Package antlr

Examples of antlr.CommonToken


    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(elementName);
      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

      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

     * @see #areThereGtsToEmit
     */
    private DetailAST emitSingleGt()
    {
        gtToReconcile -= 1;
        CommonToken gtToken = new CommonToken(GENERIC_END, ">");
        gtToken.setLine(currentGtSequence.getLineNo());
        gtToken.setColumn(currentGtSequence.getColumnNo() + (currentGtSequence.getText().length() - gtToReconcile));
        return (DetailAST)astFactory.create(gtToken);
    }
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

    /**
    *   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

    if (this.inputState.guessing > 0)
      return;
    ParseTreeRule localParseTreeRule = (ParseTreeRule)this.currentParseTreeRoot.peek();
    ParseTreeToken localParseTreeToken = null;
    if (LA(1) == 1)
      localParseTreeToken = new ParseTreeToken(new CommonToken("EOF"));
    else
      localParseTreeToken = new ParseTreeToken(LT(1));
    localParseTreeRule.addChild(localParseTreeToken);
  }
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

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.