Reorder PEG

This commit is contained in:
Emery Hemingway 2023-12-25 10:54:20 +02:00
parent f28c1a4c83
commit b7224d7a4a
2 changed files with 15 additions and 15 deletions

View File

@ -1,6 +1,6 @@
# Package
version = "20231224"
version = "20231225"
author = "Emery Hemingway"
description = "data model and serialization format"
license = "Unlicense"

View File

@ -15,15 +15,15 @@ grammar "Preserves":
Document <- Value * ws * !1
Atom <- Boolean | Float | Double | FloatRaw | DoubleRaw | SignedInteger | String | ByteString | Symbol
Collection <- Sequence | Dictionary | Set
Value <-
(ws * (Record | Collection | Atom | Embedded | Compact)) |
(ws * Annotation) |
(ws * '#' * @'\n' * Value)
Collection <- Sequence | Dictionary | Set
Atom <- Boolean | Float | Double | FloatRaw | DoubleRaw | SignedInteger | String | ByteString | Symbol
Record <- '<' * +Value * ws * '>'
Sequence <- '[' * *(commas * Value) * commas * ']'
@ -45,19 +45,24 @@ grammar "Preserves":
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) * '"'
binunescaped <- {' '..'!', '#'..'[', ']'..'~'}
binchar <- binunescaped | (escape * (escaped | '"' | ('x' * Xdigit[2])))
ByteString <- charByteString | hexByteString | b64ByteString
charByteString <- "#\"" * >(*binchar) * '"'
hexByteString <- "#x\"" * >(*(ws * Xdigit[2])) * ws * '"'
base64char <- {'A'..'Z', 'a'..'z', '0'..'9', '+', '/', '-', '_', '='}
b64ByteString <- "#[" * >(*(ws * base64char)) * ws * ']'
binchar <- binunescaped | (escape * (escaped | '"' | ('x' * Xdigit[2])))
binunescaped <- {' '..'!', '#'..'[', ']'..'~'}
symchar <- (utf8.any - {'\\', '|'}) | (escape * (escaped | ('u' * Xdigit[4]))) | "\\|"
symchar <- (utf8.any - {'\\', '|'}) | (escape * (escaped | unicodeEscaped)) | "\\|"
QuotedSymbol <- '|' * >(*symchar) * '|'
sympunct <- {'~', '!', '$', '%', '^', '&', '*', '?', '_', '=', '+', '-', '/', '.'}
symuchar <- utf8.any - { 0..127 }
@ -70,10 +75,5 @@ grammar "Preserves":
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 * '"'
DoubleRaw <- "#xd\"" * >((ws * Xdigit[2])[8]) * ws * '"'