Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

space at the end of line - parse error #55

Open
bAndie91 opened this issue Apr 24, 2020 · 3 comments
Open

space at the end of line - parse error #55

bAndie91 opened this issue Apr 24, 2020 · 3 comments

Comments

@bAndie91
Copy link

>>> bashlex.parse('cmd1\ncmd2 \ncmd3\n')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "bashlex/parser.py", line 614, in parse
    part = _parser(s[index:], strictmode=strictmode).parse()
  File "bashlex/parser.py", line 682, in parse
    tree = theparser.parse(lexer=self.tok, context=self)
  File "bashlex/yacc.py", line 277, in parse
    return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc,context)
  File "bashlex/yacc.py", line 1079, in parseopt_notrack
    tok = self.errorfunc(errtoken)
  File "bashlex/parser.py", line 539, in p_error
    p.lexer.source, p.lexpos)
bashlex.errors.ParsingError: unexpected token 'cmd3' (position 1)
@samlikins
Copy link

I was unable to reproduce this issue using version 0.18.

@idank
Copy link
Owner

idank commented May 17, 2023

Hey, thanks for going over these issues. It would be extra awesome if you could add a test case that shows these parse correctly.

@samlikins
Copy link

samlikins commented May 17, 2023

@idank: Absolutely!

In a Python interactive session (using bashlex v0.18):

Python 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import bashlex
>>> bashlex.parse('cmd1\ncmd2 \ncmd3\n')
[CommandNode(parts=[WordNode(parts=[] pos=(0, 4) word='cmd1')] pos=(0, 4)), CommandNode(parts=[WordNode(parts=[] pos=(5, 9) word='cmd2')] pos=(5, 9)), CommandNode(parts=[WordNode(parts=[] pos=(11, 15) word='cmd3')] pos=(11, 15))]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants