diff options
author | P. J. McDermott <pj@pehjota.net> | 2016-02-20 00:06:57 (EST) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2016-02-20 00:06:57 (EST) |
commit | 6a78c02494504eafb437c605bdc6f9d160b3d35d (patch) | |
tree | c5348e22d45f6c103901e6e308b8513ab947acc1 | |
parent | 6944e19e75467d92140174e979898f35659f9dc6 (diff) | |
download | eggshell-6a78c02494504eafb437c605bdc6f9d160b3d35d.zip eggshell-6a78c02494504eafb437c605bdc6f9d160b3d35d.tar.gz eggshell-6a78c02494504eafb437c605bdc6f9d160b3d35d.tar.bz2 |
Check only first word of simple commands for reseserved words
-rw-r--r-- | parsing/lexer.sh | 6 | ||||
-rw-r--r-- | parsing/parse.sh | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/parsing/lexer.sh b/parsing/lexer.sh index 52aedea..e1d3aab 100644 --- a/parsing/lexer.sh +++ b/parsing/lexer.sh @@ -522,8 +522,10 @@ accept() done tok="T_FNAME${US}${tok#T_WORD${US}}" ;; - T_WORD) - if ! [ "x${tok%%${US}*}" = "x${t}" ]; then + T_CMDNAME) + # The first word of a simple command is to be checked + # for reserved words. + if ! [ "x${tok%%${US}*}" = 'xT_WORD' ]; then return 1 fi # Verify that the word doesn't match any reserved words. diff --git a/parsing/parse.sh b/parsing/parse.sh index 542f5ea..56a1d39 100644 --- a/parsing/parse.sh +++ b/parsing/parse.sh @@ -280,7 +280,7 @@ cmd_name() { dbg 'cmd_name()' # TODO: Assignment - if accept T_WORD; then + if accept T_CMDNAME; then return 0 fi return 1 |