Reorder PEG
This commit is contained in:
parent
f28c1a4c83
commit
b7224d7a4a
|
@ -1,6 +1,6 @@
|
||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "20231224"
|
version = "20231225"
|
||||||
author = "Emery Hemingway"
|
author = "Emery Hemingway"
|
||||||
description = "data model and serialization format"
|
description = "data model and serialization format"
|
||||||
license = "Unlicense"
|
license = "Unlicense"
|
||||||
|
|
|
@ -15,15 +15,15 @@ grammar "Preserves":
|
||||||
|
|
||||||
Document <- Value * ws * !1
|
Document <- Value * ws * !1
|
||||||
|
|
||||||
|
Atom <- Boolean | Float | Double | FloatRaw | DoubleRaw | SignedInteger | String | ByteString | Symbol
|
||||||
|
|
||||||
|
Collection <- Sequence | Dictionary | Set
|
||||||
|
|
||||||
Value <-
|
Value <-
|
||||||
(ws * (Record | Collection | Atom | Embedded | Compact)) |
|
(ws * (Record | Collection | Atom | Embedded | Compact)) |
|
||||||
(ws * Annotation) |
|
(ws * Annotation) |
|
||||||
(ws * '#' * @'\n' * Value)
|
(ws * '#' * @'\n' * Value)
|
||||||
|
|
||||||
Collection <- Sequence | Dictionary | Set
|
|
||||||
|
|
||||||
Atom <- Boolean | Float | Double | FloatRaw | DoubleRaw | SignedInteger | String | ByteString | Symbol
|
|
||||||
|
|
||||||
Record <- '<' * +Value * ws * '>'
|
Record <- '<' * +Value * ws * '>'
|
||||||
|
|
||||||
Sequence <- '[' * *(commas * Value) * commas * ']'
|
Sequence <- '[' * *(commas * Value) * commas * ']'
|
||||||
|
@ -45,19 +45,24 @@ grammar "Preserves":
|
||||||
|
|
||||||
SignedInteger <- int * &delimiter
|
SignedInteger <- int * &delimiter
|
||||||
|
|
||||||
char <- unescaped | '|' | (escape * (escaped | '"' | ('u' * Xdigit[4])))
|
unescaped <- utf8.any - { '\x00'..'\x19', '"', '\\', '|' }
|
||||||
|
unicodeEscaped <- 'u' * Xdigit[4]
|
||||||
|
escaped <- {'\\', '/', 'b', 'f', 'n', 'r', 't'}
|
||||||
|
escape <- '\\'
|
||||||
|
|
||||||
|
char <- unescaped | '|' | (escape * (escaped | '"' | unicodeEscaped))
|
||||||
String <- '"' * >(*char) * '"'
|
String <- '"' * >(*char) * '"'
|
||||||
|
|
||||||
|
binunescaped <- {' '..'!', '#'..'[', ']'..'~'}
|
||||||
|
binchar <- binunescaped | (escape * (escaped | '"' | ('x' * Xdigit[2])))
|
||||||
|
|
||||||
ByteString <- charByteString | hexByteString | b64ByteString
|
ByteString <- charByteString | hexByteString | b64ByteString
|
||||||
charByteString <- "#\"" * >(*binchar) * '"'
|
charByteString <- "#\"" * >(*binchar) * '"'
|
||||||
hexByteString <- "#x\"" * >(*(ws * Xdigit[2])) * ws * '"'
|
hexByteString <- "#x\"" * >(*(ws * Xdigit[2])) * ws * '"'
|
||||||
base64char <- {'A'..'Z', 'a'..'z', '0'..'9', '+', '/', '-', '_', '='}
|
base64char <- {'A'..'Z', 'a'..'z', '0'..'9', '+', '/', '-', '_', '='}
|
||||||
b64ByteString <- "#[" * >(*(ws * base64char)) * ws * ']'
|
b64ByteString <- "#[" * >(*(ws * base64char)) * ws * ']'
|
||||||
|
|
||||||
binchar <- binunescaped | (escape * (escaped | '"' | ('x' * Xdigit[2])))
|
symchar <- (utf8.any - {'\\', '|'}) | (escape * (escaped | unicodeEscaped)) | "\\|"
|
||||||
binunescaped <- {' '..'!', '#'..'[', ']'..'~'}
|
|
||||||
|
|
||||||
symchar <- (utf8.any - {'\\', '|'}) | (escape * (escaped | ('u' * Xdigit[4]))) | "\\|"
|
|
||||||
QuotedSymbol <- '|' * >(*symchar) * '|'
|
QuotedSymbol <- '|' * >(*symchar) * '|'
|
||||||
sympunct <- {'~', '!', '$', '%', '^', '&', '*', '?', '_', '=', '+', '-', '/', '.'}
|
sympunct <- {'~', '!', '$', '%', '^', '&', '*', '?', '_', '=', '+', '-', '/', '.'}
|
||||||
symuchar <- utf8.any - { 0..127 }
|
symuchar <- utf8.any - { 0..127 }
|
||||||
|
@ -70,10 +75,5 @@ grammar "Preserves":
|
||||||
|
|
||||||
Compact <- "#=" * ws * ByteString
|
Compact <- "#=" * ws * ByteString
|
||||||
|
|
||||||
unescaped <- utf8.any - { '\x00'..'\x19', '"', '\\', '|' }
|
|
||||||
unicodeEscaped <- 'u' * Xdigit[4]
|
|
||||||
escaped <- {'\\', '/', 'b', 'f', 'n', 'r', 't'}
|
|
||||||
escape <- '\\'
|
|
||||||
|
|
||||||
FloatRaw <- "#xf\"" * >((ws * Xdigit[2])[4]) * ws * '"'
|
FloatRaw <- "#xf\"" * >((ws * Xdigit[2])[4]) * ws * '"'
|
||||||
DoubleRaw <- "#xd\"" * >((ws * Xdigit[2])[8]) * ws * '"'
|
DoubleRaw <- "#xd\"" * >((ws * Xdigit[2])[8]) * ws * '"'
|
||||||
|
|
Loading…
Reference in New Issue