summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--parse.y1
-rw-r--r--test/ruby/test_ast.rb8
2 files changed, 8 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index 2c8be06373..a92faab27f 100644
--- a/parse.y
+++ b/parse.y
@@ -8927,7 +8927,6 @@ number_literal_suffix(struct parser_params *p, int mask)
}
if (!ISASCII(c) || ISALPHA(c) || c == '_') {
p->lex.pcur = lastp;
- literal_flush(p, p->lex.pcur);
return 0;
}
pushback(p, c);
diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb
index 2ba87c6080..5d95dcd46f 100644
--- a/test/ruby/test_ast.rb
+++ b/test/ruby/test_ast.rb
@@ -1751,6 +1751,14 @@ dummy
assert_locations(node.children.last.locations, [[1, 0, 1, 2]])
end
+ def test_numeric_location_with_nonsuffix
+ node = ast_parse("1if true")
+ assert_locations(node.children.last.children[1].locations, [[1, 0, 1, 1]])
+
+ node = ast_parse("1q", error_tolerant: true)
+ assert_locations(node.children.last.locations, [[1, 0, 1, 1]])
+ end
+
private
def ast_parse(src, **options)
begin