-
Notifications
You must be signed in to change notification settings - Fork 4
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
Update parser.py #19
Update parser.py #19
Conversation
OS:ubuntu-20.04 |
Thank you for this PR! Could you also add a test that checks this behavior? Then we can merge it! |
OS:ubuntu-20.04 |
OS:ubuntu-20.04 |
This test script works for the current implementation, though I'm not sure it is the best solution as it interprets code such as |
@Cyerunix Thanks and sorry for the delayed response! As far as I understand the operand is now correctly parsed but it is not correctly printed. If that is the case I think we can safely merge and this can be fixed later. If I misunderstood something let me know! |
I believe what happens is the printer removes the quotes around operands when it prints them, so something like |
Thanks for the clarification @Cyerunix !! Yes it is correct to parse "" as an operand, so the printing needs to be fixed later. If you can add an issue about it pointing to this PR too that would be great!! |
In the
parse
function inparser/parser.py
, if the empty string is included inparsed_elements_list
(which may be the case when parsing commands such asecho ""
), the function call toare_all_individually_flags
on line 39 will fail because once line 117 is reached (the first line ofare_all_individually_flags
), the code will attempt to access the first character ofpotential_flag_or_option
, which will fail sincepotential_flag_or_option
will be the empty string at this point.I believe this slight change should fix the problem.