A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20150905/be8a70a1/attachment.html below:

<p dir="ltr">On Sep 5, 2015 11:32 AM, "Eric V. Smith" <<a href="mailto:eric@trueblade.com">eric@trueblade.com</a>> wrote:<br>
><br>
> > Actually, my current implementation doesn't use the lexer, although I<br>
> > suppose it could. I'm currently manually scanning the string, keeping<br>
> > track of strings and parens. To find the end of an expression, it looks<br>
> > for a '!', ':', or non-doubled '}', not inside of a string or (), [], or<br>
> > {}. There's a special case for '!=' so the bang isn't seen as ending the<br>
> > expression.<br>
><br>
> Ignore the part about non-doubled '}'. The actual description is:<br>
><br>
> To find the end of an expression, it looks for a '!', ':', or '}', not<br>
> inside of a string or (), [], or {}. There's a special case for '!=' so<br>
> the bang isn't seen as ending the expression.</p>
<p dir="ltr">Sounds like you're reimplementing a lot of the lexer... I guess that's doable, but how confident are you that your definition of "inside a string" matches the original in all corner cases?</p>
<p dir="ltr">In any case the abstract language definition part should be phrased in terms of the python lexer -- the expression ends when you encounter the first } *token* that is not nested inside () [] {} *tokens*, and then you can implement it however makes sense...</p>
<p dir="ltr">(This is then the same rule that patsy uses to find the end of python expressions embedded inside patsy formula strings: <a href="http://patsy.readthedocs.org">patsy.readthedocs.org</a>)</p>
<p dir="ltr">-n</p>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4