@@ -317,6 +317,8 @@ private function hMacro_getArgW( byval argtb as LEXPP_ARGTB ptr, byval num as in
317317
318318end function
319319
320+ #define hIsTokenEndOfStream() ((lexGetToken() = FB_TK_EOL) orelse (lexGetToken() = FB_TK_EOF))
321+
320322private function hMacro_EvalZ( byval arg as zstring ptr, byval errnum as integer ptr ) as string
321323
322324 '' the expression should have already been handled in hLoadMacro|hLoadMacroW
@@ -367,13 +369,13 @@ private function hMacro_EvalZ( byval arg as zstring ptr, byval errnum as integer
367369 DZStrAssign( res, astConstFlushToStr( expr ) )
368370
369371 '' any tokens still in the buffer? cExpression() should have used them all
370- if ( lexGetToken( ) <> FB_TK_EOL ) then
372+ if ( not hIsTokenEndOfStream() ) then
371373 errmsg = FB_ERRMSG_SYNTAXERROR
372374 end if
373375 elseif ( astIsConstant( expr ) ) then
374376 DZStrAssign( res, symbGetConstStrAsStr( expr->sym ) )
375377 '' any tokens still in the buffer? cExpression() should have used them all
376- if ( lexGetToken( ) <> FB_TK_EOL ) then
378+ if ( not hIsTokenEndOfStream() ) then
377379 errmsg = FB_ERRMSG_SYNTAXERROR
378380 end if
379381 astDelTree( expr )
@@ -454,13 +456,13 @@ private function hMacro_EvalW( byval arg as wstring ptr, byval errnum as integer
454456 DWStrAssign( res, astConstFlushToWstr( expr ) )
455457
456458 '' any tokens still in the buffer? cExpression() should have used them all
457- if ( lexGetToken( ) <> FB_TK_EOL ) then
459+ if ( not hIsTokenEndOfStream() ) then
458460 errmsg = FB_ERRMSG_SYNTAXERROR
459461 end if
460462 elseif ( astIsConstant( expr ) ) then
461463 DWStrAssign( res, symbGetConstStrAsWstr( expr->sym ) )
462464 '' any tokens still in the buffer? cExpression() should have used them all
463- if ( lexGetToken( ) <> FB_TK_EOL ) then
465+ if ( not hIsTokenEndOfStream() ) then
464466 errmsg = FB_ERRMSG_SYNTAXERROR
465467 end if
466468 astDelTree( expr )
@@ -1114,7 +1116,7 @@ private function hDefQuerySymZ_cb( byval argtb as LEXPP_ARGTB ptr, byval errnum
11141116 '' because there is more, try as typeof.
11151117
11161118 '' not the end of 'sym'? retry as TYPEOF
1117- if ( lexGetToken( ) <> FB_TK_EOF ) then
1119+ if ( not hIsTokenEndOfStream() ) then
11181120 retry = TRUE
11191121 end if
11201122
0 commit comments