Package antlr

Examples of antlr.CommonToken


      labelName = existingLabelName;
    }
    else {
      // else create new label
      labelName = generator.createUniqueLabel(refdSymbol);
      CommonToken label = new CommonToken(ANTLRParser.ID, labelName);
      if ( grammar.type != Grammar.LEXER &&
         Character.isUpperCase(refdSymbol.charAt(0)) )
      {
        grammar.defineTokenRefLabel(name, label, uniqueRefAST);
      }
View Full Code Here


   
    /**
    *   Clones the token
    */
    public Token cloneToken(Token t) {
        CommonToken clone = new CommonToken(t.getType(),t.getText());
        clone.setLine(t.getLine());
        clone.setColumn(t.getColumn());
        return clone;
    }
View Full Code Here

    /**
    *   Clones the token
    */
    public Token cloneToken(Token t) {
        CommonToken clone = new CommonToken(t.getType(),t.getText());
        clone.setLine(t.getLine());
        clone.setColumn(t.getColumn());
        return clone;
    }
View Full Code Here

    /**
    *   Clones the token
    */
    public Token cloneToken(Token t) {
        CommonToken clone = new CommonToken(t.getType(),t.getText());
        clone.setLine(t.getLine());
        clone.setColumn(t.getColumn());
        return clone;
    }
View Full Code Here

     * Grammar files may override this to build various subclasses of Token such
     * as ASToken. The default is to build an ANTLR CommonToken.
     */
    protected Token buildToken(int type, int start, int end, int line, int column, String text)
    {
        CommonToken token = new CommonToken(type, text);
        token.setLine(line);
        token.setColumn(column);
        lastToken = token;
        return token;
    }
View Full Code Here

            setText(StringUtils.stripFrontBack(getText(), "{", "}"));
          }
          else {
            setText(StringUtils.stripFrontBack(getText(), "{", "}?"));
          }
          CommonToken t = new CommonToken(_ttype,new String(text.getBuffer(),_begin,text.length()-_begin));
          t.setLine(actionLine);      // set action line to start
          t.setColumn(actionColumn);
          _token = t;
       
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
View Full Code Here

      labelName = existingLabelName;
    }
    else {
      // else create new label
      labelName = generator.createUniqueLabel(refdSymbol);
      CommonToken label = new CommonToken(ANTLRParser.ID, labelName);
      if ( grammar.type != Grammar.LEXER &&
         Character.isUpperCase(refdSymbol.charAt(0)) )
      {
        grammar.defineTokenRefLabel(name, label, uniqueRefAST);
      }
View Full Code Here

    if ( (grammar.buildAST()||suffix.length()>0) && label==null &&
         (r==null || !r.isSynPred) )
    {
      // we will need a label to do the AST or tracking, make one
      label = generator.createUniqueLabel(ruleTargetName);
      CommonToken labelTok = new CommonToken(ANTLRParser.ID, label);
      grammar.defineRuleRefLabel(currentRuleName, labelTok, elementAST);
    }
    StringTemplate elementST = templates.getInstanceOf(name);
    if ( label!=null ) {
      elementST.setAttribute("label", label);
View Full Code Here

    Rule r = grammar.getRule(currentRuleName);
    if ( (grammar.buildAST()||suffix.length()>0) && label==null &&
         (r==null || !r.isSynPred) )
    {
      label = generator.createUniqueLabel(elementName);
      CommonToken labelTok = new CommonToken(ANTLRParser.ID, label);
      grammar.defineTokenRefLabel(currentRuleName, labelTok, elementAST);
    }
    StringTemplate elementST = templates.getInstanceOf(name);
    if ( label!=null ) {
      elementST.setAttribute("label", label);
View Full Code Here

   
    /**
    *   Clones the token
    */
    public Token cloneToken(Token t) {
        CommonToken clone = new CommonToken(t.getType(),t.getText());
        clone.setLine(t.getLine());
        clone.setColumn(t.getColumn());
        return clone;
    }
View Full Code Here

TOP

Related Classes of antlr.CommonToken

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.