I have added a restricted version of this back into Felix:

~/felix>cat q.flx
val x = 1;
val y = "World";
val z = 99.76;
val s = q"ab$(x)$(y)$(z)cd";

~/felix>flx --test=build/release q
ab1World99.76cd

The constraint is: you can only use unqualified variable names in the $(varname)
bits, you cannot put a general expression. The reason is that the contents
of $(..) are discovered AFTER parsing.  To reparse them requires a complex
mechanism which will reprocess all the syntax and auto-includes, just to
reload the syntax automaton. This CAN be done I think: it is already
done in the same piece of code for include files. 

The other way to do this is to actually parse the q".." string inside the 
parser.
This is also possible but tricky! It either involves early recursion of the 
parser
from the Scheme action codes (which requires some way to call Ocaml functions
from Scheme), or, it requires the actual string to be parsed by grammar
productions. Both are possible but messy.

For expressions there's a simple workaround:

        q"hello $(get_name() + delim), wie gehts?"

can be replaced by

        (let ?x = get_name() + delim in
        q"hello $(x), wie gehts?")

Finally note, the variable's type must have a visible "str" function.

--
john skaller
skal...@users.sourceforge.net





------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to