Added line breaks in parser strings
Actual line breaks and \n both work
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
// Generated automatically by nearley, version 2.16.0
|
// Generated automatically by nearley, version 2.20.1
|
||||||
// http://github.com/Hardmath123/nearley
|
// http://github.com/Hardmath123/nearley
|
||||||
function id(x) { return x[0]; }
|
function id(x) { return x[0]; }
|
||||||
|
|
||||||
@@ -9,8 +9,8 @@ function id(x) { return x[0]; }
|
|||||||
const lexer = moo.compile({
|
const lexer = moo.compile({
|
||||||
number: /[0-9]+(?:\.[0-9]+)?/,
|
number: /[0-9]+(?:\.[0-9]+)?/,
|
||||||
string: {
|
string: {
|
||||||
match: /'.*?'|".*?"/,
|
match: /'[^']*'|"[^"]*"/,
|
||||||
value: s => s.slice(1, -1),
|
value: s => s.slice(1, -1).replace('\\n', '\n'),
|
||||||
},
|
},
|
||||||
name: {
|
name: {
|
||||||
match: /[a-zA-Z_#$]*[a-ce-zA-Z_#$][a-zA-Z0-9_#$]*/,
|
match: /[a-zA-Z_#$]*[a-ce-zA-Z_#$][a-zA-Z0-9_#$]*/,
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
const lexer = moo.compile({
|
const lexer = moo.compile({
|
||||||
number: /[0-9]+(?:\.[0-9]+)?/,
|
number: /[0-9]+(?:\.[0-9]+)?/,
|
||||||
string: {
|
string: {
|
||||||
match: /'.*?'|".*?"/,
|
match: /'[^']*'|"[^"]*"/,
|
||||||
value: s => s.slice(1, -1),
|
value: s => s.slice(1, -1).replace('\\n', '\n'),
|
||||||
},
|
},
|
||||||
name: {
|
name: {
|
||||||
match: /[a-zA-Z_#$]*[a-ce-zA-Z_#$][a-zA-Z0-9_#$]*/,
|
match: /[a-zA-Z_#$]*[a-ce-zA-Z_#$][a-zA-Z0-9_#$]*/,
|
||||||
|
|||||||
Reference in New Issue
Block a user