| fb-doc 0.2 documentation tool for FreeBasic

- Main Page
- Tutorial
- Data Structures
- Files

- Data Structures
- Data Structure Index
- Data Fields

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Types | Public Member Functions | Data Fields | Private Types | Private Attributes
Parser Class Reference

The parser. More...

Collaboration diagram for Parser:
[legend]

## Public Types

enum | ParserTokens { MSG_STOP = -1, MSG_ERROR, TOK_EOS, TOK_BRCLO, TOK_COMMA, TOK_KLOPN, TOK_KLCLO, TOK_DOT, TOK_TRIDO, TOK_QUOTE, TOK_LATTE, TOK_BROPN, TOK_EQUAL, TOK_ABST, TOK_ALIA, TOK_AS,
TOK_BYRE, TOK_BYVA, TOK_CDEC, TOK_CLAS,
TOK_COMM, TOK_CONS, TOK_DECL, TOK_DEFI,
TOK_DIM, TOK_END, TOK_ENUM, TOK_EXDS,
TOK_EMAC, TOK_EXRN, TOK_EXPO, TOK_INCL,
TOK_LIB, TOK_MACR, TOK_NAMS, TOK_ONCE,
TOK_OVER, TOK_PASC, TOK_PRIV, TOK_PROT,
TOK_RDIM, TOK_PTR, TOK_PUBL, TOK_SCOP,
TOK_SHAR, TOK_STAT, TOK_STCL, TOK_TYPE,
TOK_UNIO, TOK_VAR, TOK_VIRT, TOK_FUNC,
TOK_FILD, TOK_OPER, TOK_PROP, TOK_SUB,
TOK_CTOR, TOK_DTOR, TOK_BYTE, TOK_DOUB,
TOK_INT, TOK_LONG, TOK_LINT, TOK_STRI,
TOK_SHOR, TOK_SING, TOK_UBYT, TOK_ULNG,
TOK_ULIN, TOK_UINT, TOK_USHO, TOK_WSTR,
TOK_ZSTR, TOK_WORD, TOK_COMSL, TOK_COMML
}
| The tokens used by the parser. More...

## Public Member Functions

| Parser (BYVAL_AS_EmitterIF_PTR)
| The constructor. More...
Filehandlers
Filehandlers are used to load some FreeBasic source code input in to the buffer Parser::Buf from different input channels (may be the StdIn pipe, a single file or all files in a folder). Afterwards the source code gets parsed and translated output created by the emitter gets returned.
SUB | File_ (BYREF_AS_STRING)
| Read a buffer from a file and parse. More...
SUB | StdIn ()
| Read a buffer from pipe StdIn and parse. More...
Properties to extract original source code
Properties are used to extract original text from the input buffer at a certain position. This is the current position of the parser, or the position of the given parameter.
PROPERTY_AS_INTEGER_PTR | CurTok ()
| The current token. More...
PROPERTY_AS_STRING | BitIni ()
| The initialization of a bitfield. More...
PROPERTY_AS_STRING | VarIni ()
| The variable initialization. More...
PROPERTY_AS_STRING | SubStr ()
| Context of current token. More...
PROPERTY_AS_STRING | SubStr (BYVAL_AS_INTEGER_PTR)
| Check current token position, extract word if string type. More...
PROPERTY_AS_STRING | Bracket (BYVAL_AS_INTEGER_PTR)
| The dimension of a variable. More...
Parsers for lists and blocks
External demuxers are called from emitter-handlers when they sit on a list of statments, ie in an ENUM block or in a DIM statement with more than one variable.
SUB | parseListNam (BYVAL_AS_EmitFunc)
| Evaluate a list of names. More...
SUB | parseListNamTyp (BYVAL_AS_EmitFunc)
| Evaluate a list of declarations. More...
SUB | parseListPara (BYVAL_AS_EmitFunc)
| Evaluate a parameter list. More...
SUB | parseBlockEnum (BYVAL_AS_EmitFunc)
| Evaluate the context of an ENUM block. More...
SUB | parseBlockTyUn (BYVAL_AS_EmitFunc)
| Evaluate the context of a block. More...

## Data Fields

enum Parser::ParserTokens | ParserTokens
Parser STRINGs
STRING variables to exchange data with th emitters.
STRING | Buf
| the input buffer More...
STRING | ErrMsg
| an error message More...
STRING | Tok
| the token list More...
STRING | BlockNam
| the name of a block (ENUM, UNION, TYPE) More...
Parser token pointers
Pointers to the token list, used to specify the result of the parsing process. The tokens specify the construct in progress and they are used by the emitters to create their output. Four main tokens specify the kind of the construct:

- StaTok: the current construct
- NamTok - subtokens: DimTok, IniTok (may be zero in parameter lists)
- TypTok - subtokens: ShaTok, PtrTok, Co1Tok, Co2Tok (is zero for VAR, may be zero for CONST)
- FunTok - subtokens: ParTok, AliTok, DivTok, By_Tok (is zero for variables)

Other tokens are only valid if the main token is not zero.

INTEGER_PTR | StaTok
| the pre-parsed token More...
INTEGER_PTR | NamTok
| the name token of the construct More...
INTEGER_PTR | DimTok
| the token of the left parenthesis of a dimension More...
INTEGER_PTR | IniTok
| the start token of an initializer ('=') More...
INTEGER_PTR | BitTok
| the start token of an bitfiled declaration (':') More...
INTEGER_PTR | TypTok
| the token of the type keyword More...
INTEGER_PTR | ShaTok
| the token of the SHARED keyword More...
INTEGER_PTR | PtrTok
| the token of the first PTR keyword More...
INTEGER_PTR | Co1Tok
| the token of the first CONST keyword (if any) More...
INTEGER_PTR | Co2Tok
| the token of the second CONST keyword (if any) More...
INTEGER_PTR | FunTok
| type of the pre-parsed token More...
INTEGER_PTR | CalTok
| the token of the calling convention keyword (if any) More...
INTEGER_PTR | AliTok
| the token of the ALIAS keyword (if any) More...
INTEGER_PTR | As_Tok
| the token of the AS keyword (if no SUB) More...
INTEGER_PTR | ParTok
| the token of the left parenthesis of a parameter list More...
INTEGER_PTR | By_Tok
| the token of the declaration specifier (BYVAL / BYREF) More...
INTEGER_PTR | DivTok
| the token of different purposes like the STATIC keyword in a member function declaration (if any) or the LIB keyword in a normal declaration More...
INTEGER_PTR | Tk1
| the first token in a statment More...
INTEGER_PTR | TkEnd
| the last token in the list More...
INTEGER_PTR | UserTok
| a token for customised usage in emitter-handlers More...
Parser counters, integers and pointers
Diverse variables used on different events. They inform the emitters about the state of the parser.
INTEGER | Ocha
| the ouput file number (channel) More...
INTEGER | Fin
| the last position in the input buffer Parser::Buf More...
INTEGER | PtrCount
| the number of PTR keywords More...
INTEGER | SrcBgn
| start position to export FB source More...
INTEGER | InLines
| the current line in the input buffer Parser::Buf More...
INTEGER | LevelCount
| the level in nested blocks (one based) More...
INTEGER | ListCount
| the current entry in a list (zero based) More...

## Private Types

enum | EoS_Modi { TO_END_BLOCK, TO_END, TO_EOL, TO_COLON }
| The modi for end of statement searching. More...

## Private Member Functions

Internal parsers
Functions for evaluating a construct in the FreeBasic source code after a relevant keyword was found in the pre-parsering process. After the fine-parsing process the matching emitter-handler gets called. (Or the function _Error_() in case of a syntax problem. It's up to the emitter if and where the user sees the error message.)
SUB | pre_parse ()
| Pre-parse all FB source code, search relevant constructs. More...
PROPERTY_AS_STRING | USubStr ()
| Check current token position, extract word if string type. More...
FUNCTION_AS_INTEGER | getToken ()
| Check word at current parser position. More...
FUNCTION_AS_INTEGER | tokenize (BYVAL_AS_EoS_Modi)
| Parse a relevant construct, create a token list. More...
FUNCTION_AS_INTEGER | Errr (BYREF_AS_STRING)
| Emit an error message. More...
FUNCTION_AS_INTEGER | demuxNam (BYVAL_AS_INTEGER, BYVAL_AS_INTEGER)
| Evaluate a name, dimension and initializer in the token list. More...
FUNCTION_AS_INTEGER | demuxTyp (BYVAL_AS_INTEGER)
| Evaluate a type declaration in the token list. More...
FUNCTION_AS_INTEGER | demuxDecl ()
| Evaluate a function declaration in the token list. More...
FUNCTION_AS_INTEGER | skipOverColon ()
| Move to the end of statement and one step beyond. More...
FUNCTION_AS_INTEGER | skipOverBrclo ()
| Move to the matching right parenthesis and one step beyond. More...
FUNCTION_AS_INTEGER | skipOverComma ()
| Move to the next comma and one step beyond. More...
FUNCTION_AS_INTEGER | _VAR_ ()
| Evaluate a variable declaration. More...
FUNCTION_AS_INTEGER | _TYPE_ ()
| Evaluate a TYPE or CLASS statement. More...
FUNCTION_AS_INTEGER | _ENUM_ ()
| Evaluate an ENUM block. More...
FUNCTION_AS_INTEGER | _UNION_ ()
| Evaluate an UNION block. More...
FUNCTION_AS_INTEGER | _FUNCTION_ ()
| Evaluate a function. More...
FUNCTION_AS_INTEGER | _DECLARE_ ()
| Evaluate a forward declaration. More...
FUNCTION_AS_INTEGER | _INCLUDE_ ()
| Evaluate an #INCLUDE line. More...
FUNCTION_AS_INTEGER | _DEFINE_ ()
| Evaluate a #DEFINE declaration. More...
FUNCTION_AS_INTEGER | _MACRO_ ()
| Evaluate a #MACRO declaration. More...

## Private Attributes

enum Parser::EoS_Modi | EoS_Modi
Internal values
Variables used in pre-parsing process.
INTEGER | Po
| the current position in the input buffer Parser::Buf More...
INTEGER | ToLast
| the type of the token before the current one More...
INTEGER_PTR | Tk
| the current token of the parser More...
INTEGER_PTR | A
| start of a word in pre-parsing More...
INTEGER_PTR | L
| length of a word in pre-parsing More...
EmitterIF_PTR | Emit
| the emitter interface More...

## Detailed Description

The parser.

Class to handle FreeBasic source code. A Parser allways work on exactly one input stream, comming from a file or from StdIn. The Parser does

- read the source from an input channel (see StdIn(), File_())
- call function EmitterIF::_Init_() before parsing
- pre-parse the source for relavant code fractions (see pre_parse()) and call the comments emitter-handler on the way.
- fine-scan any relavant code fractions (see tokenize()) and call the matching emitter-handler for this code (done by the private functions ie like _DEFINE_(), _FUNCTION_(), _VAR_(), ...)
- provide functions to extract elements form the source (like SubStr(), Bracket(), VarIni(), ...)
- call matching emitter functions to generaate the output stream
- call function EmitterIF::_Exit_() after parsing

When fb-doc follows the source tree (option –tree), the function EmitterIF::Incl_() creates a new Parser for each file.

Definition at line 33 of file fb-doc_parser.bi.

## Member Enumeration Documentation

enum ParserTokens

The tokens used by the parser.

Enumerators used to classify the type of a token found in the FreeBasic source code.

Enumerator
MSG_STOP | end of file / token list reached
MSG_ERROR | continue parsing
TOK_EOS | end of statement (either ' ' or ':')
TOK_BRCLO | right parenthesis
TOK_COMMA | a comma
TOK_KLOPN | left other bracket
TOK_KLCLO | right other bracket
TOK_DOT | a dot
TOK_TRIDO | three dots
TOK_QUOTE | a string constant (including quotes)
TOK_LATTE | the '#' character
TOK_BROPN | left parenthesis
TOK_EQUAL | the '=' character
TOK_ABST | the ABSTRACT keyword
TOK_ALIA | the ALIAS keyword
TOK_AS | the AS keyword
TOK_BYRE | the BYREF keyword
TOK_BYVA | the BYVAL keyword
TOK_CDEC | the CDECL keyword
TOK_CLAS | the CLASS keyword
TOK_COMM | the COMMON keyword
TOK_CONS | the CONST keyword
TOK_DECL | the DECLARE keyword
TOK_DEFI | the #DEFINE keyword
TOK_DIM | the DIM keyword
TOK_END | the END keyword
TOK_ENUM | the ENUM keyword
TOK_EXDS | the EXTENDS keyword
TOK_EMAC | the #ENDMACRO keyword
TOK_EXRN | the EXTERN keyword
TOK_EXPO | the EXPORT keyword
TOK_INCL | the #INCLUDE keyword
TOK_LIB | the LIB keyword
TOK_MACR | the #MACRO keyword
TOK_NAMS | the NAMESPACE keyword
TOK_ONCE | the ONCE keyword
TOK_OVER | the OVERLOAD keyword
TOK_PASC | the PASCAL keyword
TOK_PRIV | the PRIVATE keyword
TOK_PROT | the PROTECTED keyword
TOK_RDIM | the REDIM keyword
TOK_PTR | the PTR or POINTER keyword
TOK_PUBL | the PUBLIC keyword
TOK_SCOP | the SCOPE keyword
TOK_SHAR | the SHARED keyword
TOK_STAT | the STAvarTIC keyword
TOK_STCL | the STDCALL keyword
TOK_TYPE | the TYPE keyword
TOK_UNIO | the UNION keyword
TOK_VAR | the VAR keyword
TOK_VIRT | the VIRTUAL keyword
TOK_FUNC | the FUNCTION keyword
TOK_FILD | the FIELD keyword
TOK_OPER | the OPERATOR keyword
TOK_PROP | the PROPERTY keyword
TOK_SUB | the SUB keyword
TOK_CTOR | the CONSTRUCTOR keyword
TOK_DTOR | the DESTRUCTOR keyword
TOK_BYTE | the BYTE data type
TOK_DOUB | the DOUBLE data type
TOK_INT | the INTEGER data type
TOK_LONG | the LONG data type
TOK_LINT | the LONGINT data type
TOK_STRI | the STRING data type
TOK_SHOR | the SHORT data type
TOK_SING | the SINGLE data type
TOK_UBYT | the UBYTE data type
TOK_ULNG | the ULONG data type
TOK_ULIN | the ULONGINT data type
TOK_UINT | the UINTEGER data type
TOK_USHO | the USHORT data type
TOK_WSTR | the ZSTRING data type
TOK_ZSTR | the ZSTRING data type
TOK_WORD | a word
TOK_COMSL | line end comment (single line)
TOK_COMML | multi line comment

Definition at line 41 of file fb-doc_parser.bi.

enum EoS_Modi

private

The modi for end of statement searching.

Enumerators used in internal in the parser to specify where to stop to tokenize the input buffer

Enumerator
TO_END_BLOCK | tokenize to the end of the structure
TO_END | stop at the end of the token list
TO_EOL | stop at the next line end
TO_COLON | stop at the next line end or colon

Definition at line 254 of file fb-doc_parser.bi.

## Constructor & Destructor Documentation

Parser | ( | BYVAL_AS_EmitterIF_PTR | Em) |  |

The constructor.

Parameters

  Em | a pointer to the emitter interface to use

Initialize the start values. We get the pointer to the EmitterIF to use and we create a short token list (just two entries) for usage inside the parser. This token list is static and it doesn't change its adress (unlike the Parser::Tok list that may shift when growing).

Definition at line 22 of file fb-doc_parser.bas.

## Member Function Documentation

SUB File_ | ( | BYREF_AS_STRING | File) |  |

Read a buffer from a file and parse.

Parameters

  File | the name of the file to translate

Returns
  the translated code (if any)

Read a file in to input buffer. Start detailed parsing on each relevant construct. Otherways skip the current line. Export comments on the way. Do nothing if file doesn't exist or isn't readable.

Definition at line 1090 of file fb-doc_parser.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

SUB StdIn | ( | ) |  |

Read a buffer from pipe StdIn and parse.

Returns
  the translated code (or an informal text)

Get all characters from StdIn. Start the parsing process. If there is no input (an empty line) then load file Options::EmitFile and output its context. Otherwise call function EmitterIF::_Empty_(). (Useful for generating templates in –geany mode.)

Definition at line 1112 of file fb-doc_parser.bas.

Here is the call graph for this function:

PROPERTY_AS_INTEGER_PTR CurTok | ( | ) |  |

The current token.

Returns
  the token the parser currently stopping at

This property returns the parser token (where the parser currently stops).

Definition at line 1156 of file fb-doc_parser.bas.

Here is the caller graph for this function:

PROPERTY_AS_STRING BitIni | ( | ) |  |

The initialization of a bitfield.

Returns
  the bitfield initialization

This property returns the initialization of a bitfield in a TYPE / UNION block. The size of the bitfield may either be an integer number or a macro (= TOK_WORD).

Definition at line 1168 of file fb-doc_parser.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

PROPERTY_AS_STRING VarIni | ( | ) |  |

The variable initialization.

Returns
  the initialiser

This property reads the initialization of a variable from the input buffer.

Definition at line 1205 of file fb-doc_parser.bas.

Here is the caller graph for this function:

PROPERTY_AS_STRING SubStr | ( | ) |  |

Context of current token.

Returns
  the context of the current token

This property returns the context of the current token from the input buffer.

Definition at line 1236 of file fb-doc_parser.bas.

Here is the caller graph for this function:

PROPERTY_AS_STRING SubStr | ( | BYVAL_AS_INTEGER_PTR | T) |  |

Check current token position, extract word if string type.

Parameters

  T | The token to read

Returns
  the context of the token T

This property returns the context of the token T from the input buffer.

Definition at line 1249 of file fb-doc_parser.bas.

PROPERTY_AS_STRING Bracket | ( | BYVAL_AS_INTEGER_PTR | T) |  |

The dimension of a variable.

Returns
  the name including round or squared brackets

This property reads the dimension of a variable from the input buffer.

Definition at line 1186 of file fb-doc_parser.bas.

Here is the caller graph for this function:

SUB parseListNam | ( | BYVAL_AS_EmitFunc | Export_) |  |

Evaluate a list of names.

Parameters

  Export_ | the function to call on each find

Scan the token list for variable declarations and call the emitter for each find (ie for constructs like DIM AS BYTE Nam1, Nam2(5) = {0,1,2,3,4,5}, Nam3, ...).

Definition at line 304 of file fb-doc_parser.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

SUB parseListNamTyp | ( | BYVAL_AS_EmitFunc | Export_) |  |

Evaluate a list of declarations.

Parameters

  Export_ | the function to call on each find

Scan the token list for variable declarations and call the emitter for each find (ie for constructs like DIM Nam1 AS BYTE, Nam2(5) AS UBYTE = {0,1,2,3,4,5}, Nam3 AS STRING, ...).

Definition at line 323 of file fb-doc_parser.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

SUB parseListPara | ( | BYVAL_AS_EmitFunc | Export_) |  |

Evaluate a parameter list.

Parameters

  Export_ | the function to call on each find

Scan the token list for a parameter list. Evaluate declaration specifiers (BYVAL / BYREF) and handle ellipsis, parameters without name, initializers and empty lists.

Definition at line 437 of file fb-doc_parser.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

SUB parseBlockEnum | ( | BYVAL_AS_EmitFunc | Export_) |  |

Evaluate the context of an ENUM block.

Parameters

  Export_ | the function to call on each find

The emitter calls us to evaluate statements inside an ENUM block. So we stop after finding a statement and call the emitter handler one-by-one.

Definition at line 341 of file fb-doc_parser.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

SUB parseBlockTyUn | ( | BYVAL_AS_EmitFunc | Export_) |  |

Evaluate the context of a block.

Parameters

  Export_ | the function to call on each find

The emitter calls us to evaluate constructs inside a block (TYPE / UNION). So we stop after finding a statement and call the emitter handler one-by-one.

Definition at line 369 of file fb-doc_parser.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

SUB pre_parse | ( | ) |  |

private

Pre-parse all FB source code, search relevant constructs.

Returns
  the length of the output code, if any

Search the input buffer for a relevant construct. Start detailed parsing on each relevant construct. Otherways skip the current line. Export comments on the way.

Definition at line 1026 of file fb-doc_parser.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

PROPERTY_AS_STRING USubStr | ( | ) |  |

private

Check current token position, extract word if string type.

Returns
  the current word in upper case

This property returns the context of the current parser position in the input buffer in upper case characters.

Definition at line 1262 of file fb-doc_parser.bas.

Here is the caller graph for this function:

FUNCTION_AS_INTEGER getToken | ( | ) |  |

private

Check word at current parser position.

Returns
  : The token for the word at current position

This function checks the word at the current parser position. In case of a keyword the matching token gets returned. Otherwise Parser::TOK_WORD gets returned.

Definition at line 738 of file fb-doc_parser.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

FUNCTION_AS_INTEGER tokenize | ( | BYVAL_AS_EoS_Modi | Stop_) |  |

private

Parse a relevant construct, create a token list.

Parameters

  Stop_ | the condition where to end parsing

Returns
  the length of the token list in byte (at least 8)

Start at the current position of the input buffer to check each character. Sort the input in to a token list. The token list contains three values in each entry: the type of the input, its start and its length.

The end of this process gets specified by the Stop_ parameter. It's one of the EoS_Modi enumerators.

Definition at line 944 of file fb-doc_parser.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

FUNCTION_AS_INTEGER Errr | ( | BYREF_AS_STRING | E) |  |

private

Emit an error message.

Parameters

  E | the reason for the error message

Returns
  MSG_ERROR (and MSG_STOP at end of file)

Create an error message and call the error function of the emitter. It depends on the emitter if and where the error is shown.

Definition at line 690 of file fb-doc_parser.bas.

Here is the caller graph for this function:

FUNCTION_AS_INTEGER demuxNam | ( | BYVAL_AS_INTEGER | MinTk = `TOK_WORD`,
|  | BYVAL_AS_INTEGER | DeclMod = `0`
| ) |  |

private

Evaluate a name, dimension and initializer in the token list.

Parameters

  MinTk | the token to start at
  DeclMod | the modus (normal or declaration)

Returns
  the (doubled) number of steps gone in the token list (or MSG_ERROR on error and MSG_STOP on the end of the token list)

Check the token list for a declaration of a name, starting at the current token (ie behind a VAR keyword). Also checking for parenthesis to specify a dimension and the equal '=' character of an initializer. After execution the current position is at the next token after the equal character, or behind the closing parenthesis, or the name. An error is returned if there is no word at the current position.

Definition at line 113 of file fb-doc_parser.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

FUNCTION_AS_INTEGER demuxTyp | ( | BYVAL_AS_INTEGER | DeclMod = `0`) |  |

private

Evaluate a type declaration in the token list.

Parameters

  DeclMod | the modus (normal or declaration)

Returns
  the (doubled) number of steps gone in the token list (or MSG_ERROR on error and MSG_STOP on the end of the token list)

Check the token list for a type declaration. Starting at the AS statement we read the name of the type and all following 'PTR' statements. The type may be a SUB, FUNCTION, PROPERTY, ... After execution the current position is at the next token behind the last PTR, or at the type name, or at the closing parenthesis. An error is returned if there is no word at the current position, or the token list doesn't start with 'AS', or the next token isn't a word.

Definition at line 210 of file fb-doc_parser.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

FUNCTION_AS_INTEGER demuxDecl | ( | ) |  |

private

Evaluate a function declaration in the token list.

Returns
  the the result of demuxTyp() (or MSG_ERROR on error and MSG_STOP on the end of the token list)

Pre-check the token list for a declaration of a function, starting at the token behind the DECLARE statement. When OK, use demuxTyp() to evaluate the type of the declaration.

Definition at line 168 of file fb-doc_parser.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

FUNCTION_AS_INTEGER skipOverColon | ( | ) |  |

private

Move to the end of statement and one step beyond.

Returns
  the (doubled) number of steps gone in the token list (or MSG_ERROR on error and MSG_STOP on the end of the token list)

Step through the token list and search for the end of the current statement. Then walk one step beyond, if not end of token list.

Definition at line 89 of file fb-doc_parser.bas.

Here is the caller graph for this function:

FUNCTION_AS_INTEGER skipOverBrclo | ( | ) |  |

private

Move to the matching right parenthesis and one step beyond.

Returns
  the (doubled) number of steps gone in the token list (or MSG_ERROR on error and MSG_STOP on the end of the token list)

Step through the token list and search for the next right parenthesis, skipping nested pairs of paranethesis. When we find a matching right parenthesis we walk one step beyond. Else we stop at the next colon or line end.

Definition at line 69 of file fb-doc_parser.bas.

Here is the caller graph for this function:

FUNCTION_AS_INTEGER skipOverComma | ( | ) |  |

private

Move to the next comma and one step beyond.

Returns
  the (doubled) number of steps gone in the token list (or MSG_ERROR on error and MSG_STOP on the end of the token list)

We step trough the token list and search for the next comma, skipping nested pairs of parenthesis. When we find a comma we walk one step beyond. Otherwise we stop at the next right parenthesis or the next colon or line end.

Definition at line 46 of file fb-doc_parser.bas.

Here is the caller graph for this function:

FUNCTION_AS_INTEGER _VAR_ | ( | ) |  |

private

Evaluate a variable declaration.

Returns
  MSG_ERROR (or MSG_STOP on the end of the token list)

The pre-parser found a VAR, DIM, CONST, EXTERN, COMMON or STATIC keyword. We tokenize the current line and send the result to the emitter, or we call Errr() on syntax problems.

Definition at line 513 of file fb-doc_parser.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

FUNCTION_AS_INTEGER _TYPE_ | ( | ) |  |

private

Evaluate a TYPE or CLASS statement.

Returns
  MSG_ERROR (or MSG_STOP on the end of the token list)

The pre-parser found a TYPE or CLASS keyword. In case of TYPE we tokenize the line and check if it is an alias declaration. In that case we call the emitter for a declaration on that single line. Otherwise we tokenize the complete block and call the emitter for a TYPE block. Or we call Errr() on syntax problems.

Note: the C emitter creates

- 'typedef Typ Nam' for 'TYPE AS Typ Nam'
- 'typedef struct Typ Nam' for 'TYPE Nam AS Typ'

Definition at line 477 of file fb-doc_parser.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

FUNCTION_AS_INTEGER _ENUM_ | ( | ) |  |

private

Evaluate an ENUM block.

Returns
  MSG_ERROR (or MSG_STOP on the end of the token list)

The pre-parser found an ENUM keyword. We tokenize the context of the complete block and call the emitter, or we call Errr() on syntax problems.

Definition at line 549 of file fb-doc_parser.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

FUNCTION_AS_INTEGER _UNION_ | ( | ) |  |

private

Evaluate an UNION block.

Returns
  MSG_ERROR (or MSG_STOP on the end of the token list)

The pre-parser found an UNION keyword. We tokenize the context of the complete block and call the emitter, or we call Errr() on syntax problems.

Definition at line 567 of file fb-doc_parser.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

FUNCTION_AS_INTEGER _FUNCTION_ | ( | ) |  |

private

Evaluate a function.

Returns
  MSG_ERROR (or MSG_STOP on the end of the token list)

The pre-parser found a SUB, FUNCTION, CONSTRUCTOR, DESTRUCTOR, PROPERTY or OPERATOR keyword. We tokenize the complete block, evaluate the name and type and send the result to the emitter, or we call Errr() on syntax problems.

Definition at line 587 of file fb-doc_parser.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

FUNCTION_AS_INTEGER _DECLARE_ | ( | ) |  |

private

Evaluate a forward declaration.

Returns
  MSG_ERROR (or MSG_STOP on the end of the token list)

The pre-parser found a DECLARE keyword. We tokenize the current line and send the result to the emitter, or we call Errr() on syntax problems.

Definition at line 620 of file fb-doc_parser.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

FUNCTION_AS_INTEGER _INCLUDE_ | ( | ) |  |

private

Evaluate an #INCLUDE line.

Returns
  MSG_ERROR (or MSG_STOP on the end of the token list)

The pre-parser found an #INCLUDE line. We tokenize the line and call the emitter, or we call Errr() handler on syntax problems. It's up to the emitter function to follow the source tree (= create a new parser and load the file).

Definition at line 637 of file fb-doc_parser.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

FUNCTION_AS_INTEGER _DEFINE_ | ( | ) |  |

private

Evaluate a #DEFINE declaration.

Returns
  MSG_ERROR (or MSG_STOP on the end of the token list)

The pre-parser found a #DEFINE line. We tokenize the line and call the emitter, or we call Errr() handler on syntax problems.

Definition at line 672 of file fb-doc_parser.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

FUNCTION_AS_INTEGER _MACRO_ | ( | ) |  |

private

Evaluate a #MACRO declaration.

Returns
  MSG_ERROR (or MSG_STOP on the end of the token list)

The pre-parser found a #MACRO block. We tokenize the block and call the emitter, or we call Errr() handler on syntax problems.

Definition at line 653 of file fb-doc_parser.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

## Field Documentation

enum Parser::ParserTokens ParserTokens

STRING Buf

the input buffer

Definition at line 132 of file fb-doc_parser.bi.

STRING ErrMsg

an error message

Definition at line 132 of file fb-doc_parser.bi.

STRING Tok

the token list

Definition at line 132 of file fb-doc_parser.bi.

STRING BlockNam

the name of a block (ENUM, UNION, TYPE)

Definition at line 132 of file fb-doc_parser.bi.

INTEGER_PTR StaTok

the pre-parsed token

Definition at line 158 of file fb-doc_parser.bi.

INTEGER_PTR NamTok

the name token of the construct

Definition at line 158 of file fb-doc_parser.bi.

INTEGER_PTR DimTok

the token of the left parenthesis of a dimension

Definition at line 158 of file fb-doc_parser.bi.

INTEGER_PTR IniTok

the start token of an initializer ('=')

Definition at line 158 of file fb-doc_parser.bi.

INTEGER_PTR BitTok

the start token of an bitfiled declaration (':')

Definition at line 158 of file fb-doc_parser.bi.

INTEGER_PTR TypTok

the token of the type keyword

Definition at line 158 of file fb-doc_parser.bi.

INTEGER_PTR ShaTok

the token of the SHARED keyword

Definition at line 158 of file fb-doc_parser.bi.

INTEGER_PTR PtrTok

the token of the first PTR keyword

Definition at line 158 of file fb-doc_parser.bi.

INTEGER_PTR Co1Tok

the token of the first CONST keyword (if any)

Definition at line 158 of file fb-doc_parser.bi.

INTEGER_PTR Co2Tok

the token of the second CONST keyword (if any)

Definition at line 158 of file fb-doc_parser.bi.

INTEGER_PTR FunTok

type of the pre-parsed token

Definition at line 158 of file fb-doc_parser.bi.

INTEGER_PTR CalTok

the token of the calling convention keyword (if any)

Definition at line 158 of file fb-doc_parser.bi.

INTEGER_PTR AliTok

the token of the ALIAS keyword (if any)

Definition at line 158 of file fb-doc_parser.bi.

INTEGER_PTR As_Tok

the token of the AS keyword (if no SUB)

Definition at line 158 of file fb-doc_parser.bi.

INTEGER_PTR ParTok

the token of the left parenthesis of a parameter list

Definition at line 158 of file fb-doc_parser.bi.

INTEGER_PTR By_Tok

the token of the declaration specifier (BYVAL / BYREF)

Definition at line 158 of file fb-doc_parser.bi.

INTEGER_PTR DivTok

the token of different purposes like the STATIC keyword in a member function declaration (if any) or the LIB keyword in a normal declaration

Definition at line 158 of file fb-doc_parser.bi.

INTEGER_PTR Tk1

the first token in a statment

Definition at line 158 of file fb-doc_parser.bi.

INTEGER_PTR TkEnd

the last token in the list

Definition at line 158 of file fb-doc_parser.bi.

INTEGER_PTR UserTok

a token for customised usage in emitter-handlers

Definition at line 158 of file fb-doc_parser.bi.

INTEGER Ocha

the ouput file number (channel)

Definition at line 189 of file fb-doc_parser.bi.

INTEGER Fin

the last position in the input buffer Parser::Buf

Definition at line 189 of file fb-doc_parser.bi.

INTEGER PtrCount

the number of PTR keywords

Definition at line 189 of file fb-doc_parser.bi.

INTEGER SrcBgn

start position to export FB source

Definition at line 189 of file fb-doc_parser.bi.

INTEGER InLines

the current line in the input buffer Parser::Buf

Definition at line 189 of file fb-doc_parser.bi.

INTEGER LevelCount

the level in nested blocks (one based)

Definition at line 189 of file fb-doc_parser.bi.

INTEGER ListCount

the current entry in a list (zero based)

Definition at line 189 of file fb-doc_parser.bi.

enum Parser::EoS_Modi EoS_Modi

private

INTEGER Po

private

the current position in the input buffer Parser::Buf

Definition at line 268 of file fb-doc_parser.bi.

INTEGER ToLast

private

the type of the token before the current one

Definition at line 268 of file fb-doc_parser.bi.

INTEGER_PTR Tk

private

the current token of the parser

Definition at line 272 of file fb-doc_parser.bi.

INTEGER_PTR A

private

start of a word in pre-parsing

Definition at line 272 of file fb-doc_parser.bi.

INTEGER_PTR L

private

length of a word in pre-parsing

Definition at line 272 of file fb-doc_parser.bi.

EmitterIF_PTR Emit

private

the emitter interface

Definition at line 276 of file fb-doc_parser.bi.

The documentation for this class was generated from the following files:

- fb-doc_parser.bi
- fb-doc_parser.bas