[DGD]parse_string

Ludger Merkens balduin at uni-paderborn.de
Tue Feb 1 14:42:07 CET 2000


On Fri, 28 Jan 2000, Felix A. Croes wrote:

Another parse_string example
I try the following:

    grammar = "\
whitespace=/[ !-[]+/            \ /* note the [ in the set */
tag=/<[a-zA-Z]+>/               \
term =/\\(*[A-Za-z`']+\\)*/     \
s : term ? _term                \
s : tag ?  _tag                 \
";

if i call parse_string("! <abc>",grammar) i receive
({"abc"}) and the function _term is called.
looks wrong to me.

If I remove the '[' from the set in whitespace , I get the grammar 
    grammar = "\
whitespace=/[ !-]+/         \
tag=/<[a-zA-Z]+>/           \
term =/\\(*[A-Za-z`']+\\)*/ \
s : term ? _term            \
s : tag ?  _tag             \
";

parse_string("! <abc>",grammar) now returns:
({"<abc>"}) and the function _tag is called. Which is what I intended.
According to the Manpages '[' needs not to be escaped in a set (and I
tried to escape it like whitespace=/[ !-\\[]+/         \ and failed)

confused

Ludger Merkens
(balduin at uni-paderborn.de)



List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list