allowed newlines in strings and error other special chars not handled by mc itself.
This commit is contained in:
1 parent
6ac249968a
commit
f76afb5b2c
1 file changed
+34
-5
@@ -166,15 +166,44 @@ public class Tokenizer implements Iterator<Tokenizer.Token>
|
||||
{
|
||||
if (ch == '\\')
|
||||
{
|
||||
pos++;
|
||||
char nextChar = peekNextChar();
|
||||
if (nextChar == 'n')
|
||||
{
|
||||
token.append('\n');
|
||||
}
|
||||
else if (nextChar == 't')
|
||||
{
|
||||
throw new ExpressionException(context, this.expression, token,
|
||||
"Tab character is not supported");
|
||||
//token.append('\t');
|
||||
}
|
||||
else if (nextChar == 'r')
|
||||
{
|
||||
throw new ExpressionException(context, this.expression, token,
|
||||
"Carriage return character is not supported");
|
||||
//token.append('\r');
|
||||
}
|
||||
else if (nextChar == '\\' || nextChar == '\'')
|
||||
{
|
||||
token.append(nextChar);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos--;
|
||||
linepos--;
|
||||
}
|
||||
pos+=2;
|
||||
linepos+=2;
|
||||
if (pos == input.length() && expression != null && context != null)
|
||||
throw new ExpressionException(context, this.expression, token, "Program truncated");
|
||||
}
|
||||
else
|
||||
{
|
||||
token.append(input.charAt(pos++));
|
||||
linepos++;
|
||||
if (pos == input.length() && expression != null && context != null)
|
||||
throw new ExpressionException(context, this.expression, token, "Program truncated");
|
||||
}
|
||||
token.append(input.charAt(pos++));
|
||||
linepos++;
|
||||
if (pos == input.length() && expression != null && context != null)
|
||||
throw new ExpressionException(context, this.expression, token, "Program truncated");
|
||||
ch = input.charAt(pos);
|
||||
}
|
||||
pos++;
|
||||
|
||||
Reference in new issue
Block a user