antlr.Token.setType()方法的使用及代码示例

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

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

Token.setType介绍

暂无

代码示例

代码示例来源:origin: hibernate/hibernate-orm

@Override
public void firstPathTokenWeakKeywords() throws TokenStreamException {
  int t = LA( 1 );
  switch ( t ){
    case DOT:
      LT(0).setType( IDENT );
  }
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public void handleDotIdent() throws TokenStreamException {
  // This handles HHH-354, where there is a strange property name in a where clause.
  // If the lookahead contains a DOT then something that isn't an IDENT...
  if ( LA( 1 ) == DOT && LA( 2 ) != IDENT ) {
    // See if the second lookahead token can be an identifier.
    HqlToken t = (HqlToken) LT( 2 );
    if ( t.isPossibleID() ) {
      // Set it!
      LT( 2 ).setType( IDENT );
      if ( LOG.isDebugEnabled() ) {
        LOG.debugf( "handleDotIdent() : new LT(2) token - %s", LT( 1 ) );
      }
    }
  }
}

代码示例来源:origin: hibernate/hibernate-orm

token.setType( HqlTokenTypes.WEIRD_IDENT );
astFactory.addASTChild( currentAST, astFactory.create( token ) );
consume();

代码示例来源:origin: hibernate/hibernate-orm

@Override
public void weakKeywords() throws TokenStreamException {
  int t = LA( 1 );
  switch ( t ) {
    case ORDER:
    case GROUP:
      // Case 1: Multi token keywords GROUP BY and ORDER BY
      // The next token ( LT(2) ) should be 'by'... otherwise, this is just an ident.
      if ( LA( 2 ) != LITERAL_by ) {
        LT( 1 ).setType( IDENT );
        if ( LOG.isDebugEnabled() ) {
          LOG.debugf( "weakKeywords() : new LT(1) token - %s", LT( 1 ) );
        }
      }
      break;
    default:
      // Case 2: The current token is after FROM and before '.'.
      if ( LA( 0 ) == FROM && t != IDENT && LA( 2 ) == DOT ) {
        HqlToken hqlToken = (HqlToken) LT( 1 );
        if ( hqlToken.isPossibleID() ) {
          hqlToken.setType( IDENT );
          if ( LOG.isDebugEnabled() ) {
            LOG.debugf( "weakKeywords() : new LT(1) token - %s", LT( 1 ) );
          }
        }
      }
      break;
  }
}

代码示例来源:origin: hibernate/hibernate-orm

_returnToken.setType(_ttype);
return _returnToken;

代码示例来源:origin: jenkinsci/jenkins

_ttype = _returnToken.getType();
_ttype = testLiteralsTable(_ttype);
_returnToken.setType(_ttype);
return _returnToken;

代码示例来源:origin: hibernate/hibernate-orm

_returnToken.setType(_ttype);
return _returnToken;

代码示例来源:origin: hibernate/hibernate-orm

_ttype = _returnToken.getType();
_ttype = testLiteralsTable(_ttype);
_returnToken.setType(_ttype);
return _returnToken;

代码示例来源:origin: jenkinsci/jenkins

_ttype = _returnToken.getType();
_ttype = testLiteralsTable(_ttype);
_returnToken.setType(_ttype);
return _returnToken;

代码示例来源:origin: hibernate/hibernate-orm

_returnToken.setType(_ttype);
return _returnToken;

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

public void setType(int type) {
  token.setType(type);
}

代码示例来源:origin: org.xtext/antlr-generator

public void setType(int type) {
  token.setType(type);
}

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

_returnToken.setType(_ttype);
return _returnToken;

代码示例来源:origin: checkstyle/checkstyle

_returnToken.setType(_ttype);
return _returnToken;

代码示例来源:origin: hibernate/hibernate

public void weakKeywords() throws TokenStreamException {
  int t = LA( 1 );
  switch ( t ) {
    case ORDER:
    case GROUP:
      // The next token ( LT(2) ) should be 'by'... otherwise, this is just an ident.
      if ( LA( 2 ) != LITERAL_by ) {
        LT( 1 ).setType( IDENT );
        if ( log.isDebugEnabled() ) {
          log.debug( "weakKeywords() : new LT(1) token - " + LT( 1 ) );
        }
      }
      break;
    default:
      break;
  }
}

代码示例来源:origin: org.glassfish.external/antlr

protected Token makeToken(int t) {
  try {
    Token tok = (Token)tokenObjectClass.newInstance();
    tok.setType(t);
    tok.setColumn(inputState.tokenStartColumn);
    tok.setLine(inputState.tokenStartLine);
    // tracking real start line now: tok.setLine(inputState.line);
    return tok;
  }
  catch (InstantiationException ie) {
    panic("can't instantiate token: " + tokenObjectClass);
  }
  catch (IllegalAccessException iae) {
    panic("Token class is not accessible" + tokenObjectClass);
  }
  return Token.badToken;
}

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

public void handleDotIdent() throws TokenStreamException {
  // This handles HHH-354, where there is a strange property name in a where clause.
  // If the lookahead contains a DOT then something that isn't an IDENT...
  if (LA(1) == DOT && LA(2) != IDENT) {
    // See if the second lookahed token can be an identifier.
    HqlToken t = (HqlToken)LT(2);
    if (t.isPossibleID())
    {
      // Set it!
      LT( 2 ).setType( IDENT );
      if ( log.isDebugEnabled() ) {
        log.debug( "handleDotIdent() : new LT(2) token - " + LT( 1 ) );
      }
    }
  }
}

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

public void weakKeywords() throws TokenStreamException {
  int t = LA( 1 );
  switch ( t ) {
    case ORDER:
    case GROUP:
      // Case 1: Multi token keywords GROUP BY and ORDER BY
      // The next token ( LT(2) ) should be 'by'... otherwise, this is just an ident.
      if ( LA( 2 ) != LITERAL_by ) {
        LT( 1 ).setType( IDENT );
        if ( log.isDebugEnabled() ) {
          log.debug( "weakKeywords() : new LT(1) token - " + LT( 1 ) );
        }
      }
      break;
    default:
      // Case 2: The current token is after FROM and before '.'.
      if (LA(0) == FROM && t != IDENT && LA(2) == DOT) {
        HqlToken hqlToken = (HqlToken)LT(1);
        if (hqlToken.isPossibleID()) {
          hqlToken.setType(IDENT);
          if ( log.isDebugEnabled() ) {
            log.debug( "weakKeywords() : new LT(1) token - " + LT( 1 ) );
          }
        }
      }
      break;
  }
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

@Override
public void handleDotIdent() throws TokenStreamException {
  // This handles HHH-354, where there is a strange property name in a where clause.
  // If the lookahead contains a DOT then something that isn't an IDENT...
  if ( LA( 1 ) == DOT && LA( 2 ) != IDENT ) {
    // See if the second lookahead token can be an identifier.
    HqlToken t = (HqlToken) LT( 2 );
    if ( t.isPossibleID() )
    {
      // Set it!
      LT( 2 ).setType( IDENT );
      if ( LOG.isDebugEnabled() ) {
        LOG.debugf( "handleDotIdent() : new LT(2) token - %s", LT( 1 ) );
      }
    }
  }
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate

@Override
public void handleDotIdent() throws TokenStreamException {
  // This handles HHH-354, where there is a strange property name in a where clause.
  // If the lookahead contains a DOT then something that isn't an IDENT...
  if ( LA( 1 ) == DOT && LA( 2 ) != IDENT ) {
    // See if the second lookahead token can be an identifier.
    HqlToken t = (HqlToken) LT( 2 );
    if ( t.isPossibleID() )
    {
      // Set it!
      LT( 2 ).setType( IDENT );
      if ( LOG.isDebugEnabled() ) {
        LOG.debugf( "handleDotIdent() : new LT(2) token - %s", LT( 1 ) );
      }
    }
  }
}

相关文章