Parse require delimiters after bools, numbers, symbols
This commit is contained in:
parent
522be62186
commit
1a61f9537e
|
@ -9,8 +9,9 @@ when defined(nimHasUsed): {.used.}
|
||||||
|
|
||||||
grammar "Preserves":
|
grammar "Preserves":
|
||||||
|
|
||||||
ws <- *(' ' | '\t' | '\r' | '\n' )
|
ws <- *{ ' ', '\t', '\r', '\n' }
|
||||||
commas <- *(ws * ',') * ws
|
commas <- *(ws * ',') * ws
|
||||||
|
delimiter <- { ' ', '\t', '\r', '\n', '<', '>', '[', ']', '{', '}', '#', ':', '"', '|', '@', ';', ',' } | !1
|
||||||
|
|
||||||
Document <- Value * ws * !1
|
Document <- Value * ws * !1
|
||||||
|
|
||||||
|
@ -31,7 +32,7 @@ grammar "Preserves":
|
||||||
|
|
||||||
Set <- "#{" * *(commas * Value) * commas * '}'
|
Set <- "#{" * *(commas * Value) * commas * '}'
|
||||||
|
|
||||||
Boolean <- "#f" | "#t"
|
Boolean <- '#' * {'f', 't'} * &delimiter
|
||||||
|
|
||||||
nat <- '0' | (Digit-'0') * *Digit
|
nat <- '0' | (Digit-'0') * *Digit
|
||||||
int <- ?('-'|'+') * nat
|
int <- ?('-'|'+') * nat
|
||||||
|
@ -39,10 +40,10 @@ grammar "Preserves":
|
||||||
exp <- 'e' * ?('-'|'+') * +Digit
|
exp <- 'e' * ?('-'|'+') * +Digit
|
||||||
flt <- int * ((frac * exp) | frac | exp)
|
flt <- int * ((frac * exp) | frac | exp)
|
||||||
|
|
||||||
Float <- >flt * {'f','F'}
|
Float <- >flt * {'f','F'} * &delimiter
|
||||||
Double <- flt
|
Double <- flt * &delimiter
|
||||||
|
|
||||||
SignedInteger <- int
|
SignedInteger <- int * &delimiter
|
||||||
|
|
||||||
char <- unescaped | '|' | (escape * (escaped | '"' | ('u' * Xdigit[4])))
|
char <- unescaped | '|' | (escape * (escaped | '"' | ('u' * Xdigit[4])))
|
||||||
String <- '"' * >(*char) * '"'
|
String <- '"' * >(*char) * '"'
|
||||||
|
@ -61,7 +62,7 @@ grammar "Preserves":
|
||||||
sympunct <- {'~', '!', '$', '%', '^', '&', '*', '?', '_', '=', '+', '-', '/', '.'}
|
sympunct <- {'~', '!', '$', '%', '^', '&', '*', '?', '_', '=', '+', '-', '/', '.'}
|
||||||
symuchar <- utf8.any - { 0..127 }
|
symuchar <- utf8.any - { 0..127 }
|
||||||
SymbolOrNumber <- >(+(Alpha | Digit | sympunct | symuchar))
|
SymbolOrNumber <- >(+(Alpha | Digit | sympunct | symuchar))
|
||||||
Symbol <- QuotedSymbol | SymbolOrNumber
|
Symbol <- QuotedSymbol | (SymbolOrNumber * &delimiter)
|
||||||
|
|
||||||
Embedded <- "#!" * Value
|
Embedded <- "#!" * Value
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue