Commit Graph

13 Commits

Author SHA1 Message Date
Max Brunsfeld c34619a1c4 Don't parse square bracket commands as special syntax 2018-02-28 14:32:58 -08:00
Max Brunsfeld 675a581839 Allow special characters in bare word arguments
I've moved tokenization of bare words into the external scanner. This
way we can keep the grammar simple, but support some fancy rules that
I've inferred from experimenting with bash:

- Only allow '}' inside of a bare word if '}' isn't a valid lookahead
token (i.e. we're not inside of a variable expansion).
- Only allow ']' at the *start* of a bare word if neither ']' nor ']]'
are valid lookahead tokens (i.e. we're not inside of a square bracket
command or an array subscript).
- Parentheses seem to never be allowed in bare words. You have to quote
them.

For alphanumeric words, I fall through to the normal scanner so that it
can continue to distinguish reserved words from other words.

Fixes #5
2018-02-27 16:55:20 -08:00
Max Brunsfeld 0259c5bce2 Guard against buffer overflow when serializing scanner
/cc philipturnbull
2018-01-19 09:52:45 -08:00
Max Brunsfeld 145d4e86a4 Add missing array syntax 2017-12-26 14:55:37 -08:00
Max Brunsfeld 8f67869b16 Use string::copy rather than memcpy 2017-08-01 10:26:42 -07:00
Max Brunsfeld 4340002e38 Implement external scanner serialization 2017-08-01 10:12:16 -07:00
Max Brunsfeld dce4ee6937 Handle words concatenated with strings and expansions 2017-07-17 10:47:34 -07:00
Max Brunsfeld 403361626d Add length operator in variable expansions 2017-07-15 23:12:22 -07:00
Max Brunsfeld 1b5e1557f2 Reorganize, rename a bunch of things 2017-07-15 22:13:55 -07:00
Max Brunsfeld 66693d7575 Add empty environment variable values 2017-07-14 17:41:14 -07:00
Max Brunsfeld a0406c8906 Fix distinction between numeric args and redirect file descriptors 2017-07-14 17:14:23 -07:00
Max Brunsfeld a46748839e Add variable expansion inside of heredocs 2017-07-14 14:27:13 -07:00
Max Brunsfeld 6be8857926 Start work on heredocs 2017-07-14 13:54:05 -07:00