[LEPL] conversion to 4.0

8 views
Skip to first unread message

Neal Becker

unread,
Apr 16, 2010, 11:50:29 AM4/16/10
to le...@googlegroups.com
Ok, I'll admit I've only started to read the 4.0 docs. I'm trying to see if
my 3.x lepl code will still work. It doesn't. It appears to be choking on a
'\n' character.

Here's the relevant part of my code (I think):

name = Word() > 'name'
datetime = Drop(Literal('datetime.datetime')+'(')+Word(AnyBut(')'))+Drop(')')
value = Drop("'") & Word(AnyBut("'")) & Drop("'") | Word() | datetime >
'value'
arg = name & '=' & value > make_dict
spaces = ~Whitespace()[:]
with Separator(spaces):
sep = ','
args = arg[1:,Drop(sep)]
l = Drop('Namespace(') & args & Drop(')') > combine

Here's the error message:

FullFirstMatchException: The match failed at '
',
Line 1, character 640 of str: "Namespace(agcEnable=False, alph....

I'm wondering if somebody might just know right off what change could cause
this.

--
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.

andrew cooke

unread,
Apr 16, 2010, 11:58:15 AM4/16/10
to le...@googlegroups.com

Two possibilities.

First, perhaps it never worked. Lepl 4 now checks whether you have matched
the full string, and gives an error if not. Before it just silently returned
whatever match you had.

To disable this, use
matcher.config.no_full_first_match()

Second, maybe something has changed with Whitespace()? I can't see any change
(it includes newline), and it would be a bit stupid of me to do so (but that
doesn't mean it's impossible) so I'm hoping it's the first.

Cheers,
Andrew

andrew cooke

unread,
Apr 16, 2010, 12:00:41 PM4/16/10
to le...@googlegroups.com

Looking in more detail at you code I think maybe you want "sep" to be
something like Drop(Or(Whitespace(), ',')[:]) and I suspect this has always
been a problem in the code?

Andrew

Neal Becker

unread,
Apr 16, 2010, 12:37:27 PM4/16/10
to le...@googlegroups.com, andrew cooke
Problem is trailing '\n'. I just modified the calling code to remove the '\n'.
Problem solved.
Reply all
Reply to author
Forward
0 new messages