Package nexj.core.scripting

Examples of nexj.core.scripting.Compiler


      if (sScript != null)
      {
         Intrinsic.load(sScript, machine);
      }

      final Pair spec = (Pair)machine.invoke(new Compiler().compile(
         new SchemeParser(machine.getGlobalEnvironment()).parse(new StringReader(sQuery), null),
         null, machine, true), (Pair)null);

      exportData(new Exporter()
      {
View Full Code Here


   /**
    * @see nexj.core.tools.GenericREPL#evaluate(java.lang.Object)
    */
   protected Object evaluate(Object expr)
   {
      PCodeFunction fun = new Compiler().compile(expr, null, m_machine, true);
      Object value = m_machine.invoke(fun, (Pair)null);

      m_machine.getGlobalEnvironment().defineVariable(LAST, value);

      return value;
View Full Code Here

    */
   private PCodeFunction compile(Object expr, Pair args, Machine machine, String sItem)
   {
      try
      {
         return new Compiler().compile(
            new Pair(Symbol.LAMBDA, new Pair(args, new Pair(expr))),
            m_textPosMap, machine, false);
      }
      catch (Exception e)
      {
View Full Code Here

      super.setUp();

      m_metadata = Repository.getMetadata();
      m_context = new InvocationContext(m_metadata);
      m_parser = new SchemeParser(m_context.getMachine().getGlobalEnvironment());
      m_compiler = new Compiler();

      try
      {
         m_context.initialize(null);
      }
View Full Code Here

    */
   public void compile(Machine machine)
   {
      if (m_body != null)
      {
         m_function = new Compiler().compile(
            new Pair(Symbol.LAMBDA, new Pair(null, m_body)),
            m_posMap, "upgrade:" + m_upgrade.getName() + '$' + m_sName, machine, false);
         m_body = null;
      }
   }
View Full Code Here

    * Initializes the definitions and implementations into the global environment.
    * @param machine The virtual machine.
    */
   public void initDefinitions(Machine machine)
   {
      Compiler compiler = new Compiler();
      Lookup posMap = new HashTab();

      for (Iterator defItr = m_definitionMap.valueIterator(); defItr.hasNext(); )
      {
         Definition def = (Definition)defItr.next();

         for (Iterator typeItr = def.getTypesIterator(); typeItr.hasNext(); )
         {
            ModelType type = (ModelType)typeItr.next();
            Object code = type.getCode();
            PCodeFunction fun;

            posMap.clear();
            posMap.put(code, new TextPosition(0, 0, "definition:" + type.getGlobalName()));
            fun = compiler.compile(code, posMap, machine, false);
            machine.invoke(fun, (Pair)null);
         }

         for (Iterator intItr = def.getInterfacesIterator(); intItr.hasNext(); )
         {
            Interface iface = (Interface)intItr.next();
            Object code = iface.getCode();
            PCodeFunction fun;

            posMap.clear();
            posMap.put(code, new TextPosition(0, 0, "definition:" + iface.getGlobalName()));
            fun = compiler.compile(code, posMap, machine, false);
            machine.invoke(fun, (Pair)null);
         }

         for (Iterator svcItr = def.getServicesIterator(); svcItr.hasNext(); )
         {
            Service service = (Service)svcItr.next();
            Object code = service.getCode();
            PCodeFunction fun;

            posMap.clear();
            posMap.put(code, new TextPosition(0, 0, "definition:" + service.getGlobalName()));
            fun = compiler.compile(code, posMap, machine, false);
            machine.invoke(fun, (Pair)null);
         }
      }

      for (Iterator implItr = m_implementationMap.valueIterator(); implItr.hasNext(); )
      {
         Implementation impl = (Implementation)implItr.next();
         Object code = impl.getCode();
         PCodeFunction fun;

         posMap.clear();
         posMap.put(code, new TextPosition(0, 0, "implementation:" + impl.getNamePrefix()));

         try
         {
            machine.getGlobalEnvironment().defineVariable(Symbol.SYS_CURRENT_LOGGER,
               Logger.getLogger(SysUtil.NAMESPACE + ".soa." +
                  impl.getService().getDefinition().getNamePrefix().replace('.', '_') + '.' + impl.getService().getName()));
            fun = compiler.compile(code, posMap, machine, false);
            machine.invoke(fun, (Pair)null);
         }
         finally
         {
            machine.getGlobalEnvironment().removeVariable(Symbol.SYS_CURRENT_LOGGER);
View Full Code Here

         Event event = (Event)itr.getKey1();
         Pair body = (Pair)machine.invoke((Function)machine.getGlobalEnvironment()
            .getVariable(Symbol.SYS_GENERATE_FLOW_FUNCTION), itr.getValue(), (Object[])null);

         itr.setValue(new Pair(new Compiler().compile(m_variables,
            event.getArguments(true), body, m_posMap, m_urlMap, machine)));
         map.put(event.getRoot(), itr.getKey2(), null);
      }

      for (Lookup2D.Iterator itr = map.valueIterator(); itr.hasNext();)
View Full Code Here

         posMap.put(body, new TextPosition(0, 0));
      }

      setPosURLs(body);

      return new Compiler().compile(flow.getVariables(),
         args, body, flow.getPosMap(), flow.getURLMap(), machine);
   }
View Full Code Here

         )
      );

      textPosMap.put(code, new TextPosition(0, 0, sURL));

      m_function = new Compiler().compile(code, textPosMap, machine, false);
   }
View Full Code Here

         )
      );

      textPosMap.put(code, new TextPosition(0, 0, sURLPrefix));

      m_function = new Compiler().compile(code, textPosMap, machine, false);
   }
View Full Code Here

TOP

Related Classes of nexj.core.scripting.Compiler

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.