Examples of ASTNode

  • org.eclipse.dltk.ast.ASTNode
  • org.eclipse.jdt.core.dom.ASTNode
    Abstract superclass of all Abstract Syntax Tree (AST) node types.

    An AST node represents a Java source code construct, such as a name, type, expression, statement, or declaration.

    Each AST node belongs to a unique AST instance, called the owning AST. The children of an AST node always have the same owner as their parent node. If a node from one AST is to be added to a different AST, the subtree must be cloned first to ensure that the added nodes have the correct owning AST.

    When an AST node is part of an AST, it has a unique parent node. Clients can navigate upwards, from child to parent, as well as downwards, from parent to child. Newly created nodes are unparented. When an unparented node is set as a child of a node (using a setCHILD method), its parent link is set automatically and the parent link of the former child is set to null. For nodes with properties that include a list of children (for example, Block whose statements property is a list of statements), adding or removing an element to/for the list property automatically updates the parent links. These lists support the List.set method; however, the constraint that the same node cannot appear more than once means that this method cannot be used to swap elements without first removing the node.

    ASTs must not contain cycles. All operations that could create a cycle detect this possibility and fail.

    ASTs do not contain "holes" (missing subtrees). If a node is required to have a certain property, a syntactically plausible initial value is always supplied.

    The hierarchy of AST node types has some convenient groupings marked by abstract superclasses:

    Abstract syntax trees may be hand constructed by clients, using the newTYPE factory methods (see AST) to create new nodes, and the various setCHILD methods to connect them together.

    The class {@link ASTParser} parses a stringcontaining a Java source code and returns an abstract syntax tree for it. The resulting nodes carry source ranges relating the node back to the original source characters. The source range covers the construct as a whole.

    Each AST node carries bit flags, which may convey additional information about the node. For instance, the parser uses a flag to indicate a syntax error. Newly created nodes have no flags set.

    Each AST node is capable of carrying an open-ended collection of client-defined properties. Newly created nodes have none. getProperty and setProperty are used to access these properties.

    AST nodes are thread-safe for readers provided there are no active writers. If one thread is modifying an AST, including creating new nodes or cloning existing ones, it is not safe for another thread to read, visit, write, create, or clone any of the nodes on the same AST. When synchronization is required, consider using the common AST object that owns the node; that is, use synchronize (node.getAST()) {...}.

    ASTs also support the visitor pattern; see the class ASTVisitor for details. The NodeFinder class can be used to find a specific node inside a tree.

    Compilation units created by ASTParser from a source document can be serialized after arbitrary modifications with minimal loss of original formatting. See {@link CompilationUnit#recordModifications()} for details.See also {@link org.eclipse.jdt.core.dom.rewrite.ASTRewrite} foran alternative way to describe and serialize changes to a read-only AST.

    @see ASTParser @see ASTVisitor @see NodeFinder @since 2.0 @noextend This class is not intended to be subclassed by clients.
  • org.eclipse.jdt.internal.compiler.ast.ASTNode
  • org.eclipse.php.internal.core.ast.nodes.ASTNode
    Abstract superclass of all Abstract Syntax Tree (AST) node types.

    An AST node represents a PHP source code construct, such as a name, type, expression, statement, or declaration.

    ASTs do not contain cycles.

    @see Visitable @author Modhe S., Roy G. ,2007

  • org.erlide.engine.new_model.internal.ASTNode
  • org.jboss.dna.sequencer.ddl.node.AstNode
    Utility object class designed to facilitate constructing an AST or Abstract Syntax Tree representing nodes and properties that are compatible with DNA graph component structure.
  • org.modeshape.sequencer.ddl.node.AstNode
    Utility object class designed to facilitate constructing an AST or Abstract Syntax Tree representing nodes and properties that are compatible with ModeShape graph component structure.
  • org.mozilla.javascript.ast.AstNode
    Base class for AST node types. The goal of the AST is to represent the physical source code, to make it useful for code-processing tools such as IDEs or pretty-printers. The parser must not rewrite the parse tree when producing this representation.

    The {@code AstNode} hierarchy sits atop the older {@link Node} class,which was designed for code generation. The {@code Node} class is aflexible, weakly-typed class suitable for creating and rewriting code trees, but using it requires you to remember the exact ordering of the child nodes, which are kept in a linked list. The {@code AstNode}hierarchy is a strongly-typed facade with named accessors for children and common properties, but under the hood it's still using a linked list of child nodes. It isn't a very good idea to use the child list directly unless you know exactly what you're doing.

    Note that {@code AstNode} records additional information, includingthe node's position, length, and parent node. Also, some {@code AstNode}subclasses record some of their child nodes in instance members, since they are not needed for code generation. In a nutshell, only the code generator should be mixing and matching {@code AstNode} and {@code Node}objects.

    All offset fields in all subclasses of AstNode are relative to their parent. For things like paren, bracket and keyword positions, the position is relative to the current node. The node start position is relative to the parent node.

    During the actual parsing, node positions are absolute; adding the node to its parent fixes up the offsets to be relative. By the time you see the AST (e.g. using the {@code Visitor} interface), the offsets are relative.

    {@code AstNode} objects have property lists accessible via the{@link #getProp} and {@link #putProp} methods. The property lists areinteger-keyed with arbitrary {@code Object} values. For the most part theparser generating the AST avoids using properties, preferring fields for elements that are always set. Property lists are intended for user-defined annotations to the tree. The Rhino code generator acts as a client and uses node properties extensively. You are welcome to use the property-list API for anything your client needs.

    This hierarchy does not have separate branches for expressions and statements, as the distinction in JavaScript is not as clear-cut as in Java or C++.

  • org.mvel2.ast.ASTNode
  • org.netbeans.api.languages.ASTNode
  • org.openntf.formula.ASTNode
    represents an AST node and is returned by a parser.parse (as root of the AST-Node) @author Roland Praml, Foconis AG
  • org.sbml.jsbml.ASTNode
    A node in the Abstract Syntax Tree (AST) representation of a mathematical expression. @author Andreas Dräger @author Nicolas Rodriguez @author Alexander Dörr @since 0.8 @version $Rev: 1533 $
  • sicel.compiler.parser.ASTNode
  • symboltable.ASTNode

  • Examples of com.cloudera.flume.conf.FlumeBuilder.ASTNODE

    * used to regenerated the code as a string so it can be sent to the nodes.
    */
    public class FlumeSpecGen {

      static String genArg(CommonTree t) throws FlumeSpecException {
        ASTNODE type = ASTNODE.valueOf(t.getText()); // convert to enum
        switch (type) {
        case HEX:
        case DEC:
        case BOOL:
        case OCT:
    View Full Code Here

    Examples of com.dragome.compiler.ast.ASTNode

      }

      public void visit_(Block block)
      {
        depth++;
        ASTNode node= block.getFirstChild();
        while (node != null)
        {
          currentNode= node;
          if (DragomeJsCompiler.compiler.isGenerateLineNumbers())
          {
            int lineNumber= currentMethodDeclaration.getLineNumberCursor().getAndMarkLineNumber(node);
            if (lineNumber != -1)
            {
              print("//ln=" + lineNumber + ";\n");
            }
          }

          indent();
          if (node instanceof Block && ((Block) node).isLabeled())
          {
            print(((Block) node).getLabel() + ": ");
          }

          node.visit(this);

          if (lastChar == '}')
          {
            println("");
          }
          else
          {
            println(";");
          }
          node= node.getNextSibling();
        }
        depth--;
      }
    View Full Code Here

    Examples of com.google.dart.engine.ast.AstNode

          return node.getElement();
        }

        @Override
        public Element visitIdentifier(Identifier node) {
          AstNode parent = node.getParent();
          // Type name in Annotation
          if (parent instanceof Annotation) {
            Annotation annotation = (Annotation) parent;
            if (annotation.getName() == node && annotation.getConstructorName() == null) {
              return annotation.getElement();
            }
          }
          // Extra work to map Constructor Declarations to their associated Constructor Elements
          if (parent instanceof ConstructorDeclaration) {
            ConstructorDeclaration decl = (ConstructorDeclaration) parent;
            Identifier returnType = decl.getReturnType();
            if (returnType == node) {
              SimpleIdentifier name = decl.getName();
              if (name != null) {
                return name.getBestElement();
              }
              Element element = node.getBestElement();
              if (element instanceof ClassElement) {
                return ((ClassElement) element).getUnnamedConstructor();
              }
            }
          }
          if (parent instanceof LibraryIdentifier) {
            AstNode grandParent = ((LibraryIdentifier) parent).getParent();
            if (grandParent instanceof PartOfDirective) {
              Element element = ((PartOfDirective) grandParent).getElement();
              if (element instanceof LibraryElement) {
                return ((LibraryElement) element).getDefiningCompilationUnit();
              }
    View Full Code Here

    Examples of com.google.javascript.jscomp.mozilla.rhino.ast.AstNode

          return node;
        }

        @Override
        Node processCatchClause(CatchClause clauseNode) {
          AstNode catchVar = clauseNode.getVarName();
          Node node = newNode(Token.CATCH, transform(catchVar));
          if (clauseNode.getCatchCondition() != null) {
            errorReporter.error(
                "Catch clauses are not supported",
                sourceName,
    View Full Code Here

    Examples of com.intellij.lang.ASTNode

        return super.getChildAttributes(newChildIndex);
      }

      @Override
      public boolean isIncomplete() {
        ASTNode lastChild = myNode.getLastChildNode();
        while (lastChild != null && lastChild.getElementType() == TokenType.WHITE_SPACE) {
          lastChild = lastChild.getTreePrev();
        }
        if (lastChild == null) return false;
        if (lastChild.getElementType() == TokenType.ERROR_ELEMENT) return true;
        return FormatterUtil.isIncomplete(lastChild);
      }
    View Full Code Here

    Examples of com.orange.wink.ast.AstNode

      public GetProp(final AstNode n) throws WinkUnmanagedSyntaxException {
        super(n);

        final List<AstNode> childs = n.getChilds();
        if (childs.size() == 2) {
          final AstNode left = childs.get(0);
          final AstNode right = childs.get(1);
          final int lt = left.getType();
          final int rt = right.getType();

          if (lt == Token.NAME || lt == Token.GETVAR) {
            name = left.asString();
          } else if (lt == Token.THIS) {
            name = Ast.tokenName(Token.THIS);
          } else if (lt == Token.GETPROP || lt == Token.GETELEM) {
            child = new GetProp(left);
          } else {
            throw new WinkUnmanagedSyntaxException("Unknow GetProp Syntax, unexpected: " + Ast.tokenName(lt) + "-" + Ast.tokenName(rt) + " " + Ast.getPositionInfo(n));
          }
          if (rt == Token.STRING || rt == Token.NAME || rt == Token.GETVAR || rt == Token.NUMBER) {
            prop = right.asString();
          } else if (rt == Token.SUB || rt == Token.ADD) {
            final List<AstNode> rightChilds = right.getChilds();
            final String sign = (rt == Token.SUB) ? "-" : "+";
            try {
              prop = rightChilds.get(0).asString() + sign + rightChilds.get(1).asString();
            } catch (final Exception e) {
              prop = Ast.tokenName(rt);
    View Full Code Here

    Examples of com.sonar.sslr.api.AstNode

      /** Exclude subsequent generated nodes, if they are consecutive and on the same line.
       */
      private boolean isGeneratedNodeExcluded(AstNode astNode)
      {
        AstNode prev = astNode.getPreviousAstNode();
        return prev != null &&
               prev.getTokenLine() == astNode.getTokenLine() &&
               prev.getTokenLine() == astNode.getTokenLine() &&
               prev.isCopyBookOrGeneratedNode();
      }
    View Full Code Here

    Examples of com.strobel.decompiler.languages.java.ast.AstNode

    import com.strobel.decompiler.languages.java.ast.Expression;
    import com.strobel.decompiler.languages.java.ast.UnaryOperatorExpression;

    public final class UsageClassifier {
        public static UsageType getUsageType(final Expression expression) {
            final AstNode parent = expression.getParent();

            if (parent instanceof BinaryOperatorExpression) {
                return UsageType.Read;
            }
    View Full Code Here

    Examples of de.odysseus.el.tree.impl.ast.AstNode

            protected AstEval eval(boolean required, boolean deferred) throws ScanException, ParseException {
                AstEval v = null;
                Symbol start_eval = deferred ? START_EVAL_DEFERRED : START_EVAL_DYNAMIC;
                if (this.getToken().getSymbol() == start_eval) {
                    consumeToken();
                    AstNode node = expr(true);
                    try {
                        consumeToken(END_EVAL);
                    } catch (ParseException e) {
                        if (this.getToken().getSymbol() == FLOAT && node instanceof AstIdentifier) {
                            // Handle ${someMap.${someId}}
    View Full Code Here

    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
    TOP
    Copyright © 2018 www.massapi.com. 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.