Skip to content

Error in double-quoting.js when handling quoted ) and $ characters #58

@cetfor

Description

@cetfor

Hey, awesome job on bash-parser. I'm finding this extremely useful in my own work.

I've run into an issue when parsing ) and $ characters in quoted strings. Let me give an example to help explain.

Consider the following line:

command="$(echo "$input" | sed -e "s/^[ \t]*\([^ \t]*\)[ \t]*.*$/\1/g")"

This line is a part of a larger, more complex bash script I'm analyzing. There are actually two (2) issues here.

  1. At column 64, the $ causes an error.
  2. At column 55, the ) causes an error.

Removing the $ leads the parser to believe the ) at column 55 is the closing parentheses rather than a string literal.

Both issues boil down to line 50 in double-quoting.js, where reducers is undefined.

I understand this is a strange case since the issue here exists in parsing a string pattern. I'm honestly not too sure how to go about addressing this yet. If I come up with anything I'll make sure to comment here. Also, if you have any ideas please share them, I'd be happy to work on a fix as soon as I think of the best way to handle these cases.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions