|
|
|
@ -989,54 +989,34 @@ DOUBLE_NEGATIVE -> () = '-' _ DOUBLE |
|
|
|
|
EXPONENT -> () = [eE] [+-]? [0-9]+ |
|
|
|
|
|
|
|
|
|
//[156] |
|
|
|
|
STRING_LITERAL1 -> String = "'" l:((STRING_LITERAL1_simple_char / ECHAR)*) "'" { |
|
|
|
|
l.into_iter().collect() |
|
|
|
|
STRING_LITERAL1 -> String = "'" l:$((STRING_LITERAL1_simple_char / ECHAR)*) "'" { |
|
|
|
|
unescape_echars(l).to_string() |
|
|
|
|
} |
|
|
|
|
STRING_LITERAL1_simple_char -> char = c:$([^'\u{005c}\u{000a}\u{000d}]) { c.chars().next().unwrap() } |
|
|
|
|
STRING_LITERAL1_simple_char -> () = [^'\u{005c}\u{000a}\u{000d}] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//[157] |
|
|
|
|
STRING_LITERAL2 -> String = "\"" l:((STRING_LITERAL2_simple_char / ECHAR)*) "\"" { |
|
|
|
|
l.into_iter().collect() |
|
|
|
|
STRING_LITERAL2 -> String = "\"" l:$((STRING_LITERAL2_simple_char / ECHAR)*) "\"" { |
|
|
|
|
unescape_echars(l).to_string() |
|
|
|
|
} |
|
|
|
|
STRING_LITERAL2_simple_char -> char = c:$([^"\u{005c}\u{000a}\u{000d}]) { c.chars().next().unwrap() } |
|
|
|
|
STRING_LITERAL2_simple_char -> () = [^"\u{005c}\u{000a}\u{000d}] |
|
|
|
|
|
|
|
|
|
//[158] |
|
|
|
|
STRING_LITERAL_LONG1 -> String = "'''" l:(STRING_LITERAL_LONG1_inner*) "'''" { |
|
|
|
|
l.into_iter().collect() |
|
|
|
|
STRING_LITERAL_LONG1 -> String = "'''" l:$(STRING_LITERAL_LONG1_inner*) "'''" { |
|
|
|
|
unescape_echars(l).to_string() |
|
|
|
|
} |
|
|
|
|
STRING_LITERAL_LONG1_inner -> String = a:$(("''" / "'")?) b:(STRING_LITERAL_LONG1_simple_char / ECHAR) { |
|
|
|
|
let mut s = a.to_string(); |
|
|
|
|
s.push(b); |
|
|
|
|
s |
|
|
|
|
} |
|
|
|
|
STRING_LITERAL_LONG1_simple_char -> char = c:$([^'\u{005c}]) { c.chars().next().unwrap() } |
|
|
|
|
STRING_LITERAL_LONG1_inner -> () = ("''" / "'")? (STRING_LITERAL_LONG1_simple_char / ECHAR) |
|
|
|
|
STRING_LITERAL_LONG1_simple_char -> () = [^'\u{005c}] |
|
|
|
|
|
|
|
|
|
//[159] |
|
|
|
|
STRING_LITERAL_LONG2 -> String = "\"\"\"" l:(STRING_LITERAL_LONG2_inner*) "\"\"\"" { |
|
|
|
|
l.into_iter().collect() |
|
|
|
|
} |
|
|
|
|
STRING_LITERAL_LONG2_inner -> String = a:$(("\"\"" / "\"")?) b:(STRING_LITERAL_LONG2_simple_char / ECHAR) { |
|
|
|
|
let mut s = a.to_string(); |
|
|
|
|
s.push(b); |
|
|
|
|
s |
|
|
|
|
STRING_LITERAL_LONG2 -> String = "\"\"\"" l:$(STRING_LITERAL_LONG2_inner*) "\"\"\"" { |
|
|
|
|
unescape_echars(l).to_string() |
|
|
|
|
} |
|
|
|
|
STRING_LITERAL_LONG2_simple_char -> char = c:$([^"\u{005c}]) { c.chars().next().unwrap() } |
|
|
|
|
STRING_LITERAL_LONG2_inner -> () = ("\"\"" / "\"")? (STRING_LITERAL_LONG2_simple_char / ECHAR) |
|
|
|
|
STRING_LITERAL_LONG2_simple_char -> () = [^"\u{005c}] |
|
|
|
|
|
|
|
|
|
//[160] |
|
|
|
|
ECHAR -> char = "\\" c:$([tbnrf"'\\]) { |
|
|
|
|
match c { |
|
|
|
|
"t" => '\u{0009}', |
|
|
|
|
"b" => '\u{0008}', |
|
|
|
|
"n" => '\u{000A}', |
|
|
|
|
"r" => '\u{000D}', |
|
|
|
|
"f" => '\u{000C}', |
|
|
|
|
"\"" => '\u{0022}', |
|
|
|
|
"'" => '\u{0027}', |
|
|
|
|
"\\" => '\u{005C}', |
|
|
|
|
_ => panic!("unexpected escaped char") // not possible |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
ECHAR -> () = "\\" [tbnrf"'\\] |
|
|
|
|
|
|
|
|
|
//[161] |
|
|
|
|
NIL -> () = "(" WS* ")" |
|
|
|
|