Java Code Examples for org.antlr.runtime.tree.CommonTree#getTokenStartIndex()

The following examples show how to use org.antlr.runtime.tree.CommonTree#getTokenStartIndex() . 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: CompilationState.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void emit(CommonTree opAST, short opcode) {
    ensureCapacity(1);
    if ( opAST!=null ) {
        int i = opAST.getTokenStartIndex();
        int j = opAST.getTokenStopIndex();
        int p = ((CommonToken)tokens.get(i)).getStartIndex();
        int q = ((CommonToken)tokens.get(j)).getStopIndex();
        if ( !(p<0 || q<0) ) impl.sourceMap[ip] = new Interval(p, q);
    }
    impl.instrs[ip++] = (byte)opcode;
}
 
Example 2
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 3
Source File: CompilationState.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void emit(CommonTree opAST, short opcode) {
	ensureCapacity(1);
	if ( opAST!=null ) {
		int i = opAST.getTokenStartIndex();
		int j = opAST.getTokenStopIndex();
		int p = ((CommonToken)tokens.get(i)).getStartIndex();
		int q = ((CommonToken)tokens.get(j)).getStopIndex();
		if ( !(p<0 || q<0) ) impl.sourceMap[ip] = new Interval(p, q);
	}
	impl.instrs[ip++] = (byte)opcode;
}
 
Example 4
Source File: CompilationState.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void emit(CommonTree opAST, short opcode) {
    ensureCapacity(1);
    if ( opAST!=null ) {
        int i = opAST.getTokenStartIndex();
        int j = opAST.getTokenStopIndex();
        int p = ((CommonToken)tokens.get(i)).getStartIndex();
        int q = ((CommonToken)tokens.get(j)).getStopIndex();
        if ( !(p<0 || q<0) ) impl.sourceMap[ip] = new Interval(p, q);
    }
    impl.instrs[ip++] = (byte)opcode;
}
 
Example 5
Source File: CompilationState.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void emit(CommonTree opAST, short opcode) {
    ensureCapacity(1);
    if ( opAST !=null ) {
        int i = opAST.getTokenStartIndex();
        int j = opAST.getTokenStopIndex();
        int p = ((CommonToken)tokens.get(i)).getStartIndex();
        int q = ((CommonToken)tokens.get(j)).getStopIndex();
        if ( !(p< 0 || q< 0) ) impl.sourceMap[ip] = new Interval(p, q);
    }
    impl.instrs[ip++] = (byte)opcode;
}
 
Example 6
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 7
Source File: CompilationState.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void emit(CommonTree opAST, short opcode) {
    ensureCapacity(1);
    if ( opAST!=null ) {
        int i = opAST.getTokenStartIndex();
        int j = opAST.getTokenStopIndex();
        int p = ((CommonToken)tokens.get(i)).getStartIndex();
        int q = ((CommonToken)tokens.get(j)).getStopIndex();
        if ( !(p<0 || q<0) ) impl.sourceMap[ip] = new Interval(p, q);
    }
    impl.instrs[ip++] = (byte)opcode;
}
 
Example 8
Source File: CompilationState.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void emit(CommonTree opAST, short opcode) {
    ensureCapacity(1);
    if ( opAST!=null ) {
        int i = opAST.getTokenStartIndex();
        int j = opAST.getTokenStopIndex();
        int p = ((CommonToken)tokens.get(i)).getStartIndex();
        int q = ((CommonToken)tokens.get(j)).getStopIndex();
        if ( !(p<0 || q<0) ) impl.sourceMap[ip] = new Interval(p, q);
    }
    impl.instrs[ip++] = (byte)opcode;
}
 
Example 9
Source File: CompilationState.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void emit(CommonTree opAST, short opcode) {
    ensureCapacity(1);
    if ( opAST !=null ) {
        int i = opAST.getTokenStartIndex();
        int j = opAST.getTokenStopIndex();
        int p = ((CommonToken)tokens.get(i)).getStartIndex();
        int q = ((CommonToken)tokens.get(j)).getStopIndex();
        if ( !(p< 0 || q< 0) ) impl.sourceMap[ip] = new Interval(p, q);
    }
    impl.instrs[ip++] = (byte)opcode;
}
 
Example 10
Source File: CompilationState.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void emit(CommonTree opAST, short opcode) {
    ensureCapacity(1);
    if ( opAST!=null ) {
        int i = opAST.getTokenStartIndex();
        int j = opAST.getTokenStopIndex();
        int p = ((CommonToken)tokens.get(i)).getStartIndex();
        int q = ((CommonToken)tokens.get(j)).getStopIndex();
        if ( !(p< 0 || q< 0) ) impl.sourceMap[ip] = new Interval(p, q);
    }
    impl.instrs[ip++] = (byte)opcode;
}
 
Example 11
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 12
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 13
Source File: CompilationState.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void emit(CommonTree opAST, short opcode) {
    ensureCapacity(1);
    if ( opAST !=null ) {
        int i = opAST.getTokenStartIndex();
        int j = opAST.getTokenStopIndex();
        int p = ((CommonToken)tokens.get(i)).getStartIndex();
        int q = ((CommonToken)tokens.get(j)).getStopIndex();
        if ( !(p<0 || q<0) ) impl.sourceMap[ip] = new Interval(p, q);
    }
    impl.instrs[ip++] = (byte)opcode;
}
 
Example 14
Source File: CompilationState.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void emit(CommonTree opAST, short opcode) {
    ensureCapacity(1);
    if ( opAST !=null ) {
        int i = opAST.getTokenStartIndex();
        int j = opAST.getTokenStopIndex();
        int p = ((CommonToken)tokens.get(i)).getStartIndex();
        int q = ((CommonToken)tokens.get(j)).getStopIndex();
        if ( !(p<0 || q<0) ) impl.sourceMap[ip] = new Interval(p, q);
    }
    impl.instrs[ip++] = (byte)opcode;
}
 
Example 15
Source File: CompilationState.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void emit(CommonTree opAST, short opcode) {
    ensureCapacity(1);
    if ( opAST !=null ) {
        int i = opAST.getTokenStartIndex();
        int j = opAST.getTokenStopIndex();
        int p = ((CommonToken)tokens.get(i)).getStartIndex();
        int q = ((CommonToken)tokens.get(j)).getStopIndex();
        if ( !(p<0 || q<0) ) impl.sourceMap[ip] = new Interval(p, q);
    }
    impl.instrs[ip++] = (byte)opcode;
}
 
Example 16
Source File: CompilationState.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void emit(CommonTree opAST, short opcode) {
    ensureCapacity(1);
    if ( opAST !=null ) {
        int i = opAST.getTokenStartIndex();
        int j = opAST.getTokenStopIndex();
        int p = ((CommonToken)tokens.get(i)).getStartIndex();
        int q = ((CommonToken)tokens.get(j)).getStopIndex();
        if ( !(p<0 || q<0) ) impl.sourceMap[ip] = new Interval(p, q);
    }
    impl.instrs[ip++] = (byte)opcode;
}
 
Example 17
Source File: CompilationState.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void emit(CommonTree opAST, short opcode) {
    ensureCapacity(1);
    if ( opAST !=null ) {
        int i = opAST.getTokenStartIndex();
        int j = opAST.getTokenStopIndex();
        int p = ((CommonToken)tokens.get(i)).getStartIndex();
        int q = ((CommonToken)tokens.get(j)).getStopIndex();
        if ( !(p<0 || q<0) ) impl.sourceMap[ip] = new Interval(p, q);
    }
    impl.instrs[ip++] = (byte)opcode;
}
 
Example 18
Source File: CompilationState.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void emit(CommonTree opAST, short opcode) {
    ensureCapacity(1);
    if ( opAST !=null ) {
        int i = opAST.getTokenStartIndex();
        int j = opAST.getTokenStopIndex();
        int p = ((CommonToken)tokens.get(i)).getStartIndex();
        int q = ((CommonToken)tokens.get(j)).getStopIndex();
        if ( !(p<0 || q<0) ) impl.sourceMap[ip] = new Interval(p, q);
    }
    impl.instrs[ip++] = (byte)opcode;
}
 
Example 19
Source File: CompilationState.java    From codebuff with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void emit(CommonTree opAST, short opcode) {
    ensureCapacity(1);
    if ( opAST !=null ) {
        int i = opAST.getTokenStartIndex();
        int j = opAST.getTokenStopIndex();
        int p = ((CommonToken)tokens.get(i)).getStartIndex();
        int q = ((CommonToken)tokens.get(j)).getStopIndex();
        if ( !(p<0 || q<0) ) impl.sourceMap[ip] = new Interval(p, q);
    }
    impl.instrs[ip++] = (byte)opcode;
}
 
Example 20
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);
}