FreeBASIC  0.91.0
parser.bi
Go to the documentation of this file.
1 ''
2 '' parser protos
3 ''
4 
5 #include once "lex.bi"
6 #include once "ast.bi"
7 
8 '' compound statements permissions
11  FB_CMPSTMT_MASK_CODE = &h00000001
12  FB_CMPSTMT_MASK_PROC = &h00000002
14  FB_CMPSTMT_MASK_DECL = &h00000008
16  FB_CMPSTMT_MASK_DATA = &h00000020
17  FB_CMPSTMT_MASK_ALL = &hFFFFFFFF
19 end enum
20 
21 '' compound statements stats
23 
25  attop as integer
26  inilabel as FBSYMBOL ptr
27  cmplabel as FBSYMBOL ptr
28  endlabel as FBSYMBOL ptr
30 end type
31 
33  cmplabel as FBSYMBOL ptr
34  endlabel as FBSYMBOL ptr
36 end type
37 
39  sym as FBSYMBOL ptr '' if sym = null, value will be used
41  dtype as integer
42 end type
43 
45  outerscopenode as ASTNODE ptr
50  testlabel as FBSYMBOL ptr
51  inilabel as FBSYMBOL ptr
52  cmplabel as FBSYMBOL ptr
53  endlabel as FBSYMBOL ptr
55  explicit_step as integer
56 end type
57 
59  issingle as integer
60  nxtlabel as FBSYMBOL ptr
61  endlabel as FBSYMBOL ptr
62  elsecnt as integer
63 end type
64 
67  is_nested as integer
68  endlabel as FBSYMBOL ptr
70 end type
71 
73  base as integer
74  deflabel as FBSYMBOL ptr
75  minval as ulongint
76  maxval as ulongint
77 end type
78 
80  isconst as integer
81  sym as FBSYMBOL ptr
82  casecnt as integer
84  cmplabel as FBSYMBOL ptr
85  endlabel as FBSYMBOL ptr
87  outerscopenode as ASTNODE ptr '' Big scope around the whole SELECT compound (to destroy its temp var)
88 end type
89 
91  '' The WITH temp var (if it needed to use a pointer), or the variable
92  '' (if a simple VAR access was given to the WITH)
93  sym as FBSYMBOL ptr
94  is_ptr as integer
95 end type
96 
98  as FBSYMBOL ptr sym '' Namespace symbol
99  as integer levels '' a.b.c nesting level (multiple nested namespaces in this namespace compound block)
100 end type
101 
104 end type
105 
107  lastis_scope as integer
108 end type
109 
111  id as integer
113  scopenode as ASTNODE ptr
114  union
125  end union
126 end type
127 
129  expr as ASTNODE ptr
130 end type
131 
133  list as TLIST '' of FB_LETSTMT_NODE
134 end type
135 
136 '' parser context
139  id as FB_TOKEN '' current compound stmt id
140 
141  cnt as integer '' keep track of :'s to help scope break's
142 
143  for as FB_CMPSTMTSTK ptr
144  do as FB_CMPSTMTSTK ptr
145  while as FB_CMPSTMTSTK ptr
150 end type
151 
153  FB_PARSEROPT_NONE = &h00000000
154  FB_PARSEROPT_PRNTOPT = &h00000001
155  FB_PARSEROPT_CHKARRAY = &h00000002 '' used by LEN() to handle expr's and ()-less arrays (while set, there will be "array access, index expected" errors, unsetting allows to have no-index arrays, e.g. as bydesc arguments, or in l/ubound())
156  FB_PARSEROPT_ISEXPR = &h00000004 '' parsing an expression?
157  FB_PARSEROPT_ISSCOPE = &h00000008
158  FB_PARSEROPT_ISFUNC = &h00000010
159  FB_PARSEROPT_OPTONLY = &h00000020
162  FB_PARSEROPT_EQINPARENSONLY = &h00000100 '' only check for '=' if inside parentheses
163  FB_PARSEROPT_GTINPARENSONLY = &h00000200 '' only check for '>' if inside parentheses
164  FB_PARSEROPT_ISPP = &h00000400 '' PP expression? (e.g. #if condition)
165  FB_PARSEROPT_EXPLICITBASE = &h00000800 '' Used to tell cProcArgList() & co about explicit BASE accesses from hBaseMemberAccess() functions
166 end enum
167 
169  '' stmt recursion
171  nspcrec as integer '' namespace recursion
172 
173  '' globals
174  scope as uinteger '' current scope (0=main module)
175 
176  mangling as FB_MANGLING '' current EXTERN's mangling
177 
178  currproc as FBSYMBOL ptr '' current proc
179  currblock as FBSYMBOL ptr '' current scope block (= proc if outside any block)
180 
181  ovlarglist as TLIST '' used to resolve calls to overloaded functions
182 
183  '' hacks
184  prntcnt as integer '' ()'s count, to allow optional ()'s on SUB's
186  ctx_dtype as integer '' used to resolve the address of overloaded procs
187  ctxsym as FBSYMBOL ptr '' /
189 end type
190 
191 '' cSymbolType flags
193  FB_SYMBTYPEOPT_NONE = &h00000000
194 
197 
199 end enum
200 
201 '' cIdentifier flags
203  FB_IDOPT_NONE = &h00000000
204 
206  FB_IDOPT_SHOWERROR = &h00000002
207  FB_IDOPT_ISDECL = &h00000004
208  FB_IDOPT_ISOPERATOR = &h00000008
209  FB_IDOPT_ALLOWSTRUCT = &h00000010
210  FB_IDOPT_CHECKSTATIC = &h00000020
211  FB_IDOPT_ISVAR = &h00000040 '' parsing namespace prefix for variable declaration?
212 
214 end enum
215 
216 '' cInitializer flags
218  FB_INIOPT_NONE = &h00000000
219 
220  FB_INIOPT_ISINI = &h00000001
221  FB_INIOPT_DODEREF = &h00000002
222  FB_INIOPT_ISOBJ = &h00000004
223 end enum
224 
225 '' cProcHeader() flags
227  FB_PROCOPT_NONE = &h00000000
228  FB_PROCOPT_ISPROTO = &h00000001
229  FB_PROCOPT_HASPARENT = &h00000002
230 end enum
231 
232 '' cVarOrDeref flags
234  FB_VAREXPROPT_NONE = &h00000000
237  FB_VAREXPROPT_ISEXPR = &h00000004
238  FB_VAREXPROPT_ISASSIGN = &h00000010 '' Used by SWAP to disallow CALLs etc.
239 end enum
240 
241 declare sub cProgram()
242 
243 declare function cLabel _
244  ( _
245  _
246  ) as integer
247 
248 declare function cComment _
249  ( _
250  byval lexflags as LEXCHECK = LEXCHECK_EVERYTHING _
251  ) as integer
252 
253 declare sub cStatement()
254 
255 declare function cStmtSeparator _
256  ( _
257  byval lexflags as LEXCHECK = LEXCHECK_EVERYTHING _
258  ) as integer
259 
260 declare function cDeclaration _
261  ( _
262  _
263  ) as integer
264 
265 declare sub cConstDecl( byval attrib as integer )
266 declare sub cTypeDecl( byval attrib as integer )
267 declare sub cTypedefMultDecl( )
268 declare sub cTypedefSingleDecl( byval pid as zstring ptr )
269 declare sub cEnumDecl( byval attrib as integer )
270 declare function hCheckScope() as integer
271 
272 declare function cVariableDecl _
273  ( _
274  byval attrib as FB_SYMBATTRIB = FB_SYMBATTRIB_NONE _
275  ) as integer
276 
277 declare sub cAutoVarDecl(byval attrib as FB_SYMBATTRIB)
278 
279 declare function cStaticArrayDecl _
280  ( _
281  byref dimensions as integer, _
282  dTB() as FBARRAYDIM, _
283  byval checkprnts as integer = TRUE, _
284  byval allow_ellipsis as integer = TRUE _
285  ) as integer
286 
287 declare sub cArrayDecl( byref dimensions as integer, exprTB() as ASTNODE ptr )
288 
289 declare function cInitializer _
290  ( _
291  byval s as FBSYMBOL ptr, _
292  byval options as FB_INIOPT _
293  ) as ASTNODE ptr
294 
295 declare function cTypeOrExpression _
296  ( _
297  byval is_len as integer, _
298  byref dtype as integer, _
299  byref subtype as FBSYMBOL ptr, _
300  byref lgt as longint _
301  ) as ASTNODE ptr
302 
303 declare sub cTypeOf _
304  ( _
305  byref dtype as integer, _
306  byref subtype as FBSYMBOL ptr, _
307  byref lgt as longint _
308  )
309 
310 declare function cSymbolType _
311  ( _
312  byref dtype as integer, _
313  byref subtype as FBSYMBOL ptr, _
314  byref lgt as longint, _
316  ) as integer
317 
318 declare function cIdentifier _
319  ( _
320  byref base_parent as FBSYMBOL ptr, _
321  byval options as FB_IDOPT = FB_IDOPT_DEFAULT _
322  ) as FBSYMCHAIN ptr
323 
324 declare function cParentId _
325  ( _
326  byval options as FB_IDOPT = FB_IDOPT_NONE _
327  ) as FBSYMBOL ptr
328 
329 declare sub cCurrentParentId( )
330 declare sub cProcDecl( )
331 
332 declare function cProcHeader _
333  ( _
334  byval attrib as FB_SYMBATTRIB, _
335  byref is_nested as integer, _
336  byval options as FB_PROCOPT, _
337  byval tk as integer _
338  ) as FBSYMBOL ptr
339 
340 declare sub cParameters _
341  ( _
342  byval parent as FBSYMBOL ptr, _
343  byval proc as FBSYMBOL ptr, _
344  byval procmode as integer, _
345  byval isproto as integer _
346  )
347 
348 declare sub cDefDecl( )
349 declare sub cOptDecl( )
350 
351 declare function cProcCallOrAssign _
352  ( _
353  _
354  ) as integer
355 
356 declare function cQuirkStmt _
357  ( _
358  byval tk as FB_TOKEN = INVALID _
359  ) as integer
360 
361 declare function cCompoundStmt _
362  ( _
363  _
364  ) as integer
365 
366 declare function cCompStmtCheck _
367  ( _
368  _
369  ) as integer
370 
371 declare function cCompStmtPush _
372  ( _
373  byval id as FB_TOKEN, _
375  ) as FB_CMPSTMTSTK ptr
376 
377 declare function cCompStmtGetTOS _
378  ( _
379  byval forid as FB_TOKEN, _
380  byval showerror as integer = TRUE _
381  ) as FB_CMPSTMTSTK ptr
382 
383 declare sub cCompStmtPop( byval stk as FB_CMPSTMTSTK ptr )
384 
385 declare function cCompStmtIsAllowed _
386  ( _
387  byval allowmask as FB_CMPSTMT_MASK _
388  ) as integer
389 
390 declare sub cIfStmtBegin( )
391 declare sub cIfStmtNext( )
392 declare sub cIfStmtEnd( )
393 declare sub cForStmtBegin( )
394 declare sub cForStmtEnd( )
395 declare sub cDoStmtBegin( )
396 declare sub cDoStmtEnd( )
397 declare sub cWhileStmtBegin( )
398 declare sub cWhileStmtEnd( )
399 declare sub cSelectStmtBegin( )
400 declare sub cSelectStmtNext( )
401 declare sub cSelectStmtEnd( )
402 declare sub cSelConstStmtBegin( )
403 declare sub cSelConstStmtNext( byval stk as FB_CMPSTMTSTK ptr )
404 declare sub cSelConstStmtEnd( byval stk as FB_CMPSTMTSTK ptr )
405 declare sub hDisallowStaticAttrib( byref attrib as integer )
406 declare sub hDisallowVirtualCtor( byref attrib as integer )
407 declare sub hDisallowAbstractDtor( byref attrib as integer )
408 declare sub hDisallowConstCtorDtor( byval tk as integer, byref attrib as integer )
409 declare sub cProcStmtBegin( byval attrib as integer = 0 )
410 declare sub cProcStmtEnd( )
411 declare sub cExitStatement( )
412 declare sub cEndStatement( )
413 declare sub cContinueStatement( )
414 declare sub cWithStmtBegin( )
415 declare sub cWithStmtEnd( )
416 declare sub cScopeStmtBegin( )
417 declare sub cScopeStmtEnd( )
418 
419 declare sub cNamespaceStmtBegin( )
420 declare sub cNamespaceStmtEnd( )
421 declare sub cUsingStmt( )
422 declare sub cExternStmtBegin( )
423 declare sub cExternStmtEnd( )
424 
425 declare function cAssignmentOrPtrCall _
426  ( _
427  _
428  ) as integer
429 
430 declare function cAssignmentOrPtrCallEx _
431  ( _
432  byval expr as ASTNODE ptr _
433  ) as integer
434 
435 declare function hIsAssignToken( ) as integer
436 declare function cAssignToken( ) as integer
437 
438 declare function cOperator( byval is_overload as integer ) as integer
439 
440 declare function cExpression _
441  ( _
442  _
443  ) as ASTNODE ptr
444 
445 declare function cCatExpression _
446  ( _
447  _
448  ) as ASTNODE ptr
449 
450 declare function cBoolExpression _
451  ( _
452  _
453  ) as ASTNODE ptr
454 
455 declare function cLogExpression _
456  ( _
457  _
458  ) as ASTNODE ptr
459 
460 declare function cRelExpression _
461  ( _
462  _
463  ) as ASTNODE ptr
464 
465 declare function cAddExpression _
466  ( _
467  _
468  ) as ASTNODE ptr
469 
470 declare function cShiftExpression _
471  ( _
472  _
473  ) as ASTNODE ptr
474 
475 declare function cModExpression _
476  ( _
477  _
478  ) as ASTNODE ptr
479 
480 declare function cIntDivExpression _
481  ( _
482  _
483  ) as ASTNODE ptr
484 
485 declare function cMultExpression _
486  ( _
487  _
488  ) as ASTNODE ptr
489 
490 declare function cExpExpression _
491  ( _
492  _
493  ) as ASTNODE ptr
494 
495 declare function cNegNotExpression _
496  ( _
497  _
498  ) as ASTNODE ptr
499 
500 declare function cHighestPrecExpr _
501  ( _
502  byval base_parent as FBSYMBOL ptr, _
503  byval chain_ as FBSYMCHAIN ptr _
504  ) as ASTNODE ptr
505 
506 declare function cDerefExpression( ) as ASTNODE ptr
507 declare function cAddrOfExpression( ) as ASTNODE ptr
508 
509 declare function cTypeConvExpr _
510  ( _
511  byval tk as FB_TOKEN, _
512  byval isASM as integer = FALSE _
513  ) as ASTNODE ptr
514 
515 declare function cEqInParensOnlyExpr _
516  ( _
517  _
518  ) as ASTNODE ptr
519 
520 declare function cGtInParensOnlyExpr _
521  ( _
522  _
523  ) as ASTNODE ptr
524 
525 declare function cParentExpression _
526  ( _
527  _
528  ) as ASTNODE ptr
529 
530 declare function cAtom _
531  ( _
532  byval base_parent as FBSYMBOL ptr, _
533  byval chain_ as FBSYMCHAIN ptr _
534  ) as ASTNODE ptr
535 
536 declare function cVariable _
537  ( _
538  byval chain as FBSYMCHAIN ptr, _
539  byval checkarray as integer = TRUE _
540  ) as ASTNODE ptr
541 
542 declare function cVariableEx overload _
543  ( _
544  byval sym as FBSYMBOL ptr, _
545  byval check_array as integer _
546  ) as ASTNODE ptr
547 
548 declare function cVariableEx _
549  ( _
550  byval chain as FBSYMCHAIN ptr, _
551  byval checkarray as integer _
552  ) as ASTNODE ptr
553 
554 declare function cWithVariable( byval checkarray as integer ) as ASTNODE ptr
555 
556 declare function cImplicitDataMember _
557  ( _
558  byval base_parent as FBSYMBOL ptr, _
559  byval chain_ as FBSYMCHAIN ptr, _
560  byval checkarray as integer, _
561  byval options as FB_PARSEROPT _
562  ) as ASTNODE ptr
563 
564 declare function cVarOrDeref _
565  ( _
567  ) as ASTNODE ptr
568 
569 declare function cFunctionEx _
570  ( _
571  byval base_parent as FBSYMBOL ptr, _
572  byval sym as FBSYMBOL ptr, _
573  byval options as FB_PARSEROPT = 0 _
574  ) as ASTNODE ptr
575 
576 declare function cQuirkFunction _
577  ( _
578  byval sym as FBSYMBOL ptr _
579  ) as ASTNODE ptr
580 
581 declare function cConstant( byval sym as FBSYMBOL ptr ) as ASTNODE ptr
582 
583 declare function cEnumConstant _
584  ( _
585  byval sym as FBSYMBOL ptr _
586  ) as ASTNODE ptr
587 
588 declare function cStrLiteral( byval skiptoken as integer = TRUE ) as ASTNODE ptr
589 declare function cNumLiteral( byval skiptoken as integer = TRUE ) as ASTNODE ptr
590 
591 declare function cProcArgList _
592  ( _
593  byval base_parent as FBSYMBOL ptr, _
594  byval proc as FBSYMBOL ptr, _
595  byval ptrexpr as ASTNODE ptr, _
596  byval arg_list as FB_CALL_ARG_LIST ptr, _
597  byval options as FB_PARSEROPT _
598  ) as ASTNODE ptr
599 
600 declare function cAsmBlock _
601  ( _
602  _
603  ) as integer
604 
605 declare function cAliasAttribute( ) as zstring ptr
606 declare sub cLibAttribute( )
607 declare sub cMethodAttributes _
608  ( _
609  byval parent as FBSYMBOL ptr, _
610  byref attrib as integer _
611  )
612 
613 declare sub cProcRetType _
614  ( _
615  byval attrib as integer, _
616  byval proc as FBSYMBOL ptr, _
617  byval is_proto as integer, _
618  byref dtype as integer, _
619  byref subtype as FBSYMBOL ptr _
620  )
621 
622 declare function cProcReturnMethod _
623  ( _
624  byval dtype as FB_DATATYPE _
625  ) as FB_PROC_RETURN_METHOD
626 
627 declare function cProcCallingConv _
628  ( _
629  byval default as FB_FUNCMODE = FB_FUNCMODE_FBCALL _
630  ) as FB_FUNCMODE
631 
632 declare sub cByrefAttribute( byref attrib as integer, byval is_func as integer )
633 
634 declare function cFunctionCall _
635  ( _
636  byval base_parent as FBSYMBOL ptr, _
637  byval sym as FBSYMBOL ptr, _
638  byval ptrexpr as ASTNODE ptr, _
639  byval thisexpr as ASTNODE ptr = NULL, _
640  byval options as FB_PARSEROPT = 0 _
641  ) as ASTNODE ptr
642 
643 declare sub hMethodCallAddInstPtrOvlArg _
644  ( _
645  byval proc as FBSYMBOL ptr, _
646  byval thisexpr as ASTNODE ptr, _
647  byval arg_list as FB_CALL_ARG_LIST ptr, _
648  byval options as FB_PARSEROPT ptr _
649  )
650 
651 declare function cProcCall _
652  ( _
653  byval base_parent as FBSYMBOL ptr, _
654  byval sym as FBSYMBOL ptr, _
655  byval ptrexpr as ASTNODE ptr, _
656  byval thisexpr as ASTNODE ptr = NULL, _
657  byval checkprnts as integer = FALSE, _
658  byval options as FB_PARSEROPT = 0 _
659  ) as ASTNODE ptr
660 
661 declare function cMethodCall _
662  ( _
663  byval sym as FBSYMBOL ptr, _
664  byval thisexpr as ASTNODE ptr, _
665  byval options as FB_PARSEROPT _
666  ) as ASTNODE ptr
667 
668 declare function cCtorCall _
669  ( _
670  byval sym as FBSYMBOL ptr _
671  ) as ASTNODE ptr
672 
673 declare function cUdtMember _
674  ( _
675  byval dtype as integer, _
676  byval subtype as FBSYMBOL ptr, _
677  byval varexpr as ASTNODE ptr, _
678  byval check_array as integer, _
679  byval options as FB_PARSEROPT = 0 _
680  ) as ASTNODE ptr
681 
682 declare function cMemberAccess _
683  ( _
684  byval dtype as integer, _
685  byval subtype as FBSYMBOL ptr, _
686  byval expr as ASTNODE ptr _
687  ) as ASTNODE ptr
688 
689 declare function cMemberDeref _
690  ( _
691  byval dtype as integer, _
692  byval subtype as FBSYMBOL ptr, _
693  byval varexpr as ASTNODE ptr, _
694  byval checkarray as integer _
695  ) as ASTNODE ptr
696 
697 declare function cFuncPtrOrMemberDeref _
698  ( _
699  byval dtype as integer, _
700  byval subtype as FBSYMBOL ptr, _
701  byval varexpr as ASTNODE ptr, _
702  byval isfuncptr as integer, _
703  byval checkarray as integer _
704  ) as ASTNODE ptr
705 
706 declare function cStrIdxOrMemberDeref _
707  ( _
708  byval expr as ASTNODE ptr _
709  ) as ASTNODE ptr
710 
711 declare sub cAssignment(byval assgexpr as ASTNODE ptr)
712 declare function cBydescArrayArgParens( byval arg as ASTNODE ptr ) as FB_PARAMMODE
713 declare function cAssignFunctResult( byval is_return as integer ) as integer
714 
715 declare function cGfxStmt _
716  ( _
717  byval tk as FB_TOKEN _
718  ) as integer
719 
720 declare function cGfxFunct _
721  ( _
722  byval tk as FB_TOKEN _
723  ) as ASTNODE ptr
724 
725 declare function cGotoStmt _
726  ( _
727  byval tk as FB_TOKEN _
728  ) as integer
729 
730 declare function cPrintStmt _
731  ( _
732  byval tk as FB_TOKEN _
733  ) as integer
734 
735 declare function cDataStmt _
736  ( _
737  byval tk as FB_TOKEN _
738  ) as integer
739 
740 declare function cEraseStmt() as integer
741 declare function cSwapStmt() as integer
742 
743 declare function cLineInputStmt _
744  ( _
745  _
746  ) as integer
747 
748 declare function cInputStmt _
749  ( _
750  _
751  ) as integer
752 
753 declare function cPokeStmt _
754  ( _
755  _
756  ) as integer
757 
758 declare function cFileStmt _
759  ( _
760  byval tk as FB_TOKEN _
761  ) as integer
762 
763 declare function cOnStmt _
764  ( _
765  _
766  ) as integer
767 
768 declare function cWriteStmt() as integer
769 declare function cErrorStmt() as integer
770 declare function cErrSetStmt() as integer
771 declare function cViewStmt(byval is_func as integer) as ASTNODE ptr
772 declare function cMidStmt( ) as integer
773 declare function cLRSetStmt(byval tk as FB_TOKEN) as integer
774 declare function cWidthStmt(byval isfunc as integer) as ASTNODE ptr
775 declare function cColorStmt(byval isfunc as integer) as ASTNODE ptr
776 declare function cStringFunct(byval tk as FB_TOKEN) as ASTNODE ptr
777 declare function cCVXFunct(byval tk as FB_TOKEN) as ASTNODE ptr
778 declare function cMKXFunct(byval tk as FB_TOKEN) as ASTNODE ptr
779 declare function cMathFunct _
780  ( _
781  byval tk as FB_TOKEN, _
782  byval isasm as integer _
783  ) as ASTNODE ptr
784 declare function cPeekFunct() as ASTNODE ptr
785 declare function cArrayFunct(byval tk as FB_TOKEN) as ASTNODE ptr
786 declare function cFileFunct(byval tk as FB_TOKEN) as ASTNODE ptr
787 declare function cErrorFunct() as ASTNODE ptr
788 declare function cIIFFunct() as ASTNODE ptr
789 declare function cVAFunct() as ASTNODE ptr
790 declare function cScreenFunct() as ASTNODE ptr
791 declare function cAnonType( ) as ASTNODE ptr
792 declare function cConstIntExpr _
793  ( _
794  byval expr as ASTNODE ptr, _
795  byval defaultvalue as longint = 0 _
796  ) as longint
797 declare function cOperatorNew( ) as ASTNODE ptr
798 declare sub cOperatorDelete( )
799 
800 declare sub hSkipUntil _
801  ( _
802  byval token as integer, _
803  byval doeat as integer = FALSE, _
804  byval flags as LEXCHECK = LEXCHECK_EVERYTHING, _
805  byval stop_on_comma as integer = FALSE _
806  )
807 
808 declare sub hSkipCompound _
809  ( _
810  byval for_token as integer, _
811  byval until_token as integer = INVALID, _
812  byval flags as LEXCHECK = LEXCHECK_EVERYTHING _
813  )
814 
815 declare function hMatchExpr _
816  ( _
817  byval dtype as integer _
818  ) as ASTNODE ptr
819 
820 declare function cVarDecl _
821  ( _
822  byval attrib as integer, _
823  byval dopreserve as integer, _
824  byval token as integer, _
825  byval is_fordecl as integer _
826  ) as FBSYMBOL ptr
827 
828 declare sub hComplainIfAbstractClass _
829  ( _
830  byval dtype as integer, _
831  byval subtype as FBSYMBOL ptr _
832  )
833 
834 declare sub hSymbolType _
835  ( _
836  byref dtype as integer, _
837  byref subtype as FBSYMBOL ptr, _
838  byref lgt as longint _
839  )
840 
841 declare function hCheckForDefiniteTypes _
842  ( _
843  _
844  ) as integer
845 
846 declare function hCheckForDefiniteExprs _
847  ( _
848  _
849  ) as integer
850 
851 declare function cThreadCallFunc() as ASTNODE ptr
852 
853 declare function hIntegerTypeFromBitSize _
854  ( _
855  byval bitsize as longint, _
856  byval is_unsigned as integer = FALSE _
857  ) as FB_DATATYPE
858 
859 ''
860 '' macros
861 ''
862 #define cCompSetAllowmask(s, v) s->allowmask = v
863 
864 #define hSkipStmt( ) _
866 
867 '':::::
868 #macro hMatchLPRNT()
869  if( lexGetToken( ) <> CHAR_LPRNT ) then
870  errReport( FB_ERRMSG_EXPECTEDLPRNT )
871  else
872  lexSkipToken( )
873  end if
874 #endmacro
875 
876 '':::::
877 #macro hMatchRPRNT()
878  if( lexGetToken( ) <> CHAR_RPRNT ) then
879  errReport( FB_ERRMSG_EXPECTEDRPRNT )
880  hSkipUntil( CHAR_RPRNT, TRUE )
881  else
882  lexSkipToken( )
883  end if
884 #endmacro
885 
886 '':::::
887 #macro hMatchCOMMA()
888  if( lexGetToken( ) <> CHAR_COMMA ) then
889  errReport( FB_ERRMSG_EXPECTEDCOMMA )
890  else
891  lexSkipToken( )
892  end if
893 #endmacro
894 
895 '':::::
896 #macro hMatchExpression(e)
897  e = hMatchExpr( INVALID )
898  if( e = NULL ) then
899  exit function
900  end if
901 #endmacro
902 
903 '':::::
904 #macro hMatchExpressionEx(e, dtype)
905  e = hMatchExpr( dtype )
906  if( e = NULL ) then
907  exit function
908  end if
909 #endmacro
910 
911 '':::::
912 #macro hCheckSuffix(suffix)
913  if( suffix <> FB_DATATYPE_INVALID ) then
914  if( fbLangOptIsSet( FB_LANG_OPT_SUFFIX ) = FALSE ) then
915  errReportNotAllowed( FB_LANG_OPT_SUFFIX, FB_ERRMSG_SUFFIXONLYVALIDINLANG )
916  end if
917  end if
918 #endmacro
919 
920 '':::::
921 #macro hEmitCurrLine( )
922  if( env.clopt.debug ) then
923  if( env.includerec = 0 ) then
924  astAdd( astNewLIT( lexCurrLineGet( ) ) )
925  lexCurrLineReset( )
926  end if
927  end if
928 #endmacro
929 
930 #define hGetInstPtrMode(ip) iif( astIsCONST( ip ), FB_PARAMMODE_BYVAL, INVALID )
931 
932 #define fbIsModLevel( ) (parser.currproc = env.main.proc)
933 
934 #define fbGetCompStmtId( ) parser.stmt.id
935 
936 #define fbGetPrntOptional( ) ((parser.options and FB_PARSEROPT_PRNTOPT) <> 0)
937 
938 #macro fbSetPrntOptional( _bool )
939  if( _bool ) then
941  else
943  end if
944 #endmacro
945 
946 #define fbGetCheckArray( ) ((parser.options and FB_PARSEROPT_CHKARRAY) <> 0)
947 
948 #macro fbSetCheckArray( _bool )
949  if( _bool ) then
951  else
953  end if
954 #endmacro
955 
956 #define fbGetIsExpression( ) ((parser.options and FB_PARSEROPT_ISEXPR) <> 0)
957 
958 #macro fbSetIsExpression( _bool )
959  if( _bool ) then
961  else
963  end if
964 #endmacro
965 
966 #define fbGetIsScope( ) ((parser.options and FB_PARSEROPT_ISSCOPE) <> 0)
967 
968 #macro fbSetIsScope( _bool )
969  if( _bool ) then
971  else
973  end if
974 #endmacro
975 
976 #define fbGetEqInParensOnly( ) ((parser.options and FB_PARSEROPT_EQINPARENSONLY) <> 0)
977 
978 #macro fbSetEqInParensOnly( _bool )
979  if( _bool ) then
981  else
983  end if
984 #endmacro
985 
986 #define fbGetGtInParensOnly( ) ((parser.options and FB_PARSEROPT_GTINPARENSONLY) <> 0)
987 
988 #macro fbSetGtInParensOnly( _bool )
989  if( _bool ) then
991  else
993  end if
994 #endmacro
995 
996 '' Whether the expression being parsed is a PP expression (#ifdef etc.)
997 #define fbGetIsPP( ) ((parser.options and FB_PARSEROPT_ISPP) <> 0)
998 #macro fbSetIsPP( _bool )
999  if( _bool ) then
1001  else
1003  end if
1004 #endmacro
1005 
1006 ''
1007 '' inter-module globals
1008 ''
1009 extern parser as PARSERCTX
1010