Skip to content

Commit

Permalink
Merge pull request #94 from crystal-lang-tools/nobody/more-s_exp-stdlib
Browse files Browse the repository at this point in the history
More s_exp stuff
  • Loading branch information
nobodywasishere authored Jan 9, 2025
2 parents cdb5139 + 35f2ac7 commit 3f5b4d3
Show file tree
Hide file tree
Showing 11 changed files with 1,283 additions and 1,540 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ jobs:
- name: Run stdlib coverage
run: crystal run test/stdlib_coverage.cr

- name: Run compiler verification tests
- name: Run compiler verification tests (corpus)
run: crystal run test/crystal_parse_corpus.cr

- name: Run compiler verification tests (stdlib)
run: crystal run test/crystal_parse_stdlib.cr

generate:
runs-on: ubuntu-latest
steps:
Expand Down
19 changes: 11 additions & 8 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1193,9 +1193,9 @@ module.exports = grammar({

type_def: $ => seq(
'type',
$.constant,
field('name', $.constant),
'=',
$._bare_type,
field('type', $._bare_type),
),

c_struct_def: $ => {
Expand All @@ -1204,7 +1204,7 @@ module.exports = grammar({
return seq(
'struct',
name,
$._c_struct_expressions,
field('body', alias($._c_struct_expressions, $.expressions)),
'end',
)
},
Expand Down Expand Up @@ -1232,7 +1232,7 @@ module.exports = grammar({
const names = seq($.identifier, repeat(seq(',', $.identifier)))

return seq(
names,
field('name', names),
/[ \t]:\s/,
field('type', $._bare_type),
)
Expand All @@ -1244,7 +1244,7 @@ module.exports = grammar({
return seq(
'union',
name,
$._union_expressions,
field('body', alias($._union_expressions, $.expressions)),
'end',
)
},
Expand All @@ -1271,14 +1271,14 @@ module.exports = grammar({
const names = seq($.identifier, repeat(seq(',', $.identifier)))

return seq(
names,
field('name', names),
/[ \t]:\s/,
field('type', $._bare_type),
)
},

global_var: $ => {
const name = seq('$', $.identifier)
const name = field('name', seq('$', $.identifier))
const real_name = field('real_name', choice($.identifier, $.constant))
const return_type = field('type', seq(/[ \t]:\s/, $._bare_type))

Expand Down Expand Up @@ -2743,7 +2743,10 @@ module.exports = grammar({
)
},

ensure: $ => seq(alias($._regular_ensure_keyword, 'ensure'), optional($._statements)),
ensure: $ => seq(
alias($._regular_ensure_keyword, 'ensure'),
field('body', optional(alias($._statements, $.expressions))),
),

modifier_rescue: $ => seq(
$._statement,
Expand Down
193 changes: 120 additions & 73 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3f5b4d3

Please sign in to comment.