Skip to content

Commit

Permalink
Fix string elements
Browse files Browse the repository at this point in the history
  • Loading branch information
oovm committed Nov 28, 2023
1 parent ea5dcd6 commit f69e23a
Show file tree
Hide file tree
Showing 7 changed files with 734 additions and 312 deletions.
20 changes: 16 additions & 4 deletions projects/json5-parser/grammars/json5.ygg
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,24 @@ class Array {
}

atomic class String {
| '"' (StringEscaped | ANY) '"'
| "'" (StringEscaped | ANY) "'"
| '"' StringElement* '"'
| "'" StringElement* "'"
}

atomic class StringEscaped {
'\' ANY
atomic union StringElement {
| '\' HexDigit #HexDigit
| '\' Escaped #Escaped
| StringText #StringText
}

class HexDigit {
/[0-9a-fA-F]{4}/
}
class Escaped {
ANY
}
class StringText {
/[^"'\\]+/
}

atomic class Number {
Expand Down
Loading

0 comments on commit f69e23a

Please sign in to comment.