diff options
Diffstat (limited to 'eshtrans/frontend/lexer.esh')
-rw-r--r-- | eshtrans/frontend/lexer.esh | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/eshtrans/frontend/lexer.esh b/eshtrans/frontend/lexer.esh index 6eb168a..275e928 100644 --- a/eshtrans/frontend/lexer.esh +++ b/eshtrans/frontend/lexer.esh @@ -221,6 +221,11 @@ next() next_io return ;; + ',') + lgetc + tok=T_COMMA + return + ;; *) next_word return @@ -438,7 +443,7 @@ scan_word() lines=$((${lines} + 1)) word="${word}${c}" ;; - ' '|"${HT}"|'&'|'|'|';'|'('|')'|'<'|'>') + ' '|"${HT}"|'&'|'|'|';'|'('|')'|'<'|'>'|',') if ! ${in_param} && ! ${quoted}; then break fi @@ -949,6 +954,21 @@ accept() tok="${t}" fi ;; + T_TYPE) + # Types are recognized as literal T_WORDs. + if ! [ "x${tok%%${US}*}" = 'xT_WORD' ]; then + return 1 + fi + # Validate type. + case "${tok#*${US}}" in + 'bool'|'int'|'string') + ;; + *) + return 1 + ;; + esac + tok="T_TYPE${US}${tok#T_WORD${US}}" + ;; T_NAME) # Names are recognized as literal T_WORDs. if ! [ "x${tok%%${US}*}" = 'xT_WORD' ]; then |