Miscellaneous undocumented keywords in Basic
Miscellaneous undocumented keywords in Basic
This is sort of a minor issue to sate my curiosity. OOo Basic picks out a variety of words to display in blue and treat as keywords, e.g. "function", "open", "string". Most of these have obvious functions, and many even appear in the packaged documentation or on the API wiki. However, having discovered the untapped and undocumented utility of the "Type" keyword, I have begun to wonder about some other keywords on which I can't find any information. These are "Enum", "Text", and "In". Anyone know what these do?
OOo 3.0.X on Ms Windows XP
Re: Miscellaneous undocumented keywords in Basic
Don't care. Could be a matter of excessive syntax highlighting (too many keywords in some list). The Basic IDE is rather primitive. It's the same as in Star Office 5, which was a cheap "me-too-clone" against the first version of VBA in 1995 (Microsofts idea of a localizable "Basic for idiots" without classes... Funzione Italiano...Fin Funzione).
StarBasic did not change too much since these days. Instead they added support for several true programming languages and ship the office suite with a complete Python runtime, which is a very mature programming language you can simply use in your prefered IDE, and it's by far easier than any dialect of Basic since it is consistent and perfectly documented.

StarBasic did not change too much since these days. Instead they added support for several true programming languages and ship the office suite with a complete Python runtime, which is a very mature programming language you can simply use in your prefered IDE, and it's by far easier than any dialect of Basic since it is consistent and perfectly documented.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Miscellaneous undocumented keywords in Basic
In case anyone does find this at least a little curious, add "implements" to the list. I was under the impression that this was a Java thing, but it doesn't seem to do anything except cause a syntax error no matter where it's placed in Basic. The same goes for most of the other keywords that don't appear in the documentation; however, the "is" operator and the "type" statement have come in handy, so if any of these do anything at all, I'd like to know. Thanks.
OOo 3.0.X on Ms Windows XP
Re: Miscellaneous undocumented keywords in Basic
The IN operator is used with collections, there is a basic description on oooforum.org
http://www.oooforum.org/forum/viewtopic.phtml?t=79325
http://www.oooforum.org/forum/viewtopic.phtml?t=79325
Re: Miscellaneous undocumented keywords in Basic
Hey! That's great! I didn't even know one could instantiate a collection from Basic. Do you know whether the objects are passed by reference? That would be pretty excellent.
OOo 3.0.X on Ms Windows XP
Re: Miscellaneous undocumented keywords in Basic
I believe they added this recently for the infamous "VBA compatibility". Normally, nobody ever needs that since this office is accessible through real programming languages.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Miscellaneous undocumented keywords in Basic
Props to Villeroy on pointing me to the source for OOo Basic. Here's what those keywords do, as well as a bunch of other interesting stuff, in case anyone cares:
'Text' belongs after 'Option Compare', as in 'Option Compare Text'. This is the default option, and it causes the compiler to misinterpret a lot of other tokens and keywords. Your other option is 'Option Compare Bin', and that's what makes the rest of those keywords work, rather than tell you something like 'expected: sub'. Can't be certain as to whether this indicates that this functionality is intended to be unimplemented, but the code is all there, it works just fine, and it hasn't eaten my hard disk or shown me contextual advertisements, so I think it's alright.
If placed immediately after 'Option Compare Bin', the phrase 'Option ClassModule' allows you instantiate the current module as an object variable. Methods, as well as properties, are accessible this way, unlike the 'Type' structs. As such, one can overload a method and call it via a generic object variable without knowing or specifying the Library and Module until runtime.
'Enum' actually does exactly what you would expect: creates an enumerated type. Put some arbitrary symbols in there in no particular order... not much else to say.
Here's another new one: 'Property' follows the same structure as a function or "Sub", except that it's possible to specify its scope, and it's used to implement the same style of "simulated properties" you see in Java or C++. The syntax is "{public | private} property {set | let | get} nameOfProperty([parameters])".
'Implements' adds an interface to a class module. I haven't tried this, and from what I can tell, this just causes the parser to shove the string you give it to the end of a vector. It would be interesting if you could write in a "real" Uno interface name and have other components accept it as an argument. Anyway, I'm not 100% sure what goes on with that list of interfaces after 'implements' is parsed; maybe nothing. The parser's functions are split between several files, are ordered more by alphabet than by purpose, and are commented in a language I don't speak. I'll get around to it.
There were a few items I saw in tokens code that didn't appear to be mapped to anything explicitly in the parser's code, so I'll have to root around for them a bit, as they probably modify some other statement. These are 'Like' and 'CDecl'. I think I saw 'CDecl' under the Dim code in passing. Something about them does smack of VBA compatibility.
Speaking of VBA compatibility, it is apparently possible to use 'Option Compatible', which enables (at least) the use of 'ParamArray', which sounds like it uses an array to pass parameters, and I'm sure that is useful for something in VBA.
'Text' belongs after 'Option Compare', as in 'Option Compare Text'. This is the default option, and it causes the compiler to misinterpret a lot of other tokens and keywords. Your other option is 'Option Compare Bin', and that's what makes the rest of those keywords work, rather than tell you something like 'expected: sub'. Can't be certain as to whether this indicates that this functionality is intended to be unimplemented, but the code is all there, it works just fine, and it hasn't eaten my hard disk or shown me contextual advertisements, so I think it's alright.
If placed immediately after 'Option Compare Bin', the phrase 'Option ClassModule' allows you instantiate the current module as an object variable. Methods, as well as properties, are accessible this way, unlike the 'Type' structs. As such, one can overload a method and call it via a generic object variable without knowing or specifying the Library and Module until runtime.
'Enum' actually does exactly what you would expect: creates an enumerated type. Put some arbitrary symbols in there in no particular order... not much else to say.
Here's another new one: 'Property' follows the same structure as a function or "Sub", except that it's possible to specify its scope, and it's used to implement the same style of "simulated properties" you see in Java or C++. The syntax is "{public | private} property {set | let | get} nameOfProperty([parameters])".
'Implements' adds an interface to a class module. I haven't tried this, and from what I can tell, this just causes the parser to shove the string you give it to the end of a vector. It would be interesting if you could write in a "real" Uno interface name and have other components accept it as an argument. Anyway, I'm not 100% sure what goes on with that list of interfaces after 'implements' is parsed; maybe nothing. The parser's functions are split between several files, are ordered more by alphabet than by purpose, and are commented in a language I don't speak. I'll get around to it.
There were a few items I saw in tokens code that didn't appear to be mapped to anything explicitly in the parser's code, so I'll have to root around for them a bit, as they probably modify some other statement. These are 'Like' and 'CDecl'. I think I saw 'CDecl' under the Dim code in passing. Something about them does smack of VBA compatibility.
Speaking of VBA compatibility, it is apparently possible to use 'Option Compatible', which enables (at least) the use of 'ParamArray', which sounds like it uses an array to pass parameters, and I'm sure that is useful for something in VBA.
OOo 3.0.X on Ms Windows XP