Comments (5)
hi. the main issue here isn't a bug - it's how lepl works. you can either
work in tokens, or not, but not both. that's what the error message says.
trying to tokenize String fails because String is too complex for lepl to
tokenize automatically. it might be possible to write String so that it can be
converted automatically, and i will add that to the list of things to do, but
meantime you can simply define your own regular expression:
myString = Regexp("'[^']*'")
or similar.
andrew
Original comment by [email protected]
on 1 Jan 2012 at 10:55
- Changed state: WontFix
from lepl.
[deleted comment]
from lepl.
Well, I have defined my own string indeed
string = Token('"[^"]+"') | Token("'[^']+'")
However I have no idea how to allow quoting of apostrophe or quotation
characters with backslash, i.e. "test\"string" or 'test\'string'.
Using Python regular expressions that would be
r""""(([^"]|\")+)"|'(([^']|\')+)'"""
w
Original comment by [email protected]
on 1 Jan 2012 at 11:48
from lepl.
the syntax for regexps should be the same as python, except that capturing
groups are not supported. so you need to replace each (...) with (?:...)
andrew
Original comment by [email protected]
on 2 Jan 2012 at 12:11
from lepl.
Thanks for the tip.
The definition is as follows
string = Token(r'"(?:[^"]|\\")+"') | Token(r"'(?:[^']|\\')+'")
But I wonder how above is different from SingleLineString?
If it is not different, then I would like to report that the following code
fails
"""
from lepl import *
v = Token('[a-z]+') & Token(' +') & Token(SingleLineString())
v.parse('aaa "aaa"')
"""
w
Original comment by [email protected]
on 5 Jan 2012 at 6:53
from lepl.
Related Issues (20)
- Regexp Inverted Ranges Unreliable HOT 1
- LEPL-2.3.2 installed with easy_install gives "ImportError: No module named regexp" error HOT 1
- Error Handling and Tracing HOT 1
- Better graph support HOT 1
- Offside Rule HOT 1
- '*' Operator Fails (Multiple Arguments?) HOT 2
- Cloning loses matchers HOT 2
- Incorrect loop detection HOT 2
- Undo Actions
- lepl.functions.String bug HOT 7
- Regexp / Line Aware Improvements HOT 11
- Join function not in __all__ list HOT 1
- Node should implement __ne__ as well as __eq__ or use == rather than != in __eq__ HOT 1
- Can't print empty lepl.List objects. HOT 3
- antlr grammar for lepl HOT 1
- infinite loop in case of block related grammar HOT 4
- Incorrect example in offside rule documentation HOT 1
- cannot parse from a file HOT 4
- lepl.String() does not match empty-string: "" HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lepl.