macMikey / LCB-missing-manual

I'm trying to learn LCB, again, but the docs are thin.
MIT License
4 stars 4 forks source link

why are some property names in declarations quoted and others not quoted? #27

Open macMikey opened 1 year ago

macMikey commented 1 year ago

i don't see a pattern to them. is there any harm to quoting all of them?

bwmilby commented 1 year ago

Can you point to an example? I don't think a quoted string would be interchangeable in LCB - there isn't a string literal concept like in LCS with strict compilation turned off.

macMikey commented 1 year ago

There are several, and they're easy to find if you are using Atom or ST: In the bundle, navigate down to the Extensions->widgets folder, and do a "find in folder" for property " navbar, for instance has "opaque" and "tooltip" header has "theme", "label", "showLabel", and "opaque" switchButton has "theme" and "hilight" svgpath has "scaledWidth", "scaledHeight", "flipped", and "angle"

bwmilby commented 1 year ago

From testing I can infer that any property where the name is also a keyword (i.e. highlight, angle) must be quoted as a property name. If the token is not reserved, then quoting the property identifier is optional.

macMikey commented 1 year ago

did you see any regex/expression for the Name: Identifier anywhere? I have not seen one. I presumed that's why properties were quoted, but I couldn't find any discussion, so far, anyway.

bwmilby commented 1 year ago

Yes, at the top of the LCB Language Reference are regex expressions for all tokens. I have not seen any discussion on it either, but tested svgpath by removing the quotes and got errors on the unquoted keywords.

macMikey commented 1 year ago

right, but it doesn't include quotes, right? Identifier: [A-Za-z_][A-Za-z0-9_.]*

bwmilby commented 1 year ago

Correct, an identifier is not quoted. I can only infer that this is an undocumented workaround to allow properties to exist that are also keywords. The PropertyDefinition syntax needs to be updated to include the optional quote and the discussion needs to explain when it may be required.

macMikey commented 1 year ago

since we're annotating the manual, what do you think would be the best way to do that? If the manual gets updated, any annotations we make will be lost, right?

macMikey commented 1 year ago

in the property page I tried to address this, but I didn't modify the manual. you have collaborator privs in the wiki, if you want to take a crack at it.

bwmilby commented 1 year ago

In the widget course, they seem to quote the property name in just about every case.