14 listInit( @parser.stmt.
let.list, 16,
len( FB_LETSTMT_NODE ) )
21 listEnd( @parser.stmt.
let.list )
27 case FB_TK_ASSIGN, FB_TK_DBLEQ
43 function cOperator(
byval is_overload
as integer )
as integer
44 dim as integer op =
any, tk =
any
50 select case as const( tk )
51 case FB_TK_AND : op = AST_OP_AND
52 case FB_TK_OR : op = AST_OP_OR
53 case FB_TK_ANDALSO : op = AST_OP_ANDALSO
54 case FB_TK_ORELSE : op = AST_OP_ORELSE
55 case FB_TK_XOR : op = AST_OP_XOR
56 case FB_TK_EQV : op = AST_OP_EQV
57 case FB_TK_IMP : op = AST_OP_IMP
58 case FB_TK_SHL : op = AST_OP_SHL
59 case FB_TK_SHR : op = AST_OP_SHR
60 case FB_TK_MOD : op = AST_OP_MOD
61 case CHAR_PLUS : op = AST_OP_ADD
62 case CHAR_MINUS : op = AST_OP_SUB
63 case CHAR_RSLASH : op = AST_OP_INTDIV
64 case CHAR_TIMES : op = AST_OP_MUL
65 case CHAR_SLASH : op = AST_OP_DIV
66 case CHAR_CART : op = AST_OP_POW
67 case CHAR_AMP : op = AST_OP_CONCAT
68 case FB_TK_EQ, FB_TK_GT, FB_TK_LT, FB_TK_NE, FB_TK_LE, FB_TK_GE, _
69 FB_TK_LET, FB_TK_NOT, FB_TK_CAST, _
70 FB_TK_ABS, FB_TK_SGN, FB_TK_FIX, FB_TK_FRAC, _
71 FB_TK_INT, FB_TK_EXP, FB_TK_LOG, FB_TK_SIN, _
72 FB_TK_ASIN, FB_TK_COS, FB_TK_ACOS, FB_TK_TAN, _
74 FB_TK_ADDROFCHAR, FB_TK_FIELDDEREF, CHAR_LBRACKET, _
75 FB_TK_NEW, FB_TK_DELETE, _
76 FB_TK_FOR, FB_TK_STEP, FB_TK_NEXT
78 if( is_overload = FALSE )
then
84 select case as const( tk )
85 case FB_TK_EQ : op = AST_OP_EQ
86 case FB_TK_GT : op = AST_OP_GT
87 case FB_TK_LT : op = AST_OP_LT
88 case FB_TK_NE : op = AST_OP_NE
89 case FB_TK_LE : op = AST_OP_LE
90 case FB_TK_GE : op = AST_OP_GE
91 case FB_TK_LET : op = AST_OP_ASSIGN
92 case FB_TK_NOT : op = AST_OP_NOT
93 case FB_TK_CAST : op = AST_OP_CAST
94 case FB_TK_ABS : op = AST_OP_ABS
95 case FB_TK_SGN : op = AST_OP_SGN
96 case FB_TK_FIX : op = AST_OP_FIX
97 case FB_TK_FRAC : op = AST_OP_FRAC
98 case FB_TK_INT : op = AST_OP_FLOOR
99 case FB_TK_EXP : op = AST_OP_EXP
100 case FB_TK_LOG : op = AST_OP_LOG
101 case FB_TK_SIN : op = AST_OP_SIN
102 case FB_TK_ASIN : op = AST_OP_ASIN
103 case FB_TK_COS : op = AST_OP_COS
104 case FB_TK_ACOS : op = AST_OP_ACOS
105 case FB_TK_TAN : op = AST_OP_TAN
106 case FB_TK_ATN : op = AST_OP_ATAN
107 case FB_TK_ADDROFCHAR : op = AST_OP_ADDROF
108 case FB_TK_FIELDDEREF : op = AST_OP_FLDDEREF
111 if(
hMatch( CHAR_RBRACKET ) = FALSE )
then
117 case FB_TK_NEW, FB_TK_DELETE
118 dim as integer is_new = (tk = FB_TK_NEW)
121 if(
hMatch( CHAR_LBRACKET ) )
then
123 if(
hMatch( CHAR_RBRACKET ) = FALSE )
then
127 op =
iif( is_new, AST_OP_NEW_VEC_SELF, AST_OP_DEL_VEC_SELF )
129 op =
iif( is_new, AST_OP_NEW_SELF, AST_OP_DEL_SELF )
132 case FB_TK_FOR : op = AST_OP_FOR
133 case FB_TK_STEP : op = AST_OP_STEP
134 case FB_TK_NEXT : op = AST_OP_NEXT
146 if( is_overload = FALSE )
then
153 op = astGetOpSelfVer( op )
161 errReport( FB_ERRMSG_CONSTANTCANTBECHANGED, TRUE )
165 dim as integer op = INVALID
179 op = astGetOpSelfVer( op )
187 parser.ctxsym = astGetSubType(
l )
188 parser.ctx_dtype = astGetDataType(
l )
193 errReport( FB_ERRMSG_EXPECTEDEXPRESSION )
200 parser.ctx_dtype = FB_DATATYPE_INVALID
203 if( op <> INVALID )
then
209 errReport( FB_ERRMSG_TYPEMISMATCH, TRUE )
217 errReport( FB_ERRMSG_ILLEGALASSIGNMENT, TRUE )
225 byval expr
as ASTNODE
ptr _
236 if( expr = NULL )
then
241 dim as ASTNODE
ptr t = expr
242 if( astIsCAST( expr ) )
then
243 if( astGetCASTDoConv( expr ) = FALSE )
then
244 t = astGetLeft( expr )
249 if( astIsCALL( t ) = FALSE )
then
257 if( typeGetClass( astGetDataType( t ) ) <> FB_DATACLASS_INTEGER )
then
265 select case astGetDataType( t )
266 case FB_DATATYPE_CHAR, FB_DATATYPE_WCHAR
275 if( expr <> NULL )
then
286 byval num
as integer _
287 )
as const zstring ptr
298 tmp =
str( num ) +
"th"
311 byval fld
as FBSYMBOL
ptr, _
312 byval lhs
as ASTNODE
ptr, _
313 byval rhs
as FBSYMBOL
ptr, _
314 byval num
as integer _
318 if( symbIsField( fld ) = FALSE )
then
333 if( symbGetArrayDimensions( fld ) <> 0 )
then
341 dim as ASTNODE
ptr expr =
any
344 expr =
astNewDEREF( expr, symbGetFullType( fld ), symbGetSubType( fld ) )
348 if( expr = NULL )
then
367 dim as integer ismult = FALSE
368 dim as ASTNODE
ptr expr =
any
369 dim as FBSYMBOL
ptr fld =
any
377 if( expr = NULL )
then
385 if( fbLangOptIsSet( FB_LANG_OPT_LET ) = FALSE )
then
402 if( ismult = FALSE )
then
404 if( expr = NULL )
then
405 errReport( FB_ERRMSG_EXPECTEDIDENTIFIER )
415 dim as integer exprcnt = 0
419 dim as FB_LETSTMT_NODE
ptr node =
listNewNode( @parser.stmt.
let.list )
422 if( node->expr <> NULL )
then
425 errReport( FB_ERRMSG_CONSTANTCANTBECHANGED, TRUE )
439 if( exprcnt = 0 )
then
440 errReport( FB_ERRMSG_EXPECTEDIDENTIFIER )
461 if( expr = NULL )
then
462 errReport( FB_ERRMSG_EXPECTEDEXPRESSION )
468 if( expr <> NULL )
then
469 select case astGetDataType( expr )
470 case FB_DATATYPE_STRUCT
471 if( symbGetUDTIsUnion( astGetSubtype( expr ) )
or _
472 symbGetUDTHasAnonUnion( astGetSubtype( expr ) ) )
then
489 if( expr = NULL )
then
491 dim as FB_LETSTMT_NODE
ptr node =
listGetHead( @parser.stmt.
let.list )
492 if( node = NULL )
then
503 if( astIsCALL( expr ) )
then
507 dim as FBSYMBOL
ptr tmp = NULL
508 dim as ASTNODE
ptr tree = NULL
510 if( exprcnt > 0 )
then
511 tmp =
symbAddTempVar( typeAddrOf( astGetFulltype( expr ) ), astGetSubtype( expr ) )
519 dim as FB_LETSTMT_NODE
ptr node =
listGetHead( @parser.stmt.
let.list )
520 if( node = NULL )
then
525 if( fld = NULL )
then
530 if( node->expr <> NULL )
then
532 if( expr = NULL )
then