Symbol escaping
This commit is contained in:
parent
9f8321a748
commit
99a1cd4d15
|
@ -1,6 +1,6 @@
|
||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "20221102"
|
version = "20221106"
|
||||||
author = "Emery Hemingway"
|
author = "Emery Hemingway"
|
||||||
description = "data model and serialization format"
|
description = "data model and serialization format"
|
||||||
license = "Unlicense"
|
license = "Unlicense"
|
||||||
|
|
|
@ -52,7 +52,7 @@ grammar "Preserves":
|
||||||
binunescaped <- {' '..'!', '#'..'[', ']'..'~'}
|
binunescaped <- {' '..'!', '#'..'[', ']'..'~'}
|
||||||
base64char <- {'A'..'Z', 'a'..'z', '0'..'9', '+', '/', '-', '_', '='}
|
base64char <- {'A'..'Z', 'a'..'z', '0'..'9', '+', '/', '-', '_', '='}
|
||||||
|
|
||||||
Symbol <- (symstart * *symcont) | ('|' * *symchar * '|')
|
Symbol <- >(symstart * *symcont) | ('|' * >(*symchar) * '|')
|
||||||
|
|
||||||
symstart <- Alpha | sympunct | symustart
|
symstart <- Alpha | sympunct | symustart
|
||||||
symcont <- Alpha | sympunct | symustart | symucont | Digit | '-'
|
symcont <- Alpha | sympunct | symustart | symucont | Digit | '-'
|
||||||
|
|
|
@ -159,7 +159,7 @@ proc parsePreserves*(text: string): Preserve[void] {.gcsafe.} =
|
||||||
pushStack Value(kind: pkByteString, bytes: cast[seq[byte]](base64.decode(joinWhitespace($1))))
|
pushStack Value(kind: pkByteString, bytes: cast[seq[byte]](base64.decode(joinWhitespace($1))))
|
||||||
|
|
||||||
Preserves.Symbol <- Preserves.Symbol:
|
Preserves.Symbol <- Preserves.Symbol:
|
||||||
pushStack Value(kind: pkSymbol, symbol: Symbol $0)
|
pushStack Value(kind: pkSymbol, symbol: Symbol $1)
|
||||||
|
|
||||||
Preserves.Embedded <- Preserves.Embedded:
|
Preserves.Embedded <- Preserves.Embedded:
|
||||||
var v = stack.pop.value
|
var v = stack.pop.value
|
||||||
|
|
|
@ -272,7 +272,8 @@ const parser = peg("Schema", p: ParseState):
|
||||||
Preserves.String |
|
Preserves.String |
|
||||||
Preserves.ByteString
|
Preserves.ByteString
|
||||||
|
|
||||||
Value <- Preserves.Value
|
Value <- Preserves.Value:
|
||||||
|
discard
|
||||||
|
|
||||||
editorCruft <- '@' * @'\n'
|
editorCruft <- '@' * @'\n'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue