can we use Context.parsing using existing macro Expr ?

classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: can we use Context.parsing using existing macro Expr ?

sledorze
The new version is not yet on github i ll do it over the day. In addition, i'll change the syntax so you can mix it with the format macro for more flexibility.

Sent from my iPhone

On 2 nov. 2011, at 07:48, "go2ghana [via Haxe]" <[hidden email]> wrote:

Am 02.11.2011 00:47, schrieb sledorze:

> New version  will make it ridiculous :) :
>
>    @:macro public static function forExample2(init : Expr, cond : Expr, inc :
> Expr, body : Expr) : Expr return
>      "{
>        var i;
>        $init;
>        function oneTime() {
>          if ($cond) {
>            $body;
>            $inc;
>            oneTime();
>          }
>        }
>        oneTime();
>      }".stagged()
>
>
>
> --
> View this message in context: http://haxe.1354130.n2.nabble.com/can-we-use-Context-parsing-using-existing-macro-Expr-tp6951178p6953663.html
> Sent from the Haxe mailing list archive at Nabble.com.
>
Looks like I don't get how to use it - compilation fails with:

String has no field stagged

Hi, Could you provide a working example?

Cordially,
Axel


--
haXe - an open source web programming language
http://haxe.org



If you reply to this email, your message will be added to the discussion below:
http://haxe.1354130.n2.nabble.com/can-we-use-Context-parsing-using-existing-macro-Expr-tp6951178p6954260.html
To unsubscribe from can we use Context.parsing using existing macro Expr ?, click here.
Reply | Threaded
Open this post in threaded view
|

Re: can we use Context.parsing using existing macro Expr ?

sledorze
In reply to this post by go2ghana
The new version is available on github.

note that, like I said, I've changed the syntax for:

  @:macro public static function forExample2(init : Expr, cond : Expr, inc : Expr, body : Expr) : Expr return
    "{
      %init;
      function oneTime() {
        if (%cond) {
          %body;
          %inc;
          oneTime();
        }
      }
      oneTime();
    }".stagged()


simply so that you can now mix it with format.
I've also changed the test to :

    var i;
    StaggedTestMacros.forExample2(i = 0, i < 10, i++, trace(i));

   trace("final i " + i);

where the i var is externalized; but it depends on you own needs.. just know that it's possible.

Enjoy!

Stephane
On Wed, Nov 2, 2011 at 8:36 AM, Stephane Le Dorze <[hidden email]> wrote:
The new version is not yet on github i ll do it over the day. In addition, i'll change the syntax so you can mix it with the format macro for more flexibility.

Sent from my iPhone

On 2 nov. 2011, at 07:48, "go2ghana [via Haxe]" <[hidden email]> wrote:

Am 02.11.2011 00:47, schrieb sledorze:

> New version  will make it ridiculous :) :
>
>    @:macro public static function forExample2(init : Expr, cond : Expr, inc :
> Expr, body : Expr) : Expr return
>      "{
>        var i;
>        $init;
>        function oneTime() {
>          if ($cond) {
>            $body;
>            $inc;
>            oneTime();
>          }
>        }
>        oneTime();
>      }".stagged()
>
>
>
> --
> View this message in context: http://haxe.1354130.n2.nabble.com/can-we-use-Context-parsing-using-existing-macro-Expr-tp6951178p6953663.html
> Sent from the Haxe mailing list archive at Nabble.com.
>
Looks like I don't get how to use it - compilation fails with:

String has no field stagged

Hi, Could you provide a working example?

Cordially,
Axel


--
haXe - an open source web programming language
http://haxe.org



If you reply to this email, your message will be added to the discussion below:
http://haxe.1354130.n2.nabble.com/can-we-use-Context-parsing-using-existing-macro-Expr-tp6951178p6954260.html
To unsubscribe from can we use Context.parsing using existing macro Expr ?, click here.



--
Stéphane Le Dorze


12