Serialization fixed

This commit is contained in:
barsdeveloper
2021-11-08 22:28:26 +01:00
parent ad8c34cdab
commit 39e26bc0c2
12 changed files with 195 additions and 48 deletions

View File

@@ -8,6 +8,7 @@ import Parsimmon from "parsimmon"
import PinEntity from "../entity/PinEntity"
import PinReferenceEntity from "../entity/PinReferenceEntity"
import Utility from "../Utility"
import PathSymbol from "../entity/primitive/PathSymbol"
let P = Parsimmon
@@ -24,8 +25,8 @@ export default class Grammar {
String = _ => P.regex(/(?:[^"\\]|\\")*/).wrap(P.string('"'), P.string('"')).desc('string (with possibility to escape the quote using \")')
Word = _ => P.regex(/[a-zA-Z]+/).desc("a word")
Guid = _ => P.regex(/[0-9a-zA-Z]{32}/).map(v => new Guid(v)).desc("32 digit hexadecimal (accepts all the letters for safety) value")
PathSymbol = _ => P.regex(/[0-9a-zA-Z_]+/)
ReferencePath = r => P.seq(P.string("/"), r.PathSymbol.sepBy1(P.string(".")).tieWith("."))
PathSymbol = _ => P.regex(/[0-9a-zA-Z_]+/).map(v => new PathSymbol(v))
ReferencePath = r => P.seq(P.string("/"), r.PathSymbol.map(v => v.toString()).sepBy1(P.string(".")).tieWith("."))
.tie()
.atLeast(2)
.tie()