Refine search
protected void mismatch( IntStream input, int ttype, BitSet follow ) throws RecognitionException { throw new MismatchedTokenException( ttype, input ); }
/** * stringId := ( ID | STRING ) * @return * @throws RecognitionException */ private String stringId() throws RecognitionException { if ( input.LA( 1 ) == DRLLexer.ID ) { Token id = match( input, DRLLexer.ID, null, null, DroolsEditorType.IDENTIFIER ); if ( state.failed ) return null; return id.getText(); } else if ( input.LA( 1 ) == DRLLexer.STRING ) { Token id = match( input, DRLLexer.STRING, null, null, DroolsEditorType.IDENTIFIER ); if ( state.failed ) return null; return StringUtils.unescapeJava( safeStripStringDelimiters( id.getText() ) ); } else { throw new MismatchedTokenException( DRLLexer.ID, input ); } }
@Override public String toString() { return "MismatchedTokenException("+getUnexpectedType()+"!="+expecting+")"; } }
int LA269_0 = input.LA(1); if ( (LA269_0==BACKTICK||LA269_0==CHAR_LITERAL||(LA269_0 >= DECREMENT_OP && LA269_0 <= DIFFERENCE_OP)||LA269_0==DYNAMIC||LA269_0==FLOAT_LITERAL||LA269_0==FUNCTION_MODIFIER||LA269_0==IF_CLAUSE||LA269_0==INCREMENT_OP||(LA269_0 >= LBRACE && LA269_0 <= LIDENTIFIER)||LA269_0==LPAREN||LA269_0==NATURAL_LITERAL||(LA269_0 >= NOT_OP && LA269_0 <= OBJECT_DEFINITION)||(LA269_0 >= OUTER && LA269_0 <= PACKAGE)||LA269_0==SMALLER_OP||LA269_0==STRING_LITERAL||LA269_0==STRING_START||(LA269_0 >= SUM_OP && LA269_0 <= SWITCH_CLAUSE)||LA269_0==THIS||LA269_0==UIDENTIFIER||(LA269_0 >= VERBATIM_STRING && LA269_0 <= VOID_MODIFIER)) ) { alt269=1; new MismatchedTokenException(LIDENTIFIER, input)); }
@Override public String toString() { return "MismatchedTokenException("+getUnexpectedType()+"!="+expecting+")"; } }
protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException { RecognitionException e = null; // if next token is what we are looking for then "delete" this token if (mismatchIsUnwantedToken(input, ttype)) { e = new UnwantedTokenException(ttype, input); } else if (mismatchIsMissingToken(input, follow)) { Object inserted = getMissingSymbol(input, e, ttype, follow); e = new MissingTokenException(ttype, input, inserted); } else { e = new MismatchedTokenException(ttype, input); } throw e; }
@Override public String toString() { return "MismatchedTokenException("+getUnexpectedType()+"!="+expecting+")"; } }
protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException { RecognitionException e = null; // if next token is what we are looking for then "delete" this token if (mismatchIsUnwantedToken(input, ttype)) { e = new UnwantedTokenException(ttype, input); } else if (mismatchIsMissingToken(input, follow)) { Object inserted = getMissingSymbol(input, e, ttype, follow); e = new MissingTokenException(ttype, input, inserted); } else { e = new MismatchedTokenException(ttype, input); } throw e; }
@Override public String toString() { return "MismatchedTokenException("+getUnexpectedType()+"!="+expecting+")"; } }
@Override protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException { throw new MismatchedTokenException(ttype, input); }
@Override public String toString() { return "MismatchedTokenException("+getUnexpectedType()+"!="+expecting+")"; } }
@Override protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException { throw new MismatchedTokenException(ttype, input); }
public String toString() { return "MismatchedTokenException("+getUnexpectedType()+"!="+expecting+")"; } }
@Override protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException { throw new MismatchedTokenException(ttype, input); }
@Override public SyntaxErrorMessage getSyntaxErrorMessage(IParserErrorContext context) { if (context.getRecognitionException() instanceof MismatchedTokenException) { MismatchedTokenException exception = (MismatchedTokenException) context.getRecognitionException(); if (exception.expecting >= 0 && exception.getUnexpectedType() >= 0) { String expectingTokenTypeName = context.getTokenNames()[exception.expecting]; String unexpectedTokenTypeName = context.getTokenNames()[exception.getUnexpectedType()]; if ("RULE_ID".equals(expectingTokenTypeName)) { if (!unexpectedTokenTypeName.startsWith(RULE_PREFIX) && Character.isJavaIdentifierStart(unexpectedTokenTypeName.replace("'", "").charAt(0))) { return new SyntaxErrorMessage( "Keywords of the query language are to be prefixed with the ^ character when used as an identifier", EMFIssueCodes.IDENTIFIER_AS_KEYWORD); } else if (unexpectedTokenTypeName.startsWith(RULE_PREFIX)) { return new SyntaxErrorMessage(String.format( "Mismatched input: %s '%s' found instead of the expected identifier", unexpectedTokenTypeName.substring(RULE_PREFIX.length()).toLowerCase(), exception.token.getText()), Diagnostic.SYNTAX_DIAGNOSTIC); } } } } return super.getSyntaxErrorMessage(context); }
@Override protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException { throw new MismatchedTokenException(ttype, input); }
@Override public SyntaxErrorMessage getSyntaxErrorMessage(IParserErrorContext context) { if (context.getRecognitionException() instanceof MismatchedTokenException) { MismatchedTokenException exception = (MismatchedTokenException) context.getRecognitionException(); if (exception.expecting >= 0 && exception.getUnexpectedType() >= 0) { String expectingTokenTypeName = context.getTokenNames()[exception.expecting]; String unexpectedTokenTypeName = context.getTokenNames()[exception.getUnexpectedType()]; if ("RULE_ID".equals(expectingTokenTypeName)) { if (!unexpectedTokenTypeName.startsWith(RULE_PREFIX) && Character.isJavaIdentifierStart(unexpectedTokenTypeName.replace("'", "").charAt(0))) { return new SyntaxErrorMessage( "Keywords of the query language are to be prefixed with the ^ character when used as an identifier", IssueCodes.IDENTIFIER_AS_KEYWORD); } else if (unexpectedTokenTypeName.startsWith(RULE_PREFIX)) { return new SyntaxErrorMessage(String.format( "Mismatched input: %s '%s' found instead of the expected identifier", unexpectedTokenTypeName.substring(RULE_PREFIX.length()).toLowerCase(), exception.token.getText()), Diagnostic.SYNTAX_DIAGNOSTIC); } } } } return super.getSyntaxErrorMessage(context); }
@Override protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException { throw new MismatchedTokenException(ttype, input); }
if ((mismatched.getUnexpectedType() < 0) || (mismatched.getUnexpectedType() >= treeWalker.getTokenNames().length)) unexpected = treeWalker.getTokenNames()[mismatched.getUnexpectedType()];
@Override protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException { throw new MismatchedTokenException(ttype, input); }