gorillascript icon indicating copy to clipboard operation
gorillascript copied to clipboard

Is there anyway to make a macro function manually by calling GorillaScript directly?

Open kkirby opened this issue 11 years ago • 0 comments

Basically what I'm wanting to do is tell GorillaScript to generate a macro function from something like the following:

let a = @tmp \a
ASTE let $a = true

The result would be a function looking like:

(function() {
return (function () {
  "use strict";
  return function (macroFullData, __wrap, __const, __value, __symbol, __call, __macro) {
    var a, macroData, macroName;
    macroName = macroFullData.macroName;
    macroData = macroFullData.macroData;
    a = this.tmp("abc", true);
    __macro(
      void 0,
      38,
      {
        macroName: "let",
        macroData: {
          declarable: __macro(
            void 0,
            37,
            __macro(
              void 0,
              31,
              { ident: __wrap(a) },
              true,
              false,
              false,
              false
            ),
            true,
            false,
            false,
            false
          ),
          value: __const("false")
        }
      },
      true,
      false,
      false,
      false
    );
  };
}.call(this));

})

Is there anyway to do this? I'm sure there is, I just don't know the right calls to make. I would be doing this within a macro, so the parser would be available to me, as well as a macro context (not sure how that helps). I also have access to GorillaScript.

kkirby avatar Jan 22 '14 19:01 kkirby