Package flex2.compiler

Examples of flex2.compiler.CompilerContext


     * Do basic MXML parse, generate AS containing public signature contributors, and parse that using our ASC instance.
     * Result will be "outer" compilation unit, with the unit returned by ASC stashed in a context attribute.
     */
    public CompilationUnit parse1(Source source, SymbolTable symbolTable)
    {
    CompilerContext context = new CompilerContext();

        // 1. parse/analyze MXML, or retrieve preparsed DOM
        // 2. add MXML syntax tree to a new CompilationUnit
        DocumentNode app;
        CompilationUnit unit;
View Full Code Here


                                     symbolTable.perCompileData,
                                     result,
                                     symbolTable.emitter,
                                                                       ascConfiguration.getDefine());

    CompilerContext context = new CompilerContext();
    context.setAscContext(interfaceGenerator.getContext());

    Object syntaxTree = interfaceGenerator.getSyntaxTree();
    result.newCompilationUnit(syntaxTree, context).setSyntaxTree(syntaxTree);

    return result;
View Full Code Here

    public void parse2(CompilationUnit unit, TypeTable typeTable)
    {
        SkinPartEvaluator spEvaluator = new SkinPartEvaluator(typeTable.getSymbolTable());
        spEvaluator.setLocalizationManager(ThreadLocalToolkit.getLocalizationManager());
        Node node = (Node) unit.getSyntaxTree();
        CompilerContext context = unit.getContext();
        Context cx = (Context) context.getAscContext();
        node.evaluate(cx, spEvaluator);
    }
View Full Code Here

    if (unit.metadata.size() > 0 && unit.styles.size() == 0)
    {
      StyleEvaluator styleEvaluator = new StyleEvaluator(unit);
      styleEvaluator.setLocalizationManager(ThreadLocalToolkit.getLocalizationManager());
      Node node = (Node) unit.getSyntaxTree();
      CompilerContext context = unit.getContext();
      Context cx = context.getAscContext();
      node.evaluate(cx, styleEvaluator);
    }
  }
View Full Code Here

        // flex2.compiler.mxml.MxmlLogAdapter has some similar logic.  Ideally it should be
        // consolidated and move into a shared Logger adapter/filter.
        private String mapRenamedVariables(String msg)
        {
            CompilerContext context = s.getCompilationUnit().getContext();
            Map renamedVariableMap = (Map) context.getAttribute(CompilerContext.RENAMED_VARIABLE_MAP);

            if (renamedVariableMap != null)
            {
                Iterator iterator = renamedVariableMap.entrySet().iterator();
View Full Code Here

    public void parse1(CompilationUnit unit, TypeTable typeTable)
    {
        if (unit.metadata.size() > 0)
        {
            Node node = (Node) unit.getSyntaxTree();
            CompilerContext context = unit.getContext();
            Context cx = context.getAscContext();
            EmbedSkinClassEvaluator embedSkinClassEvaluator = new EmbedSkinClassEvaluator(unit);
            node.evaluate(cx, embedSkinClassEvaluator);
        }
    }
View Full Code Here

            EmbedEvaluator embedEvaluator = new EmbedEvaluator(unit, typeTable.getSymbolTable(),
                                                               transcoders, generatedOutputDir,
                                                               checkDeprecation);
            embedEvaluator.setLocalizationManager(ThreadLocalToolkit.getLocalizationManager());
            Node node = (Node) unit.getSyntaxTree();
            CompilerContext context = unit.getContext();
            Context cx = context.getAscContext();
            node.evaluate(cx, embedEvaluator);
        }
    }
View Full Code Here

         * later phases).
         * </p>
         */
        public CompilationUnit parse1(Source source, SymbolTable symbolTable)
        {
            CompilerContext context = new CompilerContext();
            CompilationUnit unit = source.newCompilationUnit(null, context);

            // Setup a logger to bridge FXG and Flex logging systems
            setupLogger();

            // Setup the FXG Parser using either the mobile or desktop profile
            FXGParser parser;
            if (FXG_PROFILE_MOBILE.equals(profile))
              parser = FXGParserFactory.createDefaultParserForMobile();
            else
              parser = FXGParserFactory.createDefaultParser();

            // Register Flex specific FXG nodes
            parser.registerElementNode(1.0, FXG_NAMESPACE, FXG_GRAPHIC_ELEMENT, FlexGraphicNode.class);
            parser.registerElementNode(1.0, FXG_NAMESPACE, FXG_TEXTGRAPHIC_ELEMENT, FlexTextGraphicNode.class);
            parser.registerElementNode(1.0, FXG_NAMESPACE, FXG_P_ELEMENT, FlexParagraphNode.class);
            parser.registerElementNode(1.0, FXG_NAMESPACE, FXG_SPAN_ELEMENT, FlexSpanNode.class);
            parser.registerElementNode(2.0, FXG_NAMESPACE, FXG_GRAPHIC_ELEMENT, FlexGraphicNode.class);
            parser.registerElementNode(2.0, FXG_NAMESPACE, FXG_RICHTEXT_ELEMENT, FlexRichTextNode.class);

            try
            {
                // Parse FXG to a DOM
                FXGNode node = parser.parse(source.getInputStream(), source.getNameForReporting());
                context.setAttribute(FXG_DOM_ROOT, node);

                QName topLevelQName = getQNameFromSource(source);
                unit.topLevelDefinitions.add(topLevelQName);

                MultiName baseMultiName = MULTINAME_SPRITEVISUALELEMENT;
View Full Code Here

    }

    final String path = source.getName();
    ProgramNode node = null;

    CompilerContext context = new CompilerContext();

    Context cx = new Context(symbolTable.perCompileData);

    cx.setScriptName(source.getName());
    cx.setPath(source.getParent());

    cx.setEmitter(symbolTable.emitter);
    cx.setHandler(new As3Compiler.CompilerHandler()
    {
      public void error2(String filename, int ln, int col, Object msg, String source)
      {
        filename = (filename == null || filename.length() == 0) ? path : filename;
        ThreadLocalToolkit.log((flex2.compiler.util.CompilerMessage) msg, filename);
      }

      public void warning2(String filename, int ln, int col, Object msg, String source)
      {
        filename = (filename == null || filename.length() == 0) ? path : filename;
        ThreadLocalToolkit.log((CompilerMessage) msg, filename);
      }

      public void error(String filename, int ln, int col, String msg, String source, int errorCode)
      {
        filename = (filename == null || filename.length() == 0) ? path : filename;
        if (errorCode != -1)
        {
          ThreadLocalToolkit.logError(filename, msg, errorCode);
        }
        else
        {
          ThreadLocalToolkit.logError(filename, msg);
        }
      }

      public void warning(String filename, int ln, int col, String msg, String source, int errorCode)
      {
        filename = (filename == null || filename.length() == 0) ? path : filename;
        if (errorCode != -1)
        {
          ThreadLocalToolkit.logWarning(filename, msg, errorCode);
        }
        else
        {
          ThreadLocalToolkit.logWarning(filename, msg);
        }
      }

      public void error(String filename, int ln, int col, String msg, String source)
      {
        filename = (filename == null || filename.length() == 0) ? path : filename;
        ThreadLocalToolkit.logError(filename, msg);
      }

      public void warning(String filename, int ln, int col, String msg, String source)
      {
        filename = (filename == null || filename.length() == 0) ? path : filename;
        ThreadLocalToolkit.logWarning(filename, msg);
      }

      public FileInclude findFileInclude(String parentPath, String filespec)
      {
        return null;
      }
    });
    symbolTable.perCompileData.handler = cx.getHandler();

    context.setAscContext(cx);

    byte[] abc = null;
    try
    {
      abc = source.toByteArray();
View Full Code Here

    if (node.state != ProgramNode.Inheritance)
    {
      return;
    }

    CompilerContext context = unit.getContext();
    Context cx = context.getAscContext();
    symbolTable.perCompileData.handler = cx.getHandler();

    ObjectValue global = new ObjectValue(cx, new GlobalBuilder(), null);
    cx.pushScope(global); // first scope is always considered the global scope.

    // run FlowAnalyzer
    FlowGraphEmitter flowem = new FlowGraphEmitter(cx, unit.getSource().getName(), false);
    FlowAnalyzer flower = new FlowAnalyzer(flowem);
    context.setAttribute("FlowAnalyzer", flower);

    // 1. ProgramNode.state == Inheritance
    node.evaluate(cx, flower);
    cx.popScope();
View Full Code Here

TOP

Related Classes of flex2.compiler.CompilerContext

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.