fix(generate): use correct state id when adding terminal states to
non terminal extras
This commit is contained in:
parent
968d39328d
commit
5fd818babe
3 changed files with 16 additions and 9 deletions
|
|
@ -12,11 +12,12 @@ a b c d
|
|||
Extras
|
||||
==============
|
||||
|
||||
a (one) b (two) (three) c d
|
||||
a (one) b (two) (three) c d // e
|
||||
|
||||
---
|
||||
|
||||
(module
|
||||
(comment)
|
||||
(comment)
|
||||
(comment))
|
||||
(comment (paren_comment))
|
||||
(comment (paren_comment))
|
||||
(comment (paren_comment))
|
||||
(comment (line_comment)))
|
||||
|
|
|
|||
|
|
@ -9,7 +9,12 @@ module.exports = grammar({
|
|||
],
|
||||
|
||||
rules: {
|
||||
module: $ => seq('a', 'b', 'c', 'd'),
|
||||
comment: $ => seq('(', repeat(/[a-z]+/), ')'),
|
||||
module: _ => seq('a', 'b', 'c', 'd'),
|
||||
|
||||
comment: $ => choice($.paren_comment, $.line_comment),
|
||||
|
||||
paren_comment: _ => token(seq('(', repeat(/[a-z]+/), ')')),
|
||||
|
||||
line_comment: _ => token(seq('//', /.*/)),
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue