Commit Graph

4 Commits

Author SHA1 Message Date
Julien Fischer
a56c4f5708 Merge integer tokens in lexer.
library/lexer.m:
     Merge the 'integer' and 'big_integer' tokens and extend them to include
     signedness and size information.  This conforms to recent changes to
     the rest of the system and is another step towards supporting additional
     types of integer literal.

library/parser.m:
mdbcomp/trace_counts.m:
     Conform to the above change.

tests/hard_coded/impl_def_lex.exp:
tests/hard_coded/impl_def_lex_string.exp:
tests/hard_coded/lexer_bigint.exp:
tests/hard_coded/lexer_zero.exp*:
tests/hard_coded/parse_number_from_string.exp*:
     Update these expected outputs.
2017-04-26 10:00:45 +10:00
Julien Fischer
b3835dd826 Fix bug #430.
The lexer was not allowing underscores between leading zeros in decimal integer
literals and float literals (e.g. 0_0 or 0_0.0).

library/lexer.m:
     Allow underscores in the above cases.

tests/hard_coded/parse_number_from_io.{m,exp,exp2,exp3}:
tests/hard_coded/parse_number_from_string.{m,exp,exp2,exp3}:
     Extend these tests to cover the above cases.

tests/invalid/invalid_binary_literal.err_exp:
tests/invalid/invalid_octal_literal.err_exp:
tests/invalid/invalid_hex_literal.err_exp:
     Conform to the above change.
2017-01-29 14:38:26 +11:00
Julien Fischer
d8f0d402fe Document underscores in numeric literals.
Standardize terminology in error messages about ill-formed numeric literals.

doc/reference_manual.texi:
      Document underscores in numeric literals.

      Add a TODO comment about a future piece of work.

NEWS:
     Announce the addition of support for underscores in numeric literals.

library/lexer.m:
     Use the term "literal" instead of "constant" or "token" when
     referring to numeric literals in error messages.

     s/hex/hexadecimal/ in those same error messages.

tests/hard_coded/parse_number_from_string.exp*:
tests/invalid/invalid_{binary,decimal,hex,octal}_literal.err_exp:
     Conform to the above change in error messages from the lexer.
2017-01-16 16:24:48 +11:00
Julien Fischer
170e3e3d90 Fixes for underscores in numeric literals.
library/lexer.m:
    Add a missing predicate.

tests/hard_coded/parse_number_from_io.exp[23]:
tests/hard_coded/parse_number_from_string.exp[23]:
    Additional expected outputs for the Java and C# backends.
2017-01-12 01:10:31 +11:00