org.antlr.runtime.IntStream Java Examples

The following examples show how to use org.antlr.runtime.IntStream. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExtCss3Parser.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Consume tokens until one matches the given token set */
    @Override
    public void consumeUntil(IntStream i, BitSet set) {
//        System.out.println("consumeUntil(" + set.toString(getTokenNames()) + ")");
        Token ttype;
        List<Token> skipped = new ArrayList<>();
        beginResync();
        try {
            while ((ttype = input.LT(1)) != null && ttype.getType() != Token.EOF && !set.member(ttype.getType())) {
//            System.out.println("consume during recover LA(1)=" + getTokenNames()[input.LA(1)]);
                input.consume();
                skipped.add(ttype);
            }
        } finally {
            endResync();
        }
        ((NbParseTreeBuilder) dbg).consumeSkippedTokens(skipped);
    }
 
Example #2
Source File: SemanticException.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
SemanticException(IntStream input, CommonTree tree, String errorMessage, Object... messageArguments) {
    super();
    this.input = input;
    this.token = tree.getToken();
    this.index = tree.getTokenStartIndex();
    this.line = token.getLine();
 this.charPositionInLine = token.getCharPositionInLine();
    this.errorMessage = String.format(errorMessage, messageArguments);
}
 
Example #3
Source File: SemanticException.java    From AppTroy with Apache License 2.0 5 votes vote down vote up
SemanticException(IntStream input, CommonTree tree, String errorMessage, Object... messageArguments) {
    super();
    this.input = input;
    this.token = tree.getToken();
    this.index = tree.getTokenStartIndex();
    this.line = token.getLine();
 this.charPositionInLine = token.getCharPositionInLine();
    this.errorMessage = String.format(errorMessage, messageArguments);
}
 
Example #4
Source File: SemanticException.java    From AppTroy with Apache License 2.0 5 votes vote down vote up
SemanticException(IntStream input, Token token, String errorMessage, Object... messageArguments) {
    super();
    this.input = input;
    this.token = token;
    this.index = ((CommonToken)token).getStartIndex();
    this.line = token.getLine();
 this.charPositionInLine = token.getCharPositionInLine();
    this.errorMessage = String.format(errorMessage, messageArguments);
}
 
Example #5
Source File: SemanticException.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
SemanticException(IntStream input, Token token, String errorMessage, Object... messageArguments) {
    super();
    this.input = input;
    this.token = token;
    this.index = ((CommonToken)token).getStartIndex();
    this.line = token.getLine();
 this.charPositionInLine = token.getCharPositionInLine();
    this.errorMessage = String.format(errorMessage, messageArguments);
}
 
Example #6
Source File: SemanticException.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
SemanticException(IntStream input, CommonTree tree, String errorMessage, Object... messageArguments) {
    super();
    this.input = input;
    this.token = tree.getToken();
    this.index = tree.getTokenStartIndex();
    this.line = token.getLine();
 this.charPositionInLine = token.getCharPositionInLine();
    this.errorMessage = String.format(errorMessage, messageArguments);
}
 
Example #7
Source File: InvalidScalarProjectionException.java    From spork with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor that takes an additional string to be concatenated 
 *  with the exception message 
 */
public InvalidScalarProjectionException(IntStream input, SourceLocation loc,
        ScalarExpression expr, String msg) {
    super( input, loc );
    this.scalarExpr = expr;
    this.msg = new String(msg);
}
 
Example #8
Source File: BaseInternalContentAssistParser.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void recover(IntStream stream, RecognitionException ex) {
	if (recoveryListener != null)
		recoveryListener.beginErrorRecovery();
	removeUnexpectedElements();
	if (ex instanceof FailedPredicateException && ex.token.getType() == Token.EOF) {
		failedPredicateAtEOF = true;
	}
	super.recover(stream, ex);
	if (recoveryListener != null)
		recoveryListener.endErrorRecovery();
}
 
Example #9
Source File: BaseInternalContentAssistParser.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException {
	try {
		mismatch = true;
		return super.recoverFromMismatchedToken(input, ttype, follow);
	} finally {
		mismatch = false;
	}
}
 
Example #10
Source File: LogicalPlanBuilder.java    From spork with Apache License 2.0 5 votes vote down vote up
LogicalPlanBuilder(PigContext pigContext, String scope, Map<String, String> fileNameMap,
        IntStream input) {
    this.pigContext = pigContext;
    this.scope = scope;
    this.fileNameMap = fileNameMap;
    this.intStream = input;
    this.filter = new BlackAndWhitelistFilter(this.pigContext);
}
 
Example #11
Source File: LogicalPlanBuilder.java    From spork with Apache License 2.0 5 votes vote down vote up
LogicalPlanBuilder(IntStream input) throws ExecException {
    pigContext = new PigContext( ExecType.LOCAL, new Properties() );
    pigContext.connect();
    this.scope = "test";
    this.fileNameMap = new HashMap<String, String>();
    this.intStream = input;
    this.filter = new BlackAndWhitelistFilter(this.pigContext);
}
 
Example #12
Source File: LogicalPlanBuilder.java    From spork with Apache License 2.0 5 votes vote down vote up
String buildStreamOp(SourceLocation loc, String alias, String inputAlias, StreamingCommand command,
        LogicalSchema schema, IntStream input)
throws RecognitionException {
    try {
        LOStream op = new LOStream( plan, pigContext.createExecutableManager(), command, schema );
        return buildOp( loc, op, alias, inputAlias, null );
    } catch (ExecException ex) {
        throw new PlanGenerationFailureException( input, loc, ex );
    }
}
 
Example #13
Source File: BaseInternalContentAssistParser.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public boolean mismatchIsUnwantedToken(IntStream input, int ttype) {
	try {
		inMismatchIsUnwantedToken = true;
		boolean result = super.mismatchIsUnwantedToken(input, ttype);
		return result;
	} finally {
		inMismatchIsUnwantedToken = false;
	}
}
 
Example #14
Source File: SemanticException.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
SemanticException(IntStream input, CommonTree tree, String errorMessage, Object... messageArguments) {
    super();
    this.input = input;
    this.token = tree.getToken();
    this.index = tree.getTokenStartIndex();
    this.line = token.getLine();
 this.charPositionInLine = token.getCharPositionInLine();
    this.errorMessage = String.format(errorMessage, messageArguments);
}
 
Example #15
Source File: SemanticException.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
SemanticException(IntStream input, Token token, String errorMessage, Object... messageArguments) {
    super();
    this.input = input;
    this.token = token;
    this.index = ((CommonToken)token).getStartIndex();
    this.line = token.getLine();
 this.charPositionInLine = token.getCharPositionInLine();
    this.errorMessage = String.format(errorMessage, messageArguments);
}
 
Example #16
Source File: SemanticException.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
SemanticException(IntStream input, CommonTree tree, String errorMessage, Object... messageArguments) {
    super();
    this.input = input;
    this.token = tree.getToken();
    this.index = tree.getTokenStartIndex();
    this.line = token.getLine();
 this.charPositionInLine = token.getCharPositionInLine();
    this.errorMessage = String.format(errorMessage, messageArguments);
}
 
Example #17
Source File: SemanticException.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
SemanticException(IntStream input, Token token, String errorMessage, Object... messageArguments) {
    super();
    this.input = input;
    this.token = token;
    this.index = ((CommonToken)token).getStartIndex();
    this.line = token.getLine();
 this.charPositionInLine = token.getCharPositionInLine();
    this.errorMessage = String.format(errorMessage, messageArguments);
}
 
Example #18
Source File: DFA.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public int predict(IntStream input) throws RecognitionException {
	try {
		getRecognizer().beginDFAPrediction();
		return super.predict(input);
	} finally {
		getRecognizer().endDFAPrediction();
	}
}
 
Example #19
Source File: DroolsMismatchedTokenException.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
public DroolsMismatchedTokenException(int expecting,
                                      String tokenText,
                                      IntStream input) {
    super( expecting,
           input );
    this.tokenText = tokenText;
}
 
Example #20
Source File: DroolsMissingTokenException.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
public DroolsMissingTokenException(int expecting,
                                   String text,
                                   IntStream input,
                                   Object inserted) {
    super( expecting,
           input,
           inserted );
    this.tokenText = text;
}
 
Example #21
Source File: SemanticException.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
SemanticException(IntStream input, Token token, String errorMessage, Object... messageArguments) {
    super();
    this.input = input;
    this.token = token;
    this.index = ((CommonToken)token).getStartIndex();
    this.line = token.getLine();
 this.charPositionInLine = token.getCharPositionInLine();
    this.errorMessage = String.format(errorMessage, messageArguments);
}
 
Example #22
Source File: SemanticException.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
SemanticException(IntStream input, String errorMessage, Object... messageArguments) {
    super(input);
    this.errorMessage = String.format(errorMessage, messageArguments);
}
 
Example #23
Source File: PlanGenerationFailureException.java    From spork with Apache License 2.0 4 votes vote down vote up
public PlanGenerationFailureException(IntStream input, SourceLocation loc, Exception ex) {
    super( input, loc );
    this.ex = ex;
}
 
Example #24
Source File: DFA.java    From jFuzzyLogic with GNU Lesser General Public License v3.0 4 votes vote down vote up
public int predict(IntStream input) {
	Interpreter interp = new Interpreter(nfa.grammar, input);
	return interp.predict(this);
}
 
Example #25
Source File: OdexedInstructionException.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
OdexedInstructionException(IntStream input, String odexedInstruction) {
    super(input);
    this.odexedInstruction = odexedInstruction;
}
 
Example #26
Source File: SemanticException.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
SemanticException(IntStream input, Exception ex) {
    super(input);
    this.errorMessage = ex.getMessage();
}
 
Example #27
Source File: PigRecognitionException.java    From spork with Apache License 2.0 4 votes vote down vote up
public PigRecognitionException(IntStream input, SourceLocation loc) {
    super( );
    this.line = loc.line();
    this.charPositionInLine = loc.offset();
    this.location = loc;
}
 
Example #28
Source File: InvalidPathException.java    From spork with Apache License 2.0 4 votes vote down vote up
public InvalidPathException(IntStream input, SourceLocation loc, MalformedURLException ex) {
    super( input, loc );
    this.ex = ex;
}
 
Example #29
Source File: OdexedInstructionException.java    From HeyGirl with Apache License 2.0 4 votes vote down vote up
OdexedInstructionException(IntStream input, String odexedInstruction) {
    super(input);
    this.odexedInstruction = odexedInstruction;
}
 
Example #30
Source File: InvalidScalarProjectionException.java    From spork with Apache License 2.0 4 votes vote down vote up
public InvalidScalarProjectionException(IntStream input, SourceLocation loc,
        ScalarExpression expr) {
    super( input, loc );
    this.scalarExpr = expr;
    this.msg = null;
}