Last active
October 11, 2021 21:58
-
-
Save moreati/ff210eae529cc23e1aecedaf6286c197 to your computer and use it in GitHub Desktop.
Approximation of the grammar for Bash braces expressions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start : brace+ | |
brace : [preamble] expandable [postscript] | |
preamble : /[^{}]+/ | |
postscript : /[^{}]+/ | |
expandable : "{" (range | list) "}" | |
range : begin ".." end [".." step] | |
begin : BOUND | |
end : BOUND | |
step : SIGNED_INT | |
list : [item] ("," [item])+ | |
item : /[^{},]+/ | brace+ | |
BOUND : LETTER | SIGNED_INT | |
%import common.LETTER | |
%import common.SIGNED_INT | |
// https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html | |
// TODO | |
// Escaped "{", "}", "," | |
// ${} | |
// Unicode |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try it at https://lark-parser.github.io/ide/#