Examples of RootNode


Examples of org.jruby.ast.RootNode

    public void compileRoot(Node node, ScriptCompiler context, ASTInspector inspector) {
        compileRoot(node, context, inspector, true, true);
    }

    public void compileRoot(Node node, ScriptCompiler context, ASTInspector inspector, boolean load, boolean main) {
        RootNode rootNode = (RootNode) node;
        StaticScope staticScope = rootNode.getStaticScope();

        context.startScript(staticScope);

        // force static scope to claim restarg at 0, so it only implements the [] version of __file__
        staticScope.setRestArg(-2);

        // create method for toplevel of script
        BodyCompiler methodCompiler = context.startFileMethod(null, staticScope, inspector);

        Node nextNode = rootNode.getBodyNode();
        if (nextNode != null) {
            if (nextNode.getNodeType() == NodeType.BLOCKNODE) {
                // it's a multiple-statement body, iterate over all elements in turn and chain if it get too long
                BlockNode blockNode = (BlockNode) nextNode;
View Full Code Here

Examples of org.jruby.ast.RootNode

        position = topOfAST != null ? topOfAST.getPosition() : position;

        if (result.getBeginNodes().isEmpty()) {
            if (topOfAST == null) topOfAST = NilImplicitNode.NIL;
           
            return new RootNode(position, result.getScope(), topOfAST);
        }
       
        BlockNode newTopOfAST = new BlockNode(position);
        for (Node beginNode: result.getBeginNodes()) {
            appendToBlock(newTopOfAST, beginNode);
        }
       
        // Add real top to new top (unless this top is empty [only begin/end nodes or truly empty])
        if (topOfAST != null) newTopOfAST.add(topOfAST);
       
        return new RootNode(position, result.getScope(), newTopOfAST);
    }
View Full Code Here

Examples of org.jruby.ast.RootNode

        if (fetchGlobalConstant("DATA") == null) {
            try {inputStream.close();} catch (IOException ioe) {}
        }
       
        if (parseResult instanceof RootNode) {
            RootNode scriptNode = (RootNode) parseResult;       

            ThreadContext context = getCurrentContext();

            String oldFile = context.getFile();
            int oldLine = context.getLine();
            try {
                context.setFileAndLine(scriptNode.getPosition());

                if (config.isAssumePrinting() || config.isAssumeLoop()) {
                    runWithGetsLoop(scriptNode, config.isAssumePrinting(), config.isProcessLineEnds(),
                            config.isSplit());
                } else {
View Full Code Here

Examples of org.jruby.ast.RootNode

        // no binding, just eval in "current" frame (caller's frame)
        DynamicScope evalScope = context.getCurrentScope().getEvalScope(runtime);
        evalScope.getStaticScope().determineModule();

        RootNode node = (RootNode) runtime.parseEval(src.convertToString().getByteList(), file, evalScope, lineNumber);

        return interpretCommonEval(runtime, file, lineNumber, "(eval)", node, self, Block.NULL_BLOCK, evalType);
    }
View Full Code Here

Examples of org.jruby.ast.RootNode

        evalScope.getStaticScope().determineModule();

        Frame lastFrame = context.preEvalWithBinding(binding);
        try {
            // Binding provided for scope, use it
            RootNode node = (RootNode) runtime.parseEval(src.convertToString().getByteList(), binding.getFile(), evalScope, binding.getLine());
            Block block = binding.getFrame().getBlock();

            return interpretCommonEval(runtime, binding.getFile(), binding.getLine(), binding.getMethod(), node, self, block, EvalType.BINDING_EVAL);
        } finally {
            context.postEvalWithBinding(binding, lastFrame);
View Full Code Here

Examples of org.jrubyparser.ast.RootNode

          if(rubyParser == null) {
            serializer = RubyValueSerializer.INSTANCE;
            rubyParser = new Parser();
            rubyParserConfig = new ParserConfiguration(0, CompatVersion.RUBY1_9);
          }
          RootNode root = (RootNode) rubyParser.parse(
            path.toOSString(), new StringReader(document.get()), rubyParserConfig);
          new LenientModulefileParser(this).parseRubyAST(root, chain);
        }
        else {
          if(jsonFactory == null) {
View Full Code Here

Examples of org.nasutekds.guitools.controlpanel.ui.nodes.RootNode

  public BrowserController(JTree tree, LDAPConnectionPool cpool,
      IconPool ipool)
  {
    this.tree = tree;
    iconPool = ipool;
    rootNode = new RootNode();
    rootNode.setIcon(iconPool.getIconForRootNode());
    treeModel = new DefaultTreeModel(rootNode);
    tree.setModel(treeModel);
    tree.addTreeExpansionListener(this);
    tree.setCellRenderer(new BrowserCellRenderer());
View Full Code Here

Examples of org.netbeans.modules.nodejs.ui2.RootNode

        return rn == null ? null : rn.get();
    }

    @Override
    public Node createLogicalView () {
        RootNode n;
        synchronized ( this ) {
            n = rn == null ? null : rn.get();
            if (n == null) {
                n = new RootNode( project );
                rn = new WeakReference<RootNode>( n );
            }
        }
        return n;
    }
View Full Code Here

Examples of org.pegdown.ast.RootNode

                if ( !first )
                {
                    text = text.substring( metadataMatcher.end() );
                }
            }
            RootNode rootNode = PEGDOWN_PROCESSOR.parseMarkdown( text.toCharArray() );
            if ( !haveTitle && rootNode.getChildren().size() > 0 )
            {
                // use the first (non-comment) node only if it is a heading
                int i = 0;
                Node firstNode = null;
                while ( i < rootNode.getChildren().size() && isHtmlComment(
                    ( firstNode = rootNode.getChildren().get( i ) ) ) )
                {
                    i++;
                }
                if ( firstNode instanceof HeaderNode )
                {
View Full Code Here

Examples of org.pegdown.ast.RootNode

    public void parse( Reader source, Sink sink )
        throws ParseException
    {
        try
        {
            RootNode rootNode = PEGDOWN_PROCESSOR.parseMarkdown( IOUtil.toString( source ).toCharArray() );
            String markdownAsHtml = new MarkdownToDoxiaHtmlSerializer().toHtml( rootNode );
            super.parse( new StringReader( "<html><body>" + markdownAsHtml + "</body></html>" ), sink );
        }
        catch ( IOException e )
        {
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.