PythonCompiler icon indicating copy to clipboard operation
PythonCompiler copied to clipboard

rply.errors.LexingError

Open selimaj-dev opened this issue 3 years ago • 2 comments

specification

python version: 3.10.9 cpu: M1 os: macOS Ventura 13.1 MBA 2020

error

if I run it using the print(1) method it works. but if I try a str print("Hello, World") it gives this error: rply.errors.LexingError: (None, SourcePosition(idx=0, lineno=1, colno=1))

Full error:

  return self.pg.build()
Traceback (most recent call last):
  File "/Users/klestiselimaj/Projects/lang/main.py", line 21, in <module>
    parser.parse(tokens).eval()
  File "/Users/klestiselimaj/Library/Python/3.9/lib/python/site-packages/rply/parser.py", line 32, in parse
    lookahead = next(tokenizer)
  File "/Users/klestiselimaj/Library/Python/3.9/lib/python/site-packages/rply/lexer.py", line 62, in __next__
    return self.next()
  File "/Users/klestiselimaj/Library/Python/3.9/lib/python/site-packages/rply/lexer.py", line 58, in next
    raise LexingError(None, SourcePosition(
rply.errors.LexingError: (None, SourcePosition(idx=0, lineno=1, colno=1))```

selimaj-dev avatar Feb 06 '23 21:02 selimaj-dev

The creator of the repo didn't add support for strings, he only added support for integers and basic mathematical equations. You could add support for them though. One year late...

Happy coding!

TENTHER101 avatar Apr 01 '24 15:04 TENTHER101

Thanks for the reply! I'm making my own parser and lexer in rust now.

selimaj-dev avatar Apr 03 '24 16:04 selimaj-dev