summaryrefslogtreecommitdiffstats
path: root/eshtrans/frontend
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-02-28 15:08:23 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-02-28 15:08:23 (EST)
commit96716798e04aded65e9023c40fa8492350cf212d (patch)
treef21b801f771eecaeed0eabbf65dc02b191bbfeaf /eshtrans/frontend
parentc45f9970bf041823c2b9e2ad8ab49af90b28fe7d (diff)
downloadeggshell-96716798e04aded65e9023c40fa8492350cf212d.zip
eggshell-96716798e04aded65e9023c40fa8492350cf212d.tar.gz
eggshell-96716798e04aded65e9023c40fa8492350cf212d.tar.bz2
eshtrans: Add and parse T_USE
Diffstat (limited to 'eshtrans/frontend')
-rw-r--r--eshtrans/frontend/lexer.esh6
-rw-r--r--eshtrans/frontend/parser.esh5
2 files changed, 8 insertions, 3 deletions
diff --git a/eshtrans/frontend/lexer.esh b/eshtrans/frontend/lexer.esh
index 4e66091..6eb168a 100644
--- a/eshtrans/frontend/lexer.esh
+++ b/eshtrans/frontend/lexer.esh
@@ -930,7 +930,7 @@ accept()
T_IF|T_THEN|T_ELSE|T_ELIF|T_FI|T_DO|T_DONE|\
T_CASE|T_ESAC|T_WHILE|T_UNTIL|T_FOR|\
T_LBRACE|T_RBRACE|T_BANG|T_IN|\
- T_STATIC|T_LOCAL|T_RETURN)
+ T_USE|T_STATIC|T_LOCAL|T_RETURN)
#dbg "looking for reserved word $t, have '$tok'"
if ! [ "x${tok%%${US}*}" = "x${t}" ]; then
# Reserved words are recognized as literal
@@ -984,7 +984,7 @@ accept()
for rw in T_IF T_THEN T_ELSE T_ELIF T_FI T_DO T_DONE \
T_CASE T_ESAC T_WHILE T_UNTIL T_FOR \
T_LBRACE T_RBRACE T_BANG T_IN \
- T_STATIC T_LOCAL T_RETURN; do
+ T_USE T_STATIC T_LOCAL T_RETURN; do
if [ "x${tok#T_WORD${US}}" = \
"x$(toktext "${rw}")" ]; then
tok="${rw}"
@@ -1003,7 +1003,7 @@ accept()
for rw in T_IF T_THEN T_ELSE T_ELIF T_FI T_DO T_DONE \
T_CASE T_ESAC T_WHILE T_UNTIL T_FOR \
T_LBRACE T_RBRACE T_BANG T_IN \
- T_STATIC T_LOCAL T_RETURN; do
+ T_USE T_STATIC T_LOCAL T_RETURN; do
if [ "x${tok#T_WORD${US}}" = \
"x$(toktext "${rw}")" ]; then
tok="${rw}"
diff --git a/eshtrans/frontend/parser.esh b/eshtrans/frontend/parser.esh
index 57c4b63..7966fb6 100644
--- a/eshtrans/frontend/parser.esh
+++ b/eshtrans/frontend/parser.esh
@@ -402,6 +402,11 @@ do_group()
simple_command()
{
#ptrace_begn simple_command
+ if accept T_USE; then
+ expect T_NAME
+ #ptrace_pass simple_command
+ return 0
+ fi
if accept T_LOCAL || accept T_RETURN; then
cmd_suffix
#ptrace_pass simple_command