Skip to content

Commit

Permalink
Merge pull request #14 from joker1007/support-3.5-syntax
Browse files Browse the repository at this point in the history
feat: support new syntax introduced by rbs-3.5
  • Loading branch information
joker1007 authored Jul 2, 2024
2 parents 88d8ed4 + fce7fa7 commit 8d8e65a
Show file tree
Hide file tree
Showing 5 changed files with 5,823 additions and 5,513 deletions.
9 changes: 5 additions & 4 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = grammar({
[$.required_positionals],
[$.optional_positionals],
[$.trailing_positionals],
],
],

word: $ => $.identifier,

Expand Down Expand Up @@ -70,7 +70,7 @@ module.exports = grammar({
"void",
),

comment: $ => token(prec(-2,
comment: $ => token(prec(-2,
seq('#', /.*/),
)),

Expand All @@ -90,7 +90,7 @@ module.exports = grammar({

tuple_type: $ => seq("[", optional(seq(commaSep1($.type), optional(","))), "]"),

_record_type_single: $ => seq(field("key", alias($.identifier, $.record_key)), ":", field("value", $.type)),
_record_type_single: $ => seq(optional("?"), field("key", alias($.identifier, $.record_key)), ":", field("value", $.type)),
record_type: $ => seq("{", optional(seq(commaSep1($._record_type_single), optional(","))), "}"),

class_name: $ => seq(optional($.namespace), $.constant),
Expand Down Expand Up @@ -287,6 +287,7 @@ module.exports = grammar({
parameters: $ => seq(
"(",
optional(choice(
"?",
seq($.required_positionals),
seq($.required_positionals, ",", choice($.optional_positionals, $.rest_positional, $.keywords)),
seq($.required_positionals, ",", $.optional_positionals, ",", choice($.rest_positional, $.trailing_positionals, $.keywords)),
Expand Down Expand Up @@ -423,7 +424,7 @@ module.exports = grammar({
$.constant_setter,
$.operator,
/`[^`]+`/,
),
),

identifier: $ => token(seq(LOWER_ALPHA_CHAR, IDENTIFIER_CHARS)),
}
Expand Down
16 changes: 16 additions & 0 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 8d8e65a

Please sign in to comment.