rlparse.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /* Automatically generated by Kelbt from "rlparse.kh".
  2. *
  3. * Parts of this file are copied from Kelbt source covered by the GNU
  4. * GPL. As a special exception, you may use the parts of this file copied
  5. * from Kelbt source without restriction. The remainder is derived from
  6. * "rlparse.kh" and inherits the copyright status of that file.
  7. */
  8. #line 1 "rlparse.kh"
  9. /*
  10. * Copyright 2001-2007 Adrian Thurston <thurston@complang.org>
  11. */
  12. /* This file is part of Ragel.
  13. *
  14. * Ragel is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation; either version 2 of the License, or
  17. * (at your option) any later version.
  18. *
  19. * Ragel is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with Ragel; if not, write to the Free Software
  26. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  27. */
  28. #ifndef _RLPARSE_H
  29. #define _RLPARSE_H
  30. #include <iostream>
  31. #include "avltree.h"
  32. #include "parsedata.h"
  33. /* Import scanner tokens. */
  34. #define IMP_Word 128
  35. #define IMP_Literal 129
  36. #define IMP_UInt 130
  37. #define IMP_Define 131
  38. /* This is used for tracking the include files/machine pairs. */
  39. struct IncludeHistoryItem
  40. {
  41. IncludeHistoryItem( const char *fileName, const char *sectionName )
  42. : fileName(fileName), sectionName(sectionName) {}
  43. const char *fileName;
  44. const char *sectionName;
  45. };
  46. typedef Vector<IncludeHistoryItem> IncludeHistory;
  47. struct Parser
  48. {
  49. #line 102 "rlparse.kh"
  50. #line 63 "rlparse.h"
  51. struct Parser_Block *block;
  52. struct Parser_LangEl *freshEl;
  53. int freshPos;
  54. struct Parser_LangEl *pool;
  55. int numRetry;
  56. int numNodes;
  57. struct Parser_LangEl *stackTop;
  58. struct Parser_LangEl *lastFinal;
  59. int errCount;
  60. int curs;
  61. #line 105 "rlparse.kh"
  62. void init();
  63. int parseLangEl( int type, const Token *token );
  64. Parser( const char *fileName, char *sectionName, InputLoc &sectionLoc )
  65. : sectionName(sectionName)
  66. {
  67. pd = new ParseData( fileName, sectionName, sectionLoc );
  68. exportContext.append( false );
  69. includeHistory.append( IncludeHistoryItem(
  70. fileName, sectionName ) );
  71. }
  72. int token( InputLoc &loc, int tokId, char *tokstart, int toklen );
  73. void tryMachineDef( InputLoc &loc, char *name,
  74. MachineDef *machineDef, bool isInstance );
  75. /* Report an error encountered by the parser. */
  76. ostream &parse_error( int tokId, Token &token );
  77. ParseData *pd;
  78. /* The name of the root section, this does not change during an include. */
  79. char *sectionName;
  80. NameRef nameRef;
  81. NameRefList nameRefList;
  82. Vector<bool> exportContext;
  83. IncludeHistory includeHistory;
  84. Parser *prev, *next;
  85. };
  86. #line 109 "rlparse.h"
  87. #define TK_Word 128
  88. #define TK_Literal 129
  89. #define TK_Number 130
  90. #define TK_EndSection 131
  91. #define TK_UInt 132
  92. #define TK_Hex 133
  93. #define TK_DotDot 134
  94. #define TK_ColonGt 135
  95. #define TK_ColonGtGt 136
  96. #define TK_LtColon 137
  97. #define TK_Arrow 138
  98. #define TK_DoubleArrow 139
  99. #define TK_StarStar 140
  100. #define TK_ColonEquals 141
  101. #define TK_NameSep 142
  102. #define TK_BarStar 143
  103. #define TK_DashDash 144
  104. #define TK_StartCond 145
  105. #define TK_AllCond 146
  106. #define TK_LeavingCond 147
  107. #define TK_Middle 148
  108. #define TK_StartGblError 149
  109. #define TK_AllGblError 150
  110. #define TK_FinalGblError 151
  111. #define TK_NotFinalGblError 152
  112. #define TK_NotStartGblError 153
  113. #define TK_MiddleGblError 154
  114. #define TK_StartLocalError 155
  115. #define TK_AllLocalError 156
  116. #define TK_FinalLocalError 157
  117. #define TK_NotFinalLocalError 158
  118. #define TK_NotStartLocalError 159
  119. #define TK_MiddleLocalError 160
  120. #define TK_StartEOF 161
  121. #define TK_AllEOF 162
  122. #define TK_FinalEOF 163
  123. #define TK_NotFinalEOF 164
  124. #define TK_NotStartEOF 165
  125. #define TK_MiddleEOF 166
  126. #define TK_StartToState 167
  127. #define TK_AllToState 168
  128. #define TK_FinalToState 169
  129. #define TK_NotFinalToState 170
  130. #define TK_NotStartToState 171
  131. #define TK_MiddleToState 172
  132. #define TK_StartFromState 173
  133. #define TK_AllFromState 174
  134. #define TK_FinalFromState 175
  135. #define TK_NotFinalFromState 176
  136. #define TK_NotStartFromState 177
  137. #define TK_MiddleFromState 178
  138. #define RE_Slash 179
  139. #define RE_SqOpen 180
  140. #define RE_SqOpenNeg 181
  141. #define RE_SqClose 182
  142. #define RE_Dot 183
  143. #define RE_Star 184
  144. #define RE_Dash 185
  145. #define RE_Char 186
  146. #define IL_WhiteSpace 187
  147. #define IL_Comment 188
  148. #define IL_Literal 189
  149. #define IL_Symbol 190
  150. #define KW_Machine 191
  151. #define KW_Include 192
  152. #define KW_Import 193
  153. #define KW_Write 194
  154. #define KW_Action 195
  155. #define KW_AlphType 196
  156. #define KW_Range 197
  157. #define KW_GetKey 198
  158. #define KW_InWhen 199
  159. #define KW_When 200
  160. #define KW_OutWhen 201
  161. #define KW_Eof 202
  162. #define KW_Err 203
  163. #define KW_Lerr 204
  164. #define KW_To 205
  165. #define KW_From 206
  166. #define KW_Export 207
  167. #define KW_PrePush 208
  168. #define KW_PostPop 209
  169. #define KW_Length 210
  170. #define KW_Break 211
  171. #define KW_Exec 212
  172. #define KW_Hold 213
  173. #define KW_PChar 214
  174. #define KW_Char 215
  175. #define KW_Goto 216
  176. #define KW_Call 217
  177. #define KW_Ret 218
  178. #define KW_CurState 219
  179. #define KW_TargState 220
  180. #define KW_Entry 221
  181. #define KW_Next 222
  182. #define KW_Variable 223
  183. #define KW_Access 224
  184. #define Parser_tk_eof 225
  185. #line 140 "rlparse.kh"
  186. #endif