private void require(boolean z, String problem, String solution) throws SemanticException { // TODO: Direct to a common error handler, rather than through the parser. if (!z && parser!=null) parser.requireFailed(problem, solution); if (!z) { int lineNum = inputState.getLine(), colNum = inputState.getColumn(); throw new SemanticException(problem + ";\n solution: " + solution, getFilename(), lineNum, colNum); } } public GroovyLexer(InputStream in) {
/** An IDENT token whose spelling is required to start with an uppercase letter. * In the case of a simple statement {UpperID name} the identifier is taken to be a type name, not a command name. */ public final void upperCaseIdent() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST upperCaseIdent_AST = null; if (!(isUpperCase(LT(1)))) throw new SemanticException("isUpperCase(LT(1))"); AST tmp64_AST = null; tmp64_AST = astFactory.create(LT(1)); astFactory.addASTChild(currentAST, tmp64_AST); match(IDENT); upperCaseIdent_AST = (AST)currentAST.root; returnAST = upperCaseIdent_AST; }
public void requireFailed(String problem, String solution) throws SemanticException { // TODO: Needs more work. Token lt = null; int lineNum = Token.badToken.getLine(), colNum = Token.badToken.getColumn(); try { lt = LT(1); if(lt != null) { lineNum = lt.getLine(); colNum = lt.getColumn(); } } catch (TokenStreamException ee) { if(ee instanceof TokenStreamRecognitionException) { lineNum = ((TokenStreamRecognitionException) ee).recog.getLine(); colNum = ((TokenStreamRecognitionException) ee).recog.getColumn(); } } throw new SemanticException(problem + ";\n solution: " + solution, getFilename(), lineNum, colNum); }
/** Used to look ahead for a constructor */ public final void constructorStart() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST constructorStart_AST = null; Token id = null; AST id_AST = null; modifiersOpt(); id = LT(1); id_AST = astFactory.create(id); match(IDENT); if (!(isConstructorIdent(id))) throw new SemanticException("isConstructorIdent(id)"); nls(); match(LPAREN); returnAST = constructorStart_AST; }
public void matchGenericTypeBracketsFailed(String problem, String solution) throws SemanticException { Token lt = null; int lineNum = Token.badToken.getLine(), colNum = Token.badToken.getColumn(); try { lt = LT(1); if(lt != null) { lineNum = lt.getLine(); colNum = lt.getColumn(); } } catch (TokenStreamException ee) { if(ee instanceof TokenStreamRecognitionException) { lineNum = ((TokenStreamRecognitionException) ee).recog.getLine(); colNum = ((TokenStreamRecognitionException) ee).recog.getColumn(); } } throw new SemanticException(problem + ";\n solution: " + solution, getFilename(), lineNum, colNum); }
throw new SemanticException("getLine() == 1 && getColumn() == 1"); match("#!");
throw new SemanticException(" atMultiCommentStart() "); match("/*");
throw new SemanticException("(currentLtLevel != 0) || ltCounter == currentLtLevel"); if ( inputState.guessing==0 ) { typeParameters_AST = (AST)currentAST.root;
throw new SemanticException("matchGenericTypeBrackets(((currentLtLevel != 0) || ltCounter == currentLtLevel),\n \"Missing closing bracket '>' for generics types\", \"Please specify the missing bracket!\")"); if ( inputState.guessing==0 ) { typeParameters_AST = (AST)currentAST.root;
throw new SemanticException("(currentLtLevel != 0) || ltCounter == currentLtLevel"); if ( inputState.guessing==0 ) { typeArguments_AST = (AST)currentAST.root;
throw new SemanticException(" !atMultiCommentStart() ");
throw new SemanticException("matchGenericTypeBrackets(((currentLtLevel != 0) || ltCounter == currentLtLevel),\n \"Missing closing bracket '>' for generics types\", \"Please specify the missing bracket!\")"); if ( inputState.guessing==0 ) { typeArguments_AST = (AST)currentAST.root;
throw new SemanticException("allowRegexpLiteral()"); _saveIndex=text.length(); match("$/");
throw new SemanticException("allowDeclaration"); declarationStart();
throw new SemanticException("prev==null || prev.getType()!=METHOD_CALL"); commandArgument();
/** An IDENT token whose spelling is required to start with an uppercase letter. * In the case of a simple statement {UpperID name} the identifier is taken to be a type name, not a command name. */ public final void upperCaseIdent() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST upperCaseIdent_AST = null; if (!(isUpperCase(LT(1)))) throw new SemanticException("isUpperCase(LT(1))"); AST tmp62_AST = null; tmp62_AST = astFactory.create(LT(1)); astFactory.addASTChild(currentAST, tmp62_AST); match(IDENT); upperCaseIdent_AST = (AST)currentAST.root; returnAST = upperCaseIdent_AST; }
/** Used to look ahead for a constructor */ public final void constructorStart() throws RecognitionException, TokenStreamException { returnAST = null; ASTPair currentAST = new ASTPair(); AST constructorStart_AST = null; Token id = null; AST id_AST = null; modifiersOpt(); id = LT(1); id_AST = astFactory.create(id); match(IDENT); if (!(isConstructorIdent(id))) throw new SemanticException("isConstructorIdent(id)"); nls(); match(LPAREN); returnAST = constructorStart_AST; }
public void matchGenericTypeBracketsFailed(String problem, String solution) throws SemanticException { Token lt = null; int lineNum = Token.badToken.getLine(), colNum = Token.badToken.getColumn(); try { lt = LT(1); if(lt != null) { lineNum = lt.getLine(); colNum = lt.getColumn(); } } catch (TokenStreamException ee) { if(ee instanceof TokenStreamRecognitionException) { lineNum = ((TokenStreamRecognitionException) ee).recog.getLine(); colNum = ((TokenStreamRecognitionException) ee).recog.getColumn(); } } throw new SemanticException(problem + ";\n solution: " + solution, getFilename(), lineNum, colNum); }
public void requireFailed(String problem, String solution) throws SemanticException { // TODO: Needs more work. Token lt = null; int lineNum = Token.badToken.getLine(), colNum = Token.badToken.getColumn(); try { lt = LT(1); if(lt != null) { lineNum = lt.getLine(); colNum = lt.getColumn(); } } catch (TokenStreamException ee) { if(ee instanceof TokenStreamRecognitionException) { lineNum = ((TokenStreamRecognitionException) ee).recog.getLine(); colNum = ((TokenStreamRecognitionException) ee).recog.getColumn(); } } throw new SemanticException(problem + ";\n solution: " + solution, getFilename(), lineNum, colNum); }
throw new SemanticException("getLine() == 1 && getColumn() == 1"); match("#!");