35 #define UPDATE_LINENUM( ) _
36 if(
lex.ctx->deflen = 0 )
then :_
37 lex.ctx->linenum += 1 :_
50 if( env.includerec = 0 )
then
55 if( env.inf.
format = FBFILE_FORMAT_ASCII )
then
69 byval isinclude
as integer _
75 if( env.includerec = 0 )
then
82 lex.ctx->head = @
lex.ctx->tokenTB(0)
83 lex.ctx->tail =
lex.ctx->head
86 for i = 0
to FB_LEX_MAXK-1
87 n->
next = @
lex.ctx->tokenTB(i+1)
90 n->
next =
lex.ctx->head
93 for i = 0
to FB_LEX_MAXK
103 lex.ctx->reclevel = 0
104 lex.ctx->currmacro = NULL
110 if( env.inf.
format = FBFILE_FORMAT_ASCII )
then
111 lex.ctx->buffptr = NULL
112 lex.ctx->defptr = NULL
115 lex.ctx->buffptrw = NULL
116 lex.ctx->defptrw = NULL
122 lex.ctx->lastfilepos = 0
125 if( env.includerec = 0 )
then
132 if( isinclude =
FALSE )
then
154 select case as const( char )
155 case 0, CHAR_CR, CHAR_LF
159 case CHAR_TAB, CHAR_VTAB, CHAR_FORMFEED
167 elseif( char > 255 )
then
180 dim as uinteger char =
any
183 if(
lex.ctx->deflen > 0 )
then
185 if( env.inf.
format = FBFILE_FORMAT_ASCII )
then
186 char = *
lex.ctx->defptr
188 char = *
lex.ctx->defptrw
192 if( env.clopt.debug )
then
193 if( env.includerec = 0 )
then
195 lex.insidemacro = TRUE
206 if(
lex.ctx->bufflen = 0 )
then
207 if(
eof( env.inf.num ) =
FALSE )
then
208 lex.ctx->filepos =
seek( env.inf.num )
210 select case as const env.inf.
format
211 case FBFILE_FORMAT_ASCII
212 if(
get( #env.inf.num, ,
lex.ctx->buff ) = 0 )
then
213 lex.ctx->bufflen =
seek( env.inf.num ) -
lex.ctx->filepos
214 lex.ctx->buffptr = @
lex.ctx->buff
217 case FBFILE_FORMAT_UTF8
220 case FBFILE_FORMAT_UTF16LE
223 case FBFILE_FORMAT_UTF16BE
226 case FBFILE_FORMAT_UTF32LE
229 case FBFILE_FORMAT_UTF32BE
238 if(
lex.ctx->bufflen > 0 )
then
239 if( env.inf.
format = FBFILE_FORMAT_ASCII )
then
240 char = *
lex.ctx->buffptr
242 char = *
lex.ctx->buffptrw
250 if( env.clopt.debug )
then
251 if( env.includerec = 0 )
then
252 if(
lex.insidemacro )
then
274 function =
lex.ctx->currchar
280 if(
lex.ctx->deflen > 0 )
then
283 if( env.inf.
format = FBFILE_FORMAT_ASCII )
then
286 lex.ctx->defptrw += 1
290 elseif(
lex.ctx->currchar <> 0 )
then
291 lex.ctx->bufflen -= 1
293 if( env.inf.
format = FBFILE_FORMAT_ASCII )
then
294 lex.ctx->buffptr += 1
296 lex.ctx->buffptrw += 1
305 lex.ctx->currchar =
lex.ctx->lahdchar
315 if(
lex.ctx->deflen > 0 )
then
318 if( env.inf.
format = FBFILE_FORMAT_ASCII )
then
321 lex.ctx->defptrw += 1
325 elseif(
lex.ctx->currchar <> 0 )
then
326 lex.ctx->bufflen -= 1
328 if( env.inf.
format = FBFILE_FORMAT_ASCII )
then
329 lex.ctx->buffptr += 1
331 lex.ctx->buffptrw += 1
341 byval skipwhitespc
as integer =
FALSE _
348 if( skipwhitespc )
then
349 do while( (
lex.ctx->currchar = CHAR_TAB)
or (
lex.ctx->currchar = CHAR_SPACE) )
350 lex.ctx->after_space = TRUE
356 function =
lex.ctx->currchar
363 byval skipwhitespc
as integer =
FALSE _
371 if( skipwhitespc )
then
372 do while( (
lex.ctx->lahdchar = CHAR_TAB)
or (
lex.ctx->lahdchar = CHAR_SPACE) )
373 lex.ctx->after_space = TRUE
379 function =
lex.ctx->lahdchar
407 byval pid
as zstring ptr, _
408 byref tlen
as integer, _
409 byref dtype
as integer, _
410 byval flags
as LEXCHECK _
413 dim as uinteger c =
any
414 dim as integer skipchar =
any
426 select case as const c
427 case CHAR_AUPP
to CHAR_ZUPP, _
428 CHAR_ALOW
to CHAR_ZLOW, _
433 if( (flags
and LEXCHECK_EATPERIOD) = 0 )
then
443 if( skipchar =
FALSE )
then
445 if( tlen = FB_MAXNAMELEN )
then
447 if( (flags
and LEXCHECK_NOLINECONT) = 0 )
then
449 flags
or= LEXCHECK_NOLINECONT
468 dtype = FB_DATATYPE_INVALID
470 if( (flags
and LEXCHECK_NOSUFFIX) = 0 )
then
473 case FB_TK_INTTYPECHAR
474 dtype = env.lang.integerkeyworddtype
478 case FB_TK_LNGTYPECHAR
479 dtype = FB_DATATYPE_LONG
483 case FB_TK_SGNTYPECHAR
484 dtype = FB_DATATYPE_SINGLE
488 case FB_TK_DBLTYPECHAR
491 dtype = FB_DATATYPE_DOUBLE
496 case FB_TK_STRTYPECHAR
497 dtype = FB_DATATYPE_STRING
511 byref pnum
as zstring ptr, _
512 byref tlen
as integer, _
513 byref dtype
as integer, _
514 byval flags
as LEXCHECK _
517 dim as uinteger value =
any, c =
any, first_c =
any
518 dim as ulongint value64 =
any
519 dim as integer lgt =
any
520 dim as integer skipchar =
any
522 assert( dtype = FB_DATATYPE_SHORT )
530 select case as const c
532 case CHAR_HUPP, CHAR_HLOW
540 if( (flags
and (LEXCHECK_NOLINECONT
or LEXCHECK_NOSUFFIX)) = 0 )
then
551 case CHAR_ALOW
to CHAR_FLOW, CHAR_AUPP
to CHAR_FUPP, CHAR_0
to CHAR_9
553 if( skipchar =
FALSE )
then
560 c -= (CHAR_AUPP - CHAR_9 - 1)
563 c -= (CHAR_ALOW - CHAR_AUPP)
569 dtype = FB_DATATYPE_LONGINT
570 value64 = (
culngint( value ) * 16) + c
571 elseif( lgt = 17 )
then
572 if( (flags
and LEXCHECK_NOLINECONT) = 0 )
then
577 value64 = (value64 * 16) + c
581 dtype = FB_DATATYPE_LONG
583 value = (value * 16) + c
593 case CHAR_OUPP, CHAR_OLOW
601 if( (flags
and (LEXCHECK_NOLINECONT
or LEXCHECK_NOSUFFIX)) = 0 )
then
613 case CHAR_0
to CHAR_7
616 if( skipchar =
FALSE )
then
625 select case as const lgt
627 if( first_c > CHAR_3 )
then
628 dtype = FB_DATATYPE_LONGINT
629 value64 = (
culngint( value ) * 8) + c
631 value = (value * 8) + c
635 if( typeGetSize( dtype ) < 8 )
then
636 dtype = FB_DATATYPE_LONGINT
637 value64 =
culngint( value )
639 value64 = (value64 * 8) + c
642 if( first_c > CHAR_1 )
then
643 if( (flags
and LEXCHECK_NOLINECONT) = 0 )
then
648 value64 = (value64 * 8) + c
652 if( (flags
and LEXCHECK_NOLINECONT) = 0 )
then
658 value64 = (value64 * 8) + c
663 if( first_c > CHAR_1 )
then
664 dtype = FB_DATATYPE_LONG
666 elseif( lgt = 7 )
then
667 dtype = FB_DATATYPE_LONG
669 value = (value * 8) + c
679 case CHAR_BUPP, CHAR_BLOW
687 if( (flags
and (LEXCHECK_NOLINECONT
or LEXCHECK_NOSUFFIX)) = 0 )
then
700 if( skipchar =
FALSE )
then
710 dtype = FB_DATATYPE_LONGINT
711 value64 = (
culngint( value ) * 2) + c
713 elseif( lgt = 65 )
then
714 if( (flags
and LEXCHECK_NOLINECONT) = 0 )
then
720 value64 = (value64 * 2) + c
725 dtype = FB_DATATYPE_LONG
727 value = (value * 2) + c
746 if( typeGetSize( dtype ) < 8 )
then
759 byref pnum
as zstring ptr, _
760 byref tlen
as integer, _
761 byref dtype
as integer, _
762 byval hasdot
as integer, _
763 byval flags
as LEXCHECK _
766 dim as uinteger c =
any
767 dim as integer llen =
any
768 dim as integer skipchar =
any
770 dtype = env.lang.floatliteraldtype
778 case CHAR_0
to CHAR_9
780 if( skipchar =
FALSE )
then
790 if( tlen = FB_MAXNUMLEN )
then
792 if( skipchar =
FALSE )
then
796 if( (flags
and LEXCHECK_NOLINECONT) = 0 )
then
798 flags
or= LEXCHECK_NOLINECONT
805 if( tlen > 7 +
iif( hasdot, 1, 0 ) )
then
806 dtype = FB_DATATYPE_DOUBLE
812 case CHAR_ELOW, CHAR_EUPP, CHAR_DLOW, CHAR_DUPP
817 if( c = CHAR_DLOW
or c = CHAR_DUPP )
then
818 dtype = FB_DATATYPE_DOUBLE
821 if( skipchar =
FALSE )
then
822 if( flags = LEXCHECK_EVERYTHING )
then
834 if( (c = CHAR_PLUS)
or (c = CHAR_MINUS) )
then
836 if( skipchar =
FALSE )
then
845 select case as const c
846 case CHAR_0
to CHAR_9
848 if( skipchar =
FALSE )
then
858 if( tlen = FB_MAXNUMLEN )
then
860 if( skipchar =
FALSE )
then
864 if( (flags
and LEXCHECK_NOLINECONT) = 0 )
then
866 flags
or= LEXCHECK_NOLINECONT
878 case CHAR_FUPP, CHAR_FLOW
879 dtype = FB_DATATYPE_SINGLE
881 if( (flags
and (LEXCHECK_NOSUFFIX
or LEXCHECK_NOLETTERSUFFIX)) = 0 )
then
886 case FB_TK_SGNTYPECHAR
887 dtype = FB_DATATYPE_SINGLE
889 if( (flags
and LEXCHECK_NOSUFFIX) = 0 )
then
894 case FB_TK_DBLTYPECHAR
895 dtype = FB_DATATYPE_DOUBLE
897 if( (flags
and LEXCHECK_NOSUFFIX) = 0 )
then
903 if( flags = LEXCHECK_EVERYTHING )
then
904 if( tlen - llen = 0 )
then
929 byval pnum
as zstring ptr, _
930 byref dtype
as integer, _
931 byref tlen
as integer, _
932 byval flags
as LEXCHECK _
935 dim as uinteger c =
any
936 dim as integer have_u_suffix =
any
937 dim as ulongint value =
any, value_prev =
any
938 dim as integer skipchar =
any, hasdot =
any, warn =
any
944 dtype = FB_DATATYPE_SHORT
946 have_u_suffix =
FALSE
955 select case as const c
959 if( (flags
and (LEXCHECK_NOLINECONT
or LEXCHECK_NOSUFFIX)) <> 0 )
then
968 case CHAR_1
to CHAR_9
977 select case as const c
981 if( skipchar =
FALSE )
then
985 value = (value
shl 3) + (value
shl 1)
989 case CHAR_1
to CHAR_9
991 if( skipchar =
FALSE )
then
995 value = (value
shl 3) + (value
shl 1) + (c - CHAR_0)
998 case CHAR_DOT, CHAR_ELOW, CHAR_EUPP, CHAR_DLOW, CHAR_DUPP
999 if( c = CHAR_DOT )
then
1001 if( skipchar =
FALSE )
then
1018 if( (flags
and LEXCHECK_NOSUFFIX) = 0 )
then
1019 if( skipchar =
FALSE )
then
1020 select case as const tlen
1022 if( value > 32767 )
then
1023 dtype = FB_DATATYPE_LONG
1027 dtype = FB_DATATYPE_LONG
1030 if( value > 2147483647ULL )
then
1031 if( value > 4294967295ULL )
then
1032 dtype = FB_DATATYPE_LONGINT
1034 dtype = FB_DATATYPE_ULONG
1039 dtype = FB_DATATYPE_LONGINT
1042 if( value > 9223372036854775807ULL )
then
1043 dtype = FB_DATATYPE_ULONGINT
1048 dtype = FB_DATATYPE_ULONGINT
1049 if( (flags
and LEXCHECK_NOLINECONT) = 0 )
then
1050 if( value_prev > 1844674407370955161ULL
or _
1051 (value
and &h8000000000000000ULL) = 0 )
then
1058 if( (flags
and LEXCHECK_NOLINECONT) = 0 )
then
1065 if( tlen = FB_MAXNUMLEN )
then
1067 if( skipchar =
FALSE )
then
1071 if( (flags
and LEXCHECK_NOLINECONT) = 0 )
then
1073 flags
or= LEXCHECK_NOLINECONT
1106 select case( dtype )
1107 case FB_DATATYPE_SHORT
1108 dtype = env.lang.int15literaldtype
1109 case FB_DATATYPE_USHORT
1110 dtype = env.lang.int16literaldtype
1111 case FB_DATATYPE_LONG
1112 dtype = env.lang.int31literaldtype
1113 case FB_DATATYPE_ULONG
1114 dtype = env.lang.int32literaldtype
1116 case FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT, _
1117 FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
1124 if( typeGetClass( dtype ) <> FB_DATACLASS_FPOINT )
then
1125 if( (flags
and LEXCHECK_NOSUFFIX) = 0 )
then
1128 if( (flags
and LEXCHECK_NOLETTERSUFFIX) = 0 )
then
1130 case CHAR_UUPP, CHAR_ULOW
1133 have_u_suffix = TRUE
1139 case CHAR_LUPP, CHAR_LLOW
1140 if( (flags
and LEXCHECK_NOLETTERSUFFIX) = 0 )
then
1144 if( (c = CHAR_LUPP)
or (c = CHAR_LLOW) )
then
1147 dtype =
iif( have_u_suffix, FB_DATATYPE_ULONGINT, FB_DATATYPE_LONGINT )
1151 if( value > &hFFFFFFFFull )
then
1152 if( skipchar =
FALSE )
then
1153 if( (flags
and LEXCHECK_NOLINECONT) = 0 )
then
1159 dtype =
iif( have_u_suffix, FB_DATATYPE_ULONG, FB_DATATYPE_LONG )
1164 case CHAR_FUPP, CHAR_FLOW
1165 if( (flags
and LEXCHECK_NOLETTERSUFFIX) = 0 )
then
1166 if( have_u_suffix =
FALSE )
then
1167 dtype = FB_DATATYPE_SINGLE
1174 case CHAR_DUPP, CHAR_DLOW
1175 if( (flags
and LEXCHECK_NOLETTERSUFFIX) = 0 )
then
1176 if( have_u_suffix =
FALSE )
then
1177 dtype = FB_DATATYPE_DOUBLE
1183 case FB_TK_INTTYPECHAR
1187 select case( typeGetSize( env.lang.integerkeyworddtype ) )
1188 case 2 : warn = (value > &hFFFFull)
1189 case 4 : warn = (value > &hFFFFFFFFull)
1190 case else : warn =
FALSE
1193 if( skipchar =
FALSE )
then
1194 if( (flags
and LEXCHECK_NOLINECONT) = 0 )
then
1199 dtype = env.lang.integerkeyworddtype
1204 case FB_TK_LNGTYPECHAR
1205 if( typeGetSize( dtype ) > 4 )
then
1206 if( skipchar =
FALSE )
then
1207 if( (flags
and LEXCHECK_NOLINECONT) = 0 )
then
1212 dtype = FB_DATATYPE_LONG
1217 case FB_TK_SGNTYPECHAR
1218 if( have_u_suffix =
FALSE )
then
1219 dtype = FB_DATATYPE_SINGLE
1224 case FB_TK_DBLTYPECHAR
1225 if( have_u_suffix =
FALSE )
then
1228 dtype = FB_DATATYPE_DOUBLE
1245 byval tk
as FBTOKEN
ptr, _
1246 byval ps
as zstring ptr, _
1247 byval flags
as LEXCHECK _
1250 dim as integer lgt =
any, hasesc =
any, escaped =
any, skipchar =
any
1251 dim as uinteger char =
any
1257 escaped = (tk->id = FB_TK_STRLIT_ESC)
1261 if( (flags
and LEXCHECK_NOQUOTES) = 0 )
then
1275 if( char = CHAR_QUOTE )
then
1279 if( (flags
and LEXCHECK_NOQUOTES) <> 0 )
then
1280 if( skipchar =
FALSE )
then
1289 if( char <> CHAR_QUOTE )
then exit do
1292 elseif( char = FB_INTSCAPECHAR )
then
1295 if( (flags
and LEXCHECK_NOQUOTES) = 0 )
then
1296 if( skipchar =
FALSE )
then
1297 *ps = FB_INTSCAPECHAR
1304 elseif( char = CHAR_RSLASH )
then
1311 if( skipchar =
FALSE )
then
1324 case 0, CHAR_CR, CHAR_LF
1326 if (flags
and (LEXCHECK_NOLINECONT
or LEXCHECK_NOSUFFIX)) = 0
then
1335 if( skipchar =
FALSE )
then
1337 if( lgt = FB_MAXLITLEN )
then
1339 if( (flags
and LEXCHECK_NOLINECONT) = 0 )
then
1341 flags
or= LEXCHECK_NOLINECONT
1359 tk->dtype = FB_DATATYPE_CHAR
1370 byval tk
as FBTOKEN
ptr, _
1371 byval ps
as wstring ptr, _
1372 byval flags
as LEXCHECK _
1375 dim as integer lgt =
any, hasesc =
any, escaped =
any, skipchar =
any
1376 dim as uinteger char =
any
1382 escaped = (tk->id = FB_TK_STRLIT_ESC)
1386 if( (flags
and LEXCHECK_NOQUOTES) = 0 )
then
1400 if( char = CHAR_QUOTE )
then
1404 if( (flags
and LEXCHECK_NOQUOTES) <> 0 )
then
1405 if( skipchar =
FALSE )
then
1414 if( char <> CHAR_QUOTE )
then exit do
1417 elseif( char = FB_INTSCAPECHAR )
then
1420 if( (flags
and LEXCHECK_NOQUOTES) = 0 )
then
1421 if( skipchar =
FALSE )
then
1422 *ps = FB_INTSCAPECHAR
1429 elseif( char = CHAR_RSLASH )
then
1436 if( skipchar =
FALSE )
then
1449 case 0, CHAR_CR, CHAR_LF
1451 if (flags
and (LEXCHECK_NOLINECONT
or LEXCHECK_NOSUFFIX)) = 0
then
1460 if( skipchar =
FALSE )
then
1462 if( lgt = FB_MAXLITLEN )
then
1464 if( (flags
and LEXCHECK_NOLINECONT) = 0 )
then
1466 flags
or= LEXCHECK_NOLINECONT
1484 tk->dtype = FB_DATATYPE_WCHAR
1493 byval t
as FBTOKEN
ptr, _
1494 byval flags
as LEXCHECK, _
1495 byval chain_ as FBSYMCHAIN
ptr _
1498 dim as integer readfullid =
any
1501 if(
chain_ <> NULL )
then
1507 if( symbGetClass(
chain_->sym ) <> FB_SYMBCLASS_NAMESPACE )
then
1511 do while(
chain_ <> NULL )
1512 dim as FBSYMBOL
ptr sym =
chain_->sym
1514 if( symbIsVar( sym ) )
then
1515 if( symbGetType( sym ) = FB_DATATYPE_STRUCT )
then
1520 sym = sym->hash.
next
1521 loop while( sym <> NULL )
1535 if( readfullid )
then
1540 flags
or LEXCHECK_EATPERIOD )
1542 t->sym_chain =
symbLookup( @t->text, t->id, t->
class )
1550 byval t
as FBTOKEN
ptr, _
1551 byval flags
as LEXCHECK _
1554 dim as uinteger char =
any
1555 dim as integer islinecont =
any, lgt =
any
1556 dim as FBSYMCHAIN
ptr chain_ =
any
1558 t->after_space =
lex.ctx->after_space
1571 select case as const char
1575 t->
class = FB_TKCLASS_DELIMITER
1576 t->dtype = FB_DATATYPE_INVALID
1583 if( islinecont )
then
1589 if( (flags
and LEXCHECK_NOLINECONT) = 0 )
then
1593 case CHAR_AUPP
to CHAR_ZUPP, CHAR_ALOW
to CHAR_ZLOW, _
1594 CHAR_0
to CHAR_9, CHAR_UNDER
1610 case CHAR_CR, CHAR_LF
1614 if( char = CHAR_CR )
then
1620 if( islinecont =
FALSE )
then
1622 t->
class = FB_TKCLASS_DELIMITER
1623 t->dtype = FB_DATATYPE_INVALID
1625 t->text[0] = CHAR_LF
1630 t->after_space = TRUE
1637 case CHAR_TAB, CHAR_SPACE
1638 t->after_space = TRUE
1639 if( islinecont =
FALSE )
then
1640 if( (flags
and LEXCHECK_NOWHITESPC) <> 0 )
then
1649 if( islinecont =
FALSE )
then
1658 lex.ctx->lastfilepos =
lex.ctx->filepos + (
lex.ctx->buffptr - @
lex.ctx->buff) - 1
1660 select case as const char
1665 if( (flags
and (LEXCHECK_NOLINECONT
or LEXCHECK_NOSUFFIX)) = 0 )
then
1670 if( (lachar >= CHAR_0)
and (lachar <= CHAR_9) )
then
1681 case CHAR_HUPP, CHAR_HLOW, CHAR_OUPP, CHAR_OLOW, CHAR_BUPP, CHAR_BLOW
1685 t->
class = FB_TKCLASS_OPERATOR
1693 case CHAR_0
to CHAR_9
1696 t->
class = FB_TKCLASS_NUMLITERAL
1700 case CHAR_AUPP
to CHAR_ZUPP, CHAR_ALOW
to CHAR_ZLOW
1707 if( (flags
and LEXCHECK_KWDNAMESPC) <> 0 )
then
1710 if( t->sym_chain = NULL )
then
1712 t->
class = FB_TKCLASS_IDENTIFIER
1714 t->id = t->sym_chain->sym->key.id
1715 t->
class = t->sym_chain->sym->key.tkclass
1722 if( (flags
and LEXCHECK_NOSYMBOL) <> 0 )
then
1724 t->
class = FB_TKCLASS_IDENTIFIER
1728 t->sym_chain =
symbLookup( @t->text, t->id, t->
class )
1731 if( (flags
and LEXCHECK_NODEFINE) <> 0 )
then
1737 if(
chain_ <> NULL )
then
1739 if( symbGetClass(
chain_->sym ) = FB_SYMBCLASS_DEFINE )
then
1742 t->after_space = TRUE
1748 if( fbLangOptIsSet( FB_LANG_OPT_PERIODS ) )
then
1750 if( (flags
and LEXCHECK_NOPERIOD) <> 0 )
then
1759 t->
class = FB_TKCLASS_STRLITERAL
1760 t->id =
iif( env.opt.escapestr, FB_TK_STRLIT_ESC, FB_TK_STRLIT )
1761 t->dtype = FB_DATATYPE_INVALID
1763 if( env.inf.
format = FBFILE_FORMAT_ASCII )
then
1770 case CHAR_EXCL, CHAR_DOLAR
1778 t->
class = FB_TKCLASS_STRLITERAL
1779 t->id =
iif( char = CHAR_EXCL, FB_TK_STRLIT_ESC, FB_TK_STRLIT_NOESC )
1780 t->dtype = FB_DATATYPE_INVALID
1782 if( env.inf.
format = FBFILE_FORMAT_ASCII )
then
1783 dim as zstring ptr ps =
any
1786 if( (flags
and LEXCHECK_NOQUOTES) = 0 )
then
1796 dim as wstring ptr ps =
any
1799 if( (flags
and LEXCHECK_NOQUOTES) = 0 )
then
1820 select case as const char
1822 case CHAR_LT, CHAR_GT, CHAR_EQ
1823 t->
class = FB_TKCLASS_OPERATOR
1832 t->text[t->
len+1] = 0
1840 t->text[t->
len+1] = 0
1853 t->text[t->
len+1] = 0
1865 t->text[t->
len+1] = 0
1874 case CHAR_PLUS, CHAR_TIMES, CHAR_RSLASH, CHAR_CART, CHAR_AT
1875 t->
class = FB_TKCLASS_OPERATOR
1879 t->
class = FB_TKCLASS_OPERATOR
1885 t->text[t->
len+1] = 0
1887 t->id = FB_TK_FIELDDEREF
1892 t->
class = FB_TKCLASS_OPERATOR
1895 if( (flags
and LEXCHECK_NOMULTILINECOMMENT) = 0
or _
1896 fbLangIsSet( FB_LANG_FB ) =
FALSE )
then
1901 t->after_space = TRUE
1908 t->
class = FB_TKCLASS_DELIMITER
1909 t->id = FB_TK_COMMENT
1913 t->
class = FB_TKCLASS_DELIMITER
1914 t->id = FB_TK_STMTSEP
1917 case CHAR_LPRNT, CHAR_RPRNT, CHAR_COMMA, _
1918 CHAR_SEMICOLON, CHAR_DOT, CHAR_LBRACE, CHAR_RBRACE, _
1919 CHAR_LBRACKET, CHAR_RBRACKET
1920 t->
class = FB_TKCLASS_DELIMITER
1923 case CHAR_SPACE, CHAR_TAB
1924 t->
class = FB_TKCLASS_DELIMITER
1929 case CHAR_SPACE, CHAR_TAB
1931 t->text[t->
len] = CHAR_SPACE
1941 t->
class = FB_TKCLASS_UNKNOWN
2019 byval flags
as LEXCHECK _
2027 function =
lex.ctx->head->id
2034 byval flags
as LEXCHECK _
2042 function =
lex.ctx->head->
class
2049 byval k
as integer, _
2050 byval flags
as LEXCHECK _
2053 if( k > FB_LEX_MAXK )
then
2057 if( k >
lex.ctx->k )
then
2059 lex.ctx->tail =
lex.ctx->tail->
next
2066 function =
lex.ctx->tail->id
2073 byval k
as integer, _
2074 byval flags
as LEXCHECK _
2077 if( k > FB_LEX_MAXK )
then
2081 if( k >
lex.ctx->k )
then
2083 lex.ctx->tail =
lex.ctx->tail->
next
2090 function =
lex.ctx->tail->
class
2100 lex.ctx->head =
lex.ctx->head->
next
2106 dim as integer is_escaped =
any, saw_backslash =
any
2107 dim as ubyte ptr p =
any
2112 case FB_TK_STRLIT_ESC
2115 case FB_TK_STRLIT_NOESC
2128 saw_backslash =
FALSE
2136 if( saw_backslash )
then
2143 saw_backslash =
FALSE
2146 saw_backslash = is_escaped
2150 saw_backslash =
FALSE
2165 case FB_TK_COMMENT, FB_TK_REM
2169 case FB_TK_EOF, FB_TK_EOL
2178 if(
lex.ctx->lasttk_id = FB_TK_EOL )
then
2179 print #env.ppfile_num,
""
2187 if(
lex.ctx->head->after_space )
then
2192 case FB_TK_STRLIT, FB_TK_STRLIT_ESC, FB_TK_STRLIT_NOESC
2207 if( env.ppfile_num > 0 )
then
2208 if(
lex.ctx->reclevel = 0 )
then
2214 select case lex.ctx->head->id
2221 if(
lex.ctx->deflen = 0 )
then
2222 lex.ctx->currmacro = NULL
2225 lex.ctx->lasttk_id =
lex.ctx->head->id
2228 if(
lex.ctx->k = 0 )
then
2240 byval token
as zstring ptr, _
2241 byval flags
as LEXCHECK _
2245 if(
lex.ctx->head->dtype <> FB_DATATYPE_WCHAR )
then
2246 *token =
lex.ctx->head->text
2248 *token =
str(
lex.ctx->head->textw )
2258 )
as zstring ptr static
2260 static as zstring * FB_MAXLITLEN+1 tmpstr
2262 if(
lex.ctx->head->dtype <> FB_DATATYPE_WCHAR )
then
2263 function = @
lex.ctx->head->text
2265 tmpstr =
str(
lex.ctx->head->textw )
2274 byval endchar
as uinteger =
INVALID, _
2275 byval dst
as zstring ptr, _
2276 byval skipline
as integer =
FALSE _
2279 dim as uinteger char
2281 if( skipline =
FALSE )
then
2286 do while(
lex.ctx->k > 0 )
2287 select case lex.ctx->head->id
2288 case FB_TK_EOF, FB_TK_EOL, endchar
2291 if( skipline =
FALSE )
then
2292 *dst +=
lex.ctx->head->text
2300 select case lex.ctx->head->id
2301 case FB_TK_EOF, FB_TK_EOL, endchar
2304 if( skipline =
FALSE )
then
2305 *dst +=
lex.ctx->head->text
2314 select case as const char
2316 lex.ctx->head->id = FB_TK_EOF
2317 lex.ctx->head->
class = FB_TKCLASS_DELIMITER
2321 case CHAR_CR, CHAR_LF
2324 if( char = CHAR_CR )
then
2328 lex.ctx->head->id = FB_TK_EOL
2329 lex.ctx->head->
class = FB_TKCLASS_DELIMITER
2334 if( char = endchar )
then
2335 lex.ctx->head->id = endchar
2336 lex.ctx->head->
class = FB_TKCLASS_DELIMITER
2342 if( skipline =
FALSE )
then
2359 byref token_pos
as string, _
2360 byval do_trim
as integer _
2363 static as zstring * 1024+1 buffer
2365 dim as integer p, old_p, start, token_len
2367 dim as uinteger char
2372 if( env.inf.
format <> FBFILE_FORMAT_ASCII )
then
2377 old_p =
seek( env.inf.num )
2378 p =
lex.ctx->lastfilepos - 512
2385 get #env.inf.num, p + 1, buffer
2386 seek #env.inf.num, old_p
2391 if( start > 0 )
then
2396 case CHAR_CR, CHAR_LF
2400 if( start <= 0 )
then
2417 case 0, CHAR_CR, CHAR_LF
2422 if( token_len > 0 )
then
2423 token_pos +=
chr(
iif( char = CHAR_TAB, CHAR_TAB, CHAR_SPACE ) )
2433 for i = 0
to len( res )-1
2435 case CHAR_TAB, CHAR_SPACE
2442 if( i <
len( res ) )
then
2443 res =
mid( res, 1+i )
2449 for i =
len( res )-1
to 0 step -1
2451 case CHAR_TAB, CHAR_SPACE
2459 res =
left( res, 1+i )