Compiler/lexical analyzer: Difference between revisions

Content added Content deleted
Line 9,245: Line 9,245:
if (text.equals("")) {
if (text.equals("")) {
error(line, pos, String.format("identifer_or_integer unrecopgnized character: (%d) %c", (int)this.chr, this.chr));
error(line, pos, String.format("identifer_or_integer unrecognized character: (%d) %c", (int)this.chr, this.chr));
}
}
if (Character.isDigit(text.charAt(0))) {
if (Character.isDigit(text.charAt(0))) {
if (!is_number) {
if (!is_number) {
error(line, pos, String.format("invaslid number: %s", text));
error(line, pos, String.format("invalid number: %s", text));
}
}
return new Token(TokenType.Integer, text, line, pos);
return new Token(TokenType.Integer, text, line, pos);