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 f69e23a commit 2ba848c
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion projects/json5-parser/grammars/json5.ygg
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Escaped {
ANY
}
class StringText {
/[^"'\\]+/
/[^"'\\\\]+/
}

atomic class Number {
Expand Down
50 changes: 25 additions & 25 deletions projects/json5-parser/src/codegen/debug.ron
Original file line number Diff line number Diff line change
Expand Up @@ -914,15 +914,15 @@ GrammarInfo {
tag: None,
remark: false,
body: YggdrasilRegex {
raw: "[^\"'\\]+",
span: 736..746,
raw: "[^\"'\\\\]+",
span: 736..748,
},
},
},
range: 713..748,
range: 713..750,
},
"Number": GrammarRule {
name: Identifier("Number", 763..769),
name: Identifier("Number", 765..771),
redirect: None,
document: "",
derives: RuleDerive {
Expand All @@ -946,14 +946,14 @@ GrammarInfo {
remark: false,
body: YggdrasilRegex {
raw: "[+-]?(0|[1-9][0-9]*)",
span: 776..798,
span: 778..800,
},
},
},
range: 750..800,
range: 752..802,
},
"Boolean": GrammarRule {
name: Identifier("Boolean", 808..815),
name: Identifier("Boolean", 810..817),
redirect: None,
document: "",
derives: RuleDerive {
Expand All @@ -975,38 +975,38 @@ GrammarInfo {
branches: [
YggdrasilVariant {
tag: Some(
Identifier("True", 833..837),
Identifier("True", 835..839),
),
branch: Expression {
tag: Identifier("True", 833..837),
tag: Identifier("True", 835..839),
remark: false,
body: YggdrasilText {
text: "true",
insensitive: false,
range: 824..830,
range: 826..832,
},
},
},
YggdrasilVariant {
tag: Some(
Identifier("False", 853..858),
Identifier("False", 855..860),
),
branch: Expression {
tag: Identifier("False", 853..858),
tag: Identifier("False", 855..860),
remark: false,
body: YggdrasilText {
text: "false",
insensitive: false,
range: 844..851,
range: 846..853,
},
},
},
],
},
range: 802..860,
range: 804..862,
},
"Null": GrammarRule {
name: Identifier("Null", 868..872),
name: Identifier("Null", 870..874),
redirect: None,
document: "",
derives: RuleDerive {
Expand All @@ -1031,14 +1031,14 @@ GrammarInfo {
body: YggdrasilText {
text: "null",
insensitive: false,
range: 879..885,
range: 881..887,
},
},
},
range: 862..887,
range: 864..889,
},
"Identifier": GrammarRule {
name: Identifier("Identifier", 895..905),
name: Identifier("Identifier", 897..907),
redirect: None,
document: "",
derives: RuleDerive {
Expand All @@ -1062,14 +1062,14 @@ GrammarInfo {
remark: false,
body: YggdrasilRegex {
raw: "[_\\p{XID_start}][\\p{XID_continue}]*",
span: 912..949,
span: 914..951,
},
},
},
range: 889..951,
range: 891..953,
},
"WhiteSpace": GrammarRule {
name: Identifier("WhiteSpace", 964..974),
name: Identifier("WhiteSpace", 966..976),
redirect: None,
document: "",
derives: RuleDerive {
Expand Down Expand Up @@ -1099,7 +1099,7 @@ GrammarInfo {
body: YggdrasilText {
text: " ",
insensitive: false,
range: 1008..1011,
range: 1010..1013,
},
},
Expression {
Expand All @@ -1108,7 +1108,7 @@ GrammarInfo {
body: YggdrasilText {
text: "\\n",
insensitive: false,
range: 1014..1018,
range: 1016..1020,
},
},
Expression {
Expand All @@ -1117,14 +1117,14 @@ GrammarInfo {
body: YggdrasilText {
text: "\\r",
insensitive: false,
range: 1021..1025,
range: 1023..1027,
},
},
],
},
},
},
range: 953..1027,
range: 955..1029,
},
},
token_sets: {},
Expand Down
2 changes: 1 addition & 1 deletion projects/json5-parser/src/codegen/parse_cst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ fn parse_string_text(state: Input) -> Output {
state.rule(Json5Rule::StringText, |s| {
s.match_regex({
static REGEX: OnceLock<Regex> = OnceLock::new();
REGEX.get_or_init(|| Regex::new("^(?x)([^\"'\\]+)").unwrap())
REGEX.get_or_init(|| Regex::new("^(?x)([^\"'\\\\]+)").unwrap())
})
})
}
Expand Down
10 changes: 5 additions & 5 deletions projects/json5-parser/src/codegen/railway.min.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions projects/json5-parser/src/codegen/railway.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2ba848c

Please sign in to comment.