From 2b022992a435285e1e270976e647906de0ab6de8 Mon Sep 17 00:00:00 2001 From: yhirose Date: Sun, 1 Sep 2024 15:53:10 -0400 Subject: [PATCH] Updated cpp-peglib.peg --- grammar/cpp-peglib.peg | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/grammar/cpp-peglib.peg b/grammar/cpp-peglib.peg index d670f85..dd7c45a 100644 --- a/grammar/cpp-peglib.peg +++ b/grammar/cpp-peglib.peg @@ -24,7 +24,9 @@ Primary <- / BeginTok Expression EndTok / BeginCapScope Expression EndCapScope / BeginCap Expression EndCap + / CapScope / BackRef + / DictionaryI / LiteralI / Dictionary / Literal @@ -32,11 +34,11 @@ Primary <- / NegatedClass / ClassI / Class - / DOT + / DOT Identifier <- IdentCont Spacing -IdentCont <- IdentStart IdentRest* +IdentCont <- IdentStart <- !"↑" !"⇑" ([a-zA-Z_%] / [\u0080-\uFFFF]) @@ -44,6 +46,8 @@ IdentRest <- IdentStart / [0-9] Dictionary <- LiteralD (PIPE LiteralD)+ +DictionaryI <- LiteralID (PIPE LiteralID)* + lit_ope <- ['] <(!['] Char)*> ['] Spacing / ["] <(!["] Char)*> ["] Spacing @@ -52,10 +56,14 @@ Literal <- lit_ope LiteralD <- lit_ope -LiteralI <- +lit_case_ignore_ope <- ['] <(!['] Char)*> "'i" Spacing / ["] <(!["] Char)*> '"i' Spacing +LiteralI <- lit_case_ignore_ope + +LiteralID <- lit_case_ignore_ope + # NOTE: The original Brian Ford's paper uses 'zom' instead of 'oom'. Class <- '[' !'^' <(!']' Range)+> ']' Spacing ClassI <- '[' !'^' <(!']' Range)+> ']i' Spacing @@ -82,6 +90,8 @@ RepetitionRange <- Number <- [0-9]+ Spacing +CapScope <- BeginCapScope Expression EndCapScope + LEFTARROW <- ("<-" / "←") Spacing ~SLASH <- '/' Spacing