|
@@ -6,10 +6,10 @@ module.exports = class Lexer {
|
6
|
6
|
let pos = 0
|
7
|
7
|
let line = 1
|
8
|
8
|
let tokenStream = new TokenStream()
|
9
|
|
- let allowWhiteSpaceInLiterals = false
|
|
9
|
+ let allowSpecialCharactersInLiterals = false
|
10
|
10
|
|
11
|
11
|
while (pos < source.length) {
|
12
|
|
- if (source[pos].match(/\(/)) {
|
|
12
|
+ if (source[pos].match(/\(/) && !allowSpecialCharactersInLiterals) {
|
13
|
13
|
tokenStream.tokens.push({
|
14
|
14
|
type: tokenTypes.OPAREN,
|
15
|
15
|
line: line,
|
|
@@ -22,7 +22,7 @@ module.exports = class Lexer {
|
22
|
22
|
})
|
23
|
23
|
pos++
|
24
|
24
|
} else if (source[pos].match(/['"]/)) {
|
25
|
|
- allowWhiteSpaceInLiterals = !allowWhiteSpaceInLiterals
|
|
25
|
+ allowSpecialCharactersInLiterals = !allowSpecialCharactersInLiterals
|
26
|
26
|
tokenStream.tokens.push({
|
27
|
27
|
type: tokenTypes.QUOTE,
|
28
|
28
|
line: line,
|
|
@@ -44,8 +44,8 @@ module.exports = class Lexer {
|
44
|
44
|
} else {
|
45
|
45
|
let endPattern = /[^()"':\s]+/
|
46
|
46
|
|
47
|
|
- if (allowWhiteSpaceInLiterals) {
|
48
|
|
- endPattern = /[^()"':]+/
|
|
47
|
+ if (allowSpecialCharactersInLiterals) {
|
|
48
|
+ endPattern = /[^"']+/
|
49
|
49
|
}
|
50
|
50
|
|
51
|
51
|
let value = endPattern.exec(source.slice(pos))[0]
|