Help improve program for parsing simple rules
pruebauno at latinmail.com
pruebauno at latinmail.com
Fri Apr 17 08:52:40 EDT 2009
On Apr 16, 9:29 pm, John Machin <sjmac... at lexicon.net> wrote:
> On Apr 17, 1:57 am, prueba... at latinmail.com wrote:
>
> > COMP_REPLACERS={'LT':'<', 'GT':'>', 'LE':'<=', 'GE':'>=', '=':'==',
> > '=>':'=>', '=<':'=<'}
>
> What do the '=>' and '=<' represent? Why are you replacing each by
> itself?
because of this:
groups=split_seccions(subst,COMP_REPLACERS.values())
I didn't want to create a separate variable. Those are dubious anyway,
I haven't seen one in all of our current rules and it generates a
syntax error in Python so I took them out:
COMP_REPLACERS={'LT':'<', 'GT':'>', 'LE':'<=', 'GE':'>=', '=':'=='}
And before somebody else points it out. This line:
(TOK.NUMBER,str(vars_.get(x[1],x[1]))) if x[0]==TOK.NAME
should really be:
(TOK.NUMBER,str(vars_[x[1]])) if (x[0]==TOK.NAME and x[1] in vars_)
More information about the Python-list
mailing list