diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-01-05 00:09:30 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-01-05 00:09:30 -0800 |
| commit | 4350d996d1f4987ae83569acfdec2e25b996f599 (patch) | |
| tree | 835ab3332ec593c748f4eabd7490266b2e22aa30 /grammars | |
| parent | 8d14bf01bc3c3cfbb3613487b59fe0bc4d6efba6 (diff) | |
Simplified `...` to `..%\n` and `$.` to `./\n`
Diffstat (limited to 'grammars')
| -rw-r--r-- | grammars/bpeg.bp | 10 | ||||
| -rw-r--r-- | grammars/builtins.bp | 20 | ||||
| -rw-r--r-- | grammars/html.bp | 8 |
3 files changed, 19 insertions, 19 deletions
diff --git a/grammars/bpeg.bp b/grammars/bpeg.bp index 007c209..8a223b2 100644 --- a/grammars/bpeg.bp +++ b/grammars/bpeg.bp @@ -1,13 +1,13 @@ # This is a file defining the BP grammar using BP syntax -Grammar: __ *(Def [__`;])%__ __ ($$ / @!=(... => "Could not parse this code")) +Grammar: __ *(Def [__`;])%__ __ ($$ / @!=(..%\n => "Could not parse this code")) Def: @name=id _ `: __ ( @definition=extended-pat / $$ @!=(''=>"No definition for rule") - / @!=(...>(`;/id_`:/$) => "Invalid definition: @0")) + / @!=(..>(`;/id_`:/$)%\n => "Invalid definition: @0")) # This is used for command line arguments: -String-pattern: ... % (Nodent / Escape / `\ pat [`;]) +String-pattern: .. % (\n / Nodent / Escape / `\ pat [`;]) pat: simple-pat !(__("!="/"=="/"=>")) / suffixed-pat simple-pat: Upto-and / Dot / String / Chars / Nodent / Escape-range @@ -68,9 +68,9 @@ extended-pat: Otherwise / Chain / pat # Special-symbol rules: _: *(` / \t) __: *(` / \t / \r / \n / comment) -$$: !$. +$$: !(./\n) $: !. -^^: !<$. +^^: !<(./\n) ^: !<. id: "^^" / "^" / "__" / "_" / "$$" / "$" / "|" / `a-z,A-Z *`a-z,A-Z,0-9,- diff --git a/grammars/builtins.bp b/grammars/builtins.bp index 9c34fe4..f68b2a7 100644 --- a/grammars/builtins.bp +++ b/grammars/builtins.bp @@ -11,7 +11,7 @@ pattern: !'' # Not defined by default replacement: !'' # Not defined by default replace-all: ( (include-binary-files / is-text-file) - +(...(>pattern replacement)) ... + +(..(>pattern replacement)%\n) ..%\n ) find-all: ( (include-binary-files / is-text-file) @@ -21,7 +21,7 @@ find-all: ( ) only-matches: ( (include-binary-files / is-text-file) - +(...@pattern =>'@1\n') + +(..@pattern%\n =>'@1\n') ) # Helper definitions (commonly used) @@ -49,10 +49,10 @@ utf8-codepoint: ( ) crlf: \r\n cr: \r -anglebraces: `<...`> % (anglebraces/string) -brackets: `[...`] % (brackets/string) -braces: `{...`} % (braces/string) -parens: `(...`) % (parens/string) +anglebraces: `<..`> % (\n/anglebraces/string) +brackets: `[..`] % (\n/brackets/string) +braces: `{..`} % (\n/braces/string) +parens: `(..`) % (\n/parens/string) string: `"..`" % (`\.) / `'..`' % (`\.) id: !<`a-z,A-Z,_,0-9 `a-z,A-Z,_ *`a-z,A-Z,_,0-9 id-char: `a-z,A-Z,_,0-9 @@ -70,16 +70,16 @@ abc: `a-z esc: \e tab: \t nl: \n; lf: \n -c-block-comment: '/*' ... '*/' -c-line-comment: '//' ..$ +c-block-comment: '/*'..'*/'%\n +c-line-comment: '//'..$ c-comment: c-line-comment / c-block-comment hash-comment: `# ..$ comment: !''; # No default definition, can be overridden WS: ` /\t/\n/\r/comment ws: ` /\t -$$: !$. +$$: !(./\n) $: !. -^^: !<$. +^^: !<(./\n) ^: !<. __: *(` /\t/\n/\r/comment) _: *(` /\t) diff --git a/grammars/html.bp b/grammars/html.bp index 9ec33b6..c820b4b 100644 --- a/grammars/html.bp +++ b/grammars/html.bp @@ -7,13 +7,13 @@ html-element: void-element / raw-element / template-element / normal-element void-element: `< ("area"/"base"/"br"/"col"/"embed"/"hr"/"img"/"input"/"link"/"meta"/"param"/"source"/"track"/"wbr") __attributes__ [`/] __ `> -template-element: "<template>"...("</template>") % (comment / html-element) +template-element: "<template>".."</template>" % (\n / comment / html-element) -raw-element: `< @tag=("script"/"style"/"textarea"/"title") __attributes__ `>...("</"tag__`>) +raw-element: `< @tag=("script"/"style"/"textarea"/"title") __attributes__ `>..("</"tag__`>)%\n -normal-element: `< @tag=id __attributes__ `>...("</"tag`>) % (comment / html-element) +normal-element: `< @tag=id __attributes__ `>..("</"tag`>) % (\n / comment / html-element) -comment: "<!--" ..."-->" +comment: "<!--" .."-->" % \n attributes: *attribute%__ attribute: (+id%`:)__`=__ (id / `" ..`" / `' ..`') |
