allow ? in identifier name
This commit is contained in:
parent
07ffc7df97
commit
40a648cd19
|
|
@ -36,6 +36,19 @@ describe('Identifier', () => {
|
||||||
FunctionCallOrIdentifier
|
FunctionCallOrIdentifier
|
||||||
Identifier 𝜋`)
|
Identifier 𝜋`)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('parses identifiers with queries', () => {
|
||||||
|
expect('even? 20').toMatchTree(`
|
||||||
|
FunctionCall
|
||||||
|
Identifier even?
|
||||||
|
PositionalArg
|
||||||
|
Number 20`)
|
||||||
|
|
||||||
|
expect('even?').toMatchTree(`
|
||||||
|
FunctionCallOrIdentifier
|
||||||
|
Identifier even?`)
|
||||||
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('Unicode Symbol Support', () => {
|
describe('Unicode Symbol Support', () => {
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ const consumeWordToken = (
|
||||||
}
|
}
|
||||||
|
|
||||||
// Track identifier validity: must be lowercase, digit, dash, or emoji/unicode
|
// Track identifier validity: must be lowercase, digit, dash, or emoji/unicode
|
||||||
if (!isLowercaseLetter(ch) && !isDigit(ch) && ch !== 45 /* - */ && !isEmojiOrUnicode(ch)) {
|
if (!isLowercaseLetter(ch) && !isDigit(ch) && ch !== 45 /* - */ && ch !== 63 /* ? */ && !isEmojiOrUnicode(ch)) {
|
||||||
if (!canBeWord) break
|
if (!canBeWord) break
|
||||||
isValidIdentifier = false
|
isValidIdentifier = false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user