In Ruby, what exactly does tLABEL mean?

Arel picture Arel · Jul 8, 2013 · Viewed 8.9k times · Source

I usually gloss over this error when I get it and just fix whatever syntax error caused it, but out of curiosity, what exactly does tLABEL mean in unexpected tLABEL?

I've tried searching for the answer, but just get a ton of people trying to get help with their errors.

I've also found this definition:

tlabel is a nonwindowed VCL control that displays non editable text on a form. It is defined in the StdCtrls.pas unit.

but I don't think that is a very accessible definition.

Answer

PinnyM picture PinnyM · Jul 8, 2013

A tLABEL is a 'Label' token. It is often used when specifying a hash in the newer 1.9 format:

{ key: value }

In the example above, key: is internally recognized as a token for a Label. The 1.9+ parser converts this to a symbol, whereas the 1.8 parser did not.

The error you are seeing occurs where the parser finds what it deems to be a Label token where it doesn't expect one.

Also, the reference to the 'tlabel' non-windowed control is very much unrelated - that TLabel class is part of the Visual Component Library used by Delphi, as hinted by the .pas (Pascal) extension.