Floating point numbers in the macro language are defined by the lexer by
INT : DIGIT+ ('_' DIGIT+)* ;
fragment EXPT : [eE] '-'? INT;
FLOAT : INT '.' INT? EXPT? | INT EXPT;
One consequence of this is that 2. is a floating point number.
Some time ago, I changed the attribute separator from
ATTR: '\'s';
to
ATTR: '\'s' | '.';
This allows the user to say w.volume instead of w's volume, which seems to be more natural to some users that have prior programming experience. Unfortunately, it means that if you try to say well #2.volume instead of well #2's volume, you get a very cryptic error message, because the . is being interpreted as part of a floating-point token rather than as a separator:
line 1:6 Expected INT, got FLOAT: 2.
To get us back to being PLA-compliant, I want to remove the possibility of having floating point numbers with trailing decimal points. The only reason people use them is to say "This is a float, not an int," and that can be done by adding a zero after the decimal point just as easily. (or "e0", if you like).
Migrated from internal repository. Originally created by @EvanKirshenbaum on Jan 15, 2023 at 12:17 PM PST. Closed on Jan 15, 2023 at 1:40 PM PST.
Floating point numbers in the macro language are defined by the lexer by
One consequence of this is that
2.
is a floating point number.Some time ago, I changed the attribute separator from
to
This allows the user to say
w.volume
instead ofw's volume
, which seems to be more natural to some users that have prior programming experience. Unfortunately, it means that if you try to saywell #2.volume
instead ofwell #2's volume
, you get a very cryptic error message, because the.
is being interpreted as part of a floating-point token rather than as a separator:To get us back to being PLA-compliant, I want to remove the possibility of having floating point numbers with trailing decimal points. The only reason people use them is to say "This is a
float
, not anint
," and that can be done by adding a zero after the decimal point just as easily. (or "e0", if you like).Migrated from internal repository. Originally created by @EvanKirshenbaum on Jan 15, 2023 at 12:17 PM PST. Closed on Jan 15, 2023 at 1:40 PM PST.