mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 04:40:39 -07:00
fix: allow unicode to be identifiers, fixes #655
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { FilteredValueToken, TagToken, HTMLToken, HashToken, QuotedToken, LiquidTagToken, OutputToken, ValueToken, Token, RangeToken, FilterToken, TopLevelToken, PropertyAccessToken, OperatorToken, LiteralToken, IdentifierToken, NumberToken } from '../tokens'
|
||||
import { OperatorHandler } from '../render/operator'
|
||||
import { TrieNode, LiteralValue, Trie, createTrie, ellipsis, literalValues, TokenizationError, TYPES, QUOTE, BLANK, IDENTIFIER, NUMBER, SIGN } from '../util'
|
||||
import { TrieNode, LiteralValue, Trie, createTrie, ellipsis, literalValues, TokenizationError, TYPES, QUOTE, BLANK, NUMBER, SIGN, isWord } from '../util'
|
||||
import { Operators, Expression } from '../render'
|
||||
import { NormalizedFullOptions, defaultOptions } from '../liquid-options'
|
||||
import { FilterArg } from './filter-arg'
|
||||
@@ -59,7 +59,7 @@ export class Tokenizer {
|
||||
if (node['end']) info = node
|
||||
}
|
||||
if (!info) return -1
|
||||
if (info['needBoundary'] && (this.peekType(i - this.p) & IDENTIFIER)) return -1
|
||||
if (info['needBoundary'] && isWord(this.peek(i - this.p))) return -1
|
||||
return i
|
||||
}
|
||||
readFilteredValue (): FilteredValueToken {
|
||||
@@ -245,7 +245,7 @@ export class Tokenizer {
|
||||
readIdentifier (): IdentifierToken {
|
||||
this.skipBlank()
|
||||
const begin = this.p
|
||||
while (!this.end() && this.peekType() & IDENTIFIER) ++this.p
|
||||
while (!this.end() && isWord(this.peek())) ++this.p
|
||||
return new IdentifierToken(this.input, begin, this.p, this.file)
|
||||
}
|
||||
|
||||
@@ -351,7 +351,7 @@ export class Tokenizer {
|
||||
n++
|
||||
} else break
|
||||
}
|
||||
if (digitFound && !(this.peekType(n) & IDENTIFIER)) {
|
||||
if (digitFound && !isWord(this.peek(n))) {
|
||||
const num = new NumberToken(this.input, this.p, this.p + n, this.file)
|
||||
this.advance(n)
|
||||
return num
|
||||
|
||||
Reference in New Issue
Block a user