summaryrefslogtreecommitdiffstats
path: root/eshtrans/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'eshtrans/frontend')
-rw-r--r--eshtrans/frontend/lexer.esh15
-rw-r--r--eshtrans/frontend/parser.esh12
2 files changed, 22 insertions, 5 deletions
diff --git a/eshtrans/frontend/lexer.esh b/eshtrans/frontend/lexer.esh
index 275e928..a30e7f5 100644
--- a/eshtrans/frontend/lexer.esh
+++ b/eshtrans/frontend/lexer.esh
@@ -954,6 +954,21 @@ accept()
tok="${t}"
fi
;;
+ T_VOID)
+ # Types are recognized as literal T_WORDs.
+ if ! [ "x${tok%%${US}*}" = 'xT_WORD' ]; then
+ return 1
+ fi
+ # Validate type.
+ case "${tok#*${US}}" in
+ 'void')
+ ;;
+ *)
+ return 1
+ ;;
+ esac
+ tok="T_VOID${US}${tok#T_WORD${US}}"
+ ;;
T_TYPE)
# Types are recognized as literal T_WORDs.
if ! [ "x${tok%%${US}*}" = 'xT_WORD' ]; then
diff --git a/eshtrans/frontend/parser.esh b/eshtrans/frontend/parser.esh
index 2607d96..9a63c03 100644
--- a/eshtrans/frontend/parser.esh
+++ b/eshtrans/frontend/parser.esh
@@ -421,12 +421,14 @@ simple_command()
return 0
elif accept T_FNAME; then
if accept T_LPAREN; then
- if accept T_TYPE; then
- expect T_NAME
- while accept T_COMMA; do
- expect T_TYPE
+ if ! accept T_VOID; then
+ if accept T_TYPE; then
expect T_NAME
- done
+ while accept T_COMMA; do
+ expect T_TYPE
+ expect T_NAME
+ done
+ fi
fi
expect T_RPAREN
if linebreak && function_body; then