Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Two very simple questions
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Thibaud  
View profile  
 More options Sep 9 2011, 5:43 pm
From: Thibaud <thibaud.antig...@gmail.com>
Date: Fri, 9 Sep 2011 14:43:51 -0700 (PDT)
Local: Fri, Sep 9 2011 5:43 pm
Subject: Two very simple questions

Hi all!

I am beginning to use LEPL. It seems very promising but I have two problems.
I guess the answer is easy or already written somewhere, but I searched for
some time now and I did not found yet :(

Firstly, this very simple code:

with TraceVariables():
from lepl import *
PERCENT = Token('%')
TEXT = Token('[^\n]*')
comment = PERCENT & TEXT
print(comment.parse('% ThisIsAComment'))

outputs:

Traceback (most recent call last):
  File
"/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packa ges/LEPL-5.0.0-py3.2.egg/lepl/stream/maxdepth.py",
line 55, in _matcher
    (result2, stream2) = yield generator
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 6, in <module>
  File
"/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packa ges/LEPL-5.0.0-py3.2.egg/lepl/core/config.py",
line 858, in parse
    return self.get_parse()(input_, **kargs)
  File
"/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packa ges/LEPL-5.0.0-py3.2.egg/lepl/core/parser.py",
line 257, in single
    return next(raw(arg, **kargs))[0]
  File
"/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packa ges/LEPL-5.0.0-py3.2.egg/lepl/core/parser.py",
line 161, in trampoline
    value = stack[-1].generator.throw(value)
  File
"/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packa ges/LEPL-5.0.0-py3.2.egg/lepl/stream/maxdepth.py",
line 61, in _matcher
    raise FullFirstMatchException(stream1)
lepl.stream.maxdepth.FullFirstMatchException: The match failed in <string>
at '% ThisIsAComment' (line 1, character 1).

I do not really see why it does not work... I did some tests with only '%'and it is correctly detected.

The second (and last) point ; this simple code:

test = Token(String())
test.parse('"irt"')

produces:

Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
  File
"/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packa ges/LEPL-5.0.0-py3.2.egg/lepl/core/config.py",
line 858, in parse
    return self.get_parse()(input_, **kargs)
  File
"/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packa ges/LEPL-5.0.0-py3.2.egg/lepl/core/config.py",
line 815, in get_parse
    return make_single(self.get_match())
  File
"/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packa ges/LEPL-5.0.0-py3.2.egg/lepl/core/config.py",
line 723, in get_match
    return self._raw_parser()
  File
"/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packa ges/LEPL-5.0.0-py3.2.egg/lepl/core/config.py",
line 675, in _raw_parser
    make_raw_parser(self, stream_factory, config)
  File
"/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packa ges/LEPL-5.0.0-py3.2.egg/lepl/core/parser.py",
line 220, in make_raw_parser
    matcher = rewriter(matcher)
  File
"/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packa ges/LEPL-5.0.0-py3.2.egg/lepl/lexer/rewriters.py",
line 125, in __call__
    return self.lexer(graph, tokens, self.alphabet, self.discard)
  File
"/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packa ges/LEPL-5.0.0-py3.2.egg/lepl/lexer/lexer.py",
line 74, in __init__
    token.compile(alphabet)
  File
"/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packa ges/LEPL-5.0.0-py3.2.egg/lepl/lexer/matchers.py",
line 135, in compile
    self.regexp = self.__to_regexp(self.regexp, self.alphabet)
  File
"/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packa ges/LEPL-5.0.0-py3.2.egg/lepl/lexer/matchers.py",
line 155, in __to_regexp
    'a regular expression: {0}', rewrite))
lepl.lexer.support.LexerError: A Token was specified with a matcher, but the
matcher could not be converted to a regular expression: And(NfaRegexp,
Transform, NfaRegexp)

It is as if the regexp behind String() was not recognized by LELP itself. Do
I miss something?

Thank you very much if you can help me or give me some clues :)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.