diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2020-09-16 17:57:56 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2020-09-16 17:57:56 -0700 |
| commit | 21807a663d0ab1fc934e1bb3ad485fe1c3e9c821 (patch) | |
| tree | 618f998a8073b0adce37cb0947718945dedf775d /bpeg.bpeg | |
| parent | 79efa8bf5efed69fafc558968d51da4dbdd9cfd1 (diff) | |
Consolidated repetition ops (instead of '+', '*', '?', etc. now it's all
number based: '1+', '0+', '0-1') and reverted to UPTO_AND behavior
instead of UPTO
Diffstat (limited to 'bpeg.bpeg')
| -rw-r--r-- | bpeg.bpeg | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/bpeg.bpeg b/bpeg.bpeg deleted file mode 100644 index de0c676..0000000 --- a/bpeg.bpeg +++ /dev/null @@ -1,70 +0,0 @@ -# This is a file defining the BPEG grammar using BPEG syntax - -Grammar = __ *Def%(__`;__) ?(`;__); -Def = @[name]Ref __ `= __ @[definition]extended-pat; - -# This is used for command line arguments: -String-pattern = *(`\ pat ?`; / .); - -pat = suffixed-pat / simple-pat; -simple-pat = Empty / Upto / Dot / String / Char-range / Char / Escape-range / Escape / No - / Nodent / Repeat / After / Before / Capture / Replace / Ref / parens; -suffixed-pat = Eq-pat; - -Eq-pat = @[first]simple-pat "==" @[second]pat; - -Empty = `/ >(__ (`)/`})); -Dot = `. !`.; -String = ( - `" @[s]*(Escape / !`"$.) `" - / `' @[s]*(Escape / !`'$.) `' - ); -Char-range = `` @[low]. `- @[high].; -Char = `` @[s].; -Escape-range = `\ @[low]escape-sequence `- @[high]escape-sequence; -Escape = `\ @[s]escape-sequence; -escape-sequence = ( - 1-3 `0-7 - / `x 2 (`0-9/`a-f/`A-F) - /`a/`b/`e/`n/`r/`t/`v / . / \n - ); -No = `! _ @pat; -Nodent = `|; -Upto = 2-3`. ?>(_@pat); -Repeat = ( - @[min]int _ `- _ @[max]int - /{@[min]{=>"0"}=>} @[max]int _ `- - / @[min]int _ `+ @[max](/) - / @[min]@[max]int - /{@[min]{=>"1"}=>} `+ @[max](/) - /{@[min]{=>"0"}=>} `* @[max](/) - /{@[min]{=>"0"}=>} `? {@[max]{=>"1"}=>} - ) _ @[repeat-pat]pat ?( __ `% __ @[sep]pat); -After = `< _ pat; -Before = `> _ pat; -Capture = `@ ?(_ `[ @[capture-name]Ref `]) _ @[capture]pat; -Replace = `{ __ ( - ?(@[replace-pat]extended-pat __) "=>" ?(__ @[replacement]String) - ) __ `}; -Ref = @[name]( - "^^" / "^" / "__" / "_" / "$$" / "$" / - (`a-z/`A-Z) *(`a-z/`A-Z/`0-9/`-)); - -parens = `( __ extended-pat __ `); - -Chain = +@pat % (__); -Otherwise = +@(Chain/pat) % (__`/__); -extended-pat = Otherwise / Chain / pat; - -# Special-symbol rules: -_ = *(` / \t); -__ = *(` / \t / \r / \n / comment); -$$ = !$.; -$ = !.; -^^ = !<$.; -^ = !<.; - -hash-comment = `# .. $; - -# Note: comments are undefined by default in regular BPEG -comment = hash-comment; |
