12 #define LEX_FLAGS (LEXCHECK_NOWHITESPC
or _
19 name as const zstring ptr
37 (@
"IF" , FB_TK_PP_IF ),
_
38 (@
"IFDEF" , FB_TK_PP_IFDEF ),
_
39 (@
"IFNDEF" , FB_TK_PP_IFNDEF ),
_
40 (@
"ELSE" , FB_TK_PP_ELSE ),
_
41 (@
"ELSEIF" , FB_TK_PP_ELSEIF ),
_
42 (@
"ENDIF" , FB_TK_PP_ENDIF ),
_
43 (@
"DEFINE" , FB_TK_PP_DEFINE ),
_
44 (@
"UNDEF" , FB_TK_PP_UNDEF ),
_
45 (@
"MACRO" , FB_TK_PP_MACRO ),
_
46 (@
"ENDMACRO", FB_TK_PP_ENDMACRO ),
_
47 (@
"INCLUDE" , FB_TK_PP_INCLUDE ),
_
48 (@
"LIBPATH" , FB_TK_PP_LIBPATH ),
_
49 (@
"INCLIB" , FB_TK_PP_INCLIB ),
_
50 (@
"PRAGMA" , FB_TK_PP_PRAGMA ),
_
51 (@
"PRINT" , FB_TK_PP_PRINT ),
_
52 (@
"ERROR" , FB_TK_PP_ERROR ),
_
53 (@
"LINE" , FB_TK_PP_LINE ),
_
54 (@
"LANG" , FB_TK_PP_LANG ),
_
55 (@
"ASSERT" , FB_TK_PP_ASSERT ),
_
64 pp.kwdns.
class = FB_SYMBCLASS_NAMESPACE
65 pp.kwdns.
scope = FB_MAINSCOPE
67 symbSymbTbInit(
pp.kwdns.nspc.ns.symtb, @
pp.kwdns )
69 pp.kwdns.nspc.ns.ext = symbCompAllocExt( )
80 @
pp.kwdns.nspc.ns.hashtb )
117 symbCompFreeExt(
pp.kwdns.nspc.ns.ext )
126 if( lex.ctx->head->
id <> CHAR_SHARP )
then
131 if( lex.ctx->reclevel <> 0 )
then
136 if( lex.ctx->lasttk_id <> FB_TK_EOL )
then
138 if( lex.ctx->lasttk_id <> INVALID )
then
143 lex.ctx->reclevel += 1
147 lex.ctx->kwdns = @
pp.kwdns
153 lex.ctx->reclevel -= 1
175 select case as const lexGetToken( LEXCHECK_KWDNAMESPC )
191 dim as FBSYMCHAIN
ptr chain_ =
any
192 dim as FBSYMBOL
ptr base_parent =
any
197 if( chain_ <> NULL )
then
198 dim as FBSYMBOL
ptr sym = chain_->
sym
201 if( symbGetNamespace(
sym ) <> @symbGetGlobalNamespc( ) )
then
202 errReport( FB_ERRMSG_CANTREMOVENAMESPCSYMBOLS )
204 if( symbGetCantUndef(
sym ) )
then
209 if( env.ppfile_num > 0 )
then
210 if( symbIsDefine(
sym ) = FALSE )
then
227 case FB_TK_PP_IFDEF, FB_TK_PP_IFNDEF, FB_TK_PP_IF
231 case FB_TK_PP_ELSE, FB_TK_PP_ELSEIF
254 case FB_TK_PP_INCLUDE
264 case FB_TK_PP_LIBPATH
305 static as zstring * FB_MAXPATHLEN+1 incfile
306 dim as integer isonce =
any
340 if( env.ppfile_num > 0 )
then
361 if( env.ppfile_num > 0 )
then
395 dim as FB_LANG
id =
any
405 if(
id = FB_LANG_INVALID )
then
412 if( env.ppfile_num > 0 )
then
423 byval text
as DZSTRING
ptr _
429 if( text = NULL )
then
431 elseif( text->
data = NULL )
then
435 p = text->
data + (text->
len - 1)
436 do while( p > text->
data )
438 select case as const (*p)[0]
440 case CHAR_SPACE, CHAR_TAB, CHAR_LF
456 byval ismultiline
as integer _
459 static as DZSTRING text
460 dim as integer nestedcnt = 0
467 if( ismultiline )
then
475 if( ismultiline = FALSE )
then
480 if( text.
len > 0 )
then
489 case FB_TK_COMMENT, FB_TK_REM
490 if( ismultiline = FALSE )
then
498 case FB_TK_EOL, FB_TK_EOF
508 (
not LEXCHECK_NOWHITESPC) )
511 if( ismultiline )
then
516 case FB_TK_PP_ENDMACRO
517 if( ismultiline )
then
519 if( nestedcnt = 0 )
then
535 case CHAR_SPACE, CHAR_TAB
538 if( text.
len > 0 )
then
554 if( lexGetType() <> FB_DATATYPE_WCHAR )
then
571 byval text
as DWSTRING
ptr _
578 p = text->
data + (text->
len - 1)
579 do while( p > text->
data )
581 select case as const (*p)[0]
583 case CHAR_SPACE, CHAR_TAB, CHAR_LF
599 byval ismultiline
as integer _
602 static as DWSTRING text
603 dim as integer nestedcnt = 0
610 if( ismultiline )
then
618 if( ismultiline = FALSE )
then
623 if( text.
len > 0 )
then
632 case FB_TK_COMMENT, FB_TK_REM
633 if( ismultiline = FALSE )
then
641 case FB_TK_EOL, FB_TK_EOF
651 (
not LEXCHECK_NOWHITESPC) )
654 if( ismultiline )
then
659 case FB_TK_PP_ENDMACRO
660 if( ismultiline )
then
662 if( nestedcnt = 0 )
then
678 case CHAR_SPACE, CHAR_TAB
681 if( text.
len > 0 )
then
697 if( lexGetType( ) = FB_DATATYPE_WCHAR )
then
713 dim as integer dtype =
any
714 dim as longint lgt =
any
715 dim as FBSYMBOL
ptr subtype =
any