Support #*# operator in variable expansions

Fixes #10
This commit is contained in:
Max Brunsfeld 2018-08-06 11:09:45 -07:00
parent 3a9b32284e
commit 0e172361a8
2 changed files with 3 additions and 0 deletions

View File

@ -56,6 +56,7 @@ echo $# $* $@
Variable expansions Variable expansions
============================= =============================
echo ${var1#*#}
echo ${!abc} echo ${!abc}
echo ${abc} echo ${abc}
echo ${abc:-def} echo ${abc:-def}
@ -66,6 +67,7 @@ echo ${abc:
--- ---
(program (program
(command (command_name (word)) (expansion (variable_name) (word)))
(command (command_name (word)) (expansion (variable_name))) (command (command_name (word)) (expansion (variable_name)))
(command (command_name (word)) (expansion (variable_name))) (command (command_name (word)) (expansion (variable_name)))
(command (command_name (word)) (expansion (variable_name) (word))) (command (command_name (word)) (expansion (variable_name) (word)))

1
src/scanner.cc vendored
View File

@ -98,6 +98,7 @@ struct Scanner {
lexer->lookahead == '&' || lexer->lookahead == '&' ||
lexer->lookahead == '|' || lexer->lookahead == '|' ||
lexer->lookahead == '`' || lexer->lookahead == '`' ||
lexer->lookahead == '#' ||
(lexer->lookahead == '}' && valid_symbols[CLOSING_BRACE]) || (lexer->lookahead == '}' && valid_symbols[CLOSING_BRACE]) ||
(lexer->lookahead == ']' && valid_symbols[CLOSING_BRACKET]) (lexer->lookahead == ']' && valid_symbols[CLOSING_BRACKET])
)) { )) {