12 declare function hCast(
byval options
as AST_CONVOPT )
as ASTNODE
ptr
16 dim as integer is_defined =
any
33 if(
hMatch( CHAR_RPRNT ) = FALSE )
then
52 dim as ASTNODE
ptr negexpr =
any
61 if( negexpr = NULL )
then
66 negexpr =
astNewUOP( AST_OP_NEG, negexpr )
69 if( negexpr = NULL )
Then
83 if( negexpr = NULL )
then
88 negexpr =
astNewUOP( AST_OP_PLUS, negexpr )
91 if( negexpr = NULL )
Then
105 if( negexpr = NULL )
then
106 errReport( FB_ERRMSG_EXPECTEDEXPRESSION )
110 negexpr =
astNewUOP( AST_OP_NOT, negexpr )
113 if( negexpr = NULL )
Then
129 byval expr
as ASTNODE
ptr _
132 dim as FBSYMBOL
ptr subtype =
any
133 dim as integer dtype =
any
135 dtype = astGetFullType( expr )
136 subtype = astGetSubType( expr )
138 select case as const typeGet( dtype )
140 case FB_DATATYPE_CHAR, FB_DATATYPE_WCHAR, FB_DATATYPE_STRING, FB_DATATYPE_FIXSTR
149 case FB_DATATYPE_STRUCT
155 if( expr = NULL )
then
159 dtype = astGetFullType( expr )
160 subtype = astGetSubType( expr )
170 if( typeIsPtr( dtype ) )
then
171 dim as integer isfuncptr = FALSE, isfield = FALSE
176 isfuncptr = (typeGetDtAndPtrOnly( dtype ) = typeAddrOf( FB_DATATYPE_FUNCTION ))
180 case FB_TK_FIELDDEREF, CHAR_LBRACKET
210 byval chain_ as FBSYMCHAIN
ptr _
213 dim as ASTNODE
ptr expr =
any
217 case FB_TK_ADDROFCHAR
223 if( expr = NULL )
then
229 dim as integer is_opt = fbGetPrntOptional( )
232 if( expr = NULL )
then
245 case FB_TK_VARPTR, FB_TK_PROCPTR, FB_TK_SADD, FB_TK_STRPTR
254 if( expr = NULL )
then
263 expr =
hCast( AST_CONVOPT_PTRONLY )
264 if( expr = NULL )
then
271 if( expr = NULL )
then
278 if( fbGetIsPP( ) )
then
301 function hCast(
byval options
as AST_CONVOPT )
as ASTNODE
ptr
302 dim as integer dtype =
any, errmsg =
any
303 dim as FBSYMBOL
ptr subtype =
any
304 dim as ASTNODE
ptr expr =
any
316 if(
cSymbolType( dtype, subtype, 0 ) = FALSE )
then
321 if( options
and AST_CONVOPT_PTRONLY )
then
322 dtype = typeAddrOf( FB_DATATYPE_VOID )
324 dtype = FB_DATATYPE_INTEGER
330 select case as const( typeGet( dtype ) )
331 case FB_DATATYPE_VOID, FB_DATATYPE_FIXSTR
332 errReport( FB_ERRMSG_INVALIDDATATYPES, TRUE )
334 if( options
and AST_CONVOPT_PTRONLY )
then
335 dtype = typeAddrOf( FB_DATATYPE_VOID )
337 dtype = FB_DATATYPE_INTEGER
341 case FB_DATATYPE_INTEGER, FB_DATATYPE_UINT, _
342 FB_DATATYPE_LONG, FB_DATATYPE_ULONG, _
343 FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT, _
346 if( options
and AST_CONVOPT_PTRONLY )
then
347 if( fbPdCheckIsSet( FB_PDCHECK_CASTTONONPTR ) )
then
352 case FB_DATATYPE_POINTER
353 options
or= AST_CONVOPT_PTRONLY
356 if( options
and AST_CONVOPT_PTRONLY )
then
371 if( expr = NULL )
then
372 errReport( FB_ERRMSG_EXPECTEDEXPRESSION )
377 options
or= AST_CONVOPT_CHECKSTR
378 expr =
astNewCONV( dtype, subtype, expr, options, @errmsg )
379 if( expr = NULL )
then
380 if( errmsg = FB_ERRMSG_OK )
then
381 if( options
and AST_CONVOPT_PTRONLY )
then
382 errmsg = FB_ERRMSG_EXPECTEDPOINTER
384 errmsg = FB_ERRMSG_TYPEMISMATCH
409 dim as integer derefcnt =
any
410 dim as ASTNODE
ptr expr =
any
426 if( expr = NULL )
then
427 errReport( FB_ERRMSG_EXPECTEDEXPRESSION )
432 function =
astBuildMultiDeref( derefcnt, expr, astGetFullType( expr ), astGetSubType( expr ) )
438 byval proc as FBSYMBOL
ptr _
441 dim as FBSYMBOL
ptr sym =
any
446 if(
hMatch( CHAR_RPRNT ) = FALSE )
then
453 if( symbIsOverloaded(
proc ) )
then
454 if( parser.ctxsym <> NULL )
then
455 if( symbIsProc( parser.ctxsym ) )
then
457 if( sym <> NULL )
then
465 if( symbIsMethod(
proc ) )
then
475 dim as FBRTLCALLBACK callback = symbGetProcCallback(
proc )
476 if( callback <> NULL )
then
486 byval chain_ as FBSYMCHAIN
ptr _
490 if( expr = NULL )
then
491 errReport( FB_ERRMSG_EXPECTEDIDENTIFIER )
497 dim as ASTNODE
ptr t = expr
498 if( astIsCAST( expr ) )
then
499 if( astGetCASTDoConv( expr ) = FALSE )
then
500 t = astGetLeft( expr )
504 select case as const astGetClass( t )
505 case AST_NODECLASS_VAR, AST_NODECLASS_IDX, AST_NODECLASS_DEREF, AST_NODECLASS_TYPEINI
507 case AST_NODECLASS_FIELD
509 if( astGetDataType( astGetLeft( t ) ) = FB_DATATYPE_BITFIELD )
then
517 errReportEx( FB_ERRMSG_INVALIDDATATYPES,
"for @ or VARPTR" )
525 dim as FBSYMBOL
ptr proc =
any
526 dim as FB_ERRMSG err_num =
any
529 if(
proc <> NULL )
then
532 if( expr = NULL )
then
537 if( err_num <> FB_ERRMSG_OK )
then
553 dim as ASTNODE
ptr expr = NULL
560 dim as integer check_id = TRUE
561 if( parser.stmt.
with.sym <> NULL )
then
569 dim as FBSYMCHAIN
ptr chain_ = NULL
578 if( sym <> NULL )
then
593 if(
hMatch( CHAR_LPRNT ) = FALSE )
then
603 if(
hMatch( CHAR_RPRNT ) = FALSE )
then
614 if(
hMatch( CHAR_LPRNT ) = FALSE )
then
622 dim as FBSYMCHAIN
ptr chain_ =
any
626 FB_IDOPT_DEFAULT
or FB_IDOPT_ALLOWSTRUCT )
628 if( sym = NULL )
then
640 if(
hMatch( CHAR_RPRNT ) = FALSE )
then
647 case FB_TK_SADD, FB_TK_STRPTR
651 if(
hMatch( CHAR_LPRNT ) = FALSE )
then
659 if( expr = NULL )
then
666 dim as integer dtype = astGetDataType( expr )
679 dim as ASTNODE
ptr t = expr
680 if( astIsCAST( expr ) )
then
681 if( astGetCASTDoConv( expr ) = FALSE )
then
682 t = astGetLeft( expr )
686 select case as const astGetClass( t )
687 case AST_NODECLASS_VAR, AST_NODECLASS_IDX, _
688 AST_NODECLASS_DEREF, AST_NODECLASS_TYPEINI, _
692 errReportEx( FB_ERRMSG_INVALIDDATATYPES,
"for STRPTR" )
696 if( dtype = FB_DATATYPE_STRING )
then
701 expr =
astNewCONV( typeAddrOf( FB_DATATYPE_CHAR ), _
707 if(
hMatch( CHAR_RPRNT ) = FALSE )
then