Skip to content

Commit 204abf4

Browse files
committed
try fix numeric literal
1 parent 478436b commit 204abf4

File tree

5 files changed

+33054
-32474
lines changed

5 files changed

+33054
-32474
lines changed

.github/workflows/ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
git clone https://github.com/starkware-libs/cairo examples/compiler --single-branch --depth=1 --filter=blob:none
4040
git clone https://github.com/OpenZeppelin/cairo-contracts examples/openzeppelin --single-branch --depth=1 --filter=blob:none
4141
git clone https://github.com/keep-starknet-strange/alexandria examples/alexandria --single-branch --depth=1 --filter=blob:none
42+
rm -rf examples/compiler/crates/cairo-lang-parser/src/parser_test_data/cairo_test_files/
4243
- name: Run tests
4344
uses: tree-sitter/parser-test-action@v2
4445
with:

grammar.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ module.exports = grammar({
560560
field_initializer_list: ($) =>
561561
seq(
562562
'{',
563-
sepBy(',', choice($.shorthand_field_initializer, $.field_initializer, base_field_initializer)),
563+
sepBy(',', choice($.shorthand_field_initializer, $.field_initializer, $.base_field_initializer)),
564564
optional(','),
565565
'}',
566566
),
@@ -577,7 +577,7 @@ module.exports = grammar({
577577
field('value', $.expression),
578578
),
579579

580-
base_field_initializer: ($) => seq('..', $._expression),
580+
base_field_initializer: ($) => seq('..', $.expression),
581581

582582
// for example in let mut a; it would be `mut a`
583583
mut_pattern: ($) => prec(-1, seq($.mutable_specifier, $._pattern)),
@@ -620,8 +620,8 @@ module.exports = grammar({
620620
numeric_literal: (_) =>
621621
token(
622622
seq(
623-
choice(/[0-9]+/, /0x[0-9a-fA-F]+/, /0b[01]+/, /0o[0-7]+/),
624-
optional(seq('_', choice(...integerTypes, 'u256', 'felt252'))),
623+
choice(/[0-9_]+/, /0x[0-9a-fA-F_]+/, /0b[01_]+/, /0o[0-7_]+/),
624+
optional(token.immediate(seq('_', choice(...integerTypes, 'u256', 'felt252')))),
625625
),
626626
),
627627

src/grammar.json

+96-68
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/node-types.json

+23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)