From 6a78c02494504eafb437c605bdc6f9d160b3d35d Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sat, 20 Feb 2016 00:06:57 -0500 Subject: Check only first word of simple commands for reseserved words --- (limited to 'parsing') 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 -- cgit v0.9.1