prebirth,birth,rebirth: Permit newlines in strings
This modifies each of the three lexers just to avoid confusion, even though prebirth has no need for it. Birth does have a need, however, since rebirth will contain newlines---despite the relevant rebirth code (next commit) not being expanded, it still has to go through the lexer, which otherwise errors out. * build-aux/bootstrap/birth.scm (lex): Permit newlines in string regex. * build-aux/bootstrap/prebirth.js (lex): Permit newlines in string regex. * build-aux/bootstrap/rebirth.scm (lex): Permit newlines in string regex.master
parent
639948da02
commit
7f7a9704e5
|
@ -112,7 +112,8 @@
|
||||||
;; strings are delimited by opening and closing ASCII
|
;; strings are delimited by opening and closing ASCII
|
||||||
;; double quotes, which can be escaped with a
|
;; double quotes, which can be escaped with a
|
||||||
;; backslash
|
;; backslash
|
||||||
(("\"") (let ((str (js:match-regexp "^\"(|.*?[^\\\\])\""
|
(("\"") (let ((str (js:match-regexp
|
||||||
|
"^\"(|(?:.|\\\n)*?[^\\\\])\""
|
||||||
trim)))
|
trim)))
|
||||||
(or str (parse-error
|
(or str (parse-error
|
||||||
src pos
|
src pos
|
||||||
|
|
|
@ -228,7 +228,7 @@ class Parser
|
||||||
// strings are delimited by opening and closing ASCII double quotes,
|
// strings are delimited by opening and closing ASCII double quotes,
|
||||||
// which can be escaped with a backslash
|
// which can be escaped with a backslash
|
||||||
else if ( trim[ 0 ] === '"' ) {
|
else if ( trim[ 0 ] === '"' ) {
|
||||||
const str = trim.match( /^"(|.*?[^\\])"/ );
|
const str = trim.match( /^"(|(?:.|\n)*?[^\\])"/ );
|
||||||
if ( !str ) {
|
if ( !str ) {
|
||||||
this._error( src, pos, "missing closing string delimiter" );
|
this._error( src, pos, "missing closing string delimiter" );
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,8 @@
|
||||||
;; strings are delimited by opening and closing ASCII
|
;; strings are delimited by opening and closing ASCII
|
||||||
;; double quotes, which can be escaped with a
|
;; double quotes, which can be escaped with a
|
||||||
;; backslash
|
;; backslash
|
||||||
(("\"") (let ((str (js:match-regexp "^\"(|.*?[^\\\\])\""
|
(("\"") (let ((str (js:match-regexp
|
||||||
|
"^\"(|(?:.|\\\n)*?[^\\\\])\""
|
||||||
trim)))
|
trim)))
|
||||||
(or str (parse-error
|
(or str (parse-error
|
||||||
src pos
|
src pos
|
||||||
|
|
Loading…
Reference in New Issue