Package dtool.parser.common

Examples of dtool.parser.common.LexElement


 
  public static LexElement findLastEffectiveTokenBeforeOffset(int offset, LexElementSource lexSource) {
    List<LexElement> lexElementList = lexSource.getLexElementList();
    assertTrue(offset > 0 && offset <= lexElementList.get(lexElementList.size()-1).getEndPos());
   
    LexElement lastLexElement = LexElementSource.START_TOKEN;
    for (LexElement lexElement : lexElementList) {
      if(lexElement.getStartPos() >= offset)
        break;
      lastLexElement = lexElement;
    }
View Full Code Here


   
    parsing: {
      if(tryConsume(DeeTokens.OPEN_PARENS)) {
        linkageStr = "";
       
        LexElement linkageToken = consumeIf(DeeTokens.IDENTIFIER);
        if(linkageToken != null ) {
          linkageStr = linkageToken.getSourceValue();
          if(linkageStr.equals("C") && tryConsume(DeeTokens.INCREMENT)) {
            linkageStr = Linkage.CPP.name;
          }
        }
       
View Full Code Here

 
  public NodeResult<AttribProtection> parseAttribProtection() {
    if(lookAheadGrouped() != DeeTokens.GROUP_PROTECTION_KW) {
      return null;
    }
    LexElement protToken = consumeLookAhead();
    ParseHelper parse = new ParseHelper();
    EProtection protection = DeeTokenSemantics.getProtectionFromToken(protToken.type);
   
    return parse.resultConclude(new AttribProtection(protection));
  }
View Full Code Here

        while(true) {
          FunctionParamAttribKinds paramAttrib = FunctionParamAttribKinds.fromToken(lookAhead());
          if(paramAttrib == null || isTypeModifier(lookAhead()) && lookAhead(1) == DeeTokens.OPEN_PARENS)
            break;
         
          LexElement attribToken = consumeLookAhead();
          attribs = lazyInitArrayList(attribs);
          attribs.add(attribToken);
         
          if(!isTypeModifier(attribToken.type)) {
            setMode(TplOrFnMode.FN);
View Full Code Here

   
    public TemplateParameter convertToTemplate() {
      if(attribs != null)  {
       
        for (int i = attribs.size()-1; i >= 0 ; i--) {
          LexElement attribToken = attribs.get(i);
          TypeModifierKinds modifier = assertNotNull(determineTypeModifier(attribToken.type));
          ref = concludeNode(srBounds(attribToken.getStartPos(), ref.getEndPos(),
            new RefTypeModifier(modifier, ref, false)));
        }
      }
      if(defId == null && couldHaveBeenParsedAsId(ref)) {
        defId = convertRefIdToDef(ref);
View Full Code Here

 
  public static final ParseRuleDescription RULE_DECLARATION = new ParseRuleDescription("Declaration", "Declaration");
 
  public InvalidSyntaxElement parseInvalidElement(ParseRuleDescription expectedRule,
    boolean inStatementList) {
    LexElement badToken = consumeLookAhead();
    ParseHelper parse = new ParseHelper();
    parse.storeError(createSyntaxError(expectedRule));
    return parse.conclude(new InvalidSyntaxElement(inStatementList, badToken));
  }
View Full Code Here

      assertTrue(comments != END_DOCCOMMENTS_READ);
     
      parsing: {
        if(ruleBroken) break parsing;
       
        LexElement nextLexElement = lookAheadElement();
       
        for (Token token : nextLexElement.getRelevantPrecedingSubChannelTokens()) {
          if(token.type == DeeTokens.LINE_END)
            break;
          if(token.type == DeeTokens.DOCCOMMENT_LINE) {
            comments = lazyInitArrayList(comments);
            comments.add(token);
View Full Code Here

    }
  }
 
  public void basicSourceRangeCheck() {
    if(!canBeginWithEmptySpace(nodeUnderTest)) {
      LexElement firstLexElement = firstLexElementInNode();
      assertTrue(firstLexElement.getFullRangeStartPos() == firstLexElement.getStartPos());
    }
   
    if(nodeConsumesTrailingWhiteSpace(nodeUnderTest)) {
      // Check that the range contains all possible whitespace
      assertTrue(lexElementAfterNode(nodeUnderTest).getStartPos() == 0);
View Full Code Here

    BaseLexElement id = consumeExpectedContentToken(DeeTokens.IDENTIFIER);
    return conclude(id.getMissingError(), srEffective(id, new RefIdentifier(idTokenToString(id))));
  }
 
  protected RefPrimitive parseRefPrimitive_start(DeeTokens primitiveType) {
    LexElement primitive = consumeLookAhead(primitiveType);
    return conclude(srOf(primitive, new RefPrimitive(primitive)));
  }
View Full Code Here

      return result(true, leftRef);
    return parseTypeReference_withLeftReference(leftRef, refRestrictions);
  }
 
  public Reference parseRefQualified(ParseHelper parse, IQualifierNode qualifier) {
    LexElement dotToken = consumeLookAhead(DeeTokens.DOT);
    RefIdentifier qualifiedId = parseRefIdentifier();
    parse.setRuleBroken(qualifiedId.isMissing());
    return parse.conclude(new RefQualified(qualifier, dotToken.getStartPos(), qualifiedId));
  }
View Full Code Here

TOP

Related Classes of dtool.parser.common.LexElement

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.