Package flex2.compiler.mxml.rep

Examples of flex2.compiler.mxml.rep.Script


        StatementListNode result = programStatementList;
        Iterator<Script> scriptIterator = scripts.iterator();

        while (scriptIterator.hasNext())
        {
            Script script = scriptIterator.next();
            String text = script.getText();
            int xmlLineNumber = script.getXmlLineNumber();
            List<Node> list = AbstractSyntaxTreeUtil.parse(context, configNamespaces, text,
                                                           xmlLineNumber, generateDocComments);
            Iterator<Node> nodeIterator = list.iterator();

            while (nodeIterator.hasNext())
            {
                Node node = nodeIterator.next();

                if (node instanceof MetaDataNode)
                {
                    result = nodeFactory.statementList(result, node);
                }
                else
                {
                    CompilerMessage m = new NodeMagic.OnlyMetadataIsAllowed();
                    m.setPath(getPath());
                    m.setLine(context.input.getLnNum(node.pos()) + script.getXmlLineNumber() - 1);
                    ThreadLocalToolkit.log(m);                   
                }
            }
        }
View Full Code Here


        StatementListNode result = statementList;
        Iterator<Script> iterator = scripts.iterator();

        while (iterator.hasNext())
        {
            Script script = iterator.next();
            String text = script.getText();
            int xmlLineNumber = script.getXmlLineNumber();
            List<Node> list = AbstractSyntaxTreeUtil.parse(context, configNamespaces, text,
                                                           xmlLineNumber, generateDocComments);
            // Don't use NodeFactory.statementList() here, because it
            // handles IncludeDirectives by inlining them and if we
            // use it here, they will get inlined a second time.
View Full Code Here

            if (node.getSourceFile() == null)
            {
                CDATANode cdata = (CDATANode) node.getChildAt(0);
                if (cdata != null)
                {
                    Script script = new Script(cdata.image, cdata.beginLine, cdata.endLine);
                    script.setEmbeddedScript(true);
                    docInfo.addScript(script);
                }
            }
            else
            {
                String source = (String) node.getAttributeValue("source");
                if (source != null)
                {
                    Script script = new Script("include \"" + source + "\";", node.beginLine);
                    docInfo.addScript(script);
                }
            }
        }
View Full Code Here

        public void analyze(MetaDataNode node)
        {
            CDATANode cdata = (CDATANode) node.getChildAt(0);
            if (cdata != null)
            {
                Script script = new Script(cdata.image, cdata.beginLine, cdata.endLine);
                docInfo.addMetadata(script);
            }
        }
View Full Code Here

        //  create SourceCode wrappers for scripts
        Set<SourceCode> scriptSet = new LinkedHashSet<SourceCode>();
        for (Iterator iter = info.getScripts().iterator(); iter.hasNext(); )
        {
          Script script = (Script) iter.next();
          if (!script.isEmbedded())
          {
            scriptSet.add(new SourceCode(script.getText(), script.getXmlLineNumber(), out, map));
          }
          else
          {
            // use Source.getName() to construct the new VirtualFile name
            String n = source.getName().replace('\\', '/') + ":" + script.getXmlLineNumber() + "," + script.getEndXmlLineNumber();
            VirtualFile f = new TextFile(script.getText(), n, source.getParent(), MimeMappings.AS, source.getLastModified());

                        // line number map is for error reporting, so the names must come from error reporting...
                        LineNumberMap m = new LineNumberMap(source.getNameForReporting(), n);

                        m.put(script.getXmlLineNumber(), 1, (script.getEndXmlLineNumber() - script.getXmlLineNumber()));
                        // C: add this so that when unexpected EOF occurs, (last line + 1) maps to the last line
                        //    in the original XML Script block.
                        m.put(script.getEndXmlLineNumber(), script.getEndXmlLineNumber() - script.getXmlLineNumber() + 1, 1);

                        // 'n' must match 'n' in the include directive...
                        source.addSourceFragment(n, f, m);

                        // 'n' must match 'n' in the addSourceFragment call.
                        scriptSet.add(new SourceCode("include \"" + n + "\";", script.getXmlLineNumber(), out, map));
                    }
                }

                //  create SourceCode wrappers for metadata entries
                Set<SourceCode> metadataSet = new LinkedHashSet<SourceCode>();
                for (Iterator iter = info.getMetadata().iterator(); iter.hasNext(); )
                {
                    Script script = (Script)iter.next();
                    metadataSet.add(new SourceCode(script.getText(), script.getXmlLineNumber(), out, map));
                }

                //  create SourceCode wrappers for variable declarations
                Map<String, SourceCode> varDeclMap = new LinkedHashMap<String, SourceCode>();
                for (Iterator iter = info.getVarDecls().values().iterator(); iter.hasNext(); )
View Full Code Here

      {
        //  ensure <mx:Metadata> contains only [metadata] annotations
        int[] beginLines = new int[md.size()], endLines = new int[md.size()];
        for (int i = 0, size = md.size(); i < size; i++)
        {
          Script script = (Script) md.get(i);
          beginLines[i] = script.getXmlLineNumber();
          endLines[i] = script.getEndXmlLineNumber();
        }
        NodeMagic.metaDataOnly(interfaceUnit, map, beginLines, endLines);
      }
    }
View Full Code Here

    add(fragment, line);
  }

  public final boolean add(String fragment, int line)
  {
    return super.add(new Script(fragment, line));
  }
View Full Code Here

    return add(fragment.toString(), line);
  }

  public void add(int index, String fragment, int line)
  {
    super.add(index, new Script(fragment, line));
  }
View Full Code Here

            if (node.getSourceFile() == null)
            {
                CDATANode cdata = (CDATANode) node.getChildAt(0);
                if (cdata != null)
                {
                    Script script = new Script(cdata.image, cdata.beginLine, cdata.endLine);
                    script.setEmbeddedScript(true);
                    docInfo.addScript(script);
                }
            }
            else
            {
                String source = (String) node.getAttributeValue("source");
                if (source != null)
                {
                    Script script = new Script("include \"" + source + "\";", node.beginLine);
                    docInfo.addScript(script);
                }
            }
        }
View Full Code Here

        public void analyze(MetaDataNode node)
        {
            CDATANode cdata = (CDATANode) node.getChildAt(0);
            if (cdata != null)
            {
                Script script = new Script(cdata.image, cdata.beginLine, cdata.endLine);
                docInfo.addMetadata(script);
            }
        }
View Full Code Here

TOP

Related Classes of flex2.compiler.mxml.rep.Script

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.