From 4e201e6a70e60d24b22ce62109b5af3d90c0a27e Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 10 Sep 2020 03:41:03 -0700 Subject: Added dashes to identifiers --- bpeg.bpeg | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'bpeg.bpeg') diff --git a/bpeg.bpeg b/bpeg.bpeg index 2064510..ad5936c 100644 --- a/bpeg.bpeg +++ b/bpeg.bpeg @@ -1,14 +1,14 @@ # This is a file defining the BPEG grammar using BPEG syntax grammar; -grammar = __ @[mainPattern]extendedPat __ (*def % (__`;__)) ?(__ `;) __; -def = @[name]ref __ `= __ @[definition]extendedPat; +grammar = __ @[main-pattern]extended-pat __ (*def % (__`;__)) ?(__ `;) __; +def = @[name]ref __ `= __ @[definition]extended-pat; # This is used for command line arguments: -stringGrammar = *(`\ pat ?`; / .); +string-grammar = *(`\ pat ?`; / .); -pat = empty / dot / string / charRange / char / escapeRange / escape / no / anythingBut - / uptoAnd / repeat / after / before / capture / replace / ref / parens; +pat = empty / dot / string / char-range / char / escape-range / escape / no / anything-but + / upto-and / repeat / after / before / capture / replace / ref / parens; empty = `/ >(__ (`}/`})); dot = `.; @@ -16,18 +16,18 @@ string = ( `" @[s]*(escape / ~`") `" / `' @[s]*(escape / ~`') `' ); -charRange = `` @[low]. `- @[high].; +char-range = `` @[low]. `- @[high].; char = `` @[s].; -escapeRange = `\ @[low]escapeSequence `- @[high]escapeSequence; -escape = `\ @[s]escapeSequence; -escapeSequence = ( +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; -anythingBut = `~ ?`~ _ @pat; -uptoAnd = `& ?`& _ @pat; +anything-but = `~ ?`~ _ @pat; +upto-and = `& ?`& _ @pat; repeat = ( @[min]int _ `- _ @[max]int / @[min]{->"0"} @[max]int _ `- @@ -36,26 +36,26 @@ repeat = ( / `+ @[min]{->"1"} @[max](/) / `* @[min]{->"0"} @[max](/) / `? @[min]{->"0"} @[max]{->"1"} - ) _ @[repeatPat]pat ?( __ `% __ @[sep]pat); + ) _ @[repeat-pat]pat ?( __ `% __ @[sep]pat); after = `< _ pat; before = `> _ pat; -capture = `@ ?(_ `[ @[captureName]ref `]) _ @[capture]pat; +capture = `@ ?(_ `[ @[capture-name]ref `]) _ @[capture]pat; replace = `{ __ ( - ?(@[replacePat]extendedPat __) "=>" ?(__ @[replacement]string) + ?(@[replace-pat]extended-pat __) "=>" ?(__ @[replacement]string) ) __ `}; ref = @[name]( "^^" / "^" / "__" / "_" / "$$" / "$" / - (`a-z/`A-Z) *(`a-z/`A-Z/`0-9)); + (`a-z/`A-Z) *(`a-z/`A-Z/`0-9/`-)); -parens = `( __ extendedPat __ `); +parens = `( __ extended-pat __ `); chain = +@pat % (__); otherwise = +@(chain/pat) % (__`/__); -extendedPat = otherwise / chain / pat; +extended-pat = otherwise / chain / pat; _ = *(` / \t); __ = *(` / \t / \r / \n / comment); -hashComment = `# *.; +hash-comment = `# *.; # Note: comments are undefined by default in regular BPEG -comment = hashComment; +comment = hash-comment; -- cgit v1.2.3