| 1 | /* do not edit automatically generated by mc from bnflex. */ |
| 2 | /* bnflex.def provides a simple lexical package for pg. |
| 3 | |
| 4 | Copyright (C) 2001-2025 Free Software Foundation, Inc. |
| 5 | Contributed by Gaius Mulley <[email protected]>. |
| 6 | |
| 7 | This file is part of GNU Modula-2. |
| 8 | |
| 9 | GNU Modula-2 is free software; you can redistribute it and/or modify |
| 10 | it under the terms of the GNU General Public License as published by |
| 11 | the Free Software Foundation; either version 3, or (at your option) |
| 12 | any later version. |
| 13 | |
| 14 | GNU Modula-2 is distributed in the hope that it will be useful, but |
| 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | General Public License for more details. |
| 18 | |
| 19 | You should have received a copy of the GNU General Public License |
| 20 | along with GNU Modula-2; see the file COPYING3. If not see |
| 21 | <http://www.gnu.org/licenses/>. */ |
| 22 | |
| 23 | |
| 24 | #if !defined (_bnflex_H) |
| 25 | # define _bnflex_H |
| 26 | |
| 27 | # ifdef __cplusplus |
| 28 | extern "C" { |
| 29 | # endif |
| 30 | #include <stdbool.h> |
| 31 | # if !defined (PROC_D) |
| 32 | # define PROC_D |
| 33 | typedef void (*PROC_t) (void); |
| 34 | typedef struct { PROC_t proc; } PROC; |
| 35 | # endif |
| 36 | |
| 37 | # include "GNameKey.h" |
| 38 | |
| 39 | # if defined (_bnflex_C) |
| 40 | # define EXTERN |
| 41 | # else |
| 42 | # define EXTERN extern |
| 43 | # endif |
| 44 | |
| 45 | typedef enum {bnflex_identtok, bnflex_literaltok, bnflex_codetok, bnflex_lbecomestok, bnflex_rbecomestok, bnflex_bartok, bnflex_lsparatok, bnflex_rsparatok, bnflex_lcparatok, bnflex_rcparatok, bnflex_lparatok, bnflex_rparatok, bnflex_errortok, bnflex_tfunctok, bnflex_symfunctok, bnflex_squotetok, bnflex_dquotetok, bnflex_moduletok, bnflex_begintok, bnflex_rulestok, bnflex_endtok, bnflex_lesstok, bnflex_gretok, bnflex_tokentok, bnflex_specialtok, bnflex_firsttok, bnflex_followtok, bnflex_BNFtok, bnflex_FNBtok, bnflex_declarationtok, bnflex_epsilontok, bnflex_eoftok} bnflex_TokenType; |
| 46 | |
| 47 | |
| 48 | /* |
| 49 | OpenSource - Attempts to open the source file, a. |
| 50 | The success of the operation is returned. |
| 51 | */ |
| 52 | |
| 53 | EXTERN bool bnflex_OpenSource (const char *a_, unsigned int _a_high); |
| 54 | |
| 55 | /* |
| 56 | CloseSource - Closes the current open file. |
| 57 | */ |
| 58 | |
| 59 | EXTERN void bnflex_CloseSource (void); |
| 60 | |
| 61 | /* |
| 62 | GetChar - returns the current character on the input stream. |
| 63 | */ |
| 64 | |
| 65 | EXTERN char bnflex_GetChar (void); |
| 66 | |
| 67 | /* |
| 68 | PutChar - pushes a character onto the push back stack, it also |
| 69 | returns the character which has been pushed. |
| 70 | */ |
| 71 | |
| 72 | EXTERN char bnflex_PutChar (char ch); |
| 73 | |
| 74 | /* |
| 75 | SymIs - if t is equal to the current token the next token is read |
| 76 | and true is returned, otherwise false is returned. |
| 77 | */ |
| 78 | |
| 79 | EXTERN bool bnflex_SymIs (bnflex_TokenType t); |
| 80 | |
| 81 | /* |
| 82 | IsSym - returns the result of the comparison between the current token |
| 83 | type and t. |
| 84 | */ |
| 85 | |
| 86 | EXTERN bool bnflex_IsSym (bnflex_TokenType t); |
| 87 | |
| 88 | /* |
| 89 | GetCurrentTokenType - returns the type of current token. |
| 90 | */ |
| 91 | |
| 92 | EXTERN bnflex_TokenType bnflex_GetCurrentTokenType (void); |
| 93 | |
| 94 | /* |
| 95 | GetCurrentToken - returns the NameKey of the current token. |
| 96 | */ |
| 97 | |
| 98 | EXTERN NameKey_Name bnflex_GetCurrentToken (void); |
| 99 | |
| 100 | /* |
| 101 | SkipUntilWhite - skips all characters until white space is seen. |
| 102 | */ |
| 103 | |
| 104 | EXTERN void bnflex_SkipUntilWhite (void); |
| 105 | |
| 106 | /* |
| 107 | SkipWhite - skips all white space. |
| 108 | */ |
| 109 | |
| 110 | EXTERN void bnflex_SkipWhite (void); |
| 111 | |
| 112 | /* |
| 113 | SkipUntilEoln - skips until a lf is seen. It consumes the lf. |
| 114 | */ |
| 115 | |
| 116 | EXTERN void bnflex_SkipUntilEoln (void); |
| 117 | |
| 118 | /* |
| 119 | AdvanceToken - advances to the next token. |
| 120 | */ |
| 121 | |
| 122 | EXTERN void bnflex_AdvanceToken (void); |
| 123 | |
| 124 | /* |
| 125 | IsReserved - returns TRUE if the name is a reserved word. |
| 126 | */ |
| 127 | |
| 128 | EXTERN bool bnflex_IsReserved (NameKey_Name name); |
| 129 | |
| 130 | /* |
| 131 | PushBackToken - pushes a token back onto input. |
| 132 | */ |
| 133 | |
| 134 | EXTERN void bnflex_PushBackToken (NameKey_Name t); |
| 135 | |
| 136 | /* |
| 137 | SetDebugging - sets the debugging flag. |
| 138 | */ |
| 139 | |
| 140 | EXTERN void bnflex_SetDebugging (bool flag); |
| 141 | # ifdef __cplusplus |
| 142 | } |
| 143 | # endif |
| 144 | |
| 145 | # undef EXTERN |
| 146 | #endif |