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 info.bliki.wiki.template.expr.ast.ASTNode

       *
       */
      public ASTNode optimizeFunction(final FunctionNode functionNode) {
        if (functionNode.size() > 0) {
          boolean doubleOnly = true;
          ASTNode node;
          for (int i = 1; i < functionNode.size(); i++) {
            node = functionNode.get(i);
            if (node instanceof NumberNode) {
              functionNode.set(i, new DoubleNode(((NumberNode) functionNode.get(i)).doubleValue()));
            } else if (functionNode.get(i) instanceof FunctionNode) {
              ASTNode optNode = optimizeFunction((FunctionNode) functionNode.get(i));
              if (!(optNode instanceof DoubleNode)) {
                doubleOnly = false;
              }
              functionNode.set(i, optNode);
            } else {
    View Full Code Here

    Examples of juzu.impl.template.spi.juzu.ast.ASTNode

      @Override
      public void process(ProcessPhase phase, ASTNode.Tag tag, TemplateModel t) {

        // Find the root template tag
        ASTNode current = tag;
        while (true) {
          if (current instanceof ASTNode.Block) {
            current = ((ASTNode.Block)current).getParent();
          }
          else {
    View Full Code Here

    Examples of litil.ast.AstNode

    public class Litil {
        public static void main(String[] args) {
            String filename = "/Users/jawher/Dropbox/coding/jaml/target/classes/litil/eval/s99.ltl";
            boolean tc = true;
            boolean ev = true;
            AstNode node = null;
            try {
                node = parseFile(filename);
            } catch (FileNotFoundException e) {
                e.printStackTrace();
                return;
    View Full Code Here

    Examples of net.sourceforge.htmlunit.corejs.javascript.ast.AstNode

                    final HtmlElement htmlElement) {

            try {
                final CompilerEnvirons environs = new CompilerEnvirons();
                environs.initFromContext(contextFactory_.enterContext());
                final AstNode root = new Parser(environs).parse(sourceCode, sourceName, lineNo_);
                final Map<Integer, Integer> strings = new TreeMap<Integer, Integer>();
                root.visit(new NodeVisitor() {

                    public boolean visit(final AstNode node) {
                        if (node instanceof StringLiteral) {
                            strings.put(node.getAbsolutePosition() + 1, node.getLength() - 2);
                        }
    View Full Code Here

    Examples of org.apache.hadoop.hive.ql.parse.ASTNode

         * @return the AST
         * @throws IOException if failed
         * @throws ParseException if failed
         */
        protected ASTNode verify(String ql) throws IOException, ParseException {
            ASTNode node = new ParseDriver().parse(ql);
            return node;
        }
    View Full Code Here

    Examples of org.apache.vxquery.xmlquery.ast.ASTNode

        private LogicalVariable translateComputedAttributeConstructorNode(TranslationContext tCtx,
                ComputedAttributeConstructorNode cNode) throws SystemException {
            ILogicalExpression name = cast(vre(translateExpression(cNode.getName(), tCtx)),
                    SequenceType.create(BuiltinTypeRegistry.XS_QNAME, Quantifier.QUANT_ONE));
            ASTNode content = cNode.getContent();
            ILogicalExpression cExpr = content == null ? sfce(BuiltinOperators.CONCATENATE) : vre(translateExpression(
                    content, tCtx));
            LogicalVariable lVar = createAssignment(sfce(BuiltinOperators.ATTRIBUTE_CONSTRUCTOR, name, cExpr), tCtx);
            return lVar;
        }
    View Full Code Here

    Examples of org.aspectj.org.eclipse.jdt.core.dom.ASTNode

        this.source = removeIndentAndNewLines(this.source, document, cu);
        ASTParser parser = ASTParser.newParser(AST.JLS3);
        parser.setSource(this.source.toCharArray());
        parser.setProject(getCompilationUnit().getJavaProject());
        parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS);
        ASTNode node = parser.createAST(this.progressMonitor);
        String createdNodeSource;
        if (node.getNodeType() != ASTNode.TYPE_DECLARATION) {
          createdNodeSource = generateSyntaxIncorrectAST();
          if (this.createdNode == null)
            throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_CONTENTS));
        } else {
          TypeDeclaration typeDeclaration = (TypeDeclaration) node;
    View Full Code Here

    Examples of org.aspectj.org.eclipse.jdt.core.dom.ASTNode

    */
    public CreateFieldOperation(IType parentElement, String source, boolean force) {
      super(parentElement, source, force);
    }
    protected ASTNode generateElementAST(ASTRewrite rewriter, IDocument document, ICompilationUnit cu) throws JavaModelException {
      ASTNode node = super.generateElementAST(rewriter, document, cu);
      if (node.getNodeType() != ASTNode.FIELD_DECLARATION)
        throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_CONTENTS));
      return node;
    }
    View Full Code Here

    Examples of org.aspectj.org.eclipse.jdt.core.dom.ASTNode

              }
            }
          }
        }
        if (value instanceof ASTNode) {
          ASTNode node= (ASTNode) value;
          return new PropertyLocation(node.getParent(), node.getLocationInParent());
        }
        return null;
      }
    View Full Code Here

    Examples of org.aspectj.org.eclipse.jdt.core.dom.ASTNode

      }
     
      private void revertListWithRanges(RewriteEvent[] childEvents, Set placeholders, List revertedChildren) {
        for (int i= 0; i < childEvents.length; i++) {
          RewriteEvent event= childEvents[i];
          ASTNode node= (ASTNode) event.getOriginalValue();
          if (placeholders.contains(node)) {
            RewriteEvent[] placeholderChildren= getListEvent(node, Block.STATEMENTS_PROPERTY, false).getChildren();
            revertListWithRanges(placeholderChildren, placeholders, revertedChildren);
          } else {
            revertedChildren.add(event);
    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.