simplified string parsing.

This commit is contained in:
gnembon committed 2019-10-28 21:55:27 -03:00
1 parent 144f3a2ad8
commit 9315bc09dd
2 files changed
+63 -23

No files matched your search

+9 -14
View File
@@ -121,12 +121,9 @@ public class Tokenizer implements Iterator<Tokenizer.Token>
{
pos++;
linepos++;
if (pos == input.length())
{
token.type = Token.TokenType.STRINGPARAM;
if (expression != null)
throw new ExpressionException(this.expression, token, "Program truncated");
}
token.type = Token.TokenType.STRINGPARAM;
if (pos == input.length() && expression != null)
throw new ExpressionException(this.expression, token, "Program truncated");
ch = input.charAt(pos);
while (ch != '\'')
{
@@ -134,20 +131,18 @@ public class Tokenizer implements Iterator<Tokenizer.Token>
{
pos++;
linepos++;
if (pos == input.length())
{
token.type = Token.TokenType.STRINGPARAM;
if (expression != null)
throw new ExpressionException(this.expression, token, "Program truncated");
}
if (pos == input.length() && expression != null)
throw new ExpressionException(this.expression, token, "Program truncated");
}
token.append(input.charAt(pos++));
linepos++;
ch = pos == input.length() ? 0 : input.charAt(pos);
if (pos == input.length() && expression != null)
throw new ExpressionException(this.expression, token, "Program truncated");
ch = input.charAt(pos);
}
pos++;
linepos++;
token.type = Token.TokenType.STRINGPARAM;
}
else if (Character.isLetter(ch) || "_".indexOf(ch) >= 0)
{