本文整理了Java中org.antlr.runtime.Token.setLine()
方法的一些代码示例,展示了Token.setLine()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Token.setLine()
方法的具体详情如下:
包路径:org.antlr.runtime.Token
类名称:Token
方法名:setLine
暂无
代码示例来源:origin: jdbi/jdbi
Token.DEFAULT_CHANNEL,
input.index(),input.index());
eof.setLine(getLine());
eof.setCharPositionInLine(getCharPositionInLine());
return eof;
代码示例来源:origin: antlr/antlr3
public void setLine(int line) {
token.setLine(line);
}
代码示例来源:origin: antlr/antlr3
public void setLine(int line) {
token.setLine(line);
}
代码示例来源:origin: org.apache.pig/pig
public PigParserNode(Token t, String fileName, int lineOffset) {
super(t);
if (t != null && lineOffset > 0) {
t.setLine(t.getLine() + lineOffset);
}
this.fileName = fileName;
}
代码示例来源:origin: btrplace/scheduler
public void offer(int ttype, String ttext) {
Token t = new CommonToken(ttype, ttext);
t.setLine(getLine());
t.setCharPositionInLine(getCharPositionInLine());
emit(t);
}
代码示例来源:origin: org.btrplace/btrpsl
public void offer(int ttype, String ttext) {
Token t = new CommonToken(ttype, ttext);
t.setLine(getLine());
t.setCharPositionInLine(getCharPositionInLine());
emit(t);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.drools
/** The standard method called to automatically emit a token at the
* outermost lexical rule. The token object should point into the
* char buffer start..stop. If there is a text override in 'text',
* use that to set the token's text. Override this method to emit
* custom Token objects.
*/
public Token emit() {
Token t = new DroolsToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1);
t.setLine(state.tokenStartLine);
t.setText(state.text);
t.setCharPositionInLine(state.tokenStartCharPositionInLine);
emit(t);
return t;
}
代码示例来源:origin: antlr/antlr3
/** Returns the EOF token (default), if you need
* to return a custom token instead override this method.
*/
public Token getEOFToken() {
Token eof = new CommonToken(input,Token.EOF,
Token.DEFAULT_CHANNEL,
input.index(),input.index());
eof.setLine(getLine());
eof.setCharPositionInLine(getCharPositionInLine());
return eof;
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/** Returns the EOF token (default), if you need
* to return a custom token instead override this method.
*/
public Token getEOFToken() {
Token eof = new CommonToken(input,Token.EOF,
Token.DEFAULT_CHANNEL,
input.index(),input.index());
eof.setLine(getLine());
eof.setCharPositionInLine(getCharPositionInLine());
return eof;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr-runtime
/** The standard method called to automatically emit a token at the
* outermost lexical rule. The token object should point into the
* char buffer start..stop. If there is a text override in 'text',
* use that to set the token's text. Override this method to emit
* custom Token objects.
*
* If you are building trees, then you should also override
* Parser or TreeParser.getMissingSymbol().
*/
public Token emit() {
Token t = new CommonToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1);
t.setLine(state.tokenStartLine);
t.setText(state.text);
t.setCharPositionInLine(state.tokenStartCharPositionInLine);
emit(t);
return t;
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/** Returns the EOF token (default), if you need
* to return a custom token instead override this method.
*/
public Token getEOFToken() {
Token eof = new CommonToken(input,Token.EOF,
Token.DEFAULT_CHANNEL,
input.index(),input.index());
eof.setLine(getLine());
eof.setCharPositionInLine(getCharPositionInLine());
return eof;
}
代码示例来源:origin: antlr/antlr3
/** Returns the EOF token (default), if you need
* to return a custom token instead override this method.
*/
public Token getEOFToken() {
Token eof = new CommonToken(input,Token.EOF,
Token.DEFAULT_CHANNEL,
input.index(),input.index());
eof.setLine(getLine());
eof.setCharPositionInLine(getCharPositionInLine());
return eof;
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/** The standard method called to automatically emit a token at the
* outermost lexical rule. The token object should point into the
* char buffer start..stop. If there is a text override in 'text',
* use that to set the token's text. Override this method to emit
* custom Token objects.
*
* If you are building trees, then you should also override
* Parser or TreeParser.getMissingSymbol().
*/
public Token emit() {
Token t = new CommonToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1);
t.setLine(state.tokenStartLine);
t.setText(state.text);
t.setCharPositionInLine(state.tokenStartCharPositionInLine);
emit(t);
return t;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr-runtime
/** Returns the EOF token (default), if you need
* to return a custom token instead override this method.
*/
public Token getEOFToken() {
Token eof = new CommonToken(input,Token.EOF,
Token.DEFAULT_CHANNEL,
input.index(),input.index());
eof.setLine(getLine());
eof.setCharPositionInLine(getCharPositionInLine());
return eof;
}
代码示例来源:origin: antlr/antlr3
/** The standard method called to automatically emit a token at the
* outermost lexical rule. The token object should point into the
* char buffer start..stop. If there is a text override in 'text',
* use that to set the token's text. Override this method to emit
* custom Token objects.
*
* If you are building trees, then you should also override
* Parser or TreeParser.getMissingSymbol().
*/
public Token emit() {
Token t = new CommonToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1);
t.setLine(state.tokenStartLine);
t.setText(state.text);
t.setCharPositionInLine(state.tokenStartCharPositionInLine);
emit(t);
return t;
}
代码示例来源:origin: antlr/antlr3
/** The standard method called to automatically emit a token at the
* outermost lexical rule. The token object should point into the
* char buffer start..stop. If there is a text override in 'text',
* use that to set the token's text. Override this method to emit
* custom Token objects.
*
* If you are building trees, then you should also override
* Parser or TreeParser.getMissingSymbol().
*/
public Token emit() {
Token t = new CommonToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1);
t.setLine(state.tokenStartLine);
t.setText(state.text);
t.setCharPositionInLine(state.tokenStartCharPositionInLine);
emit(t);
return t;
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/** The standard method called to automatically emit a token at the
* outermost lexical rule. The token object should point into the
* char buffer start..stop. If there is a text override in 'text',
* use that to set the token's text. Override this method to emit
* custom Token objects.
*
* If you are building trees, then you should also override
* Parser or TreeParser.getMissingSymbol().
*/
public Token emit() {
Token t = new CommonToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1);
t.setLine(state.tokenStartLine);
t.setText(state.text);
t.setCharPositionInLine(state.tokenStartCharPositionInLine);
emit(t);
return t;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
/** The standard method called to automatically emit a token at the
* outermost lexical rule. The token object should point into the
* char buffer start..stop. If there is a text override in 'text',
* use that to set the token's text. Override this method to emit
* custom Token objects.
*
* If you are building trees, then you should also override
* Parser or TreeParser.getMissingSymbol().
*/
public Token emit() {
Token t = new CommonToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1);
t.setLine(state.tokenStartLine);
t.setText(state.text);
t.setCharPositionInLine(state.tokenStartCharPositionInLine);
emit(t);
return t;
}
代码示例来源:origin: uk.co.nichesolutions/antlr4
public final void mERRCHAR() throws RecognitionException {
try {
int _type = ERRCHAR;
int _channel = DEFAULT_TOKEN_CHANNEL;
// org/antlr/v4/parse/ANTLRLexer.g:787:5: ( . )
// org/antlr/v4/parse/ANTLRLexer.g:787:7: .
{
matchAny(); if (state.failed) return;
if ( state.backtracking==0 ) {
Token t = new CommonToken(input, state.type, state.channel, state.tokenStartCharIndex, getCharIndex()-1);
t.setLine(state.tokenStartLine);
t.setText(state.text);
t.setCharPositionInLine(state.tokenStartCharPositionInLine);
String msg = getTokenErrorDisplay(t) + " came as a complete surprise to me";
grammarError(ErrorType.SYNTAX_ERROR, t, msg);
state.syntaxErrors++;
skip();
}
}
state.type = _type;
state.channel = _channel;
}
finally {
// do for sure before leaving
}
}
// $ANTLR end "ERRCHAR"
代码示例来源:origin: org.eclipse.epsilon/epsilon-core
protected void updateASTLocations(AST ast) {
ast.setColumn(preprocessor.getTrace().getEglColumnNumberFor(ast.getLine(), ast.getColumn()));
ast.setLine(preprocessor.getTrace().getEglLineNumberFor(ast.getLine()));
for (Token token : ast.getExtraTokens()) {
if (token == null) continue;
token.setCharPositionInLine(preprocessor.getTrace().getEglColumnNumberFor(token.getLine(), token.getCharPositionInLine()));
token.setLine(preprocessor.getTrace().getEglLineNumberFor(token.getLine()));
}
boolean done = updateRegionsOfStaticTextASTs(ast);
ast.setRegion(null); // Force ast to recompute its region
if (!done) {
for (AST child : ast.getChildren()) {
updateASTLocations(child);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!