org.antlr.runtime.Token.getCharPositionInLine()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中org.antlr.runtime.Token.getCharPositionInLine()方法的一些代码示例,展示了Token.getCharPositionInLine()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Token.getCharPositionInLine()方法的具体详情如下:
包路径:org.antlr.runtime.Token
类名称:Token
方法名:getCharPositionInLine

Token.getCharPositionInLine介绍

[英]The index of the first character relative to the beginning of the line 0..n-1
[中]相对于第0行开头的第一个字符的索引。。n-1

代码示例

代码示例来源:origin: JesusFreke/smali

txt = "<no text>";
return "[@"+t.getTokenIndex()+","+ct.getStartIndex()+":"+ct.getStopIndex()+"='"+txt+"',<"+tokenNames[t.getType()]+">"+channelStr+","+t.getLine()+":"+t.getCharPositionInLine()+"]";

代码示例来源:origin: apache/phoenix

private void throwRecognitionException(Token t) throws RecognitionException {
  RecognitionException e = new RecognitionException();
  e.token = t;
  e.line = t.getLine();
  e.charPositionInLine = t.getCharPositionInLine();
  e.input = input;
  throw e;
}

代码示例来源:origin: forcedotcom/phoenix

private void throwRecognitionException(Token t) throws RecognitionException {
  RecognitionException e = new RecognitionException();
  e.token = t;
  e.line = t.getLine();
  e.charPositionInLine = t.getCharPositionInLine();
  e.input = input;
  throw e;
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

/**
 * Checks that the specified token is valid.
 *
 * @param token the token to check
 * @return <code>true</code> if it is considered as valid, <code>false</code> otherwise.
 */
private static boolean isTokenValid(Token token)
{
  return token.getLine() > 0 && token.getCharPositionInLine() >= 0;
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server

/**
 * Checks that the specified token is valid.
 *
 * @param token the token to check
 * @return <code>true</code> if it is considered as valid, <code>false</code> otherwise.
 */
private static boolean isTokenValid(Token token)
{
  return token.getLine() > 0 && token.getCharPositionInLine() >= 0;
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

/**
 * Checks that the specified token is valid.
 *
 * @param token the token to check
 * @return <code>true</code> if it is considered as valid, <code>false</code> otherwise.
 */
private static boolean isTokenValid(Token token)
{
  return token.getLine() > 0 && token.getCharPositionInLine() >= 0;
}

代码示例来源:origin: testwhat/SmaliEx

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);
}

代码示例来源:origin: org.ceylon-lang/com.redhat.ceylon.typechecker

private static String toEndLocation(Token token) {
  return token.getLine() + ":" + 
      (token.getCharPositionInLine()
      + token.getText().length()-1);
}

代码示例来源:origin: org.apache.phoenix/phoenix-core

private void throwRecognitionException(Token t) throws RecognitionException {
  RecognitionException e = new RecognitionException();
  e.token = t;
  e.line = t.getLine();
  e.charPositionInLine = t.getCharPositionInLine();
  e.input = input;
  throw e;
}

代码示例来源:origin: CvvT/AppTroy

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);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.drools

private void isIdentifier( Token name ){
  String nameString = name.getText();
  if( ! namePat.matcher( nameString ).matches() ){
    errors.add(new ParserError( "invalid variable identifier " + nameString,
                  name.getLine(), name.getCharPositionInLine() ) );
  }
}

代码示例来源:origin: testwhat/SmaliEx

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);
}

代码示例来源:origin: org.smali/smali

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);
}

代码示例来源:origin: antlr/antlr3

protected String serializeToken(Token t) {
  StringBuffer buf = new StringBuffer(50);
  buf.append(t.getTokenIndex()); buf.append('\t');
  buf.append(t.getType()); buf.append('\t');
  buf.append(t.getChannel()); buf.append('\t');
  buf.append(t.getLine()); buf.append('\t');
  buf.append(t.getCharPositionInLine());
  serializeText(buf, t.getText());
  return buf.toString();
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

protected String serializeToken(Token t) {
  StringBuffer buf = new StringBuffer(50);
  buf.append(t.getTokenIndex()); buf.append('\t');
  buf.append(t.getType()); buf.append('\t');
  buf.append(t.getChannel()); buf.append('\t');
  buf.append(t.getLine()); buf.append('\t');
  buf.append(t.getCharPositionInLine());
  serializeText(buf, t.getText());
  return buf.toString();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr-runtime

protected String serializeToken(Token t) {
  StringBuffer buf = new StringBuffer(50);
  buf.append(t.getTokenIndex()); buf.append('\t');
  buf.append(t.getType()); buf.append('\t');
  buf.append(t.getChannel()); buf.append('\t');
  buf.append(t.getLine()); buf.append('\t');
  buf.append(t.getCharPositionInLine());
  serializeText(buf, t.getText());
  return buf.toString();
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

protected String serializeToken(Token t) {
  StringBuffer buf = new StringBuffer(50);
  buf.append(t.getTokenIndex()); buf.append('\t');
  buf.append(t.getType()); buf.append('\t');
  buf.append(t.getChannel()); buf.append('\t');
  buf.append(t.getLine()); buf.append('\t');
  buf.append(t.getCharPositionInLine());
  serializeText(buf, t.getText());
  return buf.toString();
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

protected String serializeToken(Token t) {
  StringBuffer buf = new StringBuffer(50);
  buf.append(t.getTokenIndex()); buf.append('\t');
  buf.append(t.getType()); buf.append('\t');
  buf.append(t.getChannel()); buf.append('\t');
  buf.append(t.getLine()); buf.append('\t');
  buf.append(t.getCharPositionInLine());
  serializeText(buf, t.getText());
  return buf.toString();
}

代码示例来源:origin: com.atlassian.jira/jira-core

private String checkFieldName(Token token)
{
  final String text = token.getText();
  if (StringUtils.isBlank(text))
  {
    reportError(JqlParseErrorMessages.emptyFieldName(token.getLine(), token.getCharPositionInLine()), null);
  }
  return text;
}

代码示例来源:origin: com.atlassian.jira/jira-core

private String checkFunctionName(Token token)
{
  final String text = token.getText();
  if (StringUtils.isBlank(text))
  {
    reportError(JqlParseErrorMessages.emptyFunctionName(token.getLine(), token.getCharPositionInLine()), null);
  }
  return text;
}

相关文章