FreeBASIC  0.91.0
parser-quirk-error.bas
Go to the documentation of this file.
1 '' quirk error statements (ERROR, ERR) parsing
2 ''
3 '' chng: sep/2004 written [v1ctor]
4 
5 
6 #include once "fb.bi"
7 #include once "fbint.bi"
8 #include once "parser.bi"
9 #include once "rtl.bi"
10 #include once "ast.bi"
11 
12 '' ERROR Expression
13 function cErrorStmt() as integer
14  function = FALSE
15 
16  lexSkipToken( )
17 
18  '' Expression
19  dim as ASTNODE ptr expr
20  hMatchExpressionEx(expr, FB_DATATYPE_INTEGER)
21 
22  rtlErrorThrow(expr, lexLineNum(), env.inf.name)
23 
24  function = TRUE
25 end function
26 
27 '' ERR '=' Expression
28 function cErrSetStmt() as integer
29  function = FALSE
30 
31  lexSkipToken( )
32 
33  '' '='
34  if( cAssignToken( ) = FALSE ) then
35  errReport( FB_ERRMSG_EXPECTEDEQ )
36  end if
37 
38  '' Expression
39  dim as ASTNODE ptr expr
40  hMatchExpressionEx(expr, FB_DATATYPE_INTEGER)
41 
42  rtlErrorSetnum(expr)
43 
44  function = TRUE
45 end function
46 
47 '' ERR()
48 function cErrorFunct() as ASTNODE ptr
49  '' ERR
50  lexSkipToken( )
51 
52  '' ('(' ')')?
53  if( hMatch( CHAR_LPRNT ) ) then
54  '' ')'
55  hMatchRPRNT( )
56  end if
57 
58  function = rtlErrorGetNum( )
59 end function
60