G
G
gagarinten2022-01-15 12:46:07
Python
gagarinten, 2022-01-15 12:46:07

How to make String type in rply lexer?

I need to render the string "string" using regular expressions, in the rply lexer.
I wrote this code . And he writes me an error, when I write 'move' to him, he gives me an error. Although I checked this regex! What to do? Here is the error
self.lexer.add('STRING', r"(?<=').+(?=')")

Traceback (most recent call last):
  File "C:\Users\Stud\Documents\SS-22\main.py", line 7, in <module>
    for token in tokens:
  File "C:\Users\Stud\Documents\SS-22\venv\lib\site-packages\rply\lexer.py", line 62, in __next__
    return self.next()
  File "C:\Users\Stud\Documents\SS-22\venv\lib\site-packages\rply\lexer.py", line 58, in next
    raise LexingError(None, SourcePosition(
rply.errors.LexingError: (None, SourcePosition(idx=0, lineno=1, colno=1))

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question