From 5e171a1bf0fe5e57d777ade0ae63277679089ad9 Mon Sep 17 00:00:00 2001 From: LuckyWind_sck Date: Tue, 30 Jun 2020 09:35:59 +0900 Subject: [PATCH 1/7] rename nature to natural --- coml.ebnf | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/coml.ebnf b/coml.ebnf index 318b4c6..ab6f6e1 100644 --- a/coml.ebnf +++ b/coml.ebnf @@ -14,24 +14,24 @@ basicTypes ::= number | boolean | string | array | hash | patchKey | patch | "ni (* Basic Types: Number *) digit ::= #'[1-9]'; -natural ::= digit | "0" | natural "0" | digit natural; -decInteger ::= natural | "-" natural | "+" natural; +decNatural ::= digit | "0" | decNatural "0" | digit decNatural; +decInteger ::= decNatural | "-" decNatural | "+" decNatural; float ::= decInteger "f" - | decInteger "." natural - | decInteger "." natural "e" decInteger - | decInteger "." natural "E" decInteger; + | decInteger "." decNatural + | decInteger "." decNatural "e" decInteger + | decInteger "." decNatural "E" decInteger; binDigit ::= #'[0-1]'; -binNature ::= "0b" binDigit+; -binInteger ::= binNature | "-" binNature | "+" binNature; +binNatural ::= "0b" binDigit+; +binInteger ::= binNatural | "-" binNatural | "+" binNatural; octDigit ::= #'[0-7]'; -octNature ::= "0o" octDigit+ | "0" octDigit+; -octInteger ::= octNature | "-" octNature | "+" octNature; +octNatural ::= "0o" octDigit+ | "0" octDigit+; +octInteger ::= octNatural | "-" octNatural | "+" octNatural; hexDigit ::= #'[0-9a-fA-F]'; -hexNature ::= "0x" hexDigit+; -hexInteger ::= hexNature | "-" hexNature | "+" hexNature; +hexNatural ::= "0x" hexDigit+; +hexInteger ::= hexNatural | "-" hexNatural | "+" hexNatural; integer ::= decInteger | binInteger | octInteger | hexInteger; number ::= integer | float; From ae687e3fdf2040415ea27c4fcdd24f95d7894361 Mon Sep 17 00:00:00 2001 From: LuckyWind_sck Date: Tue, 30 Jun 2020 09:52:38 +0900 Subject: [PATCH 2/7] merge naturals --- coml.ebnf | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/coml.ebnf b/coml.ebnf index ab6f6e1..0c304ef 100644 --- a/coml.ebnf +++ b/coml.ebnf @@ -23,17 +23,15 @@ float ::= decInteger "f" binDigit ::= #'[0-1]'; binNatural ::= "0b" binDigit+; -binInteger ::= binNatural | "-" binNatural | "+" binNatural; octDigit ::= #'[0-7]'; octNatural ::= "0o" octDigit+ | "0" octDigit+; -octInteger ::= octNatural | "-" octNatural | "+" octNatural; hexDigit ::= #'[0-9a-fA-F]'; hexNatural ::= "0x" hexDigit+; -hexInteger ::= hexNatural | "-" hexNatural | "+" hexNatural; -integer ::= decInteger | binInteger | octInteger | hexInteger; +natural ::= decNatural | binNatural | octNatural | hexNatural; +integer ::= natural | "-" natural | "+" natural; number ::= integer | float; (* Basic Types: Boolean *) From e4d6db96c1305da688bc7a7bf0a0204e9a9e7c23 Mon Sep 17 00:00:00 2001 From: LuckyWind_sck Date: Tue, 30 Jun 2020 09:53:33 +0900 Subject: [PATCH 3/7] merge exponent part --- coml.ebnf | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/coml.ebnf b/coml.ebnf index 0c304ef..d963de4 100644 --- a/coml.ebnf +++ b/coml.ebnf @@ -16,10 +16,13 @@ basicTypes ::= number | boolean | string | array | hash | patchKey | patch | "ni digit ::= #'[1-9]'; decNatural ::= digit | "0" | decNatural "0" | digit decNatural; decInteger ::= decNatural | "-" decNatural | "+" decNatural; + +exponentIndicator ::= "e" | "E"; +exponentPart ::= exponentIndicator decNatural + | exponentIndicator "-" decNatural + | exponentIndicator "+" decNatural; float ::= decInteger "f" - | decInteger "." decNatural - | decInteger "." decNatural "e" decInteger - | decInteger "." decNatural "E" decInteger; + | decInteger "." decNatural exponentPart*; binDigit ::= #'[0-1]'; binNatural ::= "0b" binDigit+; From 96ffd8a7b0d7bda6d871e46e62fb315fe563dc38 Mon Sep 17 00:00:00 2001 From: LuckyWind_sck Date: Tue, 30 Jun 2020 09:57:43 +0900 Subject: [PATCH 4/7] remove dependency of decInteger --- coml.ebnf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/coml.ebnf b/coml.ebnf index d963de4..a84db3f 100644 --- a/coml.ebnf +++ b/coml.ebnf @@ -15,14 +15,14 @@ basicTypes ::= number | boolean | string | array | hash | patchKey | patch | "ni digit ::= #'[1-9]'; decNatural ::= digit | "0" | decNatural "0" | digit decNatural; -decInteger ::= decNatural | "-" decNatural | "+" decNatural; exponentIndicator ::= "e" | "E"; exponentPart ::= exponentIndicator decNatural | exponentIndicator "-" decNatural | exponentIndicator "+" decNatural; -float ::= decInteger "f" - | decInteger "." decNatural exponentPart*; +unsignedFloat ::= decNatural "f" + | decNatural "." decNatural exponentPart*; +float ::= unsignedFloat | "-" unsignedFloat | "+" unsignedFloat; binDigit ::= #'[0-1]'; binNatural ::= "0b" binDigit+; @@ -33,8 +33,8 @@ octNatural ::= "0o" octDigit+ | "0" octDigit+; hexDigit ::= #'[0-9a-fA-F]'; hexNatural ::= "0x" hexDigit+; -natural ::= decNatural | binNatural | octNatural | hexNatural; -integer ::= natural | "-" natural | "+" natural; +unsignedInteger ::= decNatural | binNatural | octNatural | hexNatural; +integer ::= unsignedInteger | "-" unsignedInteger | "+" unsignedInteger; number ::= integer | float; (* Basic Types: Boolean *) From 25a713c3a1a94aabfb5aa4306aa1d4ea8ac325f4 Mon Sep 17 00:00:00 2001 From: LuckyWind_sck Date: Tue, 30 Jun 2020 10:23:54 +0900 Subject: [PATCH 5/7] rename classes --- coml.ebnf | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/coml.ebnf b/coml.ebnf index a84db3f..b7b8fdd 100644 --- a/coml.ebnf +++ b/coml.ebnf @@ -14,28 +14,29 @@ basicTypes ::= number | boolean | string | array | hash | patchKey | patch | "ni (* Basic Types: Number *) digit ::= #'[1-9]'; -decNatural ::= digit | "0" | decNatural "0" | digit decNatural; +decInteger ::= digit | "0" | decInteger "0" | digit decInteger; exponentIndicator ::= "e" | "E"; -exponentPart ::= exponentIndicator decNatural - | exponentIndicator "-" decNatural - | exponentIndicator "+" decNatural; -unsignedFloat ::= decNatural "f" - | decNatural "." decNatural exponentPart*; -float ::= unsignedFloat | "-" unsignedFloat | "+" unsignedFloat; +exponentPart ::= exponentIndicator decInteger + | exponentIndicator "-" decInteger + | exponentIndicator "+" decInteger; +unsignedFloat ::= decInteger "f" + | decInteger "." decInteger exponentPart*; binDigit ::= #'[0-1]'; -binNatural ::= "0b" binDigit+; +binInteger ::= "0b" binDigit+; octDigit ::= #'[0-7]'; -octNatural ::= "0o" octDigit+ | "0" octDigit+; +octInteger ::= "0o" octDigit+ | "0" octDigit+; hexDigit ::= #'[0-9a-fA-F]'; -hexNatural ::= "0x" hexDigit+; +hexInteger ::= "0x" hexDigit+; -unsignedInteger ::= decNatural | binNatural | octNatural | hexNatural; -integer ::= unsignedInteger | "-" unsignedInteger | "+" unsignedInteger; -number ::= integer | float; +unsignedInteger ::= decInteger | binInteger | octInteger | hexInteger; +signedInteger ::= unsignedInteger | "-" unsignedInteger | "+" unsignedInteger; +signedFloat ::= unsignedFloat | "-" unsignedFloat | "+" unsignedFloat; + +number ::= signedInteger | signedFloat; (* Basic Types: Boolean *) @@ -74,9 +75,9 @@ imports ::= import | import eol+ imports; (* Patch *) patchKey ::= patchKey "." key - | patchKey "[" whitespaces? (string | integer) whitespaces? "]" - | patchKey "[" whitespaces? integer whitespaces? ".." whitespaces? integer whitespaces? "]" - | patchKey "[" whitespaces? integer whitespaces? "..." whitespaces? integer whitespaces? "]" + | patchKey "[" whitespaces? (string | signedInteger) whitespaces? "]" + | patchKey "[" whitespaces? signedInteger whitespaces? ".." whitespaces? signedInteger whitespaces? "]" + | patchKey "[" whitespaces? signedInteger whitespaces? "..." whitespaces? signedInteger whitespaces? "]" | key; patchReplace ::= patchKey whitespaces? "=" splitter? expr; From e0b081f4179d341e1c8ffdfcba221f57e5f95f35 Mon Sep 17 00:00:00 2001 From: LuckyWind_sck Date: Tue, 30 Jun 2020 10:35:26 +0900 Subject: [PATCH 6/7] fix decimal part & exponent part of float Fix the part that makes the following cases invalid: 1.01, 1.101, 1.0e01, 1.0e101 --- coml.ebnf | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/coml.ebnf b/coml.ebnf index b7b8fdd..0c226be 100644 --- a/coml.ebnf +++ b/coml.ebnf @@ -13,15 +13,16 @@ basicTypes ::= number | boolean | string | array | hash | patchKey | patch | "ni (* Basic Types: Number *) -digit ::= #'[1-9]'; -decInteger ::= digit | "0" | decInteger "0" | digit decInteger; +decDigit ::= #'[0-9]'; +nonZeroDecDigit ::= #'[1-9]'; +decInteger ::= "0" | nonZeroDecDigit decDigit*; exponentIndicator ::= "e" | "E"; -exponentPart ::= exponentIndicator decInteger - | exponentIndicator "-" decInteger - | exponentIndicator "+" decInteger; +exponentPart ::= exponentIndicator decDigit+ + | exponentIndicator "-" decDigit+ + | exponentIndicator "+" decDigit+; unsignedFloat ::= decInteger "f" - | decInteger "." decInteger exponentPart*; + | decInteger "." decDigit+ exponentPart*; binDigit ::= #'[0-1]'; binInteger ::= "0b" binDigit+; @@ -58,7 +59,7 @@ array ::= "[" splitter? arrayElements splitter? "]" keyCharStart ::= #'[a-zA-Z_]'; -keyCharMiddle ::= keyCharStart | digit | "0" | "_"; +keyCharMiddle ::= keyCharStart | decDigit | "_"; key ::= keyCharStart keyCharMiddle*; hashElement ::= (whitespaces?) key (splitter?) ":" (splitter?) expr; hash ::= hashElement | hashElement eol+ hash; From 78f2cf7f86be94b08fe0aaa35daeb2a6dbf244f8 Mon Sep 17 00:00:00 2001 From: LuckyWind_sck Date: Tue, 30 Jun 2020 10:39:16 +0900 Subject: [PATCH 7/7] remove duplicated token --- coml.ebnf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coml.ebnf b/coml.ebnf index 0c226be..f2f29f5 100644 --- a/coml.ebnf +++ b/coml.ebnf @@ -59,7 +59,7 @@ array ::= "[" splitter? arrayElements splitter? "]" keyCharStart ::= #'[a-zA-Z_]'; -keyCharMiddle ::= keyCharStart | decDigit | "_"; +keyCharMiddle ::= keyCharStart | decDigit; key ::= keyCharStart keyCharMiddle*; hashElement ::= (whitespaces?) key (splitter?) ":" (splitter?) expr; hash ::= hashElement | hashElement eol+ hash;