private void getComment() { int startPosition = fCurrentPosition; int level = 0; fCurrentPosition++; // read multiline comment until end of file: try { while (true) { if (fInputString.charAt(fCurrentPosition) == '*' && fInputString.charAt(fCurrentPosition + 1) == ')') { fCurrentPosition++; fCurrentPosition++; if (level == 0) { break; } level--; continue; } else if (fInputString.charAt(fCurrentPosition) == '(' && fInputString.charAt(fCurrentPosition + 1) == '*') { fCurrentPosition++; fCurrentPosition++; level++; continue; } fCurrentPosition++; } } catch (IndexOutOfBoundsException ioobe) { fCurrentPosition = startPosition; throwSyntaxError("Comment doesn't end with '*)' (open multiline comment)"); } }
/** * Parse a Java <code>int</code> value. * * @return * @throws SyntaxError */ protected int getInteger() throws SyntaxError { final String number = getIntegerString(); int intValue = 0; try { intValue = Integer.parseInt(number, 10); } catch (final NumberFormatException e) { throwSyntaxError("Number format error (not an int type): " + number, number.length()); } getNextToken(); return intValue; }
fCurrentChar = fInputString[fCurrentPosition++]; } else { throwSyntaxError("string - end of string not reached."); throwSyntaxError("string -" + ident.toString() + "- contains no character."); throwSyntaxError("string - unknown character after back-slash."); default: throwSyntaxError("string - unknown character after back-slash."); throwSyntaxError("string - unknown character after back-slash."); fCurrentChar = fInputString[fCurrentPosition++]; } else { throwSyntaxError("string - end of string not reached."); throwSyntaxError("string -" + ident.toString() + "- not closed."); fCurrentChar = fInputString[fCurrentPosition++]; } else { throwSyntaxError("string - end of string not reached.");
throwSyntaxError("string -" + ident.toString() + "- contains no character."); throwSyntaxError("string - unknown character after back-slash."); throwSyntaxError("string -" + ident.toString() + "- not closed.");
throwSyntaxError( "string -" + ident.toString() + "- contains no character." ); throwSyntaxError( "string - unknown character after back-slash." ); throwSyntaxError( "string -" + ident.toString() + "- not closed." );
throwSyntaxError( "Comment doesn't end with '*)' (open multiline comment)" ); throwSyntaxError( "unexpected character: '" + fCurrentChar + "'" ); throwSyntaxError( "token not found" );
throwSyntaxError("unexpected character: '" + fCurrentChar + "'"); throwSyntaxError("token not found");
throwSyntaxError( "Operator token not found: " + fInputString.substring( startPosition, endPosition - 1 ) ); return null;
throwSyntaxError("Operator token not found: " + fInputString.substring(startPosition, endPosition - 1)); return null;
throwSyntaxError("Comment doesn't end with '*)' (open multiline comment)");
return; throwSyntaxError("unexpected character: '" + fCurrentChar + "'"); throwSyntaxError("token not found");