From: kpouer Date: Thu, 27 Feb 2003 21:56:44 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.phpeclipse.com *** empty log message *** --- diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.java b/net.sourceforge.phpeclipse/src/test/PHPParser.java new file mode 100644 index 0000000..f23c733 --- /dev/null +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.java @@ -0,0 +1,4056 @@ +/* Generated By:JavaCC: Do not edit this line. PHPParser.java */ +package test; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.ui.texteditor.MarkerUtilities; +import org.eclipse.jface.preference.IPreferenceStore; + +import java.io.CharArrayReader; +import java.util.Hashtable; +import java.io.StringReader; +import java.text.MessageFormat; + +import net.sourceforge.phpeclipse.actions.PHPStartApacheAction; +import net.sourceforge.phpeclipse.PHPeclipsePlugin; +import net.sourceforge.phpdt.internal.compiler.parser.PHPOutlineInfo; + +/** + * A new php parser. + * This php parser is inspired by the Java 1.2 grammar example + * given with JavaCC. You can get JavaCC at http://www.webgain.com + * You can test the parser with the PHPParserTestCase2.java + * @author Matthieu Casanova + */ +public class PHPParser extends PHPParserSuperclass implements PHPParserConstants { + + private static PHPParser me; + + private static IFile fileToParse; + + private static final String PARSE_ERROR_STRING = "Parse error"; //$NON-NLS-1$ + private static final String PARSE_WARNING_STRING = "Warning"; //$NON-NLS-1$ + public static final int ERROR = 2; + public static final int WARNING = 1; + public static final int INFO = 0; + PHPOutlineInfo outlineInfo; + private static int errorLevel = ERROR; + private static String errorMessage; + + public PHPParser() { + } + + public static PHPParser getInstance(IFile fileToParse) { + if (me == null) { + me = new PHPParser(fileToParse); + } else { + me.setFileToParse(fileToParse); + } + return me; + } + + public void setFileToParse(IFile fileToParse) { + this.fileToParse = fileToParse; + } + + public static PHPParser getInstance(java.io.Reader stream) { + if (me == null) { + me = new PHPParser(stream); + } else { + me.ReInit(stream); + } + return me; + } + + public PHPParser(IFile fileToParse) { + this(new StringReader("")); + this.fileToParse = fileToParse; + } + + public void phpParserTester(String strEval) throws CoreException, ParseException { + PHPParserTokenManager.SwitchTo(PHPParserTokenManager.PHPPARSING); + StringReader stream = new StringReader(strEval); + if (jj_input_stream == null) { + jj_input_stream = new SimpleCharStream(stream, 1, 1); + } + ReInit(new StringReader(strEval)); + phpTest(); + } + + public void htmlParserTester(String strEval) throws CoreException, ParseException { + StringReader stream = new StringReader(strEval); + if (jj_input_stream == null) { + jj_input_stream = new SimpleCharStream(stream, 1, 1); + } + ReInit(stream); + phpTest(); + } + + public PHPOutlineInfo parseInfo(Object parent, String s) { + outlineInfo = new PHPOutlineInfo(parent); + StringReader stream = new StringReader(s); + if (jj_input_stream == null) { + jj_input_stream = new SimpleCharStream(stream, 1, 1); + } + ReInit(stream); + try { + parse(); + } catch (ParseException e) { + if (errorMessage == null) { + PHPeclipsePlugin.log(e); + } else { + setMarker(errorMessage, e.currentToken.beginLine, errorLevel); + errorMessage = null; + } + } + return outlineInfo; + } + + + /** + * Create marker for the parse error + */ + private static void setMarker(String message, int lineNumber, int errorLevel) { + try { + setMarker(fileToParse, message, lineNumber, errorLevel); + } catch (CoreException e) { + PHPeclipsePlugin.log(e); + } + } + + public static void setMarker(IFile file, String message, int lineNumber, int errorLevel) throws CoreException { + if (file != null) { + Hashtable attributes = new Hashtable(); + MarkerUtilities.setMessage(attributes, message); + switch (errorLevel) { + case ERROR : + attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR)); + break; + case WARNING : + attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_WARNING)); + break; + case INFO : + attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO)); + break; + } + MarkerUtilities.setLineNumber(attributes, lineNumber); + MarkerUtilities.createMarker(file, attributes, IMarker.PROBLEM); + } + } + + /** + * Create markers according to the external parser output + */ + private static void createMarkers(String output, IFile file) throws CoreException { + // delete all markers + file.deleteMarkers(IMarker.PROBLEM, false, 0); + + int indx = 0; + int brIndx = 0; + boolean flag = true; + while ((brIndx = output.indexOf("
", indx)) != -1) { + // newer php error output (tested with 4.2.3) + scanLine(output, file, indx, brIndx); + indx = brIndx + 6; + flag = false; + } + if (flag) { + while ((brIndx = output.indexOf("
", indx)) != -1) { + // older php error output (tested with 4.2.3) + scanLine(output, file, indx, brIndx); + indx = brIndx + 4; + } + } + } + + private static void scanLine(String output, IFile file, int indx, int brIndx) throws CoreException { + String current; + StringBuffer lineNumberBuffer = new StringBuffer(10); + char ch; + current = output.substring(indx, brIndx); + + if (current.indexOf(PARSE_WARNING_STRING) != -1 || current.indexOf(PARSE_ERROR_STRING) != -1) { + int onLine = current.indexOf("on line "); + if (onLine != -1) { + lineNumberBuffer.delete(0, lineNumberBuffer.length()); + for (int i = onLine; i < current.length(); i++) { + ch = current.charAt(i); + if ('0' <= ch && '9' >= ch) { + lineNumberBuffer.append(ch); + } + } + + int lineNumber = Integer.parseInt(lineNumberBuffer.toString()); + + Hashtable attributes = new Hashtable(); + + current = current.replaceAll("\n", ""); + current = current.replaceAll("", ""); + current = current.replaceAll("", ""); + MarkerUtilities.setMessage(attributes, current); + + if (current.indexOf(PARSE_ERROR_STRING) != -1) + attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR)); + else if (current.indexOf(PARSE_WARNING_STRING) != -1) + attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_WARNING)); + else + attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO)); + MarkerUtilities.setLineNumber(attributes, lineNumber); + MarkerUtilities.createMarker(file, attributes, IMarker.PROBLEM); + } + } + } + + public void parse(String s) throws CoreException { + ReInit(new StringReader(s)); + try { + parse(); + } catch (ParseException e) { + PHPeclipsePlugin.log(e); + } + } + + /** + * Call the php parse command ( php -l -f <filename> ) + * and create markers according to the external parser output + */ + public static void phpExternalParse(IFile file) { + IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore(); + String filename = file.getLocation().toString(); + + String[] arguments = { filename }; + MessageFormat form = new MessageFormat(store.getString(PHPeclipsePlugin.EXTERNAL_PARSER_PREF)); + String command = form.format(arguments); + + String parserResult = PHPStartApacheAction.getParserOutput(command, "External parser: "); + + try { + // parse the buffer to find the errors and warnings + createMarkers(parserResult, file); + } catch (CoreException e) { + PHPeclipsePlugin.log(e); + } + } + + public void parse() throws ParseException { + phpFile(); + } + +/***************************************** + * THE JAVA LANGUAGE GRAMMAR STARTS HERE * + *****************************************/ + +/* + * Program structuring syntax follows. + */ + static final public void phpTest() throws ParseException { + Php(); + jj_consume_token(0); + } + + static final public void phpFile() throws ParseException { + label_1: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 1: + ; + break; + default: + jj_la1[0] = jj_gen; + break label_1; + } + jj_consume_token(1); + Php(); + jj_consume_token(128); + } + jj_consume_token(0); + } + + static final public void Php() throws ParseException { + label_2: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case CLASS: + case FUNCTION: + case IF: + case ARRAY: + case PRINT: + case ECHO: + case INCLUDE: + case REQUIRE: + case INCLUDE_ONCE: + case REQUIRE_ONCE: + case GLOBAL: + case STATIC: + case BREAK: + case CONTINUE: + case DO: + case FALSE: + case FOR: + case NEW: + case NULL: + case RETURN: + case SWITCH: + case TRUE: + case WHILE: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case LBRACE: + case SEMICOLON: + case AT: + case DOLLAR: + case BANG: + case INCR: + case DECR: + case PLUS: + case MINUS: + case DOLLAR_ID: + ; + break; + default: + jj_la1[1] = jj_gen; + break label_2; + } + BlockStatement(); + } + } + + static final public void ClassDeclaration() throws ParseException { + jj_consume_token(CLASS); + jj_consume_token(IDENTIFIER); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case EXTENDS: + jj_consume_token(EXTENDS); + jj_consume_token(IDENTIFIER); + break; + default: + jj_la1[2] = jj_gen; + ; + } + ClassBody(); + } + + static final public void ClassBody() throws ParseException { + jj_consume_token(LBRACE); + label_3: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FUNCTION: + case VAR: + ; + break; + default: + jj_la1[3] = jj_gen; + break label_3; + } + ClassBodyDeclaration(); + } + jj_consume_token(RBRACE); + } + + static final public void ClassBodyDeclaration() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case FUNCTION: + MethodDeclaration(); + break; + case VAR: + FieldDeclaration(); + break; + default: + jj_la1[4] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + static final public void FieldDeclaration() throws ParseException { + jj_consume_token(VAR); + VariableDeclarator(); + label_4: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[5] = jj_gen; + break label_4; + } + jj_consume_token(COMMA); + VariableDeclarator(); + } + jj_consume_token(SEMICOLON); + } + + static final public void VariableDeclarator() throws ParseException { + VariableDeclaratorId(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ASSIGN: + jj_consume_token(ASSIGN); + VariableInitializer(); + break; + default: + jj_la1[6] = jj_gen; + ; + } + } + + static final public void VariableDeclaratorId() throws ParseException { + Variable(); + label_5: + while (true) { + if (jj_2_1(2)) { + ; + } else { + break label_5; + } + VariableSuffix(); + } + } + + static final public void Variable() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOLLAR_ID: + jj_consume_token(DOLLAR_ID); + label_6: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LBRACE: + ; + break; + default: + jj_la1[7] = jj_gen; + break label_6; + } + jj_consume_token(LBRACE); + Expression(); + jj_consume_token(RBRACE); + } + break; + case DOLLAR: + jj_consume_token(DOLLAR); + VariableName(); + break; + default: + jj_la1[8] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + static final public void VariableName() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LBRACE: + jj_consume_token(LBRACE); + Expression(); + jj_consume_token(RBRACE); + break; + case IDENTIFIER: + jj_consume_token(IDENTIFIER); + label_7: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LBRACE: + ; + break; + default: + jj_la1[9] = jj_gen; + break label_7; + } + jj_consume_token(LBRACE); + Expression(); + jj_consume_token(RBRACE); + } + break; + case DOLLAR: + jj_consume_token(DOLLAR); + VariableName(); + break; + default: + jj_la1[10] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + static final public void VariableInitializer() throws ParseException { + Expression(); + } + + static final public void ArrayVariable() throws ParseException { + Expression(); + label_8: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ARRAYASSIGN: + ; + break; + default: + jj_la1[11] = jj_gen; + break label_8; + } + jj_consume_token(ARRAYASSIGN); + Expression(); + } + } + + static final public void ArrayInitializer() throws ParseException { + jj_consume_token(LPAREN); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ARRAY: + case PRINT: + case FALSE: + case NEW: + case NULL: + case TRUE: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case AT: + case DOLLAR: + case BANG: + case INCR: + case DECR: + case PLUS: + case MINUS: + case DOLLAR_ID: + ArrayVariable(); + label_9: + while (true) { + if (jj_2_2(2)) { + ; + } else { + break label_9; + } + jj_consume_token(COMMA); + ArrayVariable(); + } + break; + default: + jj_la1[12] = jj_gen; + ; + } + jj_consume_token(RPAREN); + } + + static final public void MethodDeclaration() throws ParseException { + jj_consume_token(FUNCTION); + MethodDeclarator(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LBRACE: + Block(); + break; + case SEMICOLON: + jj_consume_token(SEMICOLON); + break; + default: + jj_la1[13] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + static final public void MethodDeclarator() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BIT_AND: + jj_consume_token(BIT_AND); + break; + default: + jj_la1[14] = jj_gen; + ; + } + jj_consume_token(IDENTIFIER); + FormalParameters(); + } + + static final public void FormalParameters() throws ParseException { + jj_consume_token(LPAREN); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOLLAR: + case BIT_AND: + case DOLLAR_ID: + FormalParameter(); + label_10: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[15] = jj_gen; + break label_10; + } + jj_consume_token(COMMA); + FormalParameter(); + } + break; + default: + jj_la1[16] = jj_gen; + ; + } + jj_consume_token(RPAREN); + } + + static final public void FormalParameter() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BIT_AND: + jj_consume_token(BIT_AND); + break; + default: + jj_la1[17] = jj_gen; + ; + } + VariableDeclarator(); + } + + static final public void Type() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STRING: + jj_consume_token(STRING); + break; + case BOOL: + jj_consume_token(BOOL); + break; + case BOOLEAN: + jj_consume_token(BOOLEAN); + break; + case REAL: + jj_consume_token(REAL); + break; + case DOUBLE: + jj_consume_token(DOUBLE); + break; + case FLOAT: + jj_consume_token(FLOAT); + break; + case INT: + jj_consume_token(INT); + break; + case INTEGER: + jj_consume_token(INTEGER); + break; + default: + jj_la1[18] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + +/* + * Expression syntax follows. + */ + static final public void Expression() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PRINT: + PrintExpression(); + break; + case ARRAY: + case FALSE: + case NEW: + case NULL: + case TRUE: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case AT: + case DOLLAR: + case BANG: + case INCR: + case DECR: + case PLUS: + case MINUS: + case DOLLAR_ID: + ConditionalExpression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ASSIGN: + case PLUSASSIGN: + case MINUSASSIGN: + case STARASSIGN: + case SLASHASSIGN: + case ANDASSIGN: + case ORASSIGN: + case XORASSIGN: + case DOTASSIGN: + case REMASSIGN: + case LSHIFTASSIGN: + case RSIGNEDSHIFTASSIGN: + case RUNSIGNEDSHIFTASSIGN: + AssignmentOperator(); + Expression(); + break; + default: + jj_la1[19] = jj_gen; + ; + } + break; + default: + jj_la1[20] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + static final public void AssignmentOperator() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ASSIGN: + jj_consume_token(ASSIGN); + break; + case STARASSIGN: + jj_consume_token(STARASSIGN); + break; + case SLASHASSIGN: + jj_consume_token(SLASHASSIGN); + break; + case REMASSIGN: + jj_consume_token(REMASSIGN); + break; + case PLUSASSIGN: + jj_consume_token(PLUSASSIGN); + break; + case MINUSASSIGN: + jj_consume_token(MINUSASSIGN); + break; + case LSHIFTASSIGN: + jj_consume_token(LSHIFTASSIGN); + break; + case RSIGNEDSHIFTASSIGN: + jj_consume_token(RSIGNEDSHIFTASSIGN); + break; + case RUNSIGNEDSHIFTASSIGN: + jj_consume_token(RUNSIGNEDSHIFTASSIGN); + break; + case ANDASSIGN: + jj_consume_token(ANDASSIGN); + break; + case XORASSIGN: + jj_consume_token(XORASSIGN); + break; + case ORASSIGN: + jj_consume_token(ORASSIGN); + break; + case DOTASSIGN: + jj_consume_token(DOTASSIGN); + break; + default: + jj_la1[21] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + static final public void ConditionalExpression() throws ParseException { + ConditionalOrExpression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case HOOK: + jj_consume_token(HOOK); + Expression(); + jj_consume_token(COLON); + ConditionalExpression(); + break; + default: + jj_la1[22] = jj_gen; + ; + } + } + + static final public void ConditionalOrExpression() throws ParseException { + ConditionalAndExpression(); + label_11: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case _ORL: + case SC_OR: + ; + break; + default: + jj_la1[23] = jj_gen; + break label_11; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SC_OR: + jj_consume_token(SC_OR); + break; + case _ORL: + jj_consume_token(_ORL); + break; + default: + jj_la1[24] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + ConditionalAndExpression(); + } + } + + static final public void ConditionalAndExpression() throws ParseException { + ConcatExpression(); + label_12: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case _ANDL: + case SC_AND: + ; + break; + default: + jj_la1[25] = jj_gen; + break label_12; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SC_AND: + jj_consume_token(SC_AND); + break; + case _ANDL: + jj_consume_token(_ANDL); + break; + default: + jj_la1[26] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + ConcatExpression(); + } + } + + static final public void ConcatExpression() throws ParseException { + InclusiveOrExpression(); + label_13: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: + ; + break; + default: + jj_la1[27] = jj_gen; + break label_13; + } + jj_consume_token(DOT); + InclusiveOrExpression(); + } + } + + static final public void InclusiveOrExpression() throws ParseException { + ExclusiveOrExpression(); + label_14: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BIT_OR: + ; + break; + default: + jj_la1[28] = jj_gen; + break label_14; + } + jj_consume_token(BIT_OR); + ExclusiveOrExpression(); + } + } + + static final public void ExclusiveOrExpression() throws ParseException { + AndExpression(); + label_15: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case XOR: + ; + break; + default: + jj_la1[29] = jj_gen; + break label_15; + } + jj_consume_token(XOR); + AndExpression(); + } + } + + static final public void AndExpression() throws ParseException { + EqualityExpression(); + label_16: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BIT_AND: + ; + break; + default: + jj_la1[30] = jj_gen; + break label_16; + } + jj_consume_token(BIT_AND); + EqualityExpression(); + } + } + + static final public void EqualityExpression() throws ParseException { + RelationalExpression(); + label_17: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case EQ: + case NE: + ; + break; + default: + jj_la1[31] = jj_gen; + break label_17; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case EQ: + jj_consume_token(EQ); + break; + case NE: + jj_consume_token(NE); + break; + default: + jj_la1[32] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + RelationalExpression(); + } + } + + static final public void RelationalExpression() throws ParseException { + ShiftExpression(); + label_18: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case GT: + case LT: + case LE: + case GE: + ; + break; + default: + jj_la1[33] = jj_gen; + break label_18; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LT: + jj_consume_token(LT); + break; + case GT: + jj_consume_token(GT); + break; + case LE: + jj_consume_token(LE); + break; + case GE: + jj_consume_token(GE); + break; + default: + jj_la1[34] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + ShiftExpression(); + } + } + + static final public void ShiftExpression() throws ParseException { + AdditiveExpression(); + label_19: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LSHIFT: + case RSIGNEDSHIFT: + case RUNSIGNEDSHIFT: + ; + break; + default: + jj_la1[35] = jj_gen; + break label_19; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LSHIFT: + jj_consume_token(LSHIFT); + break; + case RSIGNEDSHIFT: + jj_consume_token(RSIGNEDSHIFT); + break; + case RUNSIGNEDSHIFT: + jj_consume_token(RUNSIGNEDSHIFT); + break; + default: + jj_la1[36] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + AdditiveExpression(); + } + } + + static final public void AdditiveExpression() throws ParseException { + MultiplicativeExpression(); + label_20: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PLUS: + case MINUS: + ; + break; + default: + jj_la1[37] = jj_gen; + break label_20; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PLUS: + jj_consume_token(PLUS); + break; + case MINUS: + jj_consume_token(MINUS); + break; + default: + jj_la1[38] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + MultiplicativeExpression(); + } + } + + static final public void MultiplicativeExpression() throws ParseException { + UnaryExpression(); + label_21: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STAR: + case SLASH: + case REM: + ; + break; + default: + jj_la1[39] = jj_gen; + break label_21; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STAR: + jj_consume_token(STAR); + break; + case SLASH: + jj_consume_token(SLASH); + break; + case REM: + jj_consume_token(REM); + break; + default: + jj_la1[40] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + UnaryExpression(); + } + } + + static final public void UnaryExpression() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case AT: + jj_consume_token(AT); + UnaryExpression(); + break; + case PLUS: + case MINUS: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PLUS: + jj_consume_token(PLUS); + break; + case MINUS: + jj_consume_token(MINUS); + break; + default: + jj_la1[41] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + UnaryExpression(); + break; + case INCR: + PreIncrementExpression(); + break; + case DECR: + PreDecrementExpression(); + break; + case ARRAY: + case FALSE: + case NEW: + case NULL: + case TRUE: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case DOLLAR: + case BANG: + case DOLLAR_ID: + UnaryExpressionNotPlusMinus(); + break; + default: + jj_la1[42] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + static final public void PreIncrementExpression() throws ParseException { + jj_consume_token(INCR); + PrimaryExpression(); + } + + static final public void PreDecrementExpression() throws ParseException { + jj_consume_token(DECR); + PrimaryExpression(); + } + + static final public void UnaryExpressionNotPlusMinus() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BANG: + jj_consume_token(BANG); + UnaryExpression(); + break; + default: + jj_la1[43] = jj_gen; + if (jj_2_3(2147483647)) { + CastExpression(); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ARRAY: + case NEW: + case IDENTIFIER: + case DOLLAR: + case DOLLAR_ID: + PostfixExpression(); + break; + case FALSE: + case NULL: + case TRUE: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case STRING_LITERAL: + Literal(); + break; + case LPAREN: + jj_consume_token(LPAREN); + Expression(); + jj_consume_token(RPAREN); + break; + default: + jj_la1[44] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + } + } + + static final public void CastExpression() throws ParseException { + jj_consume_token(LPAREN); + Type(); + jj_consume_token(RPAREN); + UnaryExpression(); + } + + static final public void PostfixExpression() throws ParseException { + PrimaryExpression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INCR: + case DECR: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INCR: + jj_consume_token(INCR); + break; + case DECR: + jj_consume_token(DECR); + break; + default: + jj_la1[45] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[46] = jj_gen; + ; + } + } + + static final public void PrimaryExpression() throws ParseException { + if (jj_2_4(2)) { + jj_consume_token(IDENTIFIER); + jj_consume_token(STATICCLASSACCESS); + ClassIdentifier(); + label_22: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case CLASSACCESS: + case LPAREN: + case LBRACKET: + ; + break; + default: + jj_la1[47] = jj_gen; + break label_22; + } + PrimarySuffix(); + } + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NEW: + case IDENTIFIER: + case DOLLAR: + case DOLLAR_ID: + PrimaryPrefix(); + label_23: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case CLASSACCESS: + case LPAREN: + case LBRACKET: + ; + break; + default: + jj_la1[48] = jj_gen; + break label_23; + } + PrimarySuffix(); + } + break; + case ARRAY: + jj_consume_token(ARRAY); + ArrayInitializer(); + break; + default: + jj_la1[49] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + } + + static final public void PrimaryPrefix() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IDENTIFIER: + jj_consume_token(IDENTIFIER); + break; + case NEW: + jj_consume_token(NEW); + ClassIdentifier(); + break; + case DOLLAR: + case DOLLAR_ID: + VariableDeclaratorId(); + break; + default: + jj_la1[50] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + static final public void ClassIdentifier() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IDENTIFIER: + jj_consume_token(IDENTIFIER); + break; + case DOLLAR: + case DOLLAR_ID: + VariableDeclaratorId(); + break; + default: + jj_la1[51] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + static final public void PrimarySuffix() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LPAREN: + Arguments(); + break; + case CLASSACCESS: + case LBRACKET: + VariableSuffix(); + break; + default: + jj_la1[52] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + static final public void VariableSuffix() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case CLASSACCESS: + jj_consume_token(CLASSACCESS); + VariableName(); + break; + case LBRACKET: + jj_consume_token(LBRACKET); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ARRAY: + case PRINT: + case FALSE: + case NEW: + case NULL: + case TRUE: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case AT: + case DOLLAR: + case BANG: + case INCR: + case DECR: + case PLUS: + case MINUS: + case DOLLAR_ID: + Expression(); + break; + default: + jj_la1[53] = jj_gen; + ; + } + jj_consume_token(RBRACKET); + break; + default: + jj_la1[54] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + static final public void Literal() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER_LITERAL: + jj_consume_token(INTEGER_LITERAL); + break; + case FLOATING_POINT_LITERAL: + jj_consume_token(FLOATING_POINT_LITERAL); + break; + case STRING_LITERAL: + jj_consume_token(STRING_LITERAL); + break; + case FALSE: + case TRUE: + BooleanLiteral(); + break; + case NULL: + NullLiteral(); + break; + default: + jj_la1[55] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + static final public void BooleanLiteral() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TRUE: + jj_consume_token(TRUE); + break; + case FALSE: + jj_consume_token(FALSE); + break; + default: + jj_la1[56] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + static final public void NullLiteral() throws ParseException { + jj_consume_token(NULL); + } + + static final public void Arguments() throws ParseException { + jj_consume_token(LPAREN); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ARRAY: + case PRINT: + case FALSE: + case NEW: + case NULL: + case TRUE: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case AT: + case DOLLAR: + case BANG: + case INCR: + case DECR: + case PLUS: + case MINUS: + case DOLLAR_ID: + ArgumentList(); + break; + default: + jj_la1[57] = jj_gen; + ; + } + jj_consume_token(RPAREN); + } + + static final public void ArgumentList() throws ParseException { + Expression(); + label_24: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[58] = jj_gen; + break label_24; + } + jj_consume_token(COMMA); + Expression(); + } + } + +/* + * Statement syntax follows. + */ + static final public void Statement() throws ParseException { + if (jj_2_5(2)) { + Expression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: + jj_consume_token(SEMICOLON); + break; + case 128: + jj_consume_token(128); + break; + default: + jj_la1[59] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } else if (jj_2_6(2)) { + LabeledStatement(); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LBRACE: + Block(); + break; + case SEMICOLON: + EmptyStatement(); + break; + case ARRAY: + case NEW: + case IDENTIFIER: + case DOLLAR: + case INCR: + case DECR: + case DOLLAR_ID: + StatementExpression(); + try { + jj_consume_token(SEMICOLON); + } catch (ParseException e) { + errorMessage = "';' expected after expression"; + errorLevel = ERROR; + {if (true) throw e;} + } + break; + case SWITCH: + SwitchStatement(); + break; + case IF: + IfStatement(); + break; + case WHILE: + WhileStatement(); + break; + case DO: + DoStatement(); + break; + case FOR: + ForStatement(); + break; + case BREAK: + BreakStatement(); + break; + case CONTINUE: + ContinueStatement(); + break; + case RETURN: + ReturnStatement(); + break; + case ECHO: + EchoStatement(); + break; + case INCLUDE: + case REQUIRE: + case INCLUDE_ONCE: + case REQUIRE_ONCE: + IncludeStatement(); + break; + case STATIC: + StaticStatement(); + break; + case GLOBAL: + GlobalStatement(); + break; + default: + jj_la1[60] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + } + + static final public void IncludeStatement() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case REQUIRE: + jj_consume_token(REQUIRE); + Expression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: + jj_consume_token(SEMICOLON); + break; + case 128: + jj_consume_token(128); + break; + default: + jj_la1[61] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + case REQUIRE_ONCE: + jj_consume_token(REQUIRE_ONCE); + Expression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: + jj_consume_token(SEMICOLON); + break; + case 128: + jj_consume_token(128); + break; + default: + jj_la1[62] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + case INCLUDE: + jj_consume_token(INCLUDE); + Expression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: + jj_consume_token(SEMICOLON); + break; + case 128: + jj_consume_token(128); + break; + default: + jj_la1[63] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + case INCLUDE_ONCE: + jj_consume_token(INCLUDE_ONCE); + Expression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: + jj_consume_token(SEMICOLON); + break; + case 128: + jj_consume_token(128); + break; + default: + jj_la1[64] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[65] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + static final public void PrintExpression() throws ParseException { + jj_consume_token(PRINT); + Expression(); + } + + static final public void EchoStatement() throws ParseException { + jj_consume_token(ECHO); + Expression(); + label_25: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[66] = jj_gen; + break label_25; + } + jj_consume_token(COMMA); + Expression(); + } + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: + jj_consume_token(SEMICOLON); + break; + case 128: + jj_consume_token(128); + break; + default: + jj_la1[67] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } catch (ParseException e) { + errorMessage = "';' expected after 'echo' statement"; + errorLevel = ERROR; + {if (true) throw e;} + } + } + + static final public void GlobalStatement() throws ParseException { + jj_consume_token(GLOBAL); + VariableDeclaratorId(); + label_26: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[68] = jj_gen; + break label_26; + } + jj_consume_token(COMMA); + VariableDeclaratorId(); + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: + jj_consume_token(SEMICOLON); + break; + case 128: + jj_consume_token(128); + break; + default: + jj_la1[69] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + static final public void StaticStatement() throws ParseException { + jj_consume_token(STATIC); + VariableDeclarator(); + label_27: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[70] = jj_gen; + break label_27; + } + jj_consume_token(COMMA); + VariableDeclarator(); + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: + jj_consume_token(SEMICOLON); + break; + case 128: + jj_consume_token(128); + break; + default: + jj_la1[71] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + static final public void LabeledStatement() throws ParseException { + jj_consume_token(IDENTIFIER); + jj_consume_token(COLON); + Statement(); + } + + static final public void Block() throws ParseException { + jj_consume_token(LBRACE); + label_28: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case CLASS: + case FUNCTION: + case IF: + case ARRAY: + case PRINT: + case ECHO: + case INCLUDE: + case REQUIRE: + case INCLUDE_ONCE: + case REQUIRE_ONCE: + case GLOBAL: + case STATIC: + case BREAK: + case CONTINUE: + case DO: + case FALSE: + case FOR: + case NEW: + case NULL: + case RETURN: + case SWITCH: + case TRUE: + case WHILE: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case LBRACE: + case SEMICOLON: + case AT: + case DOLLAR: + case BANG: + case INCR: + case DECR: + case PLUS: + case MINUS: + case DOLLAR_ID: + ; + break; + default: + jj_la1[72] = jj_gen; + break label_28; + } + BlockStatement(); + } + jj_consume_token(RBRACE); + } + + static final public void BlockStatement() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IF: + case ARRAY: + case PRINT: + case ECHO: + case INCLUDE: + case REQUIRE: + case INCLUDE_ONCE: + case REQUIRE_ONCE: + case GLOBAL: + case STATIC: + case BREAK: + case CONTINUE: + case DO: + case FALSE: + case FOR: + case NEW: + case NULL: + case RETURN: + case SWITCH: + case TRUE: + case WHILE: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case LBRACE: + case SEMICOLON: + case AT: + case DOLLAR: + case BANG: + case INCR: + case DECR: + case PLUS: + case MINUS: + case DOLLAR_ID: + Statement(); + break; + case CLASS: + ClassDeclaration(); + break; + case FUNCTION: + MethodDeclaration(); + break; + default: + jj_la1[73] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + static final public void LocalVariableDeclaration() throws ParseException { + VariableDeclarator(); + label_29: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[74] = jj_gen; + break label_29; + } + jj_consume_token(COMMA); + VariableDeclarator(); + } + } + + static final public void EmptyStatement() throws ParseException { + jj_consume_token(SEMICOLON); + } + + static final public void StatementExpression() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INCR: + PreIncrementExpression(); + break; + case DECR: + PreDecrementExpression(); + break; + case ARRAY: + case NEW: + case IDENTIFIER: + case DOLLAR: + case DOLLAR_ID: + PrimaryExpression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ASSIGN: + case INCR: + case DECR: + case PLUSASSIGN: + case MINUSASSIGN: + case STARASSIGN: + case SLASHASSIGN: + case ANDASSIGN: + case ORASSIGN: + case XORASSIGN: + case DOTASSIGN: + case REMASSIGN: + case LSHIFTASSIGN: + case RSIGNEDSHIFTASSIGN: + case RUNSIGNEDSHIFTASSIGN: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INCR: + jj_consume_token(INCR); + break; + case DECR: + jj_consume_token(DECR); + break; + case ASSIGN: + case PLUSASSIGN: + case MINUSASSIGN: + case STARASSIGN: + case SLASHASSIGN: + case ANDASSIGN: + case ORASSIGN: + case XORASSIGN: + case DOTASSIGN: + case REMASSIGN: + case LSHIFTASSIGN: + case RSIGNEDSHIFTASSIGN: + case RUNSIGNEDSHIFTASSIGN: + AssignmentOperator(); + Expression(); + break; + default: + jj_la1[75] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[76] = jj_gen; + ; + } + break; + default: + jj_la1[77] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + static final public void SwitchStatement() throws ParseException { + jj_consume_token(SWITCH); + jj_consume_token(LPAREN); + Expression(); + jj_consume_token(RPAREN); + jj_consume_token(LBRACE); + label_30: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case CASE: + case _DEFAULT: + ; + break; + default: + jj_la1[78] = jj_gen; + break label_30; + } + SwitchLabel(); + label_31: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case CLASS: + case FUNCTION: + case IF: + case ARRAY: + case PRINT: + case ECHO: + case INCLUDE: + case REQUIRE: + case INCLUDE_ONCE: + case REQUIRE_ONCE: + case GLOBAL: + case STATIC: + case BREAK: + case CONTINUE: + case DO: + case FALSE: + case FOR: + case NEW: + case NULL: + case RETURN: + case SWITCH: + case TRUE: + case WHILE: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case LBRACE: + case SEMICOLON: + case AT: + case DOLLAR: + case BANG: + case INCR: + case DECR: + case PLUS: + case MINUS: + case DOLLAR_ID: + ; + break; + default: + jj_la1[79] = jj_gen; + break label_31; + } + BlockStatement(); + } + } + jj_consume_token(RBRACE); + } + + static final public void SwitchLabel() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case CASE: + jj_consume_token(CASE); + Expression(); + jj_consume_token(COLON); + break; + case _DEFAULT: + jj_consume_token(_DEFAULT); + jj_consume_token(COLON); + break; + default: + jj_la1[80] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + static final public void IfStatement() throws ParseException { + jj_consume_token(IF); + Condition("if"); + Statement(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ELSEIF: + ElseIfStatement(); + break; + default: + jj_la1[81] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ELSE: + jj_consume_token(ELSE); + Statement(); + break; + default: + jj_la1[82] = jj_gen; + ; + } + } + + static final public void Condition(String keyword) throws ParseException { + try { + jj_consume_token(LPAREN); + } catch (ParseException e) { + errorMessage = "'(' expected after " + keyword + " keyword"; + errorLevel = ERROR; + {if (true) throw e;} + } + Expression(); + try { + jj_consume_token(RPAREN); + } catch (ParseException e) { + errorMessage = "')' expected after " + keyword + " keyword"; + errorLevel = ERROR; + {if (true) throw e;} + } + } + + static final public void ElseIfStatement() throws ParseException { + jj_consume_token(ELSEIF); + Condition("elseif"); + Statement(); + } + + static final public void WhileStatement() throws ParseException { + jj_consume_token(WHILE); + Condition("while"); + WhileStatement0(); + } + + static final public void WhileStatement0() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COLON: + jj_consume_token(COLON); + label_32: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IF: + case ARRAY: + case PRINT: + case ECHO: + case INCLUDE: + case REQUIRE: + case INCLUDE_ONCE: + case REQUIRE_ONCE: + case GLOBAL: + case STATIC: + case BREAK: + case CONTINUE: + case DO: + case FALSE: + case FOR: + case NEW: + case NULL: + case RETURN: + case SWITCH: + case TRUE: + case WHILE: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case LBRACE: + case SEMICOLON: + case AT: + case DOLLAR: + case BANG: + case INCR: + case DECR: + case PLUS: + case MINUS: + case DOLLAR_ID: + ; + break; + default: + jj_la1[83] = jj_gen; + break label_32; + } + Statement(); + } + jj_consume_token(ENDWHILE); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: + jj_consume_token(SEMICOLON); + break; + case 128: + jj_consume_token(128); + break; + default: + jj_la1[84] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + case IF: + case ARRAY: + case PRINT: + case ECHO: + case INCLUDE: + case REQUIRE: + case INCLUDE_ONCE: + case REQUIRE_ONCE: + case GLOBAL: + case STATIC: + case BREAK: + case CONTINUE: + case DO: + case FALSE: + case FOR: + case NEW: + case NULL: + case RETURN: + case SWITCH: + case TRUE: + case WHILE: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case LBRACE: + case SEMICOLON: + case AT: + case DOLLAR: + case BANG: + case INCR: + case DECR: + case PLUS: + case MINUS: + case DOLLAR_ID: + Statement(); + break; + default: + jj_la1[85] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + static final public void DoStatement() throws ParseException { + jj_consume_token(DO); + Statement(); + jj_consume_token(WHILE); + Condition("while"); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SEMICOLON: + jj_consume_token(SEMICOLON); + break; + case 128: + jj_consume_token(128); + break; + default: + jj_la1[86] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + static final public void ForStatement() throws ParseException { + jj_consume_token(FOR); + jj_consume_token(LPAREN); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ARRAY: + case NEW: + case IDENTIFIER: + case DOLLAR: + case INCR: + case DECR: + case DOLLAR_ID: + ForInit(); + break; + default: + jj_la1[87] = jj_gen; + ; + } + jj_consume_token(SEMICOLON); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ARRAY: + case PRINT: + case FALSE: + case NEW: + case NULL: + case TRUE: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case AT: + case DOLLAR: + case BANG: + case INCR: + case DECR: + case PLUS: + case MINUS: + case DOLLAR_ID: + Expression(); + break; + default: + jj_la1[88] = jj_gen; + ; + } + jj_consume_token(SEMICOLON); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ARRAY: + case NEW: + case IDENTIFIER: + case DOLLAR: + case INCR: + case DECR: + case DOLLAR_ID: + ForUpdate(); + break; + default: + jj_la1[89] = jj_gen; + ; + } + jj_consume_token(RPAREN); + Statement(); + } + + static final public void ForInit() throws ParseException { + if (jj_2_7(2147483647)) { + LocalVariableDeclaration(); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ARRAY: + case NEW: + case IDENTIFIER: + case DOLLAR: + case INCR: + case DECR: + case DOLLAR_ID: + StatementExpressionList(); + break; + default: + jj_la1[90] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + } + + static final public void StatementExpressionList() throws ParseException { + StatementExpression(); + label_33: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[91] = jj_gen; + break label_33; + } + jj_consume_token(COMMA); + StatementExpression(); + } + } + + static final public void ForUpdate() throws ParseException { + StatementExpressionList(); + } + + static final public void BreakStatement() throws ParseException { + jj_consume_token(BREAK); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IDENTIFIER: + jj_consume_token(IDENTIFIER); + break; + default: + jj_la1[92] = jj_gen; + ; + } + jj_consume_token(SEMICOLON); + } + + static final public void ContinueStatement() throws ParseException { + jj_consume_token(CONTINUE); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IDENTIFIER: + jj_consume_token(IDENTIFIER); + break; + default: + jj_la1[93] = jj_gen; + ; + } + jj_consume_token(SEMICOLON); + } + + static final public void ReturnStatement() throws ParseException { + jj_consume_token(RETURN); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ARRAY: + case PRINT: + case FALSE: + case NEW: + case NULL: + case TRUE: + case INTEGER_LITERAL: + case FLOATING_POINT_LITERAL: + case STRING_LITERAL: + case IDENTIFIER: + case LPAREN: + case AT: + case DOLLAR: + case BANG: + case INCR: + case DECR: + case PLUS: + case MINUS: + case DOLLAR_ID: + Expression(); + break; + default: + jj_la1[94] = jj_gen; + ; + } + jj_consume_token(SEMICOLON); + } + + static final private boolean jj_2_1(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + boolean retval = !jj_3_1(); + jj_save(0, xla); + return retval; + } + + static final private boolean jj_2_2(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + boolean retval = !jj_3_2(); + jj_save(1, xla); + return retval; + } + + static final private boolean jj_2_3(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + boolean retval = !jj_3_3(); + jj_save(2, xla); + return retval; + } + + static final private boolean jj_2_4(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + boolean retval = !jj_3_4(); + jj_save(3, xla); + return retval; + } + + static final private boolean jj_2_5(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + boolean retval = !jj_3_5(); + jj_save(4, xla); + return retval; + } + + static final private boolean jj_2_6(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + boolean retval = !jj_3_6(); + jj_save(5, xla); + return retval; + } + + static final private boolean jj_2_7(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + boolean retval = !jj_3_7(); + jj_save(6, xla); + return retval; + } + + static final private boolean jj_3R_77() { + if (jj_scan_token(PLUSASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_98() { + if (jj_scan_token(BIT_OR)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_97()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_101() { + if (jj_scan_token(XOR)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_100()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_104() { + if (jj_3R_106()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_107()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + static final private boolean jj_3R_91() { + if (jj_scan_token(_ORL)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_96() { + if (jj_scan_token(_ANDL)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_94() { + if (jj_scan_token(DOT)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_93()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_102() { + if (jj_3R_104()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_105()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + static final private boolean jj_3R_90() { + if (jj_scan_token(SC_OR)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_76() { + if (jj_scan_token(REMASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_100() { + if (jj_3R_102()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_103()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + static final private boolean jj_3R_72() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_90()) { + jj_scanpos = xsp; + if (jj_3R_91()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_71()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_95() { + if (jj_scan_token(SC_AND)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_89() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_95()) { + jj_scanpos = xsp; + if (jj_3R_96()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_88()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_97() { + if (jj_3R_100()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_101()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + static final private boolean jj_3R_67() { + if (jj_scan_token(HOOK)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_37()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(COLON)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_59()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_93() { + if (jj_3R_97()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_98()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + static final private boolean jj_3R_75() { + if (jj_scan_token(SLASHASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_88() { + if (jj_3R_93()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_94()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + static final private boolean jj_3R_71() { + if (jj_3R_88()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_89()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + static final private boolean jj_3R_66() { + if (jj_3R_71()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_72()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + static final private boolean jj_3R_74() { + if (jj_scan_token(STARASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_59() { + if (jj_3R_66()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_67()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_73() { + if (jj_scan_token(ASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_68() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_73()) { + jj_scanpos = xsp; + if (jj_3R_74()) { + jj_scanpos = xsp; + if (jj_3R_75()) { + jj_scanpos = xsp; + if (jj_3R_76()) { + jj_scanpos = xsp; + if (jj_3R_77()) { + jj_scanpos = xsp; + if (jj_3R_78()) { + jj_scanpos = xsp; + if (jj_3R_79()) { + jj_scanpos = xsp; + if (jj_3R_80()) { + jj_scanpos = xsp; + if (jj_3R_81()) { + jj_scanpos = xsp; + if (jj_3R_82()) { + jj_scanpos = xsp; + if (jj_3R_83()) { + jj_scanpos = xsp; + if (jj_3R_84()) { + jj_scanpos = xsp; + if (jj_3R_85()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_60() { + if (jj_3R_68()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_37()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_53() { + if (jj_3R_59()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_60()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_37() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_52()) { + jj_scanpos = xsp; + if (jj_3R_53()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_52() { + if (jj_3R_58()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_55() { + if (jj_scan_token(COMMA)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_54()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_51() { + if (jj_scan_token(INTEGER)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_50() { + if (jj_scan_token(INT)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_49() { + if (jj_scan_token(FLOAT)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_48() { + if (jj_scan_token(DOUBLE)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_47() { + if (jj_scan_token(REAL)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_46() { + if (jj_scan_token(BOOLEAN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_45() { + if (jj_scan_token(BOOL)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_36() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_44()) { + jj_scanpos = xsp; + if (jj_3R_45()) { + jj_scanpos = xsp; + if (jj_3R_46()) { + jj_scanpos = xsp; + if (jj_3R_47()) { + jj_scanpos = xsp; + if (jj_3R_48()) { + jj_scanpos = xsp; + if (jj_3R_49()) { + jj_scanpos = xsp; + if (jj_3R_50()) { + jj_scanpos = xsp; + if (jj_3R_51()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_44() { + if (jj_scan_token(STRING)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3_2() { + if (jj_scan_token(COMMA)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_35()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_41() { + if (jj_3R_54()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_55()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + static final private boolean jj_3R_175() { + if (jj_3R_35()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3_2()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + static final private boolean jj_3R_176() { + if (jj_scan_token(ARRAYASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_37()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_40() { + if (jj_scan_token(IDENTIFIER)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(COLON)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_164() { + if (jj_scan_token(LPAREN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_175()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(RPAREN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_35() { + if (jj_3R_37()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_176()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + static final private boolean jj_3R_99() { + if (jj_scan_token(LBRACE)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_37()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(RBRACE)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_70() { + if (jj_3R_37()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_92() { + if (jj_scan_token(LBRACE)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_37()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(RBRACE)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_62() { + if (jj_scan_token(ASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_70()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_65() { + if (jj_scan_token(DOLLAR)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_56()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_64() { + if (jj_scan_token(IDENTIFIER)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_99()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + static final private boolean jj_3R_63() { + if (jj_scan_token(LBRACE)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_37()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(RBRACE)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_56() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_63()) { + jj_scanpos = xsp; + if (jj_3R_64()) { + jj_scanpos = xsp; + if (jj_3R_65()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3_1() { + if (jj_3R_34()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_87() { + if (jj_scan_token(DOLLAR)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_56()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_58() { + if (jj_scan_token(PRINT)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_37()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_86() { + if (jj_scan_token(DOLLAR_ID)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_92()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + static final private boolean jj_3R_69() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_86()) { + jj_scanpos = xsp; + if (jj_3R_87()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_61() { + if (jj_3R_69()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3_1()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + static final private boolean jj_3R_54() { + if (jj_3R_61()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_62()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_39() { + if (jj_scan_token(128)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_38() { + if (jj_scan_token(SEMICOLON)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_179() { + if (jj_scan_token(COMMA)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_37()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3_6() { + if (jj_3R_40()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3_5() { + if (jj_3R_37()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_38()) { + jj_scanpos = xsp; + if (jj_3R_39()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_177() { + if (jj_3R_178()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_178() { + if (jj_3R_37()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_179()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + static final private boolean jj_3R_174() { + if (jj_scan_token(LPAREN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_177()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(RPAREN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_162() { + if (jj_scan_token(NULL)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_85() { + if (jj_scan_token(DOTASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_166() { + if (jj_scan_token(FALSE)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_161() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_165()) { + jj_scanpos = xsp; + if (jj_3R_166()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_165() { + if (jj_scan_token(TRUE)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_171() { + if (jj_3R_167()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_155() { + if (jj_3R_162()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_57() { + if (jj_3R_37()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_154() { + if (jj_3R_161()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_84() { + if (jj_scan_token(ORASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_153() { + if (jj_scan_token(STRING_LITERAL)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_152() { + if (jj_scan_token(FLOATING_POINT_LITERAL)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_148() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_151()) { + jj_scanpos = xsp; + if (jj_3R_152()) { + jj_scanpos = xsp; + if (jj_3R_153()) { + jj_scanpos = xsp; + if (jj_3R_154()) { + jj_scanpos = xsp; + if (jj_3R_155()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_151() { + if (jj_scan_token(INTEGER_LITERAL)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_43() { + if (jj_scan_token(LBRACKET)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_57()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(RBRACKET)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_42() { + if (jj_scan_token(CLASSACCESS)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_56()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_34() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_42()) { + jj_scanpos = xsp; + if (jj_3R_43()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_83() { + if (jj_scan_token(XORASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_170() { + if (jj_3R_34()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_167() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_169()) { + jj_scanpos = xsp; + if (jj_3R_170()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_169() { + if (jj_3R_174()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_160() { + if (jj_scan_token(DECR)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_173() { + if (jj_3R_61()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_172() { + if (jj_scan_token(IDENTIFIER)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_82() { + if (jj_scan_token(ANDASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_163() { + if (jj_3R_167()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_168() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_172()) { + jj_scanpos = xsp; + if (jj_3R_173()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_150() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_159()) { + jj_scanpos = xsp; + if (jj_3R_160()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_159() { + if (jj_scan_token(INCR)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_158() { + if (jj_3R_61()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_157() { + if (jj_scan_token(NEW)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_168()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_149() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_156()) { + jj_scanpos = xsp; + if (jj_3R_157()) { + jj_scanpos = xsp; + if (jj_3R_158()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_156() { + if (jj_scan_token(IDENTIFIER)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_145() { + if (jj_scan_token(ARRAY)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_164()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_144() { + if (jj_3R_149()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_163()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + static final private boolean jj_3_4() { + if (jj_scan_token(IDENTIFIER)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(STATICCLASSACCESS)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_168()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_171()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + static final private boolean jj_3R_138() { + Token xsp; + xsp = jj_scanpos; + if (jj_3_4()) { + jj_scanpos = xsp; + if (jj_3R_144()) { + jj_scanpos = xsp; + if (jj_3R_145()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_81() { + if (jj_scan_token(RUNSIGNEDSHIFTASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_147() { + if (jj_3R_138()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_150()) jj_scanpos = xsp; + else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_146() { + if (jj_scan_token(LPAREN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_36()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(RPAREN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_121()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3_3() { + if (jj_scan_token(LPAREN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_36()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(RPAREN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_120() { + if (jj_scan_token(RUNSIGNEDSHIFT)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_132() { + if (jj_scan_token(REM)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_143() { + if (jj_scan_token(LPAREN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_37()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_scan_token(RPAREN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_142() { + if (jj_3R_148()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_141() { + if (jj_3R_147()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_124() { + if (jj_scan_token(MINUS)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_140() { + if (jj_3R_146()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_80() { + if (jj_scan_token(RSIGNEDSHIFTASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_137() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_139()) { + jj_scanpos = xsp; + if (jj_3R_140()) { + jj_scanpos = xsp; + if (jj_3R_141()) { + jj_scanpos = xsp; + if (jj_3R_142()) { + jj_scanpos = xsp; + if (jj_3R_143()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_139() { + if (jj_scan_token(BANG)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_121()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_131() { + if (jj_scan_token(SLASH)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_136() { + if (jj_scan_token(DECR)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_138()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_115() { + if (jj_scan_token(GE)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_123() { + if (jj_scan_token(PLUS)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_119() { + if (jj_scan_token(RSIGNEDSHIFT)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_117() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_123()) { + jj_scanpos = xsp; + if (jj_3R_124()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_116()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_130() { + if (jj_scan_token(STAR)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_122() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_130()) { + jj_scanpos = xsp; + if (jj_3R_131()) { + jj_scanpos = xsp; + if (jj_3R_132()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_121()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_135() { + if (jj_scan_token(INCR)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_138()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_134() { + if (jj_scan_token(MINUS)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_114() { + if (jj_scan_token(LE)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_79() { + if (jj_scan_token(LSHIFTASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_129() { + if (jj_3R_137()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_118() { + if (jj_scan_token(LSHIFT)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_128() { + if (jj_3R_136()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_111() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_118()) { + jj_scanpos = xsp; + if (jj_3R_119()) { + jj_scanpos = xsp; + if (jj_3R_120()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_110()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_113() { + if (jj_scan_token(GT)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_109() { + if (jj_scan_token(NE)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_127() { + if (jj_3R_135()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_133() { + if (jj_scan_token(PLUS)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_126() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_133()) { + jj_scanpos = xsp; + if (jj_3R_134()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_121()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_121() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_125()) { + jj_scanpos = xsp; + if (jj_3R_126()) { + jj_scanpos = xsp; + if (jj_3R_127()) { + jj_scanpos = xsp; + if (jj_3R_128()) { + jj_scanpos = xsp; + if (jj_3R_129()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_125() { + if (jj_scan_token(AT)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_121()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_112() { + if (jj_scan_token(LT)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_108() { + if (jj_scan_token(EQ)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_107() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_112()) { + jj_scanpos = xsp; + if (jj_3R_113()) { + jj_scanpos = xsp; + if (jj_3R_114()) { + jj_scanpos = xsp; + if (jj_3R_115()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_106()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_105() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_108()) { + jj_scanpos = xsp; + if (jj_3R_109()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_104()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_116() { + if (jj_3R_121()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_122()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + static final private boolean jj_3_7() { + if (jj_3R_41()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_78() { + if (jj_scan_token(MINUSASSIGN)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_110() { + if (jj_3R_116()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_117()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + static final private boolean jj_3R_103() { + if (jj_scan_token(BIT_AND)) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + if (jj_3R_102()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + return false; + } + + static final private boolean jj_3R_106() { + if (jj_3R_110()) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_111()) { jj_scanpos = xsp; break; } + if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; + } + return false; + } + + static private boolean jj_initialized_once = false; + static public PHPParserTokenManager token_source; + static SimpleCharStream jj_input_stream; + static public Token token, jj_nt; + static private int jj_ntk; + static private Token jj_scanpos, jj_lastpos; + static private int jj_la; + static public boolean lookingAhead = false; + static private boolean jj_semLA; + static private int jj_gen; + static final private int[] jj_la1 = new int[95]; + static final private int[] jj_la1_0 = {0x2,0xff960000,0x0,0xc0000,0xc0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1800000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800000,0x0,0x800000,0x0,0x0,0x0,0x0,0x800000,0x0,0x0,0x0,0x1800000,0x0,0x0,0x0,0x1800000,0x0,0x0,0xfe900000,0x0,0x0,0x0,0x0,0x3c000000,0x0,0x0,0x0,0x0,0x0,0x0,0xff960000,0xff960000,0x0,0x0,0x0,0x800000,0x0,0xff960000,0x0,0x200000,0x400000,0xff900000,0x0,0xff900000,0x0,0x800000,0x1800000,0x800000,0x800000,0x0,0x0,0x0,0x1800000,}; + static final private int[] jj_la1_1 = {0x0,0x1aed48,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x86400,0x0,0x0,0x0,0x0,0x0,0x7f400000,0x0,0x86400,0x0,0x0,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x86400,0x0,0x86400,0x0,0x0,0x1,0x1,0x2000,0x2000,0x0,0x1,0x86400,0x1,0x84400,0x80400,0x86400,0x0,0x0,0x12a948,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1aed48,0x1aed48,0x0,0x0,0x0,0x2000,0x90,0x1aed48,0x90,0x0,0x0,0x1aed48,0x0,0x1aed48,0x0,0x2000,0x86400,0x2000,0x2000,0x0,0x0,0x0,0x86400,}; + static final private int[] jj_la1_2 = {0x0,0x232288a2,0x0,0x0,0x0,0x400000,0x4000000,0x20000,0x2000000,0x20000,0x2020800,0x0,0x230088a2,0x220000,0x0,0x400000,0x2000000,0x0,0x0,0x4000000,0x230088a2,0x4000000,0x40000000,0x0,0x0,0x1,0x1,0x800000,0x0,0x0,0x0,0x0,0x0,0x18000000,0x18000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x230088a2,0x20000000,0x20088a2,0x0,0x0,0x88000,0x88000,0x2000800,0x2000800,0x2000800,0x88000,0x230088a2,0x80000,0xa2,0x0,0x230088a2,0x400000,0x200000,0x2220800,0x200000,0x200000,0x200000,0x200000,0x0,0x400000,0x200000,0x400000,0x200000,0x400000,0x200000,0x232288a2,0x232288a2,0x400000,0x4000000,0x4000000,0x2000800,0x0,0x232288a2,0x0,0x0,0x0,0x232288a2,0x200000,0xa32288a2,0x200000,0x2000800,0x230088a2,0x2000800,0x2000800,0x400000,0x800,0x800,0x230088a2,}; + static final private int[] jj_la1_3 = {0x0,0x800003c0,0x0,0x0,0x0,0x0,0x0,0x0,0x80000000,0x0,0x0,0x0,0x800003c0,0x0,0x1000,0x0,0x80001000,0x1000,0x0,0x7ff80000,0x800003c0,0x7ff80000,0x0,0x10,0x10,0x20,0x20,0x0,0x2000,0x4000,0x1000,0x9,0x9,0x6,0x6,0x70000,0x70000,0x300,0x300,0x8c00,0x8c00,0x300,0x800003c0,0x0,0x80000000,0xc0,0xc0,0x0,0x0,0x80000000,0x80000000,0x80000000,0x0,0x800003c0,0x0,0x0,0x0,0x800003c0,0x0,0x0,0x800000c0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x800003c0,0x800003c0,0x0,0x7ff800c0,0x7ff800c0,0x800000c0,0x0,0x800003c0,0x0,0x0,0x0,0x800003c0,0x0,0x800003c0,0x0,0x800000c0,0x800003c0,0x800000c0,0x800000c0,0x0,0x0,0x0,0x800003c0,}; + static final private int[] jj_la1_4 = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1,0x1,0x1,0x1,0x0,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + static final private JJCalls[] jj_2_rtns = new JJCalls[7]; + static private boolean jj_rescan = false; + static private int jj_gc = 0; + + public PHPParser(java.io.InputStream stream) { + if (jj_initialized_once) { + System.out.println("ERROR: Second call to constructor of static parser. You must"); + System.out.println(" either use ReInit() or set the JavaCC option STATIC to false"); + System.out.println(" during parser generation."); + throw new Error(); + } + jj_initialized_once = true; + jj_input_stream = new SimpleCharStream(stream, 1, 1); + token_source = new PHPParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 95; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + static public void ReInit(java.io.InputStream stream) { + jj_input_stream.ReInit(stream, 1, 1); + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 95; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + public PHPParser(java.io.Reader stream) { + if (jj_initialized_once) { + System.out.println("ERROR: Second call to constructor of static parser. You must"); + System.out.println(" either use ReInit() or set the JavaCC option STATIC to false"); + System.out.println(" during parser generation."); + throw new Error(); + } + jj_initialized_once = true; + jj_input_stream = new SimpleCharStream(stream, 1, 1); + token_source = new PHPParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 95; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + static public void ReInit(java.io.Reader stream) { + jj_input_stream.ReInit(stream, 1, 1); + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 95; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + public PHPParser(PHPParserTokenManager tm) { + if (jj_initialized_once) { + System.out.println("ERROR: Second call to constructor of static parser. You must"); + System.out.println(" either use ReInit() or set the JavaCC option STATIC to false"); + System.out.println(" during parser generation."); + throw new Error(); + } + jj_initialized_once = true; + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 95; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + public void ReInit(PHPParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 95; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + static final private Token jj_consume_token(int kind) throws ParseException { + Token oldToken; + if ((oldToken = token).next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + if (token.kind == kind) { + jj_gen++; + if (++jj_gc > 100) { + jj_gc = 0; + for (int i = 0; i < jj_2_rtns.length; i++) { + JJCalls c = jj_2_rtns[i]; + while (c != null) { + if (c.gen < jj_gen) c.first = null; + c = c.next; + } + } + } + return token; + } + token = oldToken; + jj_kind = kind; + throw generateParseException(); + } + + static final private boolean jj_scan_token(int kind) { + if (jj_scanpos == jj_lastpos) { + jj_la--; + if (jj_scanpos.next == null) { + jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); + } else { + jj_lastpos = jj_scanpos = jj_scanpos.next; + } + } else { + jj_scanpos = jj_scanpos.next; + } + if (jj_rescan) { + int i = 0; Token tok = token; + while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } + if (tok != null) jj_add_error_token(kind, i); + } + return (jj_scanpos.kind != kind); + } + + static final public Token getNextToken() { + if (token.next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + jj_gen++; + return token; + } + + static final public Token getToken(int index) { + Token t = lookingAhead ? jj_scanpos : token; + for (int i = 0; i < index; i++) { + if (t.next != null) t = t.next; + else t = t.next = token_source.getNextToken(); + } + return t; + } + + static final private int jj_ntk() { + if ((jj_nt=token.next) == null) + return (jj_ntk = (token.next=token_source.getNextToken()).kind); + else + return (jj_ntk = jj_nt.kind); + } + + static private java.util.Vector jj_expentries = new java.util.Vector(); + static private int[] jj_expentry; + static private int jj_kind = -1; + static private int[] jj_lasttokens = new int[100]; + static private int jj_endpos; + + static private void jj_add_error_token(int kind, int pos) { + if (pos >= 100) return; + if (pos == jj_endpos + 1) { + jj_lasttokens[jj_endpos++] = kind; + } else if (jj_endpos != 0) { + jj_expentry = new int[jj_endpos]; + for (int i = 0; i < jj_endpos; i++) { + jj_expentry[i] = jj_lasttokens[i]; + } + boolean exists = false; + for (java.util.Enumeration enum = jj_expentries.elements(); enum.hasMoreElements();) { + int[] oldentry = (int[])(enum.nextElement()); + if (oldentry.length == jj_expentry.length) { + exists = true; + for (int i = 0; i < jj_expentry.length; i++) { + if (oldentry[i] != jj_expentry[i]) { + exists = false; + break; + } + } + if (exists) break; + } + } + if (!exists) jj_expentries.addElement(jj_expentry); + if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; + } + } + + static final public ParseException generateParseException() { + jj_expentries.removeAllElements(); + boolean[] la1tokens = new boolean[129]; + for (int i = 0; i < 129; i++) { + la1tokens[i] = false; + } + if (jj_kind >= 0) { + la1tokens[jj_kind] = true; + jj_kind = -1; + } + for (int i = 0; i < 95; i++) { + if (jj_la1[i] == jj_gen) { + for (int j = 0; j < 32; j++) { + if ((jj_la1_0[i] & (1< jj_gen) { + jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; + switch (i) { + case 0: jj_3_1(); break; + case 1: jj_3_2(); break; + case 2: jj_3_3(); break; + case 3: jj_3_4(); break; + case 4: jj_3_5(); break; + case 5: jj_3_6(); break; + case 6: jj_3_7(); break; + } + } + p = p.next; + } while (p != null); + } + jj_rescan = false; + } + + static final private void jj_save(int index, int xla) { + JJCalls p = jj_2_rtns[index]; + while (p.gen > jj_gen) { + if (p.next == null) { p = p.next = new JJCalls(); break; } + p = p.next; + } + p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; + } + + static final class JJCalls { + int gen; + Token first; + int arg; + JJCalls next; + } + +} diff --git a/net.sourceforge.phpeclipse/src/test/PHPParser.jj b/net.sourceforge.phpeclipse/src/test/PHPParser.jj new file mode 100644 index 0000000..57e9eb8 --- /dev/null +++ b/net.sourceforge.phpeclipse/src/test/PHPParser.jj @@ -0,0 +1,1184 @@ +options { + LOOKAHEAD = 1; + CHOICE_AMBIGUITY_CHECK = 2; + OTHER_AMBIGUITY_CHECK = 1; + STATIC = true; + DEBUG_PARSER = false; + DEBUG_LOOKAHEAD = false; + DEBUG_TOKEN_MANAGER = false; + OPTIMIZE_TOKEN_MANAGER = false; + ERROR_REPORTING = true; + JAVA_UNICODE_ESCAPE = false; + UNICODE_INPUT = false; + IGNORE_CASE = true; + USER_TOKEN_MANAGER = false; + USER_CHAR_STREAM = false; + BUILD_PARSER = true; + BUILD_TOKEN_MANAGER = true; + SANITY_CHECK = true; + FORCE_LA_CHECK = false; +} + +PARSER_BEGIN(PHPParser) +package test; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.ui.texteditor.MarkerUtilities; +import org.eclipse.jface.preference.IPreferenceStore; + +import java.io.CharArrayReader; +import java.util.Hashtable; +import java.io.StringReader; +import java.text.MessageFormat; + +import net.sourceforge.phpeclipse.actions.PHPStartApacheAction; +import net.sourceforge.phpeclipse.PHPeclipsePlugin; +import net.sourceforge.phpdt.internal.compiler.parser.PHPOutlineInfo; + +/** + * A new php parser. + * This php parser is inspired by the Java 1.2 grammar example + * given with JavaCC. You can get JavaCC at http://www.webgain.com + * You can test the parser with the PHPParserTestCase2.java + * @author Matthieu Casanova + */ +public class PHPParser extends PHPParserSuperclass { + + private static PHPParser me; + + private static IFile fileToParse; + + private static final String PARSE_ERROR_STRING = "Parse error"; //$NON-NLS-1$ + private static final String PARSE_WARNING_STRING = "Warning"; //$NON-NLS-1$ + public static final int ERROR = 2; + public static final int WARNING = 1; + public static final int INFO = 0; + PHPOutlineInfo outlineInfo; + private static int errorLevel = ERROR; + private static String errorMessage; + + public PHPParser() { + } + + public static PHPParser getInstance(IFile fileToParse) { + if (me == null) { + me = new PHPParser(fileToParse); + } else { + me.setFileToParse(fileToParse); + } + return me; + } + + public void setFileToParse(IFile fileToParse) { + this.fileToParse = fileToParse; + } + + public static PHPParser getInstance(java.io.Reader stream) { + if (me == null) { + me = new PHPParser(stream); + } else { + me.ReInit(stream); + } + return me; + } + + public PHPParser(IFile fileToParse) { + this(new StringReader("")); + this.fileToParse = fileToParse; + } + + public void phpParserTester(String strEval) throws CoreException, ParseException { + PHPParserTokenManager.SwitchTo(PHPParserTokenManager.PHPPARSING); + StringReader stream = new StringReader(strEval); + if (jj_input_stream == null) { + jj_input_stream = new SimpleCharStream(stream, 1, 1); + } + ReInit(new StringReader(strEval)); + phpTest(); + } + + public void htmlParserTester(String strEval) throws CoreException, ParseException { + StringReader stream = new StringReader(strEval); + if (jj_input_stream == null) { + jj_input_stream = new SimpleCharStream(stream, 1, 1); + } + ReInit(stream); + phpTest(); + } + + public PHPOutlineInfo parseInfo(Object parent, String s) { + outlineInfo = new PHPOutlineInfo(parent); + StringReader stream = new StringReader(s); + if (jj_input_stream == null) { + jj_input_stream = new SimpleCharStream(stream, 1, 1); + } + ReInit(stream); + try { + parse(); + } catch (ParseException e) { + if (errorMessage == null) { + PHPeclipsePlugin.log(e); + } else { + setMarker(errorMessage, e.currentToken.beginLine, errorLevel); + errorMessage = null; + } + } + return outlineInfo; + } + + + /** + * Create marker for the parse error + */ + private static void setMarker(String message, int lineNumber, int errorLevel) { + try { + setMarker(fileToParse, message, lineNumber, errorLevel); + } catch (CoreException e) { + PHPeclipsePlugin.log(e); + } + } + + public static void setMarker(IFile file, String message, int lineNumber, int errorLevel) throws CoreException { + if (file != null) { + Hashtable attributes = new Hashtable(); + MarkerUtilities.setMessage(attributes, message); + switch (errorLevel) { + case ERROR : + attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR)); + break; + case WARNING : + attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_WARNING)); + break; + case INFO : + attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO)); + break; + } + MarkerUtilities.setLineNumber(attributes, lineNumber); + MarkerUtilities.createMarker(file, attributes, IMarker.PROBLEM); + } + } + + /** + * Create markers according to the external parser output + */ + private static void createMarkers(String output, IFile file) throws CoreException { + // delete all markers + file.deleteMarkers(IMarker.PROBLEM, false, 0); + + int indx = 0; + int brIndx = 0; + boolean flag = true; + while ((brIndx = output.indexOf("
", indx)) != -1) { + // newer php error output (tested with 4.2.3) + scanLine(output, file, indx, brIndx); + indx = brIndx + 6; + flag = false; + } + if (flag) { + while ((brIndx = output.indexOf("
", indx)) != -1) { + // older php error output (tested with 4.2.3) + scanLine(output, file, indx, brIndx); + indx = brIndx + 4; + } + } + } + + private static void scanLine(String output, IFile file, int indx, int brIndx) throws CoreException { + String current; + StringBuffer lineNumberBuffer = new StringBuffer(10); + char ch; + current = output.substring(indx, brIndx); + + if (current.indexOf(PARSE_WARNING_STRING) != -1 || current.indexOf(PARSE_ERROR_STRING) != -1) { + int onLine = current.indexOf("on line "); + if (onLine != -1) { + lineNumberBuffer.delete(0, lineNumberBuffer.length()); + for (int i = onLine; i < current.length(); i++) { + ch = current.charAt(i); + if ('0' <= ch && '9' >= ch) { + lineNumberBuffer.append(ch); + } + } + + int lineNumber = Integer.parseInt(lineNumberBuffer.toString()); + + Hashtable attributes = new Hashtable(); + + current = current.replaceAll("\n", ""); + current = current.replaceAll("", ""); + current = current.replaceAll("", ""); + MarkerUtilities.setMessage(attributes, current); + + if (current.indexOf(PARSE_ERROR_STRING) != -1) + attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR)); + else if (current.indexOf(PARSE_WARNING_STRING) != -1) + attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_WARNING)); + else + attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO)); + MarkerUtilities.setLineNumber(attributes, lineNumber); + MarkerUtilities.createMarker(file, attributes, IMarker.PROBLEM); + } + } + } + + public void parse(String s) throws CoreException { + ReInit(new StringReader(s)); + try { + parse(); + } catch (ParseException e) { + PHPeclipsePlugin.log(e); + } + } + + /** + * Call the php parse command ( php -l -f <filename> ) + * and create markers according to the external parser output + */ + public static void phpExternalParse(IFile file) { + IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore(); + String filename = file.getLocation().toString(); + + String[] arguments = { filename }; + MessageFormat form = new MessageFormat(store.getString(PHPeclipsePlugin.EXTERNAL_PARSER_PREF)); + String command = form.format(arguments); + + String parserResult = PHPStartApacheAction.getParserOutput(command, "External parser: "); + + try { + // parse the buffer to find the errors and warnings + createMarkers(parserResult, file); + } catch (CoreException e) { + PHPeclipsePlugin.log(e); + } + } + + public void parse() throws ParseException { + phpFile(); + } +} + +PARSER_END(PHPParser) + + TOKEN : +{ + " SKIP : +{ + < ~[] > +} + + TOKEN : +{ + "?>" : DEFAULT +} + +/* WHITE SPACE */ + + SKIP : +{ + " " +| "\t" +| "\n" +| "\r" +| "\f" +} + +/* COMMENTS */ + + MORE : +{ + "//" : IN_SINGLE_LINE_COMMENT +| + <"/**" ~["/"]> { input_stream.backup(1); } : IN_FORMAL_COMMENT +| + "/*" : IN_MULTI_LINE_COMMENT +} + + +SPECIAL_TOKEN : +{ + " > : PHPPARSING +} + + +SPECIAL_TOKEN : +{ + : PHPPARSING +} + + +SPECIAL_TOKEN : +{ + : PHPPARSING +} + + +MORE : +{ + < ~[] > +} + +/* KEYWORDS */ + TOKEN : +{ + +| +| +| +| +| +| +} + +/* LANGUAGE CONSTRUCT */ + TOKEN : +{ + +| +| +| +| +| +| +| +| "> +| +| "> +} + +/* RESERVED WORDS AND LITERALS */ + + TOKEN : +{ + < BREAK: "break" > +| < CASE: "case" > +| < CONST: "const" > +| < CONTINUE: "continue" > +| < _DEFAULT: "default" > +| < DO: "do" > +| < EXTENDS: "extends" > +| < FALSE: "false" > +| < FOR: "for" > +| < GOTO: "goto" > +| < NEW: "new" > +| < NULL: "null" > +| < RETURN: "return" > +| < SUPER: "super" > +| < SWITCH: "switch" > +| < THIS: "this" > +| < TRUE: "true" > +| < WHILE: "while" > +| < ENDWHILE : "endwhile" > +} + +/* TYPES */ + + TOKEN : +{ + +| +| +| +| +| +| +| +| +} + + TOKEN : +{ + < _ORL : "OR" > +| < _ANDL: "AND"> +} + +/* LITERALS */ + + TOKEN : +{ + < INTEGER_LITERAL: + (["l","L"])? + | (["l","L"])? + | (["l","L"])? + > +| + < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > +| + < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > +| + < #OCTAL_LITERAL: "0" (["0"-"7"])* > +| + < FLOATING_POINT_LITERAL: + (["0"-"9"])+ "." (["0"-"9"])* ()? (["f","F","d","D"])? + | "." (["0"-"9"])+ ()? (["f","F","d","D"])? + | (["0"-"9"])+ (["f","F","d","D"])? + | (["0"-"9"])+ ()? ["f","F","d","D"] + > +| + < #EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > +| + < STRING_LITERAL: ( | | )> +| < STRING_1: + "\"" + ( (~["\""]) + | "\\\"" + )* + "\"" + > +| < STRING_2: + "'" + ( (~["'"]))* + + "'" + > +| < STRING_3: + "`" + ( (~["`"]))* + "`" + > +} + +/* IDENTIFIERS */ + + TOKEN : +{ + < IDENTIFIER: (|) (||)* > +| + < #LETTER: + ["a"-"z"] | ["A"-"Z"] + > +| + < #DIGIT: + ["0"-"9"] + > +| + < #SPECIAL: + "_" + > +} + +/* SEPARATORS */ + + TOKEN : +{ + < LPAREN: "(" > +| < RPAREN: ")" > +| < LBRACE: "{" > +| < RBRACE: "}" > +| < LBRACKET: "[" > +| < RBRACKET: "]" > +| < SEMICOLON: ";" > +| < COMMA: "," > +| < DOT: "." > +} + +/* OPERATORS */ + + TOKEN : +{ + +| +| < ASSIGN: "=" > +| < GT: ">" > +| < LT: "<" > +| < BANG: "!" > +| < HOOK: "?" > +| < COLON: ":" > +| < EQ: "==" > +| < LE: "<=" > +| < GE: ">=" > +| < NE: "!=" > +| < SC_OR: "||" > +| < SC_AND: "&&" > +| < INCR: "++" > +| < DECR: "--" > +| < PLUS: "+" > +| < MINUS: "-" > +| < STAR: "*" > +| < SLASH: "/" > +| < BIT_AND: "&" > +| < BIT_OR: "|" > +| < XOR: "^" > +| < REM: "%" > +| < LSHIFT: "<<" > +| < RSIGNEDSHIFT: ">>" > +| < RUNSIGNEDSHIFT: ">>>" > +| < PLUSASSIGN: "+=" > +| < MINUSASSIGN: "-=" > +| < STARASSIGN: "*=" > +| < SLASHASSIGN: "/=" > +| < ANDASSIGN: "&=" > +| < ORASSIGN: "|=" > +| < XORASSIGN: "^=" > +| < DOTASSIGN: ".=" > +| < REMASSIGN: "%=" > +| < LSHIFTASSIGN: "<<=" > +| < RSIGNEDSHIFTASSIGN: ">>=" > +| < RUNSIGNEDSHIFTASSIGN: ">>>=" > +} + + TOKEN : +{ + < DOLLAR_ID: > +} + +/***************************************** + * THE JAVA LANGUAGE GRAMMAR STARTS HERE * + *****************************************/ + +/* + * Program structuring syntax follows. + */ + +void phpTest() : +{} +{ + Php() + +} + +void phpFile() : +{} +{ + ("")* + +} + +void Php() : +{} +{ + (BlockStatement())* +} + +void ClassDeclaration() : +{} +{ + [ ] + ClassBody() +} + +void ClassBody() : +{} +{ + ( ClassBodyDeclaration() )* +} + +void ClassBodyDeclaration() : +{} +{ + MethodDeclaration() +| + FieldDeclaration() +} + +void FieldDeclaration() : +{} +{ + VariableDeclarator() ( VariableDeclarator() )* +} + +void VariableDeclarator() : +{} +{ + VariableDeclaratorId() [ VariableInitializer() ] +} + +void VariableDeclaratorId() : +{} +{ + Variable() ( LOOKAHEAD(2) VariableSuffix() )* +} + +void Variable(): +{} +{ + ( Expression() ) * +| + VariableName() +} + +void VariableName(): +{} +{ + Expression() +| + ( Expression() ) * +| + VariableName() +} + +void VariableInitializer() : +{} +{ + Expression() +} + +void ArrayVariable() : +{} +{ + Expression() ( Expression())* +} + +void ArrayInitializer() : +{} +{ + [ ArrayVariable() ( LOOKAHEAD(2) ArrayVariable() )* ] +} + +void MethodDeclaration() : +{} +{ + MethodDeclarator() + ( Block() | ) +} + +void MethodDeclarator() : +{} +{ + [] FormalParameters() +} + +void FormalParameters() : +{} +{ + [ FormalParameter() ( FormalParameter() )* ] +} + +void FormalParameter() : +{} +{ + [] VariableDeclarator() +} + +void Type() : +{} +{ + +| + +| + +| + +| + +| + +| + +| + +} + +/* + * Expression syntax follows. + */ + +void Expression() : +/* + * This expansion has been written this way instead of: + * Assignment() | ConditionalExpression() + * for performance reasons. + * However, it is a weakening of the grammar for it allows the LHS of + * assignments to be any conditional expression whereas it can only be + * a primary expression. Consider adding a semantic predicate to work + * around this. + */ +{} +{ + PrintExpression() +| + ConditionalExpression() + [ + AssignmentOperator() Expression() + ] +} + +void AssignmentOperator() : +{} +{ + | | | | | | | | | | | | +} + +void ConditionalExpression() : +{} +{ + ConditionalOrExpression() [ Expression() ConditionalExpression() ] +} + +void ConditionalOrExpression() : +{} +{ + ConditionalAndExpression() ( ( | <_ORL>) ConditionalAndExpression() )* +} + +void ConditionalAndExpression() : +{} +{ + ConcatExpression() ( ( | <_ANDL>) ConcatExpression() )* +} + +void ConcatExpression() : +{} +{ + InclusiveOrExpression() ( InclusiveOrExpression() )* +} + +void InclusiveOrExpression() : +{} +{ + ExclusiveOrExpression() ( ExclusiveOrExpression() )* +} + +void ExclusiveOrExpression() : +{} +{ + AndExpression() ( AndExpression() )* +} + +void AndExpression() : +{} +{ + EqualityExpression() ( EqualityExpression() )* +} + +void EqualityExpression() : +{} +{ + RelationalExpression() ( ( | ) RelationalExpression() )* +} + +void RelationalExpression() : +{} +{ + ShiftExpression() ( ( | | | ) ShiftExpression() )* +} + +void ShiftExpression() : +{} +{ + AdditiveExpression() ( ( | | ) AdditiveExpression() )* +} + +void AdditiveExpression() : +{} +{ + MultiplicativeExpression() ( ( | ) MultiplicativeExpression() )* +} + +void MultiplicativeExpression() : +{} +{ + UnaryExpression() ( ( | | ) UnaryExpression() )* +} + +void UnaryExpression() : +{} +{ + UnaryExpression() +| + ( | ) UnaryExpression() +| + PreIncrementExpression() +| + PreDecrementExpression() +| + UnaryExpressionNotPlusMinus() +} + +void PreIncrementExpression() : +{} +{ + PrimaryExpression() +} + +void PreDecrementExpression() : +{} +{ + PrimaryExpression() +} + +void UnaryExpressionNotPlusMinus() : +{} +{ + UnaryExpression() +| + LOOKAHEAD( Type() ) + CastExpression() +| + PostfixExpression() +| + Literal() +| + Expression() +} + +void CastExpression() : +{} +{ + Type() UnaryExpression() +} + +void PostfixExpression() : +{} +{ + PrimaryExpression() [ | ] +} + +void PrimaryExpression() : +{} +{ + LOOKAHEAD(2) + ClassIdentifier() (PrimarySuffix())* +| + PrimaryPrefix() ( PrimarySuffix() )* +| + ArrayInitializer() +} + +void PrimaryPrefix() : +{} +{ + +| + ClassIdentifier() +| + VariableDeclaratorId() +} + +void ClassIdentifier(): +{} +{ + +| + VariableDeclaratorId() +} + +void PrimarySuffix() : +{} +{ + Arguments() +| + VariableSuffix() +} + +void VariableSuffix() : +{} +{ + VariableName() +| + [ Expression() ] +} + +void Literal() : +{} +{ + +| + +| + +| + BooleanLiteral() +| + NullLiteral() +} + +void BooleanLiteral() : +{} +{ + +| + +} + +void NullLiteral() : +{} +{ + +} + +void Arguments() : +{} +{ + [ ArgumentList() ] +} + +void ArgumentList() : +{} +{ + Expression() ( Expression() )* +} + +/* + * Statement syntax follows. + */ + +void Statement() : +{} +{ + LOOKAHEAD(2) + Expression() ( | "?>") +| + LOOKAHEAD(2) + LabeledStatement() +| + Block() +| + EmptyStatement() +| + StatementExpression() + try { + + } catch (ParseException e) { + errorMessage = "';' expected after expression"; + errorLevel = ERROR; + throw e; + } +| + SwitchStatement() +| + IfStatement() +| + WhileStatement() +| + DoStatement() +| + ForStatement() +| + BreakStatement() +| + ContinueStatement() +| + ReturnStatement() +| + EchoStatement() +| + IncludeStatement() +| + StaticStatement() +| + GlobalStatement() +} + +void IncludeStatement() : +{} +{ + Expression() ( | "?>") +| + Expression() ( | "?>") +| + Expression() ( | "?>") +| + Expression() ( | "?>") +} + +void PrintExpression() : +{} +{ + Expression() +} + +void EchoStatement() : +{} +{ + Expression() ( Expression())* + try { + ( | "?>") + } catch (ParseException e) { + errorMessage = "';' expected after 'echo' statement"; + errorLevel = ERROR; + throw e; + } +} + +void GlobalStatement() : +{} +{ + VariableDeclaratorId() ( VariableDeclaratorId())* ( | "?>") +} + +void StaticStatement() : +{} +{ + VariableDeclarator() ( VariableDeclarator())* ( | "?>") +} + +void LabeledStatement() : +{} +{ + Statement() +} + +void Block() : +{} +{ + ( BlockStatement() )* +} + +void BlockStatement() : +{} +{ + Statement() +| + ClassDeclaration() +| + MethodDeclaration() +} + +void LocalVariableDeclaration() : +{} +{ + VariableDeclarator() ( VariableDeclarator() )* +} + +void EmptyStatement() : +{} +{ + +} + +void StatementExpression() : +/* + * The last expansion of this production accepts more than the legal + * Java expansions for StatementExpression. This expansion does not + * use PostfixExpression for performance reasons. + */ +{} +{ + PreIncrementExpression() +| + PreDecrementExpression() +| + PrimaryExpression() + [ + + | + + | + AssignmentOperator() Expression() + ] +} + +void SwitchStatement() : +{} +{ + Expression() + ( SwitchLabel() ( BlockStatement() )* )* + +} + +void SwitchLabel() : +{} +{ + Expression() +| + <_DEFAULT> +} + +void IfStatement() : +/* + * The disambiguating algorithm of JavaCC automatically binds dangling + * else's to the innermost if statement. The LOOKAHEAD specification + * is to tell JavaCC that we know what we are doing. + */ +{} +{ + Condition("if") Statement() [ LOOKAHEAD(1) ElseIfStatement() ] [ LOOKAHEAD(1) Statement() ] +} + +void Condition(String keyword) : +{} +{ + try { + + } catch (ParseException e) { + errorMessage = "'(' expected after " + keyword + " keyword"; + errorLevel = ERROR; + throw e; + } + Expression() + try { + + } catch (ParseException e) { + errorMessage = "')' expected after " + keyword + " keyword"; + errorLevel = ERROR; + throw e; + } +} + +void ElseIfStatement() : +{} +{ + Condition("elseif") Statement() +} + +void WhileStatement() : +{} +{ + Condition("while") WhileStatement0() +} + +void WhileStatement0() : +{} +{ + (Statement())* ( | "?>") +| + Statement() +} + +void DoStatement() : +{} +{ + Statement() Condition("while") ( | "?>") +} + +void ForStatement() : +{} +{ + [ ForInit() ] [ Expression() ] [ ForUpdate() ] Statement() +} + +void ForInit() : +{} +{ + LOOKAHEAD(LocalVariableDeclaration()) + LocalVariableDeclaration() +| + StatementExpressionList() +} + +void StatementExpressionList() : +{} +{ + StatementExpression() ( StatementExpression() )* +} + +void ForUpdate() : +{} +{ + StatementExpressionList() +} + +void BreakStatement() : +{} +{ + [ ] +} + +void ContinueStatement() : +{} +{ + [ ] +} + +void ReturnStatement() : +{} +{ + [ Expression() ] +} \ No newline at end of file diff --git a/net.sourceforge.phpeclipse/src/test/PHPParserConstants.java b/net.sourceforge.phpeclipse/src/test/PHPParserConstants.java new file mode 100644 index 0000000..333d9da --- /dev/null +++ b/net.sourceforge.phpeclipse/src/test/PHPParserConstants.java @@ -0,0 +1,260 @@ +/* Generated By:JavaCC: Do not edit this line. PHPParserConstants.java */ +package test; + +public interface PHPParserConstants { + + int EOF = 0; + int SINGLE_LINE_COMMENT = 13; + int FORMAL_COMMENT = 14; + int MULTI_LINE_COMMENT = 15; + int CLASS = 17; + int FUNCTION = 18; + int VAR = 19; + int IF = 20; + int ELSEIF = 21; + int ELSE = 22; + int ARRAY = 23; + int PRINT = 24; + int ECHO = 25; + int INCLUDE = 26; + int REQUIRE = 27; + int INCLUDE_ONCE = 28; + int REQUIRE_ONCE = 29; + int GLOBAL = 30; + int STATIC = 31; + int CLASSACCESS = 32; + int STATICCLASSACCESS = 33; + int ARRAYASSIGN = 34; + int BREAK = 35; + int CASE = 36; + int CONST = 37; + int CONTINUE = 38; + int _DEFAULT = 39; + int DO = 40; + int EXTENDS = 41; + int FALSE = 42; + int FOR = 43; + int GOTO = 44; + int NEW = 45; + int NULL = 46; + int RETURN = 47; + int SUPER = 48; + int SWITCH = 49; + int THIS = 50; + int TRUE = 51; + int WHILE = 52; + int ENDWHILE = 53; + int STRING = 54; + int OBJECT = 55; + int BOOL = 56; + int BOOLEAN = 57; + int REAL = 58; + int DOUBLE = 59; + int FLOAT = 60; + int INT = 61; + int INTEGER = 62; + int _ORL = 63; + int _ANDL = 64; + int INTEGER_LITERAL = 65; + int DECIMAL_LITERAL = 66; + int HEX_LITERAL = 67; + int OCTAL_LITERAL = 68; + int FLOATING_POINT_LITERAL = 69; + int EXPONENT = 70; + int STRING_LITERAL = 71; + int STRING_1 = 72; + int STRING_2 = 73; + int STRING_3 = 74; + int IDENTIFIER = 75; + int LETTER = 76; + int DIGIT = 77; + int SPECIAL = 78; + int LPAREN = 79; + int RPAREN = 80; + int LBRACE = 81; + int RBRACE = 82; + int LBRACKET = 83; + int RBRACKET = 84; + int SEMICOLON = 85; + int COMMA = 86; + int DOT = 87; + int AT = 88; + int DOLLAR = 89; + int ASSIGN = 90; + int GT = 91; + int LT = 92; + int BANG = 93; + int HOOK = 94; + int COLON = 95; + int EQ = 96; + int LE = 97; + int GE = 98; + int NE = 99; + int SC_OR = 100; + int SC_AND = 101; + int INCR = 102; + int DECR = 103; + int PLUS = 104; + int MINUS = 105; + int STAR = 106; + int SLASH = 107; + int BIT_AND = 108; + int BIT_OR = 109; + int XOR = 110; + int REM = 111; + int LSHIFT = 112; + int RSIGNEDSHIFT = 113; + int RUNSIGNEDSHIFT = 114; + int PLUSASSIGN = 115; + int MINUSASSIGN = 116; + int STARASSIGN = 117; + int SLASHASSIGN = 118; + int ANDASSIGN = 119; + int ORASSIGN = 120; + int XORASSIGN = 121; + int DOTASSIGN = 122; + int REMASSIGN = 123; + int LSHIFTASSIGN = 124; + int RSIGNEDSHIFTASSIGN = 125; + int RUNSIGNEDSHIFTASSIGN = 126; + int DOLLAR_ID = 127; + + int DEFAULT = 0; + int PHPPARSING = 1; + int IN_SINGLE_LINE_COMMENT = 2; + int IN_FORMAL_COMMENT = 3; + int IN_MULTI_LINE_COMMENT = 4; + + String[] tokenImage = { + "", + "\"", + "\"?>\"", + "\" \"", + "\"\\t\"", + "\"\\n\"", + "\"\\r\"", + "\"\\f\"", + "\"//\"", + "", + "\"/*\"", + "", + "\"*/\"", + "\"*/\"", + "", + "\"class\"", + "\"function\"", + "\"var\"", + "\"if\"", + "\"elseif\"", + "\"else\"", + "\"array\"", + "\"print\"", + "\"echo\"", + "\"include\"", + "\"require\"", + "\"include_once\"", + "\"require_once\"", + "\"global\"", + "\"static\"", + "\"->\"", + "\"::\"", + "\"=>\"", + "\"break\"", + "\"case\"", + "\"const\"", + "\"continue\"", + "\"default\"", + "\"do\"", + "\"extends\"", + "\"false\"", + "\"for\"", + "\"goto\"", + "\"new\"", + "\"null\"", + "\"return\"", + "\"super\"", + "\"switch\"", + "\"this\"", + "\"true\"", + "\"while\"", + "\"endwhile\"", + "\"string\"", + "\"object\"", + "\"bool\"", + "\"boolean\"", + "\"real\"", + "\"double\"", + "\"float\"", + "\"int\"", + "\"integer\"", + "\"OR\"", + "\"AND\"", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "\"_\"", + "\"(\"", + "\")\"", + "\"{\"", + "\"}\"", + "\"[\"", + "\"]\"", + "\";\"", + "\",\"", + "\".\"", + "\"@\"", + "\"$\"", + "\"=\"", + "\">\"", + "\"<\"", + "\"!\"", + "\"?\"", + "\":\"", + "\"==\"", + "\"<=\"", + "\">=\"", + "\"!=\"", + "\"||\"", + "\"&&\"", + "\"++\"", + "\"--\"", + "\"+\"", + "\"-\"", + "\"*\"", + "\"/\"", + "\"&\"", + "\"|\"", + "\"^\"", + "\"%\"", + "\"<<\"", + "\">>\"", + "\">>>\"", + "\"+=\"", + "\"-=\"", + "\"*=\"", + "\"/=\"", + "\"&=\"", + "\"|=\"", + "\"^=\"", + "\".=\"", + "\"%=\"", + "\"<<=\"", + "\">>=\"", + "\">>>=\"", + "", + "\"?>\"", + }; + +} diff --git a/net.sourceforge.phpeclipse/src/test/PHPParserManager.java b/net.sourceforge.phpeclipse/src/test/PHPParserManager.java new file mode 100644 index 0000000..e958ec6 --- /dev/null +++ b/net.sourceforge.phpeclipse/src/test/PHPParserManager.java @@ -0,0 +1,60 @@ +package test; + +import net.sourceforge.phpeclipse.PHPeclipsePlugin; +import org.eclipse.core.resources.IFile; + +public class PHPParserManager { + + private static PHPParserSuperclass parser; + + public static PHPParserSuperclass getParser(IFile fileToParse) { + try { + PHPParserSuperclass actualParser; + if (PHPeclipsePlugin.PHPPARSER == PHPeclipsePlugin.PHPPARSER_ORIGINAL) { + actualParser = (PHPParserSuperclass) Class.forName(PHPeclipsePlugin.PHPPARSER).newInstance(); + } else { + if (parser == null) { + parser = (PHPParserSuperclass) Class.forName(PHPeclipsePlugin.PHPPARSER).newInstance(); + } + actualParser = parser; + } + actualParser.setFileToParse(fileToParse); + return actualParser; + } catch (InstantiationException e) { + PHPeclipsePlugin.log(e); + } catch (IllegalAccessException e) { + PHPeclipsePlugin.log(e); + } catch (ClassNotFoundException e) { + PHPeclipsePlugin.log(e); + } + return null; + } + + public static PHPParserSuperclass getParser() { + try { + PHPParserSuperclass actualParser; + if (PHPeclipsePlugin.PHPPARSER == PHPeclipsePlugin.PHPPARSER_ORIGINAL) { + actualParser = (PHPParserSuperclass) Class.forName(PHPeclipsePlugin.PHPPARSER).newInstance(); + } else { + if (parser == null) { + parser = (PHPParserSuperclass) Class.forName(PHPeclipsePlugin.PHPPARSER).newInstance(); + } + actualParser = parser; + } + return actualParser; + } catch (InstantiationException e) { + PHPeclipsePlugin.log(e); + } catch (IllegalAccessException e) { + PHPeclipsePlugin.log(e); + } catch (ClassNotFoundException e) { + PHPeclipsePlugin.log(e); + } + return null; + } + + /** + * To avoid instantiation. + */ + private PHPParserManager() { + } +} diff --git a/net.sourceforge.phpeclipse/src/test/PHPParserSuperclass.java b/net.sourceforge.phpeclipse/src/test/PHPParserSuperclass.java new file mode 100644 index 0000000..78ae010 --- /dev/null +++ b/net.sourceforge.phpeclipse/src/test/PHPParserSuperclass.java @@ -0,0 +1,124 @@ +package test; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.ui.texteditor.MarkerUtilities; +import net.sourceforge.phpeclipse.PHPeclipsePlugin; +import net.sourceforge.phpeclipse.actions.PHPStartApacheAction; +import net.sourceforge.phpdt.internal.compiler.parser.PHPOutlineInfo; + +import java.text.MessageFormat; +import java.util.Hashtable; + +/** + * The superclass for our PHP parsers. + * @author Matthieu Casanova + */ +public abstract class PHPParserSuperclass { + // strings for external parser call + private static final String PARSE_ERROR_STRING = "Parse error"; //$NON-NLS-1$ + private static final String PARSE_WARNING_STRING = "Warning"; //$NON-NLS-1$ + + /** + * Call the php parse command ( php -l -f <filename> ) + * and create markers according to the external parser output + */ + public static void phpExternalParse(IFile file) { + //IFile file = (IFile) resource; + IPath path = file.getFullPath(); + IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore(); + String filename = file.getLocation().toString(); + + String[] arguments = { filename }; + MessageFormat form = + new MessageFormat(store.getString(PHPeclipsePlugin.EXTERNAL_PARSER_PREF)); + String command = form.format(arguments); + + String parserResult = + PHPStartApacheAction.getParserOutput(command, "External parser: "); + + try { + // parse the buffer to find the errors and warnings + PHPParserSuperclass.createMarkers(parserResult, file); + } catch (CoreException e) { + } + } + + /** + * Create markers according to the external parser output + */ + private static void createMarkers(String output, IFile file) + throws CoreException { + // delete all markers + file.deleteMarkers(IMarker.PROBLEM, false, 0); + + int indx = 0; + int brIndx = 0; + boolean flag = true; + while ((brIndx = output.indexOf("
", indx)) != -1) { + // newer php error output (tested with 4.2.3) + scanLine(output, file, indx, brIndx); + indx = brIndx + 6; + flag = false; + } + if (flag) { + while ((brIndx = output.indexOf("
", indx)) != -1) { + // older php error output (tested with 4.2.3) + scanLine(output, file, indx, brIndx); + indx = brIndx + 4; + } + } + } + + private static void scanLine(String output, IFile file, int indx, int brIndx) + throws CoreException { + String current; + String outLineNumberString; + StringBuffer lineNumberBuffer = new StringBuffer(10); + char ch; + current = output.substring(indx, brIndx); + + if (current.indexOf(PARSE_WARNING_STRING) != -1 + || current.indexOf(PARSE_ERROR_STRING) != -1) { + int onLine = current.indexOf("on line "); + if (onLine != -1) { + lineNumberBuffer.delete(0, lineNumberBuffer.length()); + for (int i = onLine; i < current.length(); i++) { + ch = current.charAt(i); + if ('0' <= ch && '9' >= ch) { + lineNumberBuffer.append(ch); + } + } + + int lineNumber = Integer.parseInt(lineNumberBuffer.toString()); + + Hashtable attributes = new Hashtable(); + + current = current.replaceAll("\n", ""); + current = current.replaceAll("", ""); + current = current.replaceAll("", ""); + MarkerUtilities.setMessage(attributes, current); + + if (current.indexOf(PARSE_ERROR_STRING) != -1) + attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_ERROR)); + else if (current.indexOf(PARSE_WARNING_STRING) != -1) + attributes.put( + IMarker.SEVERITY, + new Integer(IMarker.SEVERITY_WARNING)); + else + attributes.put(IMarker.SEVERITY, new Integer(IMarker.SEVERITY_INFO)); + MarkerUtilities.setLineNumber(attributes, lineNumber); + MarkerUtilities.createMarker(file, attributes, IMarker.PROBLEM); + } + } + } + + public abstract PHPOutlineInfo parseInfo(Object parent, String s); + + public abstract void setFileToParse(IFile fileToParse); + + public abstract void parse(String s) throws CoreException; +} diff --git a/net.sourceforge.phpeclipse/src/test/PHPParserTestCase2.java b/net.sourceforge.phpeclipse/src/test/PHPParserTestCase2.java index 72fe1ff..6d0457d 100644 --- a/net.sourceforge.phpeclipse/src/test/PHPParserTestCase2.java +++ b/net.sourceforge.phpeclipse/src/test/PHPParserTestCase2.java @@ -1,27 +1,25 @@ package test; - /********************************************************************** - Copyright (c) 2002 Klaus Hartlage - www.eclipseproject.de - All rights reserved. This program and the accompanying materials - are made available under the terms of the Common Public License v1.0 - which accompanies this distribution, and is available at - http://www.eclipse.org/legal/cpl-v10.html - **********************************************************************/ +Copyright (c) 2002 Klaus Hartlage - www.eclipseproject.de +All rights reserved. This program and the accompanying materials +are made available under the terms of the Common Public License v1.0 +which accompanies this distribution, and is available at +http://www.eclipse.org/legal/cpl-v10.html +**********************************************************************/ + +import org.eclipse.core.runtime.CoreException; import junit.framework.TestCase; import java.io.CharArrayReader; -import java.io.InputStream; - -import org.eclipse.core.runtime.CoreException; /** * Tests the php parser */ public class PHPParserTestCase2 extends TestCase { - PHPParser2 phpparser; + PHPParser parser; public PHPParserTestCase2(String name) { super(name); @@ -31,32 +29,67 @@ public class PHPParserTestCase2 extends TestCase { * Test the PHP Parser with different PHP snippets */ public void testPHPParser() { - checkPHP("$b = $c;"); - checkPHP("$b = ($c);"); - checkPHP("$b = ($b) ? $a : $c;"); - checkPHP("$b = $b.$a && $f.'a' || 'n '.$b;"); - checkPHP("$toto = 0;"); - checkPHP("$toto = \"tata\";"); - checkPHP("$toto = 'tata';"); - checkPHP("$$a = 'toto';"); - checkPHP("$add = 'a'.$i;"); - checkPHP("$add = 'a'.$i;$val = $$add;"); - checkPHP("$a==2;"); - checkPHP("($a==\"b\") || c($this->x)==\"d\";"); + checkHTML("tabAffich['oModeCentral']=$oModeCentral;" + + "\nob_start('ob_gzhandler');" + + "\necho $Atreides->vueMetier('visu',$AtreidesTheme);" + + "\n?>"); + checkHTML("sdfsdf "); + checkHTML("\n\n\n\n "); + checkHTML(""); + checkHTML(" foo "); + checkHTML(" "); + checkPHP("'caca'"); + checkPHP("if $cac a) echo 'coucou';"); + checkPHP("$oka dd = 'a'.$i;$val = $$add;"); + checkPHP("($a==\"b\") || (c($this->x)==\"d\");"); checkPHP("(substr($this->file, 0, 2) == \"MM\");"); checkPHP("(substr($this->file, 0, 2) == \"MM\") || substr($this->file, 0, 2) == \"II\";"); checkPHP("return (substr($this->file, 0, 2) == \"MM\") || substr($this->file, 0, 2) == \"II\";"); + checkPHP("$this->highlightfile->linkscripts{$category};"); + checkPHP("$code = call_user_method($this->highlightfile->linkscripts{$category}, $this->highlightfile, $oldword, $this->output_module);"); checkPHP("$this->startmap[$startcurrtag]();"); checkPHP("new $this->startmap[$startcurrtag]();"); checkPHP("$this->highlightfile = new $this->startmap[$startcurrtag]();"); checkPHP("echo \"Test\", \"me\";"); checkPHP("print (\"Test me\");"); -// checkPHP("$s = <<blockvariables[$block][$varname]);"); checkPHP("new IT_Error(\"The block '$block' was not found in the template.\", __FILE__, __LINE__);"); @@ -73,6 +106,8 @@ public class PHPParserTestCase2 extends TestCase { checkPHP("if (isset($test)) { } elseif (isset($lang)) { }"); checkPHP("require_once(\"mainfile.php\"); "); checkPHP("if (eregi(\"footer.php\",$PHP_SELF)) {\n" + "Header(\"Location: index.php\");\n" + "die();\n" + "}\n"); + checkPHP("while (eregi(\"footer.php\",$PHP_SELF)) {\n" + "Header(\"Location: index.php\");\n" + "die();\n" + "}\n"); + checkPHP("while (eregi(\"footer.php\",$PHP_SELF)) :\n" + "Header(\"Location: index.php\");\n" + "die();\n" + "endwhile;\n"); checkPHP("$tipath = \"images/topics/\";"); checkPHP("$reasons = array(\"1\", \"2\",\"test\");"); checkPHP("if ($home == 1) { message_box(); blocks(Center);}"); @@ -87,47 +122,54 @@ public class PHPParserTestCase2 extends TestCase { checkPHP("$message .= \"\"._THISISAUTOMATED.\"\\n\\n\";"); checkPHP("if (!empty($pass) AND $pass==$passwd) { }"); checkPHP("$AllowableHTML = array(\"b\"=>1,\n \"i\"=>1);"); + checkPHP("if ($term{0}!=$firstChar) {}"); checkPHP( "echo \"
\"._NOADMINYET.\"


\"\n" + ".\"
\"\n" + ".\"\"._NICKNAME.\":\"\n" + ";"); - checkPHP("/* \n overLib is from Eric Bosrup (http://www.bosrup.com/web/overlib/) \n */"); + checkPHP("/* \n overLib is from Eric Bosrup (http://www.bosrup.com/web/overlib/) \n */;"); checkPHP("if ($arrAtchCookie[1]==0 && $IdAtchPostId!=null){ } "); checkPHP("$arrAtchCookie[1] -= filesize(realpath($AtchTempDir).\"/\".$xattachlist)/ 1024; "); - checkPHP("$ol = new Overlib();"); - checkPHP("$risultato = mysql_query($sql) or\n die(mysql_error());"); checkPHP( "if (!isset($message)){ \n" + "$message = $myrow[post_text];\n" + "$message = eregi_replace(\"\\[addsig]\", \"\\n-----------------\\n\" . $myrow[user_sig], $message); \n" + "$message = str_replace(\"
\", \"\\n\", $message); \n" + "$message = str_replace(\"
\", \"\\n\", $message); \n } "); - checkPHP("while (eregi(\"footer.php\",$PHP_SELF)) {\n" + "Header(\"Location: index.php\");\n" + "die();\n" + "}\n"); - checkPHP("while (eregi(\"footer.php\",$PHP_SELF)) :\n" + "Header(\"Location: index.php\");\n" + "die();\n" + "endwhile;\n"); - checkPHP("if ($term{0}!=$firstChar) {}"); - checkPHP("$this->highlightfile->linkscripts{$category};"); - checkPHP("$code = call_user_method($this->highlightfile->linkscripts{$category}, $this->highlightfile, $oldword, $this->output_module);"); - checkPHP("call_user_method_array($function_name[1], ${$objectname}, $arguments);"); - checkPHP("global ${$objectname};"); checkPHP("do {$array[] = array(\"$myrow[uid]\" => \"$myrow[uname]\"); } while($myrow = mysql_fetch_array($result));"); + checkPHP("$ol = new Overlib();"); + checkPHP("$risultato = mysql_query($sql) or\n die(mysql_error());"); } private void checkPHP(String strEval) { try { System.out.println("strEval = " + strEval); - phpparser.ReInit(new CharArrayReader(strEval.toCharArray())); - phpparser.parse(); + parser.phpParserTester(strEval); + } catch (CoreException e) { + e.printStackTrace(); + } catch (ParseException e) { + e.printStackTrace(); + } + + } + private void checkHTML(String strEval) { + try { + System.out.println("strEval = " + strEval); + parser.htmlParserTester(strEval); + } catch (CoreException e) { + e.printStackTrace(); } catch (ParseException e) { - System.out.println(strEval); e.printStackTrace(); } + } /** * The JUnit setup method */ protected void setUp() { - phpparser = new PHPParser2(new CharArrayReader("".toCharArray())); + parser = (test.PHPParser) PHPParserManager.getParser(); } + } diff --git a/net.sourceforge.phpeclipse/src/test/PHPParserTokenManager.java b/net.sourceforge.phpeclipse/src/test/PHPParserTokenManager.java new file mode 100644 index 0000000..7ca8f10 --- /dev/null +++ b/net.sourceforge.phpeclipse/src/test/PHPParserTokenManager.java @@ -0,0 +1,1881 @@ +/* Generated By:JavaCC: Do not edit this line. PHPParserTokenManager.java */ +package test; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.ui.texteditor.MarkerUtilities; +import org.eclipse.jface.preference.IPreferenceStore; +import java.io.CharArrayReader; +import java.util.Hashtable; +import java.io.StringReader; +import java.text.MessageFormat; +import net.sourceforge.phpeclipse.actions.PHPStartApacheAction; +import net.sourceforge.phpeclipse.PHPeclipsePlugin; +import net.sourceforge.phpdt.internal.compiler.parser.PHPOutlineInfo; + +public class PHPParserTokenManager implements PHPParserConstants +{ + public static java.io.PrintStream debugStream = System.out; + public static void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } +static private final int jjStopAtPos(int pos, int kind) +{ + jjmatchedKind = kind; + jjmatchedPos = pos; + return pos + 1; +} +static private final int jjMoveStringLiteralDfa0_0() +{ + switch(curChar) + { + case 60: + return jjMoveStringLiteralDfa1_0(0x6L, 0x0L); + case 63: + return jjMoveStringLiteralDfa1_0(0x0L, 0x1L); + default : + return 1; + } +} +static private final int jjMoveStringLiteralDfa1_0(long active0, long active2) +{ + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return 1; + } + switch(curChar) + { + case 62: + if ((active2 & 0x1L) != 0L) + return jjStopAtPos(1, 128); + break; + case 63: + if ((active0 & 0x4L) != 0L) + { + jjmatchedKind = 2; + jjmatchedPos = 1; + } + return jjMoveStringLiteralDfa2_0(active0, 0x2L, active2, 0L); + default : + return 2; + } + return 2; +} +static private final int jjMoveStringLiteralDfa2_0(long old0, long active0, long old2, long active2) +{ + if (((active0 &= old0) | (active2 &= old2)) == 0L) + return 2; + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return 2; + } + switch(curChar) + { + case 80: + case 112: + return jjMoveStringLiteralDfa3_0(active0, 0x2L); + default : + return 3; + } +} +static private final int jjMoveStringLiteralDfa3_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return 3; + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return 3; + } + switch(curChar) + { + case 72: + case 104: + return jjMoveStringLiteralDfa4_0(active0, 0x2L); + default : + return 4; + } +} +static private final int jjMoveStringLiteralDfa4_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return 4; + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return 4; + } + switch(curChar) + { + case 80: + case 112: + if ((active0 & 0x2L) != 0L) + return jjStopAtPos(4, 1); + break; + default : + return 5; + } + return 5; +} +static private final int jjMoveStringLiteralDfa0_4() +{ + switch(curChar) + { + case 42: + return jjMoveStringLiteralDfa1_4(0x8000L); + default : + return 1; + } +} +static private final int jjMoveStringLiteralDfa1_4(long active0) +{ + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return 1; + } + switch(curChar) + { + case 47: + if ((active0 & 0x8000L) != 0L) + return jjStopAtPos(1, 15); + break; + default : + return 2; + } + return 2; +} +static private final int jjMoveStringLiteralDfa0_2() +{ + return jjMoveNfa_2(0, 0); +} +static private final void jjCheckNAdd(int state) +{ + if (jjrounds[state] != jjround) + { + jjstateSet[jjnewStateCnt++] = state; + jjrounds[state] = jjround; + } +} +static private final void jjAddStates(int start, int end) +{ + do { + jjstateSet[jjnewStateCnt++] = jjnextStates[start]; + } while (start++ != end); +} +static private final void jjCheckNAddTwoStates(int state1, int state2) +{ + jjCheckNAdd(state1); + jjCheckNAdd(state2); +} +static private final void jjCheckNAddStates(int start, int end) +{ + do { + jjCheckNAdd(jjnextStates[start]); + } while (start++ != end); +} +static private final void jjCheckNAddStates(int start) +{ + jjCheckNAdd(jjnextStates[start]); + jjCheckNAdd(jjnextStates[start + 1]); +} +static private final int jjMoveNfa_2(int startState, int curPos) +{ + int[] nextStates; + int startsAt = 0; + jjnewStateCnt = 5; + int i = 1; + jjstateSet[0] = startState; + int j, kind = 0x7fffffff; + for (;;) + { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) + { + long l = 1L << curChar; + MatchLoop: do + { + switch(jjstateSet[--i]) + { + case 0: + if ((0x2400L & l) != 0L) + { + if (kind > 13) + kind = 13; + } + else if (curChar == 63) + jjstateSet[jjnewStateCnt++] = 3; + if (curChar == 13) + jjstateSet[jjnewStateCnt++] = 1; + break; + case 1: + if (curChar == 10 && kind > 13) + kind = 13; + break; + case 2: + if (curChar == 13) + jjstateSet[jjnewStateCnt++] = 1; + break; + case 3: + if (curChar == 62) + kind = 13; + break; + case 4: + if (curChar == 63) + jjstateSet[jjnewStateCnt++] = 3; + break; + default : break; + } + } while(i != startsAt); + } + else if (curChar < 128) + { + long l = 1L << (curChar & 077); + MatchLoop: do + { + switch(jjstateSet[--i]) + { + default : break; + } + } while(i != startsAt); + } + else + { + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + MatchLoop: do + { + switch(jjstateSet[--i]) + { + default : break; + } + } while(i != startsAt); + } + if (kind != 0x7fffffff) + { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 5 - (jjnewStateCnt = startsAt))) + return curPos; + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { return curPos; } + } +} +private static final int jjStopStringLiteralDfa_1(int pos, long active0, long active1) +{ + switch (pos) + { + case 0: + if ((active0 & 0xfffffff8fffe0000L) != 0L || (active1 & 0x1L) != 0L) + { + jjmatchedKind = 75; + return 14; + } + if ((active0 & 0x1400L) != 0L || (active1 & 0x40080000000000L) != 0L) + return 2; + if ((active1 & 0x2000000L) != 0L) + return 16; + if ((active1 & 0x400000000800000L) != 0L) + return 8; + return -1; + case 1: + if ((active0 & 0x1000L) != 0L) + return 0; + if ((active0 & 0x8800010000100000L) != 0L) + return 14; + if ((active0 & 0x77fffef8ffee0000L) != 0L || (active1 & 0x1L) != 0L) + { + if (jjmatchedPos != 1) + { + jjmatchedKind = 75; + jjmatchedPos = 1; + } + return 14; + } + return -1; + case 2: + if ((active0 & 0x6000280000080000L) != 0L || (active1 & 0x1L) != 0L) + return 14; + if ((active0 & 0x1fffd6f8ffe60000L) != 0L) + { + if (jjmatchedPos != 2) + { + jjmatchedKind = 75; + jjmatchedPos = 2; + } + return 14; + } + return -1; + case 3: + if ((active0 & 0x58f386e8fd860000L) != 0L) + { + if (jjmatchedPos != 3) + { + jjmatchedKind = 75; + jjmatchedPos = 3; + } + return 14; + } + if ((active0 & 0x70c501002600000L) != 0L) + return 14; + return -1; + case 4: + if ((active0 & 0x1011042801820000L) != 0L) + return 14; + if ((active0 & 0x4ae282c0fc240000L) != 0L) + { + jjmatchedKind = 75; + jjmatchedPos = 4; + return 14; + } + return -1; + case 5: + if ((active0 & 0x8c28000c0200000L) != 0L) + return 14; + if ((active0 & 0x422002c03c040000L) != 0L) + { + jjmatchedKind = 75; + jjmatchedPos = 5; + return 14; + } + return -1; + case 6: + if ((active0 & 0x420002803c000000L) != 0L) + return 14; + if ((active0 & 0x20004000040000L) != 0L) + { + if (jjmatchedPos != 6) + { + jjmatchedKind = 75; + jjmatchedPos = 6; + } + return 14; + } + return -1; + case 7: + if ((active0 & 0x30000000L) != 0L) + { + jjmatchedKind = 75; + jjmatchedPos = 7; + return 14; + } + if ((active0 & 0x20004000040000L) != 0L) + return 14; + return -1; + case 8: + if ((active0 & 0x30000000L) != 0L) + { + jjmatchedKind = 75; + jjmatchedPos = 8; + return 14; + } + return -1; + case 9: + if ((active0 & 0x30000000L) != 0L) + { + jjmatchedKind = 75; + jjmatchedPos = 9; + return 14; + } + return -1; + case 10: + if ((active0 & 0x30000000L) != 0L) + { + jjmatchedKind = 75; + jjmatchedPos = 10; + return 14; + } + return -1; + default : + return -1; + } +} +private static final int jjStartNfa_1(int pos, long active0, long active1) +{ + return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0, active1), pos + 1); +} +static private final int jjStartNfaWithStates_1(int pos, int kind, int state) +{ + jjmatchedKind = kind; + jjmatchedPos = pos; + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { return pos + 1; } + return jjMoveNfa_1(state, pos + 1); +} +static private final int jjMoveStringLiteralDfa0_1() +{ + switch(curChar) + { + case 33: + jjmatchedKind = 93; + return jjMoveStringLiteralDfa1_1(0x0L, 0x800000000L); + case 36: + return jjStartNfaWithStates_1(0, 89, 16); + case 37: + jjmatchedKind = 111; + return jjMoveStringLiteralDfa1_1(0x0L, 0x800000000000000L); + case 38: + jjmatchedKind = 108; + return jjMoveStringLiteralDfa1_1(0x0L, 0x80002000000000L); + case 40: + return jjStopAtPos(0, 79); + case 41: + return jjStopAtPos(0, 80); + case 42: + jjmatchedKind = 106; + return jjMoveStringLiteralDfa1_1(0x0L, 0x20000000000000L); + case 43: + jjmatchedKind = 104; + return jjMoveStringLiteralDfa1_1(0x0L, 0x8004000000000L); + case 44: + return jjStopAtPos(0, 86); + case 45: + jjmatchedKind = 105; + return jjMoveStringLiteralDfa1_1(0x100000000L, 0x10008000000000L); + case 46: + jjmatchedKind = 87; + return jjMoveStringLiteralDfa1_1(0x0L, 0x400000000000000L); + case 47: + jjmatchedKind = 107; + return jjMoveStringLiteralDfa1_1(0x1400L, 0x40000000000000L); + case 58: + jjmatchedKind = 95; + return jjMoveStringLiteralDfa1_1(0x200000000L, 0x0L); + case 59: + return jjStopAtPos(0, 85); + case 60: + jjmatchedKind = 92; + return jjMoveStringLiteralDfa1_1(0x0L, 0x1001000200000000L); + case 61: + jjmatchedKind = 90; + return jjMoveStringLiteralDfa1_1(0x400000000L, 0x100000000L); + case 62: + jjmatchedKind = 91; + return jjMoveStringLiteralDfa1_1(0x0L, 0x6006000400000000L); + case 63: + jjmatchedKind = 94; + return jjMoveStringLiteralDfa1_1(0x10L, 0x0L); + case 64: + return jjStopAtPos(0, 88); + case 91: + return jjStopAtPos(0, 83); + case 93: + return jjStopAtPos(0, 84); + case 94: + jjmatchedKind = 110; + return jjMoveStringLiteralDfa1_1(0x0L, 0x200000000000000L); + case 65: + case 97: + return jjMoveStringLiteralDfa1_1(0x800000L, 0x1L); + case 66: + case 98: + return jjMoveStringLiteralDfa1_1(0x300000800000000L, 0x0L); + case 67: + case 99: + return jjMoveStringLiteralDfa1_1(0x7000020000L, 0x0L); + case 68: + case 100: + return jjMoveStringLiteralDfa1_1(0x800018000000000L, 0x0L); + case 69: + case 101: + return jjMoveStringLiteralDfa1_1(0x20020002600000L, 0x0L); + case 70: + case 102: + return jjMoveStringLiteralDfa1_1(0x10000c0000040000L, 0x0L); + case 71: + case 103: + return jjMoveStringLiteralDfa1_1(0x100040000000L, 0x0L); + case 73: + case 105: + return jjMoveStringLiteralDfa1_1(0x6000000014100000L, 0x0L); + case 78: + case 110: + return jjMoveStringLiteralDfa1_1(0x600000000000L, 0x0L); + case 79: + case 111: + return jjMoveStringLiteralDfa1_1(0x8080000000000000L, 0x0L); + case 80: + case 112: + return jjMoveStringLiteralDfa1_1(0x1000000L, 0x0L); + case 82: + case 114: + return jjMoveStringLiteralDfa1_1(0x400800028000000L, 0x0L); + case 83: + case 115: + return jjMoveStringLiteralDfa1_1(0x43000080000000L, 0x0L); + case 84: + case 116: + return jjMoveStringLiteralDfa1_1(0xc000000000000L, 0x0L); + case 86: + case 118: + return jjMoveStringLiteralDfa1_1(0x80000L, 0x0L); + case 87: + case 119: + return jjMoveStringLiteralDfa1_1(0x10000000000000L, 0x0L); + case 123: + return jjStopAtPos(0, 81); + case 124: + jjmatchedKind = 109; + return jjMoveStringLiteralDfa1_1(0x0L, 0x100001000000000L); + case 125: + return jjStopAtPos(0, 82); + default : + return jjMoveNfa_1(3, 0); + } +} +static private final int jjMoveStringLiteralDfa1_1(long active0, long active1) +{ + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_1(0, active0, active1); + return 1; + } + switch(curChar) + { + case 38: + if ((active1 & 0x2000000000L) != 0L) + return jjStopAtPos(1, 101); + break; + case 42: + if ((active0 & 0x1000L) != 0L) + return jjStartNfaWithStates_1(1, 12, 0); + break; + case 43: + if ((active1 & 0x4000000000L) != 0L) + return jjStopAtPos(1, 102); + break; + case 45: + if ((active1 & 0x8000000000L) != 0L) + return jjStopAtPos(1, 103); + break; + case 47: + if ((active0 & 0x400L) != 0L) + return jjStopAtPos(1, 10); + break; + case 58: + if ((active0 & 0x200000000L) != 0L) + return jjStopAtPos(1, 33); + break; + case 60: + if ((active1 & 0x1000000000000L) != 0L) + { + jjmatchedKind = 112; + jjmatchedPos = 1; + } + return jjMoveStringLiteralDfa2_1(active0, 0L, active1, 0x1000000000000000L); + case 61: + if ((active1 & 0x100000000L) != 0L) + return jjStopAtPos(1, 96); + else if ((active1 & 0x200000000L) != 0L) + return jjStopAtPos(1, 97); + else if ((active1 & 0x400000000L) != 0L) + return jjStopAtPos(1, 98); + else if ((active1 & 0x800000000L) != 0L) + return jjStopAtPos(1, 99); + else if ((active1 & 0x8000000000000L) != 0L) + return jjStopAtPos(1, 115); + else if ((active1 & 0x10000000000000L) != 0L) + return jjStopAtPos(1, 116); + else if ((active1 & 0x20000000000000L) != 0L) + return jjStopAtPos(1, 117); + else if ((active1 & 0x40000000000000L) != 0L) + return jjStopAtPos(1, 118); + else if ((active1 & 0x80000000000000L) != 0L) + return jjStopAtPos(1, 119); + else if ((active1 & 0x100000000000000L) != 0L) + return jjStopAtPos(1, 120); + else if ((active1 & 0x200000000000000L) != 0L) + return jjStopAtPos(1, 121); + else if ((active1 & 0x400000000000000L) != 0L) + return jjStopAtPos(1, 122); + else if ((active1 & 0x800000000000000L) != 0L) + return jjStopAtPos(1, 123); + break; + case 62: + if ((active0 & 0x10L) != 0L) + return jjStopAtPos(1, 4); + else if ((active0 & 0x100000000L) != 0L) + return jjStopAtPos(1, 32); + else if ((active0 & 0x400000000L) != 0L) + return jjStopAtPos(1, 34); + else if ((active1 & 0x2000000000000L) != 0L) + { + jjmatchedKind = 113; + jjmatchedPos = 1; + } + return jjMoveStringLiteralDfa2_1(active0, 0L, active1, 0x6004000000000000L); + case 65: + case 97: + return jjMoveStringLiteralDfa2_1(active0, 0x41000080000L, active1, 0L); + case 66: + case 98: + return jjMoveStringLiteralDfa2_1(active0, 0x80000000000000L, active1, 0L); + case 67: + case 99: + return jjMoveStringLiteralDfa2_1(active0, 0x2000000L, active1, 0L); + case 69: + case 101: + return jjMoveStringLiteralDfa2_1(active0, 0x400a08028000000L, active1, 0L); + case 70: + case 102: + if ((active0 & 0x100000L) != 0L) + return jjStartNfaWithStates_1(1, 20, 14); + break; + case 72: + case 104: + return jjMoveStringLiteralDfa2_1(active0, 0x14000000000000L, active1, 0L); + case 76: + case 108: + return jjMoveStringLiteralDfa2_1(active0, 0x1000000040620000L, active1, 0L); + case 78: + case 110: + return jjMoveStringLiteralDfa2_1(active0, 0x6020000014000000L, active1, 0x1L); + case 79: + case 111: + if ((active0 & 0x10000000000L) != 0L) + { + jjmatchedKind = 40; + jjmatchedPos = 1; + } + return jjMoveStringLiteralDfa2_1(active0, 0xb00186000000000L, active1, 0L); + case 82: + case 114: + if ((active0 & 0x8000000000000000L) != 0L) + return jjStartNfaWithStates_1(1, 63, 14); + return jjMoveStringLiteralDfa2_1(active0, 0x8000801800000L, active1, 0L); + case 84: + case 116: + return jjMoveStringLiteralDfa2_1(active0, 0x40000080000000L, active1, 0L); + case 85: + case 117: + return jjMoveStringLiteralDfa2_1(active0, 0x1400000040000L, active1, 0L); + case 87: + case 119: + return jjMoveStringLiteralDfa2_1(active0, 0x2000000000000L, active1, 0L); + case 88: + case 120: + return jjMoveStringLiteralDfa2_1(active0, 0x20000000000L, active1, 0L); + case 124: + if ((active1 & 0x1000000000L) != 0L) + return jjStopAtPos(1, 100); + break; + default : + break; + } + return jjStartNfa_1(0, active0, active1); +} +static private final int jjMoveStringLiteralDfa2_1(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_1(0, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_1(1, active0, active1); + return 2; + } + switch(curChar) + { + case 61: + if ((active1 & 0x1000000000000000L) != 0L) + return jjStopAtPos(2, 124); + else if ((active1 & 0x2000000000000000L) != 0L) + return jjStopAtPos(2, 125); + break; + case 62: + if ((active1 & 0x4000000000000L) != 0L) + { + jjmatchedKind = 114; + jjmatchedPos = 2; + } + return jjMoveStringLiteralDfa3_1(active0, 0L, active1, 0x4000000000000000L); + case 65: + case 97: + return jjMoveStringLiteralDfa3_1(active0, 0x400000080020000L, active1, 0L); + case 67: + case 99: + return jjMoveStringLiteralDfa3_1(active0, 0x14000000L, active1, 0L); + case 68: + case 100: + if ((active1 & 0x1L) != 0L) + return jjStartNfaWithStates_1(2, 64, 14); + return jjMoveStringLiteralDfa3_1(active0, 0x20000000000000L, active1, 0L); + case 69: + case 101: + return jjMoveStringLiteralDfa3_1(active0, 0x800000000L, active1, 0L); + case 70: + case 102: + return jjMoveStringLiteralDfa3_1(active0, 0x8000000000L, active1, 0L); + case 72: + case 104: + return jjMoveStringLiteralDfa3_1(active0, 0x2000000L, active1, 0L); + case 73: + case 105: + return jjMoveStringLiteralDfa3_1(active0, 0x16000001000000L, active1, 0L); + case 74: + case 106: + return jjMoveStringLiteralDfa3_1(active0, 0x80000000000000L, active1, 0L); + case 76: + case 108: + return jjMoveStringLiteralDfa3_1(active0, 0x440000000000L, active1, 0L); + case 78: + case 110: + return jjMoveStringLiteralDfa3_1(active0, 0x6000040000L, active1, 0L); + case 79: + case 111: + return jjMoveStringLiteralDfa3_1(active0, 0x1300000040000000L, active1, 0L); + case 80: + case 112: + return jjMoveStringLiteralDfa3_1(active0, 0x1000000000000L, active1, 0L); + case 81: + case 113: + return jjMoveStringLiteralDfa3_1(active0, 0x28000000L, active1, 0L); + case 82: + case 114: + if ((active0 & 0x80000L) != 0L) + return jjStartNfaWithStates_1(2, 19, 14); + else if ((active0 & 0x80000000000L) != 0L) + return jjStartNfaWithStates_1(2, 43, 14); + return jjMoveStringLiteralDfa3_1(active0, 0x40000000800000L, active1, 0L); + case 83: + case 115: + return jjMoveStringLiteralDfa3_1(active0, 0x1000600000L, active1, 0L); + case 84: + case 116: + if ((active0 & 0x2000000000000000L) != 0L) + { + jjmatchedKind = 61; + jjmatchedPos = 2; + } + return jjMoveStringLiteralDfa3_1(active0, 0x4000920000000000L, active1, 0L); + case 85: + case 117: + return jjMoveStringLiteralDfa3_1(active0, 0x808000000000000L, active1, 0L); + case 87: + case 119: + if ((active0 & 0x200000000000L) != 0L) + return jjStartNfaWithStates_1(2, 45, 14); + break; + default : + break; + } + return jjStartNfa_1(1, active0, active1); +} +static private final int jjMoveStringLiteralDfa3_1(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_1(1, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_1(2, active0, active1); + return 3; + } + switch(curChar) + { + case 61: + if ((active1 & 0x4000000000000000L) != 0L) + return jjStopAtPos(3, 126); + break; + case 65: + case 97: + return jjMoveStringLiteralDfa4_1(active0, 0x1000008800800000L, active1, 0L); + case 66: + case 98: + return jjMoveStringLiteralDfa4_1(active0, 0x800000040000000L, active1, 0L); + case 67: + case 99: + return jjMoveStringLiteralDfa4_1(active0, 0x40000L, active1, 0L); + case 69: + case 101: + if ((active0 & 0x400000L) != 0L) + { + jjmatchedKind = 22; + jjmatchedPos = 3; + } + else if ((active0 & 0x1000000000L) != 0L) + return jjStartNfaWithStates_1(3, 36, 14); + else if ((active0 & 0x8000000000000L) != 0L) + return jjStartNfaWithStates_1(3, 51, 14); + return jjMoveStringLiteralDfa4_1(active0, 0x4081020000200000L, active1, 0L); + case 73: + case 105: + return jjMoveStringLiteralDfa4_1(active0, 0x40000000000000L, active1, 0L); + case 76: + case 108: + if ((active0 & 0x400000000000L) != 0L) + return jjStartNfaWithStates_1(3, 46, 14); + else if ((active0 & 0x100000000000000L) != 0L) + { + jjmatchedKind = 56; + jjmatchedPos = 3; + } + else if ((active0 & 0x400000000000000L) != 0L) + return jjStartNfaWithStates_1(3, 58, 14); + return jjMoveStringLiteralDfa4_1(active0, 0x210000014000000L, active1, 0L); + case 78: + case 110: + return jjMoveStringLiteralDfa4_1(active0, 0x1000000L, active1, 0L); + case 79: + case 111: + if ((active0 & 0x2000000L) != 0L) + return jjStartNfaWithStates_1(3, 25, 14); + else if ((active0 & 0x100000000000L) != 0L) + return jjStartNfaWithStates_1(3, 44, 14); + break; + case 83: + case 115: + if ((active0 & 0x4000000000000L) != 0L) + return jjStartNfaWithStates_1(3, 50, 14); + return jjMoveStringLiteralDfa4_1(active0, 0x42000020000L, active1, 0L); + case 84: + case 116: + return jjMoveStringLiteralDfa4_1(active0, 0x2004080000000L, active1, 0L); + case 85: + case 117: + return jjMoveStringLiteralDfa4_1(active0, 0x800028000000L, active1, 0L); + case 87: + case 119: + return jjMoveStringLiteralDfa4_1(active0, 0x20000000000000L, active1, 0L); + default : + break; + } + return jjStartNfa_1(2, active0, active1); +} +static private final int jjMoveStringLiteralDfa4_1(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_1(2, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_1(3, active0, 0L); + return 4; + } + switch(curChar) + { + case 65: + case 97: + return jjMoveStringLiteralDfa5_1(active0, 0x40000000L); + case 67: + case 99: + return jjMoveStringLiteralDfa5_1(active0, 0x82000000000000L); + case 69: + case 101: + if ((active0 & 0x40000000000L) != 0L) + return jjStartNfaWithStates_1(4, 42, 14); + else if ((active0 & 0x10000000000000L) != 0L) + return jjStartNfaWithStates_1(4, 52, 14); + return jjMoveStringLiteralDfa5_1(active0, 0x200000000000000L); + case 71: + case 103: + return jjMoveStringLiteralDfa5_1(active0, 0x4000000000000000L); + case 72: + case 104: + return jjMoveStringLiteralDfa5_1(active0, 0x20000000000000L); + case 73: + case 105: + return jjMoveStringLiteralDfa5_1(active0, 0x40a8200000L); + case 75: + case 107: + if ((active0 & 0x800000000L) != 0L) + return jjStartNfaWithStates_1(4, 35, 14); + break; + case 76: + case 108: + return jjMoveStringLiteralDfa5_1(active0, 0x800000000000000L); + case 78: + case 110: + return jjMoveStringLiteralDfa5_1(active0, 0x40020000000000L); + case 82: + case 114: + if ((active0 & 0x1000000000000L) != 0L) + return jjStartNfaWithStates_1(4, 48, 14); + return jjMoveStringLiteralDfa5_1(active0, 0x800000000000L); + case 83: + case 115: + if ((active0 & 0x20000L) != 0L) + return jjStartNfaWithStates_1(4, 17, 14); + break; + case 84: + case 116: + if ((active0 & 0x1000000L) != 0L) + return jjStartNfaWithStates_1(4, 24, 14); + else if ((active0 & 0x2000000000L) != 0L) + return jjStartNfaWithStates_1(4, 37, 14); + else if ((active0 & 0x1000000000000000L) != 0L) + return jjStartNfaWithStates_1(4, 60, 14); + return jjMoveStringLiteralDfa5_1(active0, 0x40000L); + case 85: + case 117: + return jjMoveStringLiteralDfa5_1(active0, 0x8014000000L); + case 89: + case 121: + if ((active0 & 0x800000L) != 0L) + return jjStartNfaWithStates_1(4, 23, 14); + break; + default : + break; + } + return jjStartNfa_1(3, active0, 0L); +} +static private final int jjMoveStringLiteralDfa5_1(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(3, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_1(4, active0, 0L); + return 5; + } + switch(curChar) + { + case 65: + case 97: + return jjMoveStringLiteralDfa6_1(active0, 0x200000000000000L); + case 67: + case 99: + if ((active0 & 0x80000000L) != 0L) + return jjStartNfaWithStates_1(5, 31, 14); + break; + case 68: + case 100: + return jjMoveStringLiteralDfa6_1(active0, 0x20014000000L); + case 69: + case 101: + if ((active0 & 0x800000000000000L) != 0L) + return jjStartNfaWithStates_1(5, 59, 14); + return jjMoveStringLiteralDfa6_1(active0, 0x4000000000000000L); + case 70: + case 102: + if ((active0 & 0x200000L) != 0L) + return jjStartNfaWithStates_1(5, 21, 14); + break; + case 71: + case 103: + if ((active0 & 0x40000000000000L) != 0L) + return jjStartNfaWithStates_1(5, 54, 14); + break; + case 72: + case 104: + if ((active0 & 0x2000000000000L) != 0L) + return jjStartNfaWithStates_1(5, 49, 14); + break; + case 73: + case 105: + return jjMoveStringLiteralDfa6_1(active0, 0x20000000040000L); + case 76: + case 108: + if ((active0 & 0x40000000L) != 0L) + return jjStartNfaWithStates_1(5, 30, 14); + return jjMoveStringLiteralDfa6_1(active0, 0x8000000000L); + case 78: + case 110: + if ((active0 & 0x800000000000L) != 0L) + return jjStartNfaWithStates_1(5, 47, 14); + return jjMoveStringLiteralDfa6_1(active0, 0x4000000000L); + case 82: + case 114: + return jjMoveStringLiteralDfa6_1(active0, 0x28000000L); + case 84: + case 116: + if ((active0 & 0x80000000000000L) != 0L) + return jjStartNfaWithStates_1(5, 55, 14); + break; + default : + break; + } + return jjStartNfa_1(4, active0, 0L); +} +static private final int jjMoveStringLiteralDfa6_1(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(4, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_1(5, active0, 0L); + return 6; + } + switch(curChar) + { + case 69: + case 101: + if ((active0 & 0x4000000L) != 0L) + { + jjmatchedKind = 26; + jjmatchedPos = 6; + } + else if ((active0 & 0x8000000L) != 0L) + { + jjmatchedKind = 27; + jjmatchedPos = 6; + } + return jjMoveStringLiteralDfa7_1(active0, 0x30000000L); + case 76: + case 108: + return jjMoveStringLiteralDfa7_1(active0, 0x20000000000000L); + case 78: + case 110: + if ((active0 & 0x200000000000000L) != 0L) + return jjStartNfaWithStates_1(6, 57, 14); + break; + case 79: + case 111: + return jjMoveStringLiteralDfa7_1(active0, 0x40000L); + case 82: + case 114: + if ((active0 & 0x4000000000000000L) != 0L) + return jjStartNfaWithStates_1(6, 62, 14); + break; + case 83: + case 115: + if ((active0 & 0x20000000000L) != 0L) + return jjStartNfaWithStates_1(6, 41, 14); + break; + case 84: + case 116: + if ((active0 & 0x8000000000L) != 0L) + return jjStartNfaWithStates_1(6, 39, 14); + break; + case 85: + case 117: + return jjMoveStringLiteralDfa7_1(active0, 0x4000000000L); + default : + break; + } + return jjStartNfa_1(5, active0, 0L); +} +static private final int jjMoveStringLiteralDfa7_1(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(5, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_1(6, active0, 0L); + return 7; + } + switch(curChar) + { + case 95: + return jjMoveStringLiteralDfa8_1(active0, 0x30000000L); + case 69: + case 101: + if ((active0 & 0x4000000000L) != 0L) + return jjStartNfaWithStates_1(7, 38, 14); + else if ((active0 & 0x20000000000000L) != 0L) + return jjStartNfaWithStates_1(7, 53, 14); + break; + case 78: + case 110: + if ((active0 & 0x40000L) != 0L) + return jjStartNfaWithStates_1(7, 18, 14); + break; + default : + break; + } + return jjStartNfa_1(6, active0, 0L); +} +static private final int jjMoveStringLiteralDfa8_1(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(6, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_1(7, active0, 0L); + return 8; + } + switch(curChar) + { + case 79: + case 111: + return jjMoveStringLiteralDfa9_1(active0, 0x30000000L); + default : + break; + } + return jjStartNfa_1(7, active0, 0L); +} +static private final int jjMoveStringLiteralDfa9_1(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(7, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_1(8, active0, 0L); + return 9; + } + switch(curChar) + { + case 78: + case 110: + return jjMoveStringLiteralDfa10_1(active0, 0x30000000L); + default : + break; + } + return jjStartNfa_1(8, active0, 0L); +} +static private final int jjMoveStringLiteralDfa10_1(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(8, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_1(9, active0, 0L); + return 10; + } + switch(curChar) + { + case 67: + case 99: + return jjMoveStringLiteralDfa11_1(active0, 0x30000000L); + default : + break; + } + return jjStartNfa_1(9, active0, 0L); +} +static private final int jjMoveStringLiteralDfa11_1(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_1(9, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_1(10, active0, 0L); + return 11; + } + switch(curChar) + { + case 69: + case 101: + if ((active0 & 0x10000000L) != 0L) + return jjStartNfaWithStates_1(11, 28, 14); + else if ((active0 & 0x20000000L) != 0L) + return jjStartNfaWithStates_1(11, 29, 14); + break; + default : + break; + } + return jjStartNfa_1(10, active0, 0L); +} +static final long[] jjbitVec0 = { + 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static private final int jjMoveNfa_1(int startState, int curPos) +{ + int[] nextStates; + int startsAt = 0; + jjnewStateCnt = 56; + int i = 1; + jjstateSet[0] = startState; + int j, kind = 0x7fffffff; + for (;;) + { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) + { + long l = 1L << curChar; + MatchLoop: do + { + switch(jjstateSet[--i]) + { + case 3: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(0, 6); + else if (curChar == 39) + jjCheckNAddStates(7, 10); + else if (curChar == 34) + jjCheckNAddStates(11, 16); + else if (curChar == 36) + jjstateSet[jjnewStateCnt++] = 16; + else if (curChar == 46) + jjCheckNAdd(8); + else if (curChar == 47) + jjstateSet[jjnewStateCnt++] = 2; + if ((0x3fe000000000000L & l) != 0L) + { + if (kind > 65) + kind = 65; + jjCheckNAddTwoStates(5, 6); + } + else if (curChar == 48) + { + if (kind > 65) + kind = 65; + jjCheckNAddStates(17, 19); + } + break; + case 0: + if (curChar == 42) + jjstateSet[jjnewStateCnt++] = 1; + break; + case 1: + if ((0xffff7fffffffffffL & l) != 0L && kind > 11) + kind = 11; + break; + case 2: + if (curChar == 42) + jjstateSet[jjnewStateCnt++] = 0; + break; + case 4: + if ((0x3fe000000000000L & l) == 0L) + break; + if (kind > 65) + kind = 65; + jjCheckNAddTwoStates(5, 6); + break; + case 5: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 65) + kind = 65; + jjCheckNAddTwoStates(5, 6); + break; + case 7: + if (curChar == 46) + jjCheckNAdd(8); + break; + case 8: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 69) + kind = 69; + jjCheckNAddStates(20, 22); + break; + case 10: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(11); + break; + case 11: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 69) + kind = 69; + jjCheckNAddTwoStates(11, 12); + break; + case 14: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 75) + kind = 75; + jjstateSet[jjnewStateCnt++] = 14; + break; + case 15: + if (curChar == 36) + jjstateSet[jjnewStateCnt++] = 16; + break; + case 17: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 127) + kind = 127; + jjstateSet[jjnewStateCnt++] = 17; + break; + case 18: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(0, 6); + break; + case 19: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(19, 20); + break; + case 20: + if (curChar != 46) + break; + if (kind > 69) + kind = 69; + jjCheckNAddStates(23, 25); + break; + case 21: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 69) + kind = 69; + jjCheckNAddStates(23, 25); + break; + case 23: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(24); + break; + case 24: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 69) + kind = 69; + jjCheckNAddTwoStates(24, 12); + break; + case 25: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(25, 26); + break; + case 27: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(28); + break; + case 28: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 69) + kind = 69; + jjCheckNAddTwoStates(28, 12); + break; + case 29: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(26, 28); + break; + case 31: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(32); + break; + case 32: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(32, 12); + break; + case 33: + if (curChar != 48) + break; + if (kind > 65) + kind = 65; + jjCheckNAddStates(17, 19); + break; + case 35: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 65) + kind = 65; + jjCheckNAddTwoStates(35, 6); + break; + case 36: + if ((0xff000000000000L & l) == 0L) + break; + if (kind > 65) + kind = 65; + jjCheckNAddTwoStates(36, 6); + break; + case 37: + if (curChar == 34) + jjCheckNAddStates(11, 16); + break; + case 38: + if ((0xfffffffbffffffffL & l) != 0L) + jjCheckNAddStates(29, 31); + break; + case 39: + if (curChar == 34) + jjCheckNAddStates(29, 31); + break; + case 41: + if (curChar == 34 && kind > 71) + kind = 71; + break; + case 42: + if ((0xfffffffbffffffffL & l) != 0L) + jjCheckNAddStates(32, 34); + break; + case 43: + if (curChar == 34) + jjCheckNAddStates(32, 34); + break; + case 45: + if (curChar == 34 && kind > 72) + kind = 72; + break; + case 46: + if (curChar == 39) + jjCheckNAddStates(7, 10); + break; + case 47: + if ((0xffffff7fffffffffL & l) != 0L) + jjCheckNAddTwoStates(47, 48); + break; + case 48: + if (curChar == 39 && kind > 71) + kind = 71; + break; + case 49: + if ((0xffffff7fffffffffL & l) != 0L) + jjCheckNAddTwoStates(49, 50); + break; + case 50: + if (curChar == 39 && kind > 73) + kind = 73; + break; + case 52: + jjAddStates(35, 36); + break; + case 54: + jjAddStates(37, 38); + break; + default : break; + } + } while(i != startsAt); + } + else if (curChar < 128) + { + long l = 1L << (curChar & 077); + MatchLoop: do + { + switch(jjstateSet[--i]) + { + case 3: + if ((0x7fffffe87fffffeL & l) != 0L) + { + if (kind > 75) + kind = 75; + jjCheckNAdd(14); + } + else if (curChar == 96) + jjCheckNAddStates(39, 42); + break; + case 1: + if (kind > 11) + kind = 11; + break; + case 6: + if ((0x100000001000L & l) != 0L && kind > 65) + kind = 65; + break; + case 9: + if ((0x2000000020L & l) != 0L) + jjAddStates(43, 44); + break; + case 12: + if ((0x5000000050L & l) != 0L && kind > 69) + kind = 69; + break; + case 13: + case 14: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 75) + kind = 75; + jjCheckNAdd(14); + break; + case 16: + case 17: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 127) + kind = 127; + jjCheckNAdd(17); + break; + case 22: + if ((0x2000000020L & l) != 0L) + jjAddStates(45, 46); + break; + case 26: + if ((0x2000000020L & l) != 0L) + jjAddStates(47, 48); + break; + case 30: + if ((0x2000000020L & l) != 0L) + jjAddStates(49, 50); + break; + case 34: + if ((0x100000001000000L & l) != 0L) + jjCheckNAdd(35); + break; + case 35: + if ((0x7e0000007eL & l) == 0L) + break; + if (kind > 65) + kind = 65; + jjCheckNAddTwoStates(35, 6); + break; + case 38: + jjAddStates(29, 31); + break; + case 40: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 39; + break; + case 42: + jjAddStates(32, 34); + break; + case 44: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 43; + break; + case 47: + jjAddStates(51, 52); + break; + case 49: + jjAddStates(53, 54); + break; + case 51: + if (curChar == 96) + jjCheckNAddStates(39, 42); + break; + case 52: + if ((0xfffffffeffffffffL & l) != 0L) + jjCheckNAddTwoStates(52, 53); + break; + case 53: + if (curChar == 96 && kind > 71) + kind = 71; + break; + case 54: + if ((0xfffffffeffffffffL & l) != 0L) + jjCheckNAddTwoStates(54, 55); + break; + case 55: + if (curChar == 96 && kind > 74) + kind = 74; + break; + default : break; + } + } while(i != startsAt); + } + else + { + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + MatchLoop: do + { + switch(jjstateSet[--i]) + { + case 1: + if ((jjbitVec0[i2] & l2) != 0L && kind > 11) + kind = 11; + break; + case 38: + if ((jjbitVec0[i2] & l2) != 0L) + jjAddStates(29, 31); + break; + case 42: + if ((jjbitVec0[i2] & l2) != 0L) + jjAddStates(32, 34); + break; + case 47: + if ((jjbitVec0[i2] & l2) != 0L) + jjAddStates(51, 52); + break; + case 49: + if ((jjbitVec0[i2] & l2) != 0L) + jjAddStates(53, 54); + break; + case 52: + if ((jjbitVec0[i2] & l2) != 0L) + jjAddStates(35, 36); + break; + case 54: + if ((jjbitVec0[i2] & l2) != 0L) + jjAddStates(37, 38); + break; + default : break; + } + } while(i != startsAt); + } + if (kind != 0x7fffffff) + { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 56 - (jjnewStateCnt = startsAt))) + return curPos; + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { return curPos; } + } +} +static private final int jjMoveStringLiteralDfa0_3() +{ + switch(curChar) + { + case 42: + return jjMoveStringLiteralDfa1_3(0x4000L); + default : + return 1; + } +} +static private final int jjMoveStringLiteralDfa1_3(long active0) +{ + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + return 1; + } + switch(curChar) + { + case 47: + if ((active0 & 0x4000L) != 0L) + return jjStopAtPos(1, 14); + break; + default : + return 2; + } + return 2; +} +static final int[] jjnextStates = { + 19, 20, 25, 26, 29, 30, 12, 47, 48, 49, 50, 38, 40, 41, 42, 44, + 45, 34, 36, 6, 8, 9, 12, 21, 22, 12, 29, 30, 12, 38, 40, 41, + 42, 44, 45, 52, 53, 54, 55, 52, 53, 54, 55, 10, 11, 23, 24, 27, + 28, 31, 32, 47, 48, 49, 50, +}; +public static final String[] jjstrLiteralImages = { +"", null, "\74\77", null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, "\55\76", "\72\72", "\75\76", null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, null, null, +null, null, null, null, null, null, null, null, null, null, null, null, "\50", +"\51", "\173", "\175", "\133", "\135", "\73", "\54", "\56", "\100", "\44", "\75", +"\76", "\74", "\41", "\77", "\72", "\75\75", "\74\75", "\76\75", "\41\75", +"\174\174", "\46\46", "\53\53", "\55\55", "\53", "\55", "\52", "\57", "\46", "\174", +"\136", "\45", "\74\74", "\76\76", "\76\76\76", "\53\75", "\55\75", "\52\75", +"\57\75", "\46\75", "\174\75", "\136\75", "\56\75", "\45\75", "\74\74\75", "\76\76\75", +"\76\76\76\75", null, "\77\76", }; +public static final String[] lexStateNames = { + "DEFAULT", + "PHPPARSING", + "IN_SINGLE_LINE_COMMENT", + "IN_FORMAL_COMMENT", + "IN_MULTI_LINE_COMMENT", +}; +public static final int[] jjnewLexState = { + -1, 1, 1, -1, 0, -1, -1, -1, -1, -1, 2, 3, 4, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, +}; +static final long[] jjtoToken = { + 0xfffffffffffe0007L, 0xffffffffffff8fa3L, 0x1L, +}; +static final long[] jjtoSkip = { + 0xe3f8L, 0x0L, 0x0L, +}; +static final long[] jjtoSpecial = { + 0xe010L, 0x0L, 0x0L, +}; +static final long[] jjtoMore = { + 0x11c00L, 0x0L, 0x0L, +}; +static private SimpleCharStream input_stream; +static private final int[] jjrounds = new int[56]; +static private final int[] jjstateSet = new int[112]; +static StringBuffer image; +static int jjimageLen; +static int lengthOfMatch; +static protected char curChar; +public PHPParserTokenManager(SimpleCharStream stream) +{ + if (input_stream != null) + throw new TokenMgrError("ERROR: Second call to constructor of static lexer. You must use ReInit() to initialize the static variables.", TokenMgrError.STATIC_LEXER_ERROR); + input_stream = stream; +} +public PHPParserTokenManager(SimpleCharStream stream, int lexState) +{ + this(stream); + SwitchTo(lexState); +} +static public void ReInit(SimpleCharStream stream) +{ + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); +} +static private final void ReInitRounds() +{ + int i; + jjround = 0x80000001; + for (i = 56; i-- > 0;) + jjrounds[i] = 0x80000000; +} +static public void ReInit(SimpleCharStream stream, int lexState) +{ + ReInit(stream); + SwitchTo(lexState); +} +static public void SwitchTo(int lexState) +{ + if (lexState >= 5 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; +} + +static private final Token jjFillToken() +{ + Token t = Token.newToken(jjmatchedKind); + t.kind = jjmatchedKind; + String im = jjstrLiteralImages[jjmatchedKind]; + t.image = (im == null) ? input_stream.GetImage() : im; + t.beginLine = input_stream.getBeginLine(); + t.beginColumn = input_stream.getBeginColumn(); + t.endLine = input_stream.getEndLine(); + t.endColumn = input_stream.getEndColumn(); + return t; +} + +static int curLexState = 0; +static int defaultLexState = 0; +static int jjnewStateCnt; +static int jjround; +static int jjmatchedPos; +static int jjmatchedKind; + +public static final Token getNextToken() +{ + int kind; + Token specialToken = null; + Token matchedToken; + int curPos = 0; + + EOFLoop : + for (;;) + { + try + { + curChar = input_stream.BeginToken(); + } + catch(java.io.IOException e) + { + jjmatchedKind = 0; + matchedToken = jjFillToken(); + matchedToken.specialToken = specialToken; + return matchedToken; + } + image = null; + jjimageLen = 0; + + for (;;) + { + switch(curLexState) + { + case 0: + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_0(); + if (jjmatchedPos == 0 && jjmatchedKind > 3) + { + jjmatchedKind = 3; + } + break; + case 1: + try { input_stream.backup(0); + while (curChar <= 32 && (0x100003600L & (1L << curChar)) != 0L) + curChar = input_stream.BeginToken(); + } + catch (java.io.IOException e1) { continue EOFLoop; } + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_1(); + break; + case 2: + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_2(); + if (jjmatchedPos == 0 && jjmatchedKind > 16) + { + jjmatchedKind = 16; + } + break; + case 3: + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_3(); + if (jjmatchedPos == 0 && jjmatchedKind > 16) + { + jjmatchedKind = 16; + } + break; + case 4: + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_4(); + if (jjmatchedPos == 0 && jjmatchedKind > 16) + { + jjmatchedKind = 16; + } + break; + } + if (jjmatchedKind != 0x7fffffff) + { + if (jjmatchedPos + 1 < curPos) + input_stream.backup(curPos - jjmatchedPos - 1); + if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) + { + matchedToken = jjFillToken(); + matchedToken.specialToken = specialToken; + if (jjnewLexState[jjmatchedKind] != -1) + curLexState = jjnewLexState[jjmatchedKind]; + return matchedToken; + } + else if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) + { + if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) + { + matchedToken = jjFillToken(); + if (specialToken == null) + specialToken = matchedToken; + else + { + matchedToken.specialToken = specialToken; + specialToken = (specialToken.next = matchedToken); + } + SkipLexicalActions(matchedToken); + } + else + SkipLexicalActions(null); + if (jjnewLexState[jjmatchedKind] != -1) + curLexState = jjnewLexState[jjmatchedKind]; + continue EOFLoop; + } + MoreLexicalActions(); + if (jjnewLexState[jjmatchedKind] != -1) + curLexState = jjnewLexState[jjmatchedKind]; + curPos = 0; + jjmatchedKind = 0x7fffffff; + try { + curChar = input_stream.readChar(); + continue; + } + catch (java.io.IOException e1) { } + } + int error_line = input_stream.getEndLine(); + int error_column = input_stream.getEndColumn(); + String error_after = null; + boolean EOFSeen = false; + try { input_stream.readChar(); input_stream.backup(1); } + catch (java.io.IOException e1) { + EOFSeen = true; + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + if (curChar == '\n' || curChar == '\r') { + error_line++; + error_column = 0; + } + else + error_column++; + } + if (!EOFSeen) { + input_stream.backup(1); + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + } + throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); + } + } +} + +static final void SkipLexicalActions(Token matchedToken) +{ + switch(jjmatchedKind) + { + default : + break; + } +} +static final void MoreLexicalActions() +{ + jjimageLen += (lengthOfMatch = jjmatchedPos + 1); + switch(jjmatchedKind) + { + case 11 : + if (image == null) + image = new StringBuffer(new String(input_stream.GetSuffix(jjimageLen))); + else + image.append(new String(input_stream.GetSuffix(jjimageLen))); + jjimageLen = 0; + input_stream.backup(1); + break; + default : + break; + } +} +} diff --git a/net.sourceforge.phpeclipse/src/test/ParseException.java b/net.sourceforge.phpeclipse/src/test/ParseException.java new file mode 100644 index 0000000..ee14c39 --- /dev/null +++ b/net.sourceforge.phpeclipse/src/test/ParseException.java @@ -0,0 +1,192 @@ +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 2.1 */ +package test; + +/** + * This exception is thrown when parse errors are encountered. + * You can explicitly create objects of this exception type by + * calling the method generateParseException in the generated + * parser. + * + * You can modify this class to customize your error reporting + * mechanisms so long as you retain the public fields. + */ +public class ParseException extends Exception { + + /** + * This constructor is used by the method "generateParseException" + * in the generated parser. Calling this constructor generates + * a new object of this type with the fields "currentToken", + * "expectedTokenSequences", and "tokenImage" set. The boolean + * flag "specialConstructor" is also set to true to indicate that + * this constructor was used to create this object. + * This constructor calls its super class with the empty string + * to force the "toString" method of parent class "Throwable" to + * print the error message in the form: + * ParseException: + */ + public ParseException(Token currentTokenVal, + int[][] expectedTokenSequencesVal, + String[] tokenImageVal + ) + { + super(""); + specialConstructor = true; + currentToken = currentTokenVal; + expectedTokenSequences = expectedTokenSequencesVal; + tokenImage = tokenImageVal; + } + + /** + * The following constructors are for use by you for whatever + * purpose you can think of. Constructing the exception in this + * manner makes the exception behave in the normal way - i.e., as + * documented in the class "Throwable". The fields "errorToken", + * "expectedTokenSequences", and "tokenImage" do not contain + * relevant information. The JavaCC generated code does not use + * these constructors. + */ + + public ParseException() { + super(); + specialConstructor = false; + } + + public ParseException(String message) { + super(message); + specialConstructor = false; + } + + /** + * This variable determines which constructor was used to create + * this object and thereby affects the semantics of the + * "getMessage" method (see below). + */ + protected boolean specialConstructor; + + /** + * This is the last token that has been consumed successfully. If + * this object has been created due to a parse error, the token + * followng this token will (therefore) be the first error token. + */ + public Token currentToken; + + /** + * Each entry in this array is an array of integers. Each array + * of integers represents a sequence of tokens (by their ordinal + * values) that is expected at this point of the parse. + */ + public int[][] expectedTokenSequences; + + /** + * This is a reference to the "tokenImage" array of the generated + * parser within which the parse error occurred. This array is + * defined in the generated ...Constants interface. + */ + public String[] tokenImage; + + /** + * This method has the standard behavior when this object has been + * created using the standard constructors. Otherwise, it uses + * "currentToken" and "expectedTokenSequences" to generate a parse + * error message and returns it. If this object has been created + * due to a parse error, and you do not catch it (it gets thrown + * from the parser), then this method is called during the printing + * of the final stack trace, and hence the correct error message + * gets displayed. + */ + public String getMessage() { + if (!specialConstructor) { + return super.getMessage(); + } + String expected = ""; + int maxSize = 0; + for (int i = 0; i < expectedTokenSequences.length; i++) { + if (maxSize < expectedTokenSequences[i].length) { + maxSize = expectedTokenSequences[i].length; + } + for (int j = 0; j < expectedTokenSequences[i].length; j++) { + expected += tokenImage[expectedTokenSequences[i][j]] + " "; + } + if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { + expected += "..."; + } + expected += eol + " "; + } + String retval = "Encountered \""; + Token tok = currentToken.next; + for (int i = 0; i < maxSize; i++) { + if (i != 0) retval += " "; + if (tok.kind == 0) { + retval += tokenImage[0]; + break; + } + retval += add_escapes(tok.image); + tok = tok.next; + } + retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; + retval += "." + eol; + if (expectedTokenSequences.length == 1) { + retval += "Was expecting:" + eol + " "; + } else { + retval += "Was expecting one of:" + eol + " "; + } + retval += expected; + return retval; + } + + /** + * The end of line string for this machine. + */ + protected String eol = System.getProperty("line.separator", "\n"); + + /** + * Used to convert raw characters to their escaped version + * when these raw version cannot be used as part of an ASCII + * string literal. + */ + protected String add_escapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) + { + case 0 : + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u" + s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + continue; + } + } + return retval.toString(); + } + +} diff --git a/net.sourceforge.phpeclipse/src/test/SimpleCharStream.java b/net.sourceforge.phpeclipse/src/test/SimpleCharStream.java new file mode 100644 index 0000000..0049aa7 --- /dev/null +++ b/net.sourceforge.phpeclipse/src/test/SimpleCharStream.java @@ -0,0 +1,405 @@ +/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 2.1 */ +package test; + +/** + * An implementation of interface CharStream, where the stream is assumed to + * contain only ASCII characters (without unicode processing). + */ + +public final class SimpleCharStream +{ + public static final boolean staticFlag = true; + static int bufsize; + static int available; + static int tokenBegin; + static public int bufpos = -1; + static private int bufline[]; + static private int bufcolumn[]; + + static private int column = 0; + static private int line = 1; + + static private boolean prevCharIsCR = false; + static private boolean prevCharIsLF = false; + + static private java.io.Reader inputStream; + + static private char[] buffer; + static private int maxNextCharInd = 0; + static private int inBuf = 0; + + static private final void ExpandBuff(boolean wrapAround) + { + char[] newbuffer = new char[bufsize + 2048]; + int newbufline[] = new int[bufsize + 2048]; + int newbufcolumn[] = new int[bufsize + 2048]; + + try + { + if (wrapAround) + { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + System.arraycopy(buffer, 0, newbuffer, + bufsize - tokenBegin, bufpos); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); + bufcolumn = newbufcolumn; + + maxNextCharInd = (bufpos += (bufsize - tokenBegin)); + } + else + { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + bufcolumn = newbufcolumn; + + maxNextCharInd = (bufpos -= tokenBegin); + } + } + catch (Throwable t) + { + throw new Error(t.getMessage()); + } + + + bufsize += 2048; + available = bufsize; + tokenBegin = 0; + } + + static private final void FillBuff() throws java.io.IOException + { + if (maxNextCharInd == available) + { + if (available == bufsize) + { + if (tokenBegin > 2048) + { + bufpos = maxNextCharInd = 0; + available = tokenBegin; + } + else if (tokenBegin < 0) + bufpos = maxNextCharInd = 0; + else + ExpandBuff(false); + } + else if (available > tokenBegin) + available = bufsize; + else if ((tokenBegin - available) < 2048) + ExpandBuff(true); + else + available = tokenBegin; + } + + int i; + try { + if ((i = inputStream.read(buffer, maxNextCharInd, + available - maxNextCharInd)) == -1) + { + inputStream.close(); + throw new java.io.IOException(); + } + else + maxNextCharInd += i; + return; + } + catch(java.io.IOException e) { + --bufpos; + backup(0); + if (tokenBegin == -1) + tokenBegin = bufpos; + throw e; + } + } + + static public final char BeginToken() throws java.io.IOException + { + tokenBegin = -1; + char c = readChar(); + tokenBegin = bufpos; + + return c; + } + + static private final void UpdateLineColumn(char c) + { + column++; + + if (prevCharIsLF) + { + prevCharIsLF = false; + line += (column = 1); + } + else if (prevCharIsCR) + { + prevCharIsCR = false; + if (c == '\n') + { + prevCharIsLF = true; + } + else + line += (column = 1); + } + + switch (c) + { + case '\r' : + prevCharIsCR = true; + break; + case '\n' : + prevCharIsLF = true; + break; + case '\t' : + column--; + column += (8 - (column & 07)); + break; + default : + break; + } + + bufline[bufpos] = line; + bufcolumn[bufpos] = column; + } + + static public final char readChar() throws java.io.IOException + { + if (inBuf > 0) + { + --inBuf; + + if (++bufpos == bufsize) + bufpos = 0; + + return buffer[bufpos]; + } + + if (++bufpos >= maxNextCharInd) + FillBuff(); + + char c = buffer[bufpos]; + + UpdateLineColumn(c); + return (c); + } + + /** + * @deprecated + * @see #getEndColumn + */ + + static public final int getColumn() { + return bufcolumn[bufpos]; + } + + /** + * @deprecated + * @see #getEndLine + */ + + static public final int getLine() { + return bufline[bufpos]; + } + + static public final int getEndColumn() { + return bufcolumn[bufpos]; + } + + static public final int getEndLine() { + return bufline[bufpos]; + } + + static public final int getBeginColumn() { + return bufcolumn[tokenBegin]; + } + + static public final int getBeginLine() { + return bufline[tokenBegin]; + } + + static public final void backup(int amount) { + + inBuf += amount; + if ((bufpos -= amount) < 0) + bufpos += bufsize; + } + + public SimpleCharStream(java.io.Reader dstream, int startline, + int startcolumn, int buffersize) + { + if (inputStream != null) + throw new Error("\n ERROR: Second call to the constructor of a static SimpleCharStream. You must\n" + + " either use ReInit() or set the JavaCC option STATIC to false\n" + + " during the generation of this class."); + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + } + + public SimpleCharStream(java.io.Reader dstream, int startline, + int startcolumn) + { + this(dstream, startline, startcolumn, 4096); + } + + public SimpleCharStream(java.io.Reader dstream) + { + this(dstream, 1, 1, 4096); + } + public void ReInit(java.io.Reader dstream, int startline, + int startcolumn, int buffersize) + { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + if (buffer == null || buffersize != buffer.length) + { + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + } + prevCharIsLF = prevCharIsCR = false; + tokenBegin = inBuf = maxNextCharInd = 0; + bufpos = -1; + } + + public void ReInit(java.io.Reader dstream, int startline, + int startcolumn) + { + ReInit(dstream, startline, startcolumn, 4096); + } + + public void ReInit(java.io.Reader dstream) + { + ReInit(dstream, 1, 1, 4096); + } + public SimpleCharStream(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) + { + this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); + } + + public SimpleCharStream(java.io.InputStream dstream, int startline, + int startcolumn) + { + this(dstream, startline, startcolumn, 4096); + } + + public SimpleCharStream(java.io.InputStream dstream) + { + this(dstream, 1, 1, 4096); + } + + public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) + { + ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096); + } + + public void ReInit(java.io.InputStream dstream) + { + ReInit(dstream, 1, 1, 4096); + } + public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn) + { + ReInit(dstream, startline, startcolumn, 4096); + } + static public final String GetImage() + { + if (bufpos >= tokenBegin) + return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); + else + return new String(buffer, tokenBegin, bufsize - tokenBegin) + + new String(buffer, 0, bufpos + 1); + } + + static public final char[] GetSuffix(int len) + { + char[] ret = new char[len]; + + if ((bufpos + 1) >= len) + System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); + else + { + System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, + len - bufpos - 1); + System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); + } + + return ret; + } + + static public void Done() + { + buffer = null; + bufline = null; + bufcolumn = null; + } + + /** + * Method to adjust line and column numbers for the start of a token.
+ */ + static public void adjustBeginLineColumn(int newLine, int newCol) + { + int start = tokenBegin; + int len; + + if (bufpos >= tokenBegin) + { + len = bufpos - tokenBegin + inBuf + 1; + } + else + { + len = bufsize - tokenBegin + bufpos + 1 + inBuf; + } + + int i = 0, j = 0, k = 0; + int nextColDiff = 0, columnDiff = 0; + + while (i < len && + bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) + { + bufline[j] = newLine; + nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; + bufcolumn[j] = newCol + columnDiff; + columnDiff = nextColDiff; + i++; + } + + if (i < len) + { + bufline[j] = newLine++; + bufcolumn[j] = newCol + columnDiff; + + while (i++ < len) + { + if (bufline[j = start % bufsize] != bufline[++start % bufsize]) + bufline[j] = newLine++; + else + bufline[j] = newLine; + } + } + + line = bufline[j]; + column = bufcolumn[j]; + } + +} diff --git a/net.sourceforge.phpeclipse/src/test/Token.java b/net.sourceforge.phpeclipse/src/test/Token.java new file mode 100644 index 0000000..c579554 --- /dev/null +++ b/net.sourceforge.phpeclipse/src/test/Token.java @@ -0,0 +1,81 @@ +/* Generated By:JavaCC: Do not edit this line. Token.java Version 2.1 */ +package test; + +/** + * Describes the input token stream. + */ + +public class Token { + + /** + * An integer that describes the kind of this token. This numbering + * system is determined by JavaCCParser, and a table of these numbers is + * stored in the file ...Constants.java. + */ + public int kind; + + /** + * beginLine and beginColumn describe the position of the first character + * of this token; endLine and endColumn describe the position of the + * last character of this token. + */ + public int beginLine, beginColumn, endLine, endColumn; + + /** + * The string image of the token. + */ + public String image; + + /** + * A reference to the next regular (non-special) token from the input + * stream. If this is the last token from the input stream, or if the + * token manager has not read tokens beyond this one, this field is + * set to null. This is true only if this token is also a regular + * token. Otherwise, see below for a description of the contents of + * this field. + */ + public Token next; + + /** + * This field is used to access special tokens that occur prior to this + * token, but after the immediately preceding regular (non-special) token. + * If there are no such special tokens, this field is set to null. + * When there are more than one such special token, this field refers + * to the last of these special tokens, which in turn refers to the next + * previous special token through its specialToken field, and so on + * until the first special token (whose specialToken field is null). + * The next fields of special tokens refer to other special tokens that + * immediately follow it (without an intervening regular token). If there + * is no such token, this field is null. + */ + public Token specialToken; + + /** + * Returns the image. + */ + public final String toString() + { + return image; + } + + /** + * Returns a new Token object, by default. However, if you want, you + * can create and return subclass objects based on the value of ofKind. + * Simply add the cases to the switch for all those special cases. + * For example, if you have a subclass of Token called IDToken that + * you want to create if ofKind is ID, simlpy add something like : + * + * case MyParserConstants.ID : return new IDToken(); + * + * to the following switch statement. Then you can cast matchedToken + * variable to the appropriate type and use it in your lexical actions. + */ + public static final Token newToken(int ofKind) + { + switch(ofKind) + { + default : return new Token(); + } + } + +} diff --git a/net.sourceforge.phpeclipse/src/test/TokenMgrError.java b/net.sourceforge.phpeclipse/src/test/TokenMgrError.java new file mode 100644 index 0000000..a02f7c1 --- /dev/null +++ b/net.sourceforge.phpeclipse/src/test/TokenMgrError.java @@ -0,0 +1,133 @@ +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 2.1 */ +package test; + +public class TokenMgrError extends Error +{ + /* + * Ordinals for various reasons why an Error of this type can be thrown. + */ + + /** + * Lexical error occured. + */ + static final int LEXICAL_ERROR = 0; + + /** + * An attempt wass made to create a second instance of a static token manager. + */ + static final int STATIC_LEXER_ERROR = 1; + + /** + * Tried to change to an invalid lexical state. + */ + static final int INVALID_LEXICAL_STATE = 2; + + /** + * Detected (and bailed out of) an infinite loop in the token manager. + */ + static final int LOOP_DETECTED = 3; + + /** + * Indicates the reason why the exception is thrown. It will have + * one of the above 4 values. + */ + int errorCode; + + /** + * Replaces unprintable characters by their espaced (or unicode escaped) + * equivalents in the given string + */ + protected static final String addEscapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) + { + case 0 : + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u" + s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + continue; + } + } + return retval.toString(); + } + + /** + * Returns a detailed message for the Error when it is thrown by the + * token manager to indicate a lexical error. + * Parameters : + * EOFSeen : indicates if EOF caused the lexicl error + * curLexState : lexical state in which this error occured + * errorLine : line number when the error occured + * errorColumn : column number when the error occured + * errorAfter : prefix that was seen before this error occured + * curchar : the offending character + * Note: You can customize the lexical error message by modifying this method. + */ + private static final String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { + return("Lexical error at line " + + errorLine + ", column " + + errorColumn + ". Encountered: " + + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + + "after : \"" + addEscapes(errorAfter) + "\""); + } + + /** + * You can also modify the body of this method to customize your error messages. + * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not + * of end-users concern, so you can return something like : + * + * "Internal Error : Please file a bug report .... " + * + * from this method for such cases in the release version of your parser. + */ + public String getMessage() { + return super.getMessage(); + } + + /* + * Constructors of various flavors follow. + */ + + public TokenMgrError() { + } + + public TokenMgrError(String message, int reason) { + super(message); + errorCode = reason; + } + + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { + this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); + } +}