Skip Menu |
 

This queue is for tickets about the Shell-Parser CPAN distribution.

Report information
The Basics
Id: 67596
Status: new
Priority: 0/
Queue: Shell-Parser

People
Owner: Nobody in particular
Requestors: eli [...] panix.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Shell::Parser bug and suggestion
Date: Tue, 19 Apr 2011 18:11:34 -0400 (EDT)
To: bug-shell-parser [...] rt.cpan.org
From: Eli the Bearded <eli [...] panix.com>
Download (untitled) / with headers
text/plain 1.4k
Hello, From the "Copyright 2004", maybe you are long past caring, but I was looking at Shell::Parser and noticed some issues with it. In your own example of parsing: #!/bin/sh if [ "$text" != "" ]; then grep "$text" file.txt; fi The trace output contains: text: <"$text"> text: < > assign: <!=> text: < > text: <""> But there is no assignment going on there, that should be text. Unlike perl, shells are really strict about whitespace around =, so "varname = value" is not acceptable. The "$text", !=, and "" strings are parameters to the <[> command, which is a synonym for <test>. I'd also consider it a bug that you do not group together the $IFS whitespace into a single token. Nor do you distinguish types of quoted string. $parser->parse(q*echo "The $cow \"jumps\" over "'the $moon' && $again*); gives output: text: <echo> text: < > text: <"The $cow \"jumps\" over "'the $moon'> text: < > text: < > metachar: <&> metachar: <&> text: < > variable: <$again> When I'd expect: text: <echo> ifs: < > dquoted: <"The $cow \"jumps\" over "> squoted: <'the $moon'> ifs: < > metachar: <&> metachar: <&> ifs: < > variable: <$again> One more thing is that your set of shell syntax definitions is lacking. My ksh has an <enum> builtin, but that's not in your syntax. Rather than try to correct the reasonable defaults, I'd suggest way to define a custom syntax. See attached patch. Elijah
Download shell-parser.diff
text/x-diff 2.5k

Message body is not shown because sender requested not to inline it.



This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.