Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ static inline bool process_float_literal(TSLexer *lexer) {
if (lexer->lookahead == '.') {
has_fraction = true;
advance(lexer);
if (iswalpha(lexer->lookahead)) {
// The dot is followed by a letter: 1.max(2) => not a float but an integer
if (iswalpha(lexer->lookahead) || lexer->lookahead == '_') {
// The dot is followed by a letter or _: 1.max(2) => not a float but an integer
return false;
}

Expand Down
9 changes: 8 additions & 1 deletion test/corpus/expressions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,7 @@ mystruct.myfield;
foo().x;
value.0.1.iter();
1.max(2);
1._method();

--------------------------------------------------------------------------------

Expand Down Expand Up @@ -1024,7 +1025,13 @@ value.0.1.iter();
(integer_literal)
(field_identifier))
(arguments
(integer_literal)))))
(integer_literal))))
(expression_statement
(call_expression
(field_expression
(integer_literal)
(field_identifier))
(arguments))))

================================================================================
Method call expressions
Expand Down
Loading