Cant figure out this error

0 views
Skip to first unread message

Greg Bowyer

unread,
Nov 11, 2011, 12:57:58 AM11/11/11
to lepl
Hi all

My parser is as follows

_bool = (Literal('true') | Literal('false')) >> bool
_float = Real() >> float
_int = Integer() >> int
_string = (AnyBut(Whitespace()))[...] >> unquote_plus

value = (_float | _int | _bool | _string) & Eos()
pair = Word() & Drop('=') & value > tuple

d = Drop('{') & pair & Drop('}') > dict

I cant figure out why d.parse('{test1=test2}') fails what am I
missing ?

andrew cooke

unread,
Nov 11, 2011, 5:44:59 AM11/11/11
to le...@googlegroups.com

just looking at your code, you have an Eos() at the end of value. that means
that the input must end after the value, while you have a "}".

there may be other problems, but that certainly won't help.

using TraceVariables is a good way to debug -
http://acooke.org/lepl/debugging.html#index-3 - it will show you how far you
matche, etc.

andrew

> --
> You received this message because you are subscribed to the Google Groups "lepl" group.
> To post to this group, send email to le...@googlegroups.com.
> To unsubscribe from this group, send email to lepl+uns...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/lepl?hl=en.
>

Reply all
Reply to author
Forward
0 new messages