This repository was archived by the owner on Jun 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 109
This repository was archived by the owner on Jun 10, 2024. It is now read-only.
Parser does not support _ as a decimal separator #499
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't workingcompilerIssues pertaining to the compiler with no specific tagIssues pertaining to the compiler with no specific tag
Milestone
Description
Using _ as a separator in long integer literals has been supported since erlang/otp#2324 in BEAM, so we should support it too.
init.erl
-module(init).
-export([start/0]).
-import(erlang, [convert_time_unit/3, display/1]).
-import(lumen, [is_small_integer/1]).
start() ->
Time = 1_000_000_000,
display(is_small_integer(Time)),
FromHertz = 2,
ToHertz = 5,
display(convert_time_unit(Time, FromHertz, ToHertz)),
display(convert_time_unit(Time, FromHertz, second)),
display(convert_time_unit(Time, FromHertz, millsecond)),
display(convert_time_unit(Time, FromHertz, nanosecond)),
display(convert_time_unit(Time, FromHertz, native)),
display(convert_time_unit(Time, FromHertz, perf_counter)),
display(convert_time_unit(Time, second, ToHertz)),
display(convert_time_unit(Time, second, second)),
display(convert_time_unit(Time, second, millsecond)),
display(convert_time_unit(Time, second, nanosecond)),
display(convert_time_unit(Time, second, native)),
display(convert_time_unit(Time, second, perf_counter)),
display(convert_time_unit(Time, millisecond, ToHertz)),
display(convert_time_unit(Time, millisecond, second)),
display(convert_time_unit(Time, millisecond, millsecond)),
display(convert_time_unit(Time, millisecond, nanosecond)),
display(convert_time_unit(Time, millisecond, native)),
display(convert_time_unit(Time, millisecond, perf_counter)),
display(convert_time_unit(Time, microsecond, ToHertz)),
display(convert_time_unit(Time, microsecond, second)),
display(convert_time_unit(Time, microsecond, millsecond)),
display(convert_time_unit(Time, microsecond, nanosecond)),
display(convert_time_unit(Time, microsecond, native)),
display(convert_time_unit(Time, microsecond, perf_counter)),
display(convert_time_unit(Time, nanosecond, ToHertz)),
display(convert_time_unit(Time, nanosecond, second)),
display(convert_time_unit(Time, nanosecond, millsecond)),
display(convert_time_unit(Time, nanosecond, nanosecond)),
display(convert_time_unit(Time, nanosecond, native)),
display(convert_time_unit(Time, nanosecond, perf_counter)),
display(convert_time_unit(Time, native, ToHertz)),
display(convert_time_unit(Time, native, second)),
display(convert_time_unit(Time, native, millsecond)),
display(convert_time_unit(Time, native, nanosecond)),
display(convert_time_unit(Time, native, native)),
display(convert_time_unit(Time, native, perf_counter)),
display(convert_time_unit(Time, per_counter, ToHertz)),
display(convert_time_unit(Time, per_counter, second)),
display(convert_time_unit(Time, per_counter, millsecond)),
display(convert_time_unit(Time, per_counter, nanosecond)),
display(convert_time_unit(Time, per_counter, native)),
display(convert_time_unit(Time, per_counter, perf_counter)).
Error
Compiling tests/lib/erlang/convert_time_unit_3/with_small_integer_time_valid_units_returns_converted_value/init.erl
error: unrecognized token
┌─ tests/lib/erlang/convert_time_unit_3/with_small_integer_time_valid_units_returns_converted_value/init.erl:7:11
│
7 │ Time = 1_000_000_000,
│ ^^^^^^^^^^^^ expected: "!", "#", "(", ")", "*", "+", "++", ",", "-", "--", "->", ".", "/", "/=", ":", "::", ":=", ";", "<", "<-", "=", "=/=", "=:=", "=<", "==", "=>", ">", ">=", ">>", "]", "after", "and", "andalso", "band", "bor", "bsl", "bsr", "bxor", "catch", "div", "end", "of", "or", "orelse", "rem", "when", "xor", "|", "||", "}"
error: parsing failed
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcompilerIssues pertaining to the compiler with no specific tagIssues pertaining to the compiler with no specific tag