Add unicode support for zenscripts

The unicode characters can be recognized in strings and comments.
The encoding of scripts should be utf-8.
This commit is contained in:
Skydark Chen committed 2015-11-15 17:22:47 +08:00
1 parent 89b2548d02
commit 33c2bd0c94
3 files changed
+15 -4

No files matched your search

@@ -212,12 +212,17 @@ public class TokenStream implements Iterator<Token> {
StringBuilder value = new StringBuilder();
int tLine = line;
int tLineOffset = lineOffset;
while (dfa.transitions[state].containsKey(nextChar)) {
value.append((char) nextChar);
state = dfa.transitions[state].get(nextChar);
int _fakeNextChar = nextChar > 127 ? NFA.UNICODE_ESCAPE : nextChar;
while (dfa.transitions[state].containsKey(_fakeNextChar)) {
if (nextChar < 0)
value.append((char) nextChar);
else
value.appendCodePoint(nextChar);
state = dfa.transitions[state].get(_fakeNextChar);
line = reader.line;
lineOffset = reader.lineOffset;
nextChar = reader.read();
_fakeNextChar = nextChar > 127 ? NFA.UNICODE_ESCAPE : nextChar;
}
if (line < 0)