summaryrefslogtreecommitdiff
path: root/develop.h
diff options
context:
space:
mode:
authorBert Münnich <ber.t@posteo.de>2016-02-27 20:52:33 +0100
committerToby Goodwin <toby@paccrat.org>2017-04-17 22:01:02 +0100
commitd0ee32e585437b76f095379ec84fd753a5d30a3c (patch)
tree30bcf7cf06fd59182af337d009543995d6ca742f /develop.h
parentd260301ae1c54fb68c0849e1895c0958f55942ef (diff)
Parse equals sign as keyword
The parser treats unexpected keyword tokens (eg. if, while, ~) as literals and not as syntax errors. It does not do this for the equals sign, but it could, as it only has a special meaning at the beginning of a command, much like the keywords. Doing this allows one to write commands like this: dd if'='/dev/zero of'='data bs'='1024 count'='1 without the quotes around the equals signs. All shells from the Bourne family do this. For this to work, the lexer must not automatically terminate words at equals signs, instead it has to generate a free caret around it like for the twiddle and other such special characters. In the parser's grammar we need to get rid of the left recursion in the rules for 'simple' to turn the reduce/reduce conflict at 'first' on '=' (empty -> 'optcaret' or 'first' -> 'simple') into a shift/reduce conflict, which then can be solved with precedence/associativity so that the reduction of the empty 'optcaret' wins over shifting '='.
Diffstat (limited to 'develop.h')
0 files changed, 0 insertions, 0 deletions