Package dtool.ast

Examples of dtool.ast.ASTNode


 
  public static ASTNode getChildFlattenNodelist(int childIx, ASTNode[] children) {
   
    int flattenedTraversedIndex = 0;
    for (int ix = 0; ix < children.length; ix++) {
      ASTNode node = children[ix];
      if(node instanceof NodeList) {
        NodeList<?> nodeList = (NodeList<?>) node;
        if(childIx >= flattenedTraversedIndex + nodeList.nodes.size()) {
          flattenedTraversedIndex += nodeList.nodes.size();
          continue;
View Full Code Here


   
    return getOuterLexicalScope(node);
  }
 
  public static IScopeNode getOuterLexicalScope(ASTNode node) {
    ASTNode parent = node.getParent();
    if(parent == null) {
      return null;
    }
    return getNearestLexicalScope(parent);
  }
View Full Code Here

      IASTNode unambigParsedParameter = reparseAsFunctionParam ?
        unambigParser.parseFunctionParameter() : unambigParser.parseTemplateParameter();
       
      Object ambigParsedParameterResult = parseAmbigParameter(nodeSource);
     
      ASTNode nodeToCompareAgainst = null;
      if(ambigParsedParameterResult instanceof IFunctionParameter) {
        nodeToCompareAgainst = reparseAsFunctionParam ? (ASTNode) ambigParsedParameterResult : null;
      } else if(ambigParsedParameterResult instanceof TemplateParameter) {
        nodeToCompareAgainst = !reparseAsFunctionParam ? (ASTNode) ambigParsedParameterResult : null;
      } else {
View Full Code Here

    return type != null ? type : getEnumParentType();
  }
 
  public Reference getEnumParentType() {
    EnumBody enumBody = getParent_Concrete();
    ASTNode parentEnum = enumBody.getParent();
    if(parentEnum instanceof DeclarationEnum) {
      DeclarationEnum declarationEnum = (DeclarationEnum) parentEnum;
      return declarationEnum.type;
    }
    if(parentEnum instanceof DefinitionEnum) {
View Full Code Here

    DeeParserResult result = parseUsingRule(deeParser);
    if(result == null)
      return;
   
    String parsedSource = checkParsedSource(expectedRemainingSource, deeParser);
    ASTNode mainNode = result.node; // a null result may make sense in some tests
   
    if(mainNode != null) {
      checkBasicStructureContracts(mainNode);
    }
   
    checkExpectedStructure(mainNode, expectedStructure);
   
    if(expectedErrors != null) {
      checkParserErrors(result.getErrors(), expectedErrors);
    }
   
    if(expectedPrintedSource != null) {
      assertTrue(result.errors.size() == 0 ? parsedSource.equals(expectedPrintedSource) : true);
     
      String nodePrintedSource = mainNode == null ? "" : mainNode.toStringAsCode();
      SourceEquivalenceChecker.assertCheck(nodePrintedSource, expectedPrintedSource);
    }
   
    // Check consistency of source ranges (no overlapping ranges)
    if(mainNode != null) {
View Full Code Here

   
    assertTrue(children.length <= expectedStructure.length);
   
    for(int i = 0; i < children.length; i++) {
      NamedNodeElement namedElement = expectedStructure[i];
      ASTNode astNode = children[i];
     
      if(namedElement.name == NamedNodeElement.IGNORE_ALL) {
        continue;
      }
      if(namedElement.name != NamedNodeElement.IGNORE_NAME) {
        String expectedName = getExpectedNameAliases(namedElement.name);
        assertEquals(astNode.getClass().getSimpleName(), expectedName);
      }
      checkExpectedStructure_do(astNode.getChildren(), namedElement.children);
    }
    assertTrue(children.length == expectedStructure.length);
  }
View Full Code Here

      }
    }
    else if(parseRule.equalsIgnoreCase("EXPRESSION_ToE")) {
      DeeTestsChecksParser parser = new DeeTestsChecksParser(parsedSource);
      DeeParserResult resultToE = parser.parseUsingRule(DeeParser.RULE_TYPE_OR_EXP);
      ASTNode expNode = result.node;
      List<ParserError> resultToE_Errors = resultToE.getErrors();
      if(result.errors.size() >= 1) {
        ParserError lastError = result.getErrors().get(result.errors.size()-1);
        if(lastError.errorType == ParserErrorTypes.TYPE_USED_AS_EXP_VALUE &&
          SourceEquivalenceChecker.check(result.node.toStringAsCode(), lastError.msgErrorSource)) {
View Full Code Here

    ArrayList<ASTNode> declarations = new ArrayList<>();
    while(true) {
      if(lookAhead() == nodeListTerminator) {
        break;
      }
      ASTNode decl = parseDeclaration().node;
      if(decl == null) {
        if(lookAhead() == DeeTokens.EOF || (!consumeCloseBrackets && isCloseBracketChar(lookAhead()))) {
          break;
        }
        decl = parseInvalidElement(RULE_DECLARATION, false);
View Full Code Here

    if(attributes == null) {
      parse.checkRuleBroken();
      return null;
    }
   
    ASTNode body = null;
    AttribBodySyntax bodySyntax = AttribBodySyntax.SINGLE_DECL;
   
    if(parse.checkRuleBroken() == false) {
      boolean isPragmaBody = getLastAttributeKind(attributes) == ASTNodeTypes.ATTRIB_PRAGMA;
      boolean autoDeclEnabled = isAutoVarEnablingAttrib(attributes);
View Full Code Here

    assertTrue(parent instanceof DeclarationImport || parent instanceof ImportSelective);
    return parent;
  }
 
  public DeclarationImport getDeclarationImport() {
    ASTNode parent = super.getParent();
    if(parent instanceof DeclarationImport) {
      return (DeclarationImport) parent;
    } else {
      return ((ImportSelective) parent).getDeclarationImport();
    }
View Full Code Here

TOP

Related Classes of dtool.ast.ASTNode

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.