Skip to content

Commit 83e8a85

Browse files
committed
grammar: add support for edition
1 parent ac08241 commit 83e8a85

File tree

6 files changed

+3710
-3526
lines changed

6 files changed

+3710
-3526
lines changed

grammar.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module.exports = grammar({
3434
// proto = syntax { import | package | option | topLevelDef | emptyStatement }
3535
// topLevelDef = message | enum | service
3636
source_file: $ => seq(
37-
optional($.syntax),
37+
optional(choice($.syntax, $.edition)),
3838
optional(repeat(choice(
3939
$.import,
4040
$.package,
@@ -49,6 +49,8 @@ module.exports = grammar({
4949

5050
empty_statement: _ => ';',
5151

52+
// edition = "edition" "=" quote numeric quote ";"
53+
edition: $ => seq('edition', '=', field('year', $.string), ';'),
5254
// syntax = "syntax" "=" quote "proto3" quote ";"
5355
syntax: $ => seq('syntax', '=', choice('"proto3"', '"proto2"'), ';'),
5456

queries/highlights.scm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[
22
"syntax"
3+
"edition"
34
"package"
45
"option"
56
"import"

src/grammar.json

Lines changed: 36 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/node-types.json

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)