How to represent sequences that can be joined in any order in a tree-sitter grammar file #2416
-
Is it wrong to write it this way ? seq(rule1, rule2, rule3) I want to match the following sentences:
I really hope to get anyone's guidance, thank you very much! ---------------------------- edit --------------------------------
|
Beta Was this translation helpful? Give feedback.
Answered by
amaanq
Jul 27, 2023
Replies: 1 comment 11 replies
-
Something like: input: $ => seq(
$.triple
repeat(seq(/\n/, $.triple)),
),
triple: $ => seq(
$.identifier, ",",
$.identifier, ",",
$.identifier,
),
identifier: $ => /[a-z0-9]+/, |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you could write out every possible combination, like so: