Package nexj.core.scripting

Examples of nexj.core.scripting.Compiler


         body = new Pair(new Pair(Symbol.LAMBDA, new Pair(null, m_initializer)), body);
         setPosURLs(m_initializer, "initializer");
      }

      Function func = null;
      Compiler compiler = new Compiler();

      if (m_nLoopCount > 0)
      {
         Pair argTail = null;
         Pair loopVariables = null;

         m_loopFunctionArray = new Function[m_nLoopCount];

         for (int nLoop = 0; nLoop < m_nLoopCount; nLoop++)
         {
            m_loopFunctionArray[nLoop] = compiler.compile(
               Pair.list(Symbol.LAMBDA, loopVariables, getLoopVarExpr(nLoop)),
               m_posMap, m_urlMap, machine, false
            );

            if (loopVariables == null)
            {
               loopVariables = new Pair(getLoopVarSymbol(nLoop));
               argTail = loopVariables;
            }
            else
            {
               argTail.setTail(argTail = new Pair(getLoopVarSymbol(nLoop)));
            }
         }

         m_allVariables = Pair.append(loopVariables, m_variables);
      }
      else
      {
         m_allVariables = m_variables;
      }

      try
      {
         body = Pair.list(Symbol.LAMBDA, m_allVariables, new Pair(Symbol.VECTOR, body));

         // Set the top level code's URL
         Object pos = new TextPosition(0, 0);
         m_posMap.put(body, pos);
         m_urlMap.put(pos, URL_PREFIX + getName());

         func = compiler.compile(body, m_posMap, m_urlMap, machine, false);
      }
      catch (CompilerException e)
      {
         MetadataValidationException x = new MetadataValidationException(e);
View Full Code Here


               }

               Compiler.setPosURLs(fun, buf.toString(), posMap);
            }

            fun = machine.invoke(new Compiler().compile(fun, posMap, machine, true),
               (Pair)null);
         }
         finally
         {
            env.removeVariable(SYS_CURRENT_CLASS);
View Full Code Here

      {
         m_errorFunction = null;
      }
      else
      {
         m_errorFunction = new Compiler().compile(
            Pair.list(Symbol.LAMBDA, Pair.list(Symbol.THIS), expr),
            null, "channel:" + m_sName, machine, false);
      }
   }
View Full Code Here

         pair = new Pair(Symbol.define(((Argument)m_argList.get(i)).getName()), pair);
      }

      // (macro (arg1 ... argN) <body>)

      m_function = new Compiler().compile(
         new Pair(Symbol.MACRO, new Pair(pair, (m_body == null) ? Pair.list(null) : m_body)),
         m_textPosMap, getURL(), machine, false);

      m_body = null;
   }
View Full Code Here

      try
      {
         m_posMap.put(code, new TextPosition(0, 0, URL_PREFIX + m_sName));
         machine.getGlobalEnvironment().defineVariable(Symbol.SYS_CURRENT_LOGGER, m_logger);

         return new Compiler().compile(code, m_posMap, machine, false);
      }
      catch (CompilerException e)
      {
         MetadataValidationException x = new MetadataValidationException(e);
View Full Code Here

                  m_textPosMap.put(expr, pos);
                  urlMap.put(pos, "class:" + getName() + "$validation");
               }

               m_validationFunction = new Compiler().compile(expr, m_textPosMap, urlMap, machine, false);
            }
            catch (Exception e)
            {
               MetadataValidationException x;
View Full Code Here

            addDependency(ASSOC_QUERY, m_metaclass, m_metaclass,
               m_metaclass.dependency(value, false, getInvocationContext().getMachine()), OUTPUT_LAZY);
         }

         field = new Field(this, sName,
            new Compiler().compile(Pair.list(Symbol.LAMBDA, Pair.list(Symbol.THIS), value),
               null, m_context.getMachine(), false));
      }

      m_fieldMap.put(sName, field);
      addOutputField(field);
View Full Code Here

                  new Pair(Symbol.THIS,
                     new Pair((m_output == null) ? null : m_output.getName(), code))))));

      try
      {
         m_function = new Compiler().compile(code, m_posMap, m_urlMap, machine, false);
      }
      catch (CompilerException e)
      {
         MetadataValidationException x = new MetadataValidationException(e);
View Full Code Here

                  posMap.put(pair.getHead(), pos);
                  urlMap.put(pos, sEventURL);
               }
            }
           
            m_function = new Compiler().compile(code, posMap, urlMap, machine, false);
         }
         catch (Exception e)
         {
            MetadataValidationException x;
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.