Add ability to use escaped strings, at least for quotes

This commit is contained in:
Linus Lee 2020-09-24 09:07:24 -04:00
parent c82ee71b4d
commit bc69e7efa4

View File

@ -89,7 +89,9 @@ class Wordifier {
let acc = ''; let acc = '';
acc += this.reader.readUntil(c => c == endChar); acc += this.reader.readUntil(c => c == endChar);
while (acc.endsWith('\\') || !this.reader.hasNext()) { while (acc.endsWith('\\') || !this.reader.hasNext()) {
acc += this.reader.readUntil(c => c != endChar); acc = acc.substr(0, acc.length - 1);
this.reader.next(); // endChar
acc += endChar + this.reader.readUntil(c => c == endChar);
} }
this.reader.next(); // throw away closing char this.reader.next(); // throw away closing char
this.tokens.push('"' + acc); this.tokens.push('"' + acc);