Package org.luaj.vm2.ast

Examples of org.luaj.vm2.ast.Name


                // Traverse the directions table.
                LuaValue key = LuaValue.NIL;
                while (true) {

                    Varargs keyValue = directionsTable.next(key);
                    key = keyValue.arg1();
                    if (key.isnil()) {
                        break;
                    }
                    LuaValue directionTable = keyValue.arg(2);

                    int x = directionTable.get("x").checkint();
                    int y = directionTable.get("y").checkint();
                    int frameWidth = directionTable.get("frame_width").checkint();
                    int frameHeight = directionTable.get("frame_height").checkint();
View Full Code Here


        final int testCount        = tests.get("count").toint();
        final LuaValue provideFunc = tests.get("provide");
        final LuaValue runFunc     = tests.get("run");

        for (int i=1; i<testCount+1; i++) {
            final Varargs provideValue = provideFunc.invoke(valueOf(i));
            final LuaValue name = provideValue.arg(2);
            final String expected = provideValue.arg(3).checkjstring();

            Description testDescription = Description.createTestDescription(getClass(), name.toString());

            if (isIgnored(testDescription)) {
                notifier.fireTestIgnored(testDescription);
View Full Code Here

      } else {
        outr("new VarArgFunction(env) {");
        addindent();
        outb("public Varargs invoke(Varargs $arg) {");
        for ( int i=0; i<m; i++ ) {
          Name name = (Name) body.parlist.names.get(i);
          String value = i>0? "$arg.arg("+(i+1)+")": "$arg.arg1()";
          singleLocalDeclareAssign( name, value );
        }
        if ( body.parlist.isvararg ) {
          Variable arg = body.scope.find("arg");
View Full Code Here

      }
    }

    // functions that use themselves as upvalues require special treatment
    public void visit(LocalFuncDef stat) {
      final Name funcname = stat.name;
      final boolean[] isrecursive = { false };
      stat.body.accept( new Visitor() {
        public void visit(Name name) {
          if ( name.variable == funcname.variable ) {
            isrecursive[0] = true;
View Full Code Here

      super.visit(stat.block);
      oute( "}" );
    }

    private Name tmpJavaVar(String s) {
      Name n = new Name(s);
      n.variable = javascope.define(s);
      return n;
    }
View Full Code Here

      n.variable = javascope.define(s);
      return n;
    }
   
    public void visit(GenericFor stat) {
      Name f = tmpJavaVar("f");
      Name s = tmpJavaVar("s");
      Name var = tmpJavaVar("var");
      Name v = tmpJavaVar("v");
      String javaf = javascope.getJavaName(f.variable);
      String javas = javascope.getJavaName(s.variable);
      String javavar = javascope.getJavaName(var.variable);
      String javav = javascope.getJavaName(v.variable);
      outl("LuaValue "+javaf+","+javas+","+javavar+";");
View Full Code Here

    packageLib = new PackageLib();
    globals.load(packageLib);
    //globals.load(new Bit32Lib()); // not needed for 5.1 compatibility 
    globals.load(new TableLib());
    globals.load(new StringLib());
    globals.load(new CoroutineLib());
    globals.load(new JseMathLib());
    globals.load(new JseIoLib());
    globals.load(new JseOsLib());
    globals.load(new LuajavaLib());
    globals.load(new DebugLib());
View Full Code Here

    globals.load(new CoroutineLib());
    globals.load(new JseMathLib());
    globals.load(new JseIoLib());
    globals.load(new JseOsLib());
    globals.load(new LuajavaLib());
    globals.load(new DebugLib());
    globals.load(new LuaBytesLib(this));
    globals.load(new LuaListLib(this));
    globals.load(new LuaMapLib(this));
    globals.load(new LuaStreamLib(this));
    LuaC.install();
View Full Code Here

        return table;
    }

    private LuaValue getUrl() {

        return new LibFunction() {
            /**
             *  $text, $which, $query = null, $proto = null
             */
            @Override public Varargs invoke(Varargs args) {
                return NIL;
View Full Code Here

         * @param $ns           string|int Namespace
         * @param $text         string Title text
         * @param $fragment     string URI fragment
         * @param $interwiki    string Interwiki code
         */
        return new LibFunction() {
            @Override
            public Varargs invoke(Varargs args) {
                LuaValue ns    = args.arg(1);
                LuaValue title = args.arg(2);
                LuaValue fragment = args.arg(3);
View Full Code Here

TOP

Related Classes of org.luaj.vm2.ast.Name

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.