| fb-doc 0.2 documentation tool for FreeBasic

- Main Page
- Tutorial
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros
fb-doc_parser.bas File Reference

Source code for the Parser class. More...

`#include "fb-doc_parser.bi"`
Include dependency graph for fb-doc_parser.bas:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Macros

#define | SKIP Tk += 3
| Snippet to skip to the next token. More...
#define | SCAN_QUOTE(Buf, Po)
| Find the end of a Quote. More...
#define | SCAN_SL_COMM(Buf, Po)
| Find the end of a line end comment. More...
#define | SCAN_ML_COMM()
| Find the end of a multi line comment. More...
#define | SCAN_WORD()
| Find the end of a word. More...
#define | SETOK(_T_, _A_, _L_) Tok &= MKI(_T_) & MKI(_A_) & MKI(_L_) : ToLast = _T_
| snippet to set the current token More...
#define | EXIT_STOP SETOK(MSG_STOP, Po, 1) : Po -= 1 : EXIT DO
| snippet to exit in case of end of file More...

## Detailed Description

Source code for the Parser class.

This file contains the source code for the Parser class. It's used to scan the FB input for relevant constructs and call the matching function in the EmitterIF.

Definition in file fb-doc_parser.bas.

## Macro Definition Documentation

#define SKIP Tk += 3

Snippet to skip to the next token.

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

#define SCAN_QUOTE | ( |  | Buf,
|  |  | Po
| ) |  |

Value:
/* (multi line FreeBasic #MACRO)
VAR esc = IIF(Buf[Po - 1] = ASC("!"), 1, 0)
DO
Po += 1
SELECT CASE AS CONST Buf[Po]
CASE 0, ASC(!"\n") : Po -= 1 : EXIT DO
CASE ASC("\") : IF esc THEN Po += 1
CASE ASC("""") : IF Buf[Po + 1] = ASC("""") THEN Po += 1 ELSE EXIT DO
END SELECT
LOOP
#ENDMACRO */

Find the end of a Quote.

This snippet is used to find the end of a quoted string. It checks if the string uses escape sequences and evaluates '\"' . It stops at the last double quote (if Buf[Po] isn't ASC(!"\"") then the end of the buffer is reached).

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

#define SCAN_SL_COMM | ( |  | Buf,
|  |  | Po
| ) |  |

Value:
/* (multi line FreeBasic #MACRO)
DO
Po += 1
SELECT CASE AS CONST Buf[Po]
CASE 0, ASC(!"\n") : EXIT DO
END SELECT
LOOP
#ENDMACRO */

Find the end of a line end comment.

This snippet is used to find the end of a line end comment. It checks for a ASC(!"\n") and evaluates line concatenations ( _ ) on the way. It stops at the line end (if Buf[Po] isn't ASC(!"\n") then the end of the buffer is reached).

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

#define SCAN_ML_COMM | ( | ) |  |

Value:
/* (multi line FreeBasic #MACRO)
Po += 2
DO
SELECT CASE AS CONST Buf[Po]
CASE 0 : EXIT DO
CASE ASC(!"\n") : InLines += 1
CASE ASC("'")
SELECT CASE AS CONST Buf[Po + 1]
CASE 0 : EXIT DO
CASE ASC("/") : Po += 1 : EXIT DO
END SELECT
END SELECT : Po += 1
LOOP
#ENDMACRO */

Find the end of a multi line comment.

This snippet is used to find the end of a multi line comment block. It stops at the characters ' and / (if Buf[Po] isn't ASC("/") then the end of the buffer is reached).

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

#define SCAN_WORD | ( | ) |  |

Value:
/* (multi line FreeBasic #MACRO)
*A = Po
Po += 1
DO
SELECT CASE AS CONST Buf[Po]
CASE ASC("0") TO ASC("9"), _
ASC("A") TO ASC("Z"), _
ASC("a") TO ASC("z"), ASC("_") : Po += 1
CASE ELSE : EXIT DO
END SELECT
LOOP
#ENDMACRO */

Find the end of a word.

This snippet is used to find the end of a word in the input buffer. Po is at the first non-word character when done.

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

#define SETOK | ( |  | _T_,
|  |  | _A_,
|  |  | _L_
| ) |  | Tok &= MKI(_T_) & MKI(_A_) & MKI(_L_) : ToLast = _T_

snippet to set the current token

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

#define EXIT_STOP SETOK(MSG_STOP, Po, 1) : Po -= 1 : EXIT DO

snippet to exit in case of end of file

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