langscan 1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. data/AUTHORS.txt +19 -0
  2. data/History.txt +126 -0
  3. data/Manifest.txt +167 -0
  4. data/README.rdoc +89 -0
  5. data/Rakefile +40 -0
  6. data/ext/langscan/_make_c.rb +20 -0
  7. data/ext/langscan/_make_h.rb +30 -0
  8. data/ext/langscan/_template.c +134 -0
  9. data/ext/langscan/_template.h +53 -0
  10. data/ext/langscan/c/c/Makefile +157 -0
  11. data/ext/langscan/c/c/c.c +134 -0
  12. data/ext/langscan/c/c/c.h +66 -0
  13. data/ext/langscan/c/c/ctok.c +4622 -0
  14. data/ext/langscan/c/c/ctok.l +212 -0
  15. data/ext/langscan/c/c/extconf.rb +3 -0
  16. data/ext/langscan/c/c/modulename.txt +1 -0
  17. data/ext/langscan/c/c/tokenlist.txt +13 -0
  18. data/ext/langscan/csharp/csharp/Makefile +157 -0
  19. data/ext/langscan/csharp/csharp/csharp.c +134 -0
  20. data/ext/langscan/csharp/csharp/csharp.h +65 -0
  21. data/ext/langscan/csharp/csharp/csharptok.c +2965 -0
  22. data/ext/langscan/csharp/csharp/csharptok.l +200 -0
  23. data/ext/langscan/csharp/csharp/extconf.rb +3 -0
  24. data/ext/langscan/csharp/csharp/modulename.txt +1 -0
  25. data/ext/langscan/csharp/csharp/tokenlist.txt +12 -0
  26. data/ext/langscan/d/d/Makefile +157 -0
  27. data/ext/langscan/d/d/d.c +134 -0
  28. data/ext/langscan/d/d/d.h +64 -0
  29. data/ext/langscan/d/d/dtok.c +5461 -0
  30. data/ext/langscan/d/d/dtok.l +282 -0
  31. data/ext/langscan/d/d/extconf.rb +3 -0
  32. data/ext/langscan/d/d/modulename.txt +1 -0
  33. data/ext/langscan/d/d/tokenlist.txt +11 -0
  34. data/ext/langscan/elisp/elisp/Makefile +157 -0
  35. data/ext/langscan/elisp/elisp/elisp.c +134 -0
  36. data/ext/langscan/elisp/elisp/elisp.h +62 -0
  37. data/ext/langscan/elisp/elisp/elisptok.c +2101 -0
  38. data/ext/langscan/elisp/elisp/elisptok.l +151 -0
  39. data/ext/langscan/elisp/elisp/extconf.rb +3 -0
  40. data/ext/langscan/elisp/elisp/modulename.txt +1 -0
  41. data/ext/langscan/elisp/elisp/tokenlist.txt +9 -0
  42. data/ext/langscan/java/java/Makefile +157 -0
  43. data/ext/langscan/java/java/extconf.rb +3 -0
  44. data/ext/langscan/java/java/java.c +134 -0
  45. data/ext/langscan/java/java/java.h +64 -0
  46. data/ext/langscan/java/java/javatok.c +2090 -0
  47. data/ext/langscan/java/java/javatok.l +155 -0
  48. data/ext/langscan/java/java/modulename.txt +1 -0
  49. data/ext/langscan/java/java/tokenlist.txt +11 -0
  50. data/ext/langscan/javascript/javascript/Makefile +157 -0
  51. data/ext/langscan/javascript/javascript/extconf.rb +3 -0
  52. data/ext/langscan/javascript/javascript/javascript.c +134 -0
  53. data/ext/langscan/javascript/javascript/javascript.h +63 -0
  54. data/ext/langscan/javascript/javascript/javascripttok.c +2051 -0
  55. data/ext/langscan/javascript/javascript/javascripttok.l +147 -0
  56. data/ext/langscan/javascript/javascript/modulename.txt +1 -0
  57. data/ext/langscan/javascript/javascript/tokenlist.txt +10 -0
  58. data/ext/langscan/pairmatcher/pairmatcher/Makefile +157 -0
  59. data/ext/langscan/pairmatcher/pairmatcher/extconf.rb +3 -0
  60. data/ext/langscan/pairmatcher/pairmatcher/pairmatcher.c +890 -0
  61. data/ext/langscan/php/php/Makefile +157 -0
  62. data/ext/langscan/php/php/extconf.rb +3 -0
  63. data/ext/langscan/php/php/modulename.txt +1 -0
  64. data/ext/langscan/php/php/php.c +134 -0
  65. data/ext/langscan/php/php/php.h +64 -0
  66. data/ext/langscan/php/php/phptok.c +2406 -0
  67. data/ext/langscan/php/php/phptok.l +212 -0
  68. data/ext/langscan/php/php/tokenlist.txt +11 -0
  69. data/ext/langscan/post-distclean.rb +21 -0
  70. data/ext/langscan/pre-config.rb +57 -0
  71. data/ext/langscan/python/python/Makefile +157 -0
  72. data/ext/langscan/python/python/extconf.rb +3 -0
  73. data/ext/langscan/python/python/modulename.txt +1 -0
  74. data/ext/langscan/python/python/python.c +134 -0
  75. data/ext/langscan/python/python/python.h +61 -0
  76. data/ext/langscan/python/python/pythontok.c +2102 -0
  77. data/ext/langscan/python/python/pythontok.l +155 -0
  78. data/ext/langscan/python/python/tokenlist.txt +8 -0
  79. data/ext/langscan/ruby/compat/ripper/Makefile +158 -0
  80. data/ext/langscan/ruby/compat/ripper/depend +1 -0
  81. data/ext/langscan/ruby/compat/ripper/extconf.rb +4 -0
  82. data/ext/langscan/ruby/compat/ripper/include/eventids1.c +251 -0
  83. data/ext/langscan/ruby/compat/ripper/include/eventids2.c +277 -0
  84. data/ext/langscan/ruby/compat/ripper/include/lex.c +138 -0
  85. data/ext/langscan/ruby/compat/ripper/ripper.c +14420 -0
  86. data/ext/langscan/scheme/scheme/Makefile +157 -0
  87. data/ext/langscan/scheme/scheme/extconf.rb +3 -0
  88. data/ext/langscan/scheme/scheme/modulename.txt +1 -0
  89. data/ext/langscan/scheme/scheme/scheme.c +134 -0
  90. data/ext/langscan/scheme/scheme/scheme.h +60 -0
  91. data/ext/langscan/scheme/scheme/schemetok.c +2447 -0
  92. data/ext/langscan/scheme/scheme/schemetok.l +177 -0
  93. data/ext/langscan/scheme/scheme/tokenlist.txt +7 -0
  94. data/ext/langscan/sh/sh/Makefile +157 -0
  95. data/ext/langscan/sh/sh/extconf.rb +3 -0
  96. data/ext/langscan/sh/sh/modulename.txt +1 -0
  97. data/ext/langscan/sh/sh/sh.c +134 -0
  98. data/ext/langscan/sh/sh/sh.h +61 -0
  99. data/ext/langscan/sh/sh/shtok.c +2470 -0
  100. data/ext/langscan/sh/sh/shtok.l +325 -0
  101. data/ext/langscan/sh/sh/tokenlist.txt +8 -0
  102. data/lib/langscan.rb +124 -0
  103. data/lib/langscan/_common.rb +50 -0
  104. data/lib/langscan/_easyscanner.rb +78 -0
  105. data/lib/langscan/_pairmatcher.rb +46 -0
  106. data/lib/langscan/_type.rb +125 -0
  107. data/lib/langscan/autoconf.rb +51 -0
  108. data/lib/langscan/automake.rb +51 -0
  109. data/lib/langscan/brainfuck.rb +48 -0
  110. data/lib/langscan/c.rb +144 -0
  111. data/lib/langscan/csharp.rb +101 -0
  112. data/lib/langscan/css.rb +109 -0
  113. data/lib/langscan/d.rb +201 -0
  114. data/lib/langscan/eiffel.rb +167 -0
  115. data/lib/langscan/elisp.rb +132 -0
  116. data/lib/langscan/io.rb +84 -0
  117. data/lib/langscan/java.rb +95 -0
  118. data/lib/langscan/javascript.rb +97 -0
  119. data/lib/langscan/lua.rb +116 -0
  120. data/lib/langscan/ocaml.rb +298 -0
  121. data/lib/langscan/ocaml/camlexer.ml +28 -0
  122. data/lib/langscan/ocaml/lexer.mll +230 -0
  123. data/lib/langscan/ocaml/types.ml +36 -0
  124. data/lib/langscan/perl.rb +87 -0
  125. data/lib/langscan/perl/tokenizer.pl +231 -0
  126. data/lib/langscan/php.rb +80 -0
  127. data/lib/langscan/python.rb +101 -0
  128. data/lib/langscan/rpmspec.rb +71 -0
  129. data/lib/langscan/ruby.rb +164 -0
  130. data/lib/langscan/ruby/compat/README +5 -0
  131. data/lib/langscan/ruby/compat/ripper.rb +4 -0
  132. data/lib/langscan/ruby/compat/ripper/core.rb +918 -0
  133. data/lib/langscan/ruby/compat/ripper/filter.rb +70 -0
  134. data/lib/langscan/ruby/compat/ripper/lexer.rb +179 -0
  135. data/lib/langscan/ruby/compat/ripper/sexp.rb +100 -0
  136. data/lib/langscan/scheme.rb +160 -0
  137. data/lib/langscan/sh.rb +116 -0
  138. data/lib/langscan/text.rb +37 -0
  139. data/metaconfig +2 -0
  140. data/script/console +10 -0
  141. data/script/destroy +14 -0
  142. data/script/generate +14 -0
  143. data/script/makemanifest.rb +21 -0
  144. data/setup.rb +1604 -0
  145. data/tasks/extconf.rake +13 -0
  146. data/tasks/extconf/langscan.rake +42 -0
  147. data/test/langscan/brainfuck/test/test_scan.rb +55 -0
  148. data/test/langscan/c/test/test_scan.rb +216 -0
  149. data/test/langscan/c/test/test_token.rb +41 -0
  150. data/test/langscan/csharp/test/test_scan.rb +157 -0
  151. data/test/langscan/css/test/test_css.rb +79 -0
  152. data/test/langscan/d/test/test_scan.rb +233 -0
  153. data/test/langscan/d/test/test_token.rb +205 -0
  154. data/test/langscan/eiffel/test/test_eiffel.rb +95 -0
  155. data/test/langscan/elisp/test/test_elisp.rb +177 -0
  156. data/test/langscan/io/test/test_io.rb +79 -0
  157. data/test/langscan/java/test/test_java.rb +74 -0
  158. data/test/langscan/javascript/test/test_javascript.rb +39 -0
  159. data/test/langscan/lua/test/test_lua.rb +69 -0
  160. data/test/langscan/ocaml/test/test_ocaml.rb +161 -0
  161. data/test/langscan/php/test/test_scan.rb +138 -0
  162. data/test/langscan/python/test/test_scan.rb +105 -0
  163. data/test/langscan/rpmspec/test/test_rpmspec.rb +51 -0
  164. data/test/langscan/ruby/test/test_scan.rb +71 -0
  165. data/test/langscan/scheme/test/test_scan.rb +198 -0
  166. data/test/test_helper.rb +7 -0
  167. data/test/test_langscan.rb +123 -0
  168. metadata +296 -0
@@ -0,0 +1,64 @@
1
+ #ifndef LANGSCAN_JAVA_H
2
+ #define LANGSCAN_JAVA_H
3
+
4
+ #define LANGSCAN_JAVA_TOKEN_LIST \
5
+ LANGSCAN_JAVA_TOKEN(preproc_beg) \
6
+ LANGSCAN_JAVA_TOKEN(preproc_end) \
7
+ LANGSCAN_JAVA_TOKEN(character) \
8
+ LANGSCAN_JAVA_TOKEN(integer) \
9
+ LANGSCAN_JAVA_TOKEN(floating) \
10
+ LANGSCAN_JAVA_TOKEN(string) \
11
+ LANGSCAN_JAVA_TOKEN(ident) \
12
+ LANGSCAN_JAVA_TOKEN(punct) \
13
+ LANGSCAN_JAVA_TOKEN(comment) \
14
+ LANGSCAN_JAVA_TOKEN(space) \
15
+ LANGSCAN_JAVA_TOKEN(classdef)
16
+
17
+ typedef enum {
18
+ langscan_java_eof = 0,
19
+ #define LANGSCAN_JAVA_TOKEN(name) langscan_java_##name,
20
+ LANGSCAN_JAVA_TOKEN_LIST
21
+ #undef LANGSCAN_JAVA_TOKEN
22
+ } langscan_java_token_t;
23
+
24
+ typedef struct {
25
+ int beg_lineno;
26
+ int beg_columnno;
27
+ int beg_byteno;
28
+ int end_lineno;
29
+ int end_columnno;
30
+ int end_byteno;
31
+ int eof;
32
+ char *text;
33
+ int leng;
34
+ size_t (*user_read)(void **user_data_p, char *buf, size_t maxlen);
35
+ void *user_data;
36
+ } langscan_java_lex_extra_t;
37
+
38
+ typedef struct langscan_java_tokenizer_tag {
39
+ langscan_java_lex_extra_t *extra;
40
+ void *scanner;
41
+ } langscan_java_tokenizer_t;
42
+
43
+ typedef size_t (*user_read_t)(void **user_data_p, char *buf, size_t maxlen);
44
+
45
+ langscan_java_tokenizer_t *langscan_java_make_tokenizer(user_read_t user_read, void *user_data);
46
+ langscan_java_token_t langscan_java_get_token(langscan_java_tokenizer_t *tokenizer);
47
+ void langscan_java_free_tokenizer(langscan_java_tokenizer_t *tokenizer);
48
+
49
+ user_read_t langscan_java_tokenizer_get_user_read(langscan_java_tokenizer_t *tokenizer);
50
+ void *langscan_java_tokenizer_get_user_data(langscan_java_tokenizer_t *tokenizer);
51
+
52
+ const char *langscan_java_token_name(langscan_java_token_t token);
53
+ #define langscan_java_curtoken_beg_lineno(tokenizer) ((tokenizer)->extra->beg_lineno)
54
+ #define langscan_java_curtoken_beg_columnno(tokenizer) ((tokenizer)->extra->beg_columnno)
55
+ #define langscan_java_curtoken_beg_byteno(tokenizer) ((tokenizer)->extra->beg_byteno)
56
+ #define langscan_java_curtoken_end_lineno(tokenizer) ((tokenizer)->extra->end_lineno)
57
+ #define langscan_java_curtoken_end_columnno(tokenizer) ((tokenizer)->extra->end_columnno)
58
+ #define langscan_java_curtoken_end_byteno(tokenizer) ((tokenizer)->extra->end_byteno)
59
+ #define langscan_java_curtoken_text(tokenizer) ((tokenizer)->extra->text)
60
+ #define langscan_java_curtoken_leng(tokenizer) ((tokenizer)->extra->leng)
61
+
62
+ void langscan_java_extract_functions(langscan_java_tokenizer_t *);
63
+
64
+ #endif
@@ -0,0 +1,2090 @@
1
+
2
+ #line 3 "<stdout>"
3
+
4
+ #define YY_INT_ALIGNED short int
5
+
6
+ /* A lexical scanner generated by flex */
7
+
8
+ #define FLEX_SCANNER
9
+ #define YY_FLEX_MAJOR_VERSION 2
10
+ #define YY_FLEX_MINOR_VERSION 5
11
+ #define YY_FLEX_SUBMINOR_VERSION 35
12
+ #if YY_FLEX_SUBMINOR_VERSION > 0
13
+ #define FLEX_BETA
14
+ #endif
15
+
16
+ /* First, we deal with platform-specific or compiler-specific issues. */
17
+
18
+ /* begin standard C headers. */
19
+ #include <stdio.h>
20
+ #include <string.h>
21
+ #include <errno.h>
22
+ #include <stdlib.h>
23
+
24
+ /* end standard C headers. */
25
+
26
+ /* flex integer type definitions */
27
+
28
+ #ifndef FLEXINT_H
29
+ #define FLEXINT_H
30
+
31
+ /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
32
+
33
+ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
34
+
35
+ /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
36
+ * if you want the limit (max/min) macros for int types.
37
+ */
38
+ #ifndef __STDC_LIMIT_MACROS
39
+ #define __STDC_LIMIT_MACROS 1
40
+ #endif
41
+
42
+ #include <inttypes.h>
43
+ typedef int8_t flex_int8_t;
44
+ typedef uint8_t flex_uint8_t;
45
+ typedef int16_t flex_int16_t;
46
+ typedef uint16_t flex_uint16_t;
47
+ typedef int32_t flex_int32_t;
48
+ typedef uint32_t flex_uint32_t;
49
+ #else
50
+ typedef signed char flex_int8_t;
51
+ typedef short int flex_int16_t;
52
+ typedef int flex_int32_t;
53
+ typedef unsigned char flex_uint8_t;
54
+ typedef unsigned short int flex_uint16_t;
55
+ typedef unsigned int flex_uint32_t;
56
+ #endif /* ! C99 */
57
+
58
+ /* Limits of integral types. */
59
+ #ifndef INT8_MIN
60
+ #define INT8_MIN (-128)
61
+ #endif
62
+ #ifndef INT16_MIN
63
+ #define INT16_MIN (-32767-1)
64
+ #endif
65
+ #ifndef INT32_MIN
66
+ #define INT32_MIN (-2147483647-1)
67
+ #endif
68
+ #ifndef INT8_MAX
69
+ #define INT8_MAX (127)
70
+ #endif
71
+ #ifndef INT16_MAX
72
+ #define INT16_MAX (32767)
73
+ #endif
74
+ #ifndef INT32_MAX
75
+ #define INT32_MAX (2147483647)
76
+ #endif
77
+ #ifndef UINT8_MAX
78
+ #define UINT8_MAX (255U)
79
+ #endif
80
+ #ifndef UINT16_MAX
81
+ #define UINT16_MAX (65535U)
82
+ #endif
83
+ #ifndef UINT32_MAX
84
+ #define UINT32_MAX (4294967295U)
85
+ #endif
86
+
87
+ #endif /* ! FLEXINT_H */
88
+
89
+ #ifdef __cplusplus
90
+
91
+ /* The "const" storage-class-modifier is valid. */
92
+ #define YY_USE_CONST
93
+
94
+ #else /* ! __cplusplus */
95
+
96
+ /* C99 requires __STDC__ to be defined as 1. */
97
+ #if defined (__STDC__)
98
+
99
+ #define YY_USE_CONST
100
+
101
+ #endif /* defined (__STDC__) */
102
+ #endif /* ! __cplusplus */
103
+
104
+ #ifdef YY_USE_CONST
105
+ #define yyconst const
106
+ #else
107
+ #define yyconst
108
+ #endif
109
+
110
+ /* Returned upon end-of-file. */
111
+ #define YY_NULL 0
112
+
113
+ /* Promotes a possibly negative, possibly signed char to an unsigned
114
+ * integer for use as an array index. If the signed char is negative,
115
+ * we want to instead treat it as an 8-bit unsigned char, hence the
116
+ * double cast.
117
+ */
118
+ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
119
+
120
+ /* An opaque pointer. */
121
+ #ifndef YY_TYPEDEF_YY_SCANNER_T
122
+ #define YY_TYPEDEF_YY_SCANNER_T
123
+ typedef void* yyscan_t;
124
+ #endif
125
+
126
+ /* For convenience, these vars (plus the bison vars far below)
127
+ are macros in the reentrant scanner. */
128
+ #define yyin yyg->yyin_r
129
+ #define yyout yyg->yyout_r
130
+ #define yyextra yyg->yyextra_r
131
+ #define yyleng yyg->yyleng_r
132
+ #define yytext yyg->yytext_r
133
+ #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
134
+ #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
135
+ #define yy_flex_debug yyg->yy_flex_debug_r
136
+
137
+ /* Enter a start condition. This macro really ought to take a parameter,
138
+ * but we do it the disgusting crufty way forced on us by the ()-less
139
+ * definition of BEGIN.
140
+ */
141
+ #define BEGIN yyg->yy_start = 1 + 2 *
142
+
143
+ /* Translate the current start state into a value that can be later handed
144
+ * to BEGIN to return to the state. The YYSTATE alias is for lex
145
+ * compatibility.
146
+ */
147
+ #define YY_START ((yyg->yy_start - 1) / 2)
148
+ #define YYSTATE YY_START
149
+
150
+ /* Action number for EOF rule of a given start state. */
151
+ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
152
+
153
+ /* Special action meaning "start processing a new file". */
154
+ #define YY_NEW_FILE langscan_java_lex_restart(yyin ,yyscanner )
155
+
156
+ #define YY_END_OF_BUFFER_CHAR 0
157
+
158
+ /* Size of default input buffer. */
159
+ #ifndef YY_BUF_SIZE
160
+ #define YY_BUF_SIZE 16384
161
+ #endif
162
+
163
+ /* The state buf must be large enough to hold one state per character in the main buffer.
164
+ */
165
+ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
166
+
167
+ #ifndef YY_TYPEDEF_YY_BUFFER_STATE
168
+ #define YY_TYPEDEF_YY_BUFFER_STATE
169
+ typedef struct yy_buffer_state *YY_BUFFER_STATE;
170
+ #endif
171
+
172
+ #ifndef YY_TYPEDEF_YY_SIZE_T
173
+ #define YY_TYPEDEF_YY_SIZE_T
174
+ typedef size_t yy_size_t;
175
+ #endif
176
+
177
+ #define EOB_ACT_CONTINUE_SCAN 0
178
+ #define EOB_ACT_END_OF_FILE 1
179
+ #define EOB_ACT_LAST_MATCH 2
180
+
181
+ #define YY_LESS_LINENO(n)
182
+
183
+ /* Return all but the first "n" matched characters back to the input stream. */
184
+ #define yyless(n) \
185
+ do \
186
+ { \
187
+ /* Undo effects of setting up yytext. */ \
188
+ int yyless_macro_arg = (n); \
189
+ YY_LESS_LINENO(yyless_macro_arg);\
190
+ *yy_cp = yyg->yy_hold_char; \
191
+ YY_RESTORE_YY_MORE_OFFSET \
192
+ yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
193
+ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
194
+ } \
195
+ while ( 0 )
196
+
197
+ #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
198
+
199
+ #ifndef YY_STRUCT_YY_BUFFER_STATE
200
+ #define YY_STRUCT_YY_BUFFER_STATE
201
+ struct yy_buffer_state
202
+ {
203
+ FILE *yy_input_file;
204
+
205
+ char *yy_ch_buf; /* input buffer */
206
+ char *yy_buf_pos; /* current position in input buffer */
207
+
208
+ /* Size of input buffer in bytes, not including room for EOB
209
+ * characters.
210
+ */
211
+ yy_size_t yy_buf_size;
212
+
213
+ /* Number of characters read into yy_ch_buf, not including EOB
214
+ * characters.
215
+ */
216
+ yy_size_t yy_n_chars;
217
+
218
+ /* Whether we "own" the buffer - i.e., we know we created it,
219
+ * and can realloc() it to grow it, and should free() it to
220
+ * delete it.
221
+ */
222
+ int yy_is_our_buffer;
223
+
224
+ /* Whether this is an "interactive" input source; if so, and
225
+ * if we're using stdio for input, then we want to use getc()
226
+ * instead of fread(), to make sure we stop fetching input after
227
+ * each newline.
228
+ */
229
+ int yy_is_interactive;
230
+
231
+ /* Whether we're considered to be at the beginning of a line.
232
+ * If so, '^' rules will be active on the next match, otherwise
233
+ * not.
234
+ */
235
+ int yy_at_bol;
236
+
237
+ int yy_bs_lineno; /**< The line count. */
238
+ int yy_bs_column; /**< The column count. */
239
+
240
+ /* Whether to try to fill the input buffer when we reach the
241
+ * end of it.
242
+ */
243
+ int yy_fill_buffer;
244
+
245
+ int yy_buffer_status;
246
+
247
+ #define YY_BUFFER_NEW 0
248
+ #define YY_BUFFER_NORMAL 1
249
+ /* When an EOF's been seen but there's still some text to process
250
+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
251
+ * shouldn't try reading from the input source any more. We might
252
+ * still have a bunch of tokens to match, though, because of
253
+ * possible backing-up.
254
+ *
255
+ * When we actually see the EOF, we change the status to "new"
256
+ * (via langscan_java_lex_restart()), so that the user can continue scanning by
257
+ * just pointing yyin at a new input file.
258
+ */
259
+ #define YY_BUFFER_EOF_PENDING 2
260
+
261
+ };
262
+ #endif /* !YY_STRUCT_YY_BUFFER_STATE */
263
+
264
+ /* We provide macros for accessing buffer states in case in the
265
+ * future we want to put the buffer states in a more general
266
+ * "scanner state".
267
+ *
268
+ * Returns the top of the stack, or NULL.
269
+ */
270
+ #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
271
+ ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
272
+ : NULL)
273
+
274
+ /* Same as previous macro, but useful when we know that the buffer stack is not
275
+ * NULL or when we need an lvalue. For internal use only.
276
+ */
277
+ #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
278
+
279
+ void langscan_java_lex_restart (FILE *input_file ,yyscan_t yyscanner );
280
+ void langscan_java_lex__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
281
+ YY_BUFFER_STATE langscan_java_lex__create_buffer (FILE *file,int size ,yyscan_t yyscanner );
282
+ void langscan_java_lex__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
283
+ void langscan_java_lex__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
284
+ void langscan_java_lex_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
285
+ void langscan_java_lex_pop_buffer_state (yyscan_t yyscanner );
286
+
287
+ static void langscan_java_lex_ensure_buffer_stack (yyscan_t yyscanner );
288
+ static void langscan_java_lex__load_buffer_state (yyscan_t yyscanner );
289
+ static void langscan_java_lex__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
290
+
291
+ #define YY_FLUSH_BUFFER langscan_java_lex__flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
292
+
293
+ YY_BUFFER_STATE langscan_java_lex__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
294
+ YY_BUFFER_STATE langscan_java_lex__scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
295
+ YY_BUFFER_STATE langscan_java_lex__scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
296
+
297
+ void *langscan_java_lex_alloc (yy_size_t ,yyscan_t yyscanner );
298
+ void *langscan_java_lex_realloc (void *,yy_size_t ,yyscan_t yyscanner );
299
+ void langscan_java_lex_free (void * ,yyscan_t yyscanner );
300
+
301
+ #define yy_new_buffer langscan_java_lex__create_buffer
302
+
303
+ #define yy_set_interactive(is_interactive) \
304
+ { \
305
+ if ( ! YY_CURRENT_BUFFER ){ \
306
+ langscan_java_lex_ensure_buffer_stack (yyscanner); \
307
+ YY_CURRENT_BUFFER_LVALUE = \
308
+ langscan_java_lex__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
309
+ } \
310
+ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
311
+ }
312
+
313
+ #define yy_set_bol(at_bol) \
314
+ { \
315
+ if ( ! YY_CURRENT_BUFFER ){\
316
+ langscan_java_lex_ensure_buffer_stack (yyscanner); \
317
+ YY_CURRENT_BUFFER_LVALUE = \
318
+ langscan_java_lex__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
319
+ } \
320
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
321
+ }
322
+
323
+ #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
324
+
325
+ /* Begin user sect3 */
326
+
327
+ #define langscan_java_lex_wrap(n) 1
328
+ #define YY_SKIP_YYWRAP
329
+
330
+ typedef unsigned char YY_CHAR;
331
+
332
+ typedef int yy_state_type;
333
+
334
+ #define yytext_ptr yytext_r
335
+
336
+ static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
337
+ static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner);
338
+ static int yy_get_next_buffer (yyscan_t yyscanner );
339
+ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
340
+
341
+ /* Done after the current pattern has been matched and before the
342
+ * corresponding action - sets up yytext.
343
+ */
344
+ #define YY_DO_BEFORE_ACTION \
345
+ yyg->yytext_ptr = yy_bp; \
346
+ yyleng = (size_t) (yy_cp - yy_bp); \
347
+ yyg->yy_hold_char = *yy_cp; \
348
+ *yy_cp = '\0'; \
349
+ yyg->yy_c_buf_p = yy_cp;
350
+
351
+ #define YY_NUM_RULES 10
352
+ #define YY_END_OF_BUFFER 11
353
+ /* This struct is not used in this scanner,
354
+ but its presence is necessary. */
355
+ struct yy_trans_info
356
+ {
357
+ flex_int32_t yy_verify;
358
+ flex_int32_t yy_nxt;
359
+ };
360
+ static yyconst flex_int16_t yy_accept[47] =
361
+ { 0,
362
+ 0, 0, 0, 0, 11, 9, 3, 4, 9, 9,
363
+ 8, 8, 2, 2, 3, 0, 7, 0, 0, 5,
364
+ 8, 8, 2, 2, 0, 0, 5, 8, 2, 0,
365
+ 6, 8, 2, 0, 8, 2, 0, 0, 1, 0,
366
+ 1, 0, 0, 0, 0, 0
367
+ } ;
368
+
369
+ static yyconst flex_int32_t yy_ec[256] =
370
+ { 0,
371
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
372
+ 1, 2, 2, 1, 1, 1, 1, 1, 1, 1,
373
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
374
+ 1, 2, 1, 4, 1, 1, 1, 1, 1, 1,
375
+ 1, 5, 1, 1, 1, 1, 6, 7, 7, 7,
376
+ 7, 7, 7, 7, 7, 7, 7, 1, 1, 1,
377
+ 1, 1, 1, 1, 8, 8, 8, 8, 8, 8,
378
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
379
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
380
+ 1, 9, 1, 1, 8, 1, 10, 8, 11, 8,
381
+
382
+ 8, 8, 8, 8, 8, 8, 8, 12, 8, 8,
383
+ 8, 8, 8, 8, 13, 8, 8, 8, 8, 8,
384
+ 8, 8, 1, 1, 1, 1, 1, 1, 1, 1,
385
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
386
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
387
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
388
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
389
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
390
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
391
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
392
+
393
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
394
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
395
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
396
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
397
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
398
+ 1, 1, 1, 1, 1
399
+ } ;
400
+
401
+ static yyconst flex_int32_t yy_meta[14] =
402
+ { 0,
403
+ 1, 2, 3, 1, 1, 2, 4, 5, 1, 5,
404
+ 5, 5, 5
405
+ } ;
406
+
407
+ static yyconst flex_int16_t yy_base[59] =
408
+ { 0,
409
+ 0, 0, 6, 0, 106, 107, 103, 107, 16, 21,
410
+ 0, 92, 0, 91, 82, 24, 107, 66, 44, 0,
411
+ 0, 38, 0, 34, 38, 29, 0, 26, 25, 27,
412
+ 107, 18, 17, 24, 34, 39, 44, 19, 0, 18,
413
+ 0, 17, 46, 16, 10, 107, 52, 54, 56, 61,
414
+ 66, 71, 76, 80, 82, 87, 92, 97
415
+ } ;
416
+
417
+ static yyconst flex_int16_t yy_def[59] =
418
+ { 0,
419
+ 46, 1, 1, 3, 46, 46, 46, 46, 47, 46,
420
+ 48, 48, 49, 49, 46, 47, 46, 47, 50, 51,
421
+ 48, 48, 49, 49, 50, 52, 51, 48, 49, 53,
422
+ 46, 48, 49, 53, 48, 49, 54, 46, 55, 56,
423
+ 55, 56, 57, 58, 58, 0, 46, 46, 46, 46,
424
+ 46, 46, 46, 46, 46, 46, 46, 46
425
+ } ;
426
+
427
+ static yyconst flex_int16_t yy_nxt[121] =
428
+ { 0,
429
+ 6, 7, 8, 9, 6, 10, 6, 11, 6, 11,
430
+ 12, 11, 11, 13, 43, 13, 14, 13, 13, 17,
431
+ 43, 43, 43, 40, 18, 19, 20, 17, 26, 36,
432
+ 35, 26, 18, 26, 31, 37, 37, 33, 32, 38,
433
+ 37, 37, 26, 29, 38, 37, 37, 28, 26, 38,
434
+ 43, 37, 16, 16, 16, 16, 16, 21, 21, 23,
435
+ 23, 25, 25, 25, 25, 25, 27, 27, 46, 27,
436
+ 27, 30, 30, 30, 30, 30, 34, 34, 34, 34,
437
+ 34, 39, 39, 15, 39, 41, 41, 42, 42, 42,
438
+ 42, 42, 44, 44, 44, 44, 44, 45, 45, 45,
439
+
440
+ 45, 45, 24, 22, 15, 46, 5, 46, 46, 46,
441
+ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46
442
+ } ;
443
+
444
+ static yyconst flex_int16_t yy_chk[121] =
445
+ { 0,
446
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
447
+ 1, 1, 1, 3, 45, 3, 3, 3, 3, 9,
448
+ 44, 42, 40, 38, 9, 10, 10, 16, 34, 33,
449
+ 32, 30, 16, 26, 26, 35, 35, 29, 28, 35,
450
+ 36, 36, 25, 24, 36, 37, 37, 22, 19, 37,
451
+ 43, 43, 47, 47, 47, 47, 47, 48, 48, 49,
452
+ 49, 50, 50, 50, 50, 50, 51, 51, 18, 51,
453
+ 51, 52, 52, 52, 52, 52, 53, 53, 53, 53,
454
+ 53, 54, 54, 15, 54, 55, 55, 56, 56, 56,
455
+ 56, 56, 57, 57, 57, 57, 57, 58, 58, 58,
456
+
457
+ 58, 58, 14, 12, 7, 5, 46, 46, 46, 46,
458
+ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46
459
+ } ;
460
+
461
+ /* The intent behind this definition is that it'll catch
462
+ * any uses of REJECT which flex missed.
463
+ */
464
+ #define REJECT reject_used_but_not_detected
465
+ #define yymore() yymore_used_but_not_detected
466
+ #define YY_MORE_ADJ 0
467
+ #define YY_RESTORE_YY_MORE_OFFSET
468
+ /*
469
+ * java.l - a lex rule for Java
470
+ *
471
+ * Copyright (C) 2005 Keisuke Nishida <knishida@open-cobol.org>
472
+ * All rights reserved.
473
+ * This is free software with ABSOLUTELY NO WARRANTY.
474
+ *
475
+ * You can redistribute it and/or modify it under the terms of
476
+ * the GNU General Public License version 2.
477
+ */
478
+
479
+ #include "java.h"
480
+
481
+ #define YY_EXTRA_TYPE langscan_java_lex_extra_t *
482
+
483
+ #if YY_NULL != 0
484
+ #error "YY_NULL is not 0."
485
+ #endif
486
+
487
+ #define YY_DECL langscan_java_token_t langscan_java_lex_lex(yyscan_t yyscanner)
488
+
489
+ #define YY_INPUT(buf,result,max_size) \
490
+ if (!yyextra->eof) { \
491
+ result = yyextra->user_read(&(yyextra->user_data), (buf), (max_size)); \
492
+ if (result == 0) \
493
+ yyextra->eof = 1; \
494
+ }
495
+
496
+ #define UPD update_pos(yyextra, yytext, yyleng)
497
+ static void update_pos(langscan_java_lex_extra_t *, char *, int);
498
+
499
+ #define report(token) \
500
+ do { \
501
+ yyextra->text = yytext; \
502
+ yyextra->leng = yyleng; \
503
+ return langscan_java_##token; \
504
+ } while (0)
505
+
506
+ #define INITIAL 0
507
+ #define CLASSDEF 1
508
+
509
+ #ifndef YY_NO_UNISTD_H
510
+ /* Special case for "unistd.h", since it is non-ANSI. We include it way
511
+ * down here because we want the user's section 1 to have been scanned first.
512
+ * The user has a chance to override it with an option.
513
+ */
514
+ #include <unistd.h>
515
+ #endif
516
+
517
+ #ifndef YY_EXTRA_TYPE
518
+ #define YY_EXTRA_TYPE void *
519
+ #endif
520
+
521
+ /* Holds the entire state of the reentrant scanner. */
522
+ struct yyguts_t
523
+ {
524
+
525
+ /* User-defined. Not touched by flex. */
526
+ YY_EXTRA_TYPE yyextra_r;
527
+
528
+ /* The rest are the same as the globals declared in the non-reentrant scanner. */
529
+ FILE *yyin_r, *yyout_r;
530
+ size_t yy_buffer_stack_top; /**< index of top of stack. */
531
+ size_t yy_buffer_stack_max; /**< capacity of stack. */
532
+ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
533
+ char yy_hold_char;
534
+ yy_size_t yy_n_chars;
535
+ yy_size_t yyleng_r;
536
+ char *yy_c_buf_p;
537
+ int yy_init;
538
+ int yy_start;
539
+ int yy_did_buffer_switch_on_eof;
540
+ int yy_start_stack_ptr;
541
+ int yy_start_stack_depth;
542
+ int *yy_start_stack;
543
+ yy_state_type yy_last_accepting_state;
544
+ char* yy_last_accepting_cpos;
545
+
546
+ int yylineno_r;
547
+ int yy_flex_debug_r;
548
+
549
+ char *yytext_r;
550
+ int yy_more_flag;
551
+ int yy_more_len;
552
+
553
+ }; /* end struct yyguts_t */
554
+
555
+ static int yy_init_globals (yyscan_t yyscanner );
556
+
557
+ int langscan_java_lex_lex_init (yyscan_t* scanner);
558
+
559
+ int langscan_java_lex_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
560
+
561
+ /* Accessor methods to globals.
562
+ These are made visible to non-reentrant scanners for convenience. */
563
+
564
+ int langscan_java_lex_lex_destroy (yyscan_t yyscanner );
565
+
566
+ int langscan_java_lex_get_debug (yyscan_t yyscanner );
567
+
568
+ void langscan_java_lex_set_debug (int debug_flag ,yyscan_t yyscanner );
569
+
570
+ YY_EXTRA_TYPE langscan_java_lex_get_extra (yyscan_t yyscanner );
571
+
572
+ void langscan_java_lex_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
573
+
574
+ FILE *langscan_java_lex_get_in (yyscan_t yyscanner );
575
+
576
+ void langscan_java_lex_set_in (FILE * in_str ,yyscan_t yyscanner );
577
+
578
+ FILE *langscan_java_lex_get_out (yyscan_t yyscanner );
579
+
580
+ void langscan_java_lex_set_out (FILE * out_str ,yyscan_t yyscanner );
581
+
582
+ yy_size_t langscan_java_lex_get_leng (yyscan_t yyscanner );
583
+
584
+ char *langscan_java_lex_get_text (yyscan_t yyscanner );
585
+
586
+ int langscan_java_lex_get_lineno (yyscan_t yyscanner );
587
+
588
+ void langscan_java_lex_set_lineno (int line_number ,yyscan_t yyscanner );
589
+
590
+ /* Macros after this point can all be overridden by user definitions in
591
+ * section 1.
592
+ */
593
+
594
+ #ifndef YY_SKIP_YYWRAP
595
+ #ifdef __cplusplus
596
+ extern "C" int langscan_java_lex_wrap (yyscan_t yyscanner );
597
+ #else
598
+ extern int langscan_java_lex_wrap (yyscan_t yyscanner );
599
+ #endif
600
+ #endif
601
+
602
+ static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner);
603
+
604
+ #ifndef yytext_ptr
605
+ static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
606
+ #endif
607
+
608
+ #ifdef YY_NEED_STRLEN
609
+ static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
610
+ #endif
611
+
612
+ #ifndef YY_NO_INPUT
613
+
614
+ #ifdef __cplusplus
615
+ static int yyinput (yyscan_t yyscanner );
616
+ #else
617
+ static int input (yyscan_t yyscanner );
618
+ #endif
619
+
620
+ #endif
621
+
622
+ /* Amount of stuff to slurp up with each read. */
623
+ #ifndef YY_READ_BUF_SIZE
624
+ #define YY_READ_BUF_SIZE 8192
625
+ #endif
626
+
627
+ /* Copy whatever the last rule matched to the standard output. */
628
+ #ifndef ECHO
629
+ /* This used to be an fputs(), but since the string might contain NUL's,
630
+ * we now use fwrite().
631
+ */
632
+ #define ECHO fwrite( yytext, yyleng, 1, yyout )
633
+ #endif
634
+
635
+ /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
636
+ * is returned in "result".
637
+ */
638
+ #ifndef YY_INPUT
639
+ #define YY_INPUT(buf,result,max_size) \
640
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
641
+ { \
642
+ int c = '*'; \
643
+ yy_size_t n; \
644
+ for ( n = 0; n < max_size && \
645
+ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
646
+ buf[n] = (char) c; \
647
+ if ( c == '\n' ) \
648
+ buf[n++] = (char) c; \
649
+ if ( c == EOF && ferror( yyin ) ) \
650
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
651
+ result = n; \
652
+ } \
653
+ else \
654
+ { \
655
+ errno=0; \
656
+ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
657
+ { \
658
+ if( errno != EINTR) \
659
+ { \
660
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
661
+ break; \
662
+ } \
663
+ errno=0; \
664
+ clearerr(yyin); \
665
+ } \
666
+ }\
667
+ \
668
+
669
+ #endif
670
+
671
+ /* No semi-colon after return; correct usage is to write "yyterminate();" -
672
+ * we don't want an extra ';' after the "return" because that will cause
673
+ * some compilers to complain about unreachable statements.
674
+ */
675
+ #ifndef yyterminate
676
+ #define yyterminate() return YY_NULL
677
+ #endif
678
+
679
+ /* Number of entries by which start-condition stack grows. */
680
+ #ifndef YY_START_STACK_INCR
681
+ #define YY_START_STACK_INCR 25
682
+ #endif
683
+
684
+ /* Report a fatal error. */
685
+ #ifndef YY_FATAL_ERROR
686
+ #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
687
+ #endif
688
+
689
+ /* end tables serialization structures and prototypes */
690
+
691
+ /* Default declaration of generated scanner - a define so the user can
692
+ * easily add parameters.
693
+ */
694
+ #ifndef YY_DECL
695
+ #define YY_DECL_IS_OURS 1
696
+
697
+ extern int langscan_java_lex_lex (yyscan_t yyscanner);
698
+
699
+ #define YY_DECL int langscan_java_lex_lex (yyscan_t yyscanner)
700
+ #endif /* !YY_DECL */
701
+
702
+ /* Code executed at the beginning of each rule, after yytext and yyleng
703
+ * have been set up.
704
+ */
705
+ #ifndef YY_USER_ACTION
706
+ #define YY_USER_ACTION
707
+ #endif
708
+
709
+ /* Code executed at the end of each rule. */
710
+ #ifndef YY_BREAK
711
+ #define YY_BREAK break;
712
+ #endif
713
+
714
+ #define YY_RULE_SETUP \
715
+ YY_USER_ACTION
716
+
717
+ /** The main scanner function which does all the work.
718
+ */
719
+ YY_DECL
720
+ {
721
+ register yy_state_type yy_current_state;
722
+ register char *yy_cp, *yy_bp;
723
+ register int yy_act;
724
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
725
+
726
+ if ( !yyg->yy_init )
727
+ {
728
+ yyg->yy_init = 1;
729
+
730
+ #ifdef YY_USER_INIT
731
+ YY_USER_INIT;
732
+ #endif
733
+
734
+ if ( ! yyg->yy_start )
735
+ yyg->yy_start = 1; /* first start state */
736
+
737
+ if ( ! yyin )
738
+ yyin = stdin;
739
+
740
+ if ( ! yyout )
741
+ yyout = stdout;
742
+
743
+ if ( ! YY_CURRENT_BUFFER ) {
744
+ langscan_java_lex_ensure_buffer_stack (yyscanner);
745
+ YY_CURRENT_BUFFER_LVALUE =
746
+ langscan_java_lex__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
747
+ }
748
+
749
+ langscan_java_lex__load_buffer_state(yyscanner );
750
+ }
751
+
752
+ while ( 1 ) /* loops until end-of-file is reached */
753
+ {
754
+ yy_cp = yyg->yy_c_buf_p;
755
+
756
+ /* Support of yytext. */
757
+ *yy_cp = yyg->yy_hold_char;
758
+
759
+ /* yy_bp points to the position in yy_ch_buf of the start of
760
+ * the current run.
761
+ */
762
+ yy_bp = yy_cp;
763
+
764
+ yy_current_state = yyg->yy_start;
765
+ yy_match:
766
+ do
767
+ {
768
+ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
769
+ if ( yy_accept[yy_current_state] )
770
+ {
771
+ yyg->yy_last_accepting_state = yy_current_state;
772
+ yyg->yy_last_accepting_cpos = yy_cp;
773
+ }
774
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
775
+ {
776
+ yy_current_state = (int) yy_def[yy_current_state];
777
+ if ( yy_current_state >= 47 )
778
+ yy_c = yy_meta[(unsigned int) yy_c];
779
+ }
780
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
781
+ ++yy_cp;
782
+ }
783
+ while ( yy_base[yy_current_state] != 107 );
784
+
785
+ yy_find_action:
786
+ yy_act = yy_accept[yy_current_state];
787
+ if ( yy_act == 0 )
788
+ { /* have to back up */
789
+ yy_cp = yyg->yy_last_accepting_cpos;
790
+ yy_current_state = yyg->yy_last_accepting_state;
791
+ yy_act = yy_accept[yy_current_state];
792
+ }
793
+
794
+ YY_DO_BEFORE_ACTION;
795
+
796
+ do_action: /* This label is used only to access EOF actions. */
797
+
798
+ switch ( yy_act )
799
+ { /* beginning of action switch */
800
+ case 0: /* must back up */
801
+ /* undo the effects of YY_DO_BEFORE_ACTION */
802
+ *yy_cp = yyg->yy_hold_char;
803
+ yy_cp = yyg->yy_last_accepting_cpos;
804
+ yy_current_state = yyg->yy_last_accepting_state;
805
+ goto yy_find_action;
806
+
807
+ case 1:
808
+ /* rule 1 can match eol */
809
+ *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
810
+ yyg->yy_c_buf_p = yy_cp = yy_bp + 5;
811
+ YY_DO_BEFORE_ACTION; /* set up yytext again */
812
+ YY_RULE_SETUP
813
+ { UPD; BEGIN(CLASSDEF); report(ident); }
814
+ YY_BREAK
815
+ case 2:
816
+ YY_RULE_SETUP
817
+ { UPD; BEGIN(INITIAL); report(classdef); }
818
+ YY_BREAK
819
+ case 3:
820
+ YY_RULE_SETUP
821
+ { UPD; report(space); }
822
+ YY_BREAK
823
+ case 4:
824
+ /* rule 4 can match eol */
825
+ YY_RULE_SETUP
826
+ { UPD; report(space); }
827
+ YY_BREAK
828
+ case 5:
829
+ YY_RULE_SETUP
830
+ { UPD; report(comment); }
831
+ YY_BREAK
832
+ case 6:
833
+ /* rule 6 can match eol */
834
+ YY_RULE_SETUP
835
+ { UPD; report(comment); }
836
+ YY_BREAK
837
+ case 7:
838
+ /* rule 7 can match eol */
839
+ YY_RULE_SETUP
840
+ { UPD; report(string); }
841
+ YY_BREAK
842
+ case 8:
843
+ YY_RULE_SETUP
844
+ { UPD; report(ident); }
845
+ YY_BREAK
846
+ case 9:
847
+ YY_RULE_SETUP
848
+ { UPD; report(punct); }
849
+ YY_BREAK
850
+ case 10:
851
+ YY_RULE_SETUP
852
+ YY_FATAL_ERROR( "flex scanner jammed" );
853
+ YY_BREAK
854
+ case YY_STATE_EOF(INITIAL):
855
+ case YY_STATE_EOF(CLASSDEF):
856
+ yyterminate();
857
+
858
+ case YY_END_OF_BUFFER:
859
+ {
860
+ /* Amount of text matched not including the EOB char. */
861
+ int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
862
+
863
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
864
+ *yy_cp = yyg->yy_hold_char;
865
+ YY_RESTORE_YY_MORE_OFFSET
866
+
867
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
868
+ {
869
+ /* We're scanning a new file or input source. It's
870
+ * possible that this happened because the user
871
+ * just pointed yyin at a new source and called
872
+ * langscan_java_lex_lex(). If so, then we have to assure
873
+ * consistency between YY_CURRENT_BUFFER and our
874
+ * globals. Here is the right place to do so, because
875
+ * this is the first action (other than possibly a
876
+ * back-up) that will match for the new input source.
877
+ */
878
+ yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
879
+ YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
880
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
881
+ }
882
+
883
+ /* Note that here we test for yy_c_buf_p "<=" to the position
884
+ * of the first EOB in the buffer, since yy_c_buf_p will
885
+ * already have been incremented past the NUL character
886
+ * (since all states make transitions on EOB to the
887
+ * end-of-buffer state). Contrast this with the test
888
+ * in input().
889
+ */
890
+ if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
891
+ { /* This was really a NUL. */
892
+ yy_state_type yy_next_state;
893
+
894
+ yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
895
+
896
+ yy_current_state = yy_get_previous_state( yyscanner );
897
+
898
+ /* Okay, we're now positioned to make the NUL
899
+ * transition. We couldn't have
900
+ * yy_get_previous_state() go ahead and do it
901
+ * for us because it doesn't know how to deal
902
+ * with the possibility of jamming (and we don't
903
+ * want to build jamming into it because then it
904
+ * will run more slowly).
905
+ */
906
+
907
+ yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
908
+
909
+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
910
+
911
+ if ( yy_next_state )
912
+ {
913
+ /* Consume the NUL. */
914
+ yy_cp = ++yyg->yy_c_buf_p;
915
+ yy_current_state = yy_next_state;
916
+ goto yy_match;
917
+ }
918
+
919
+ else
920
+ {
921
+ yy_cp = yyg->yy_c_buf_p;
922
+ goto yy_find_action;
923
+ }
924
+ }
925
+
926
+ else switch ( yy_get_next_buffer( yyscanner ) )
927
+ {
928
+ case EOB_ACT_END_OF_FILE:
929
+ {
930
+ yyg->yy_did_buffer_switch_on_eof = 0;
931
+
932
+ if ( langscan_java_lex_wrap(yyscanner ) )
933
+ {
934
+ /* Note: because we've taken care in
935
+ * yy_get_next_buffer() to have set up
936
+ * yytext, we can now set up
937
+ * yy_c_buf_p so that if some total
938
+ * hoser (like flex itself) wants to
939
+ * call the scanner after we return the
940
+ * YY_NULL, it'll still work - another
941
+ * YY_NULL will get returned.
942
+ */
943
+ yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
944
+
945
+ yy_act = YY_STATE_EOF(YY_START);
946
+ goto do_action;
947
+ }
948
+
949
+ else
950
+ {
951
+ if ( ! yyg->yy_did_buffer_switch_on_eof )
952
+ YY_NEW_FILE;
953
+ }
954
+ break;
955
+ }
956
+
957
+ case EOB_ACT_CONTINUE_SCAN:
958
+ yyg->yy_c_buf_p =
959
+ yyg->yytext_ptr + yy_amount_of_matched_text;
960
+
961
+ yy_current_state = yy_get_previous_state( yyscanner );
962
+
963
+ yy_cp = yyg->yy_c_buf_p;
964
+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
965
+ goto yy_match;
966
+
967
+ case EOB_ACT_LAST_MATCH:
968
+ yyg->yy_c_buf_p =
969
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
970
+
971
+ yy_current_state = yy_get_previous_state( yyscanner );
972
+
973
+ yy_cp = yyg->yy_c_buf_p;
974
+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
975
+ goto yy_find_action;
976
+ }
977
+ break;
978
+ }
979
+
980
+ default:
981
+ YY_FATAL_ERROR(
982
+ "fatal flex scanner internal error--no action found" );
983
+ } /* end of action switch */
984
+ } /* end of scanning one token */
985
+ } /* end of langscan_java_lex_lex */
986
+
987
+ /* yy_get_next_buffer - try to read in a new buffer
988
+ *
989
+ * Returns a code representing an action:
990
+ * EOB_ACT_LAST_MATCH -
991
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
992
+ * EOB_ACT_END_OF_FILE - end of file
993
+ */
994
+ static int yy_get_next_buffer (yyscan_t yyscanner)
995
+ {
996
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
997
+ register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
998
+ register char *source = yyg->yytext_ptr;
999
+ register int number_to_move, i;
1000
+ int ret_val;
1001
+
1002
+ if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1003
+ YY_FATAL_ERROR(
1004
+ "fatal flex scanner internal error--end of buffer missed" );
1005
+
1006
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1007
+ { /* Don't try to fill the buffer, so this is an EOF. */
1008
+ if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1009
+ {
1010
+ /* We matched a single character, the EOB, so
1011
+ * treat this as a final EOF.
1012
+ */
1013
+ return EOB_ACT_END_OF_FILE;
1014
+ }
1015
+
1016
+ else
1017
+ {
1018
+ /* We matched some text prior to the EOB, first
1019
+ * process it.
1020
+ */
1021
+ return EOB_ACT_LAST_MATCH;
1022
+ }
1023
+ }
1024
+
1025
+ /* Try to read more data. */
1026
+
1027
+ /* First move last chars to start of buffer. */
1028
+ number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
1029
+
1030
+ for ( i = 0; i < number_to_move; ++i )
1031
+ *(dest++) = *(source++);
1032
+
1033
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1034
+ /* don't do the read, it's not guaranteed to return an EOF,
1035
+ * just force an EOF
1036
+ */
1037
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1038
+
1039
+ else
1040
+ {
1041
+ yy_size_t num_to_read =
1042
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1043
+
1044
+ while ( num_to_read <= 0 )
1045
+ { /* Not enough room in the buffer - grow it. */
1046
+
1047
+ /* just a shorter name for the current buffer */
1048
+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1049
+
1050
+ int yy_c_buf_p_offset =
1051
+ (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
1052
+
1053
+ if ( b->yy_is_our_buffer )
1054
+ {
1055
+ yy_size_t new_size = b->yy_buf_size * 2;
1056
+
1057
+ if ( new_size <= 0 )
1058
+ b->yy_buf_size += b->yy_buf_size / 8;
1059
+ else
1060
+ b->yy_buf_size *= 2;
1061
+
1062
+ b->yy_ch_buf = (char *)
1063
+ /* Include room in for 2 EOB chars. */
1064
+ langscan_java_lex_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
1065
+ }
1066
+ else
1067
+ /* Can't grow it, we don't own it. */
1068
+ b->yy_ch_buf = 0;
1069
+
1070
+ if ( ! b->yy_ch_buf )
1071
+ YY_FATAL_ERROR(
1072
+ "fatal error - scanner input buffer overflow" );
1073
+
1074
+ yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1075
+
1076
+ num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1077
+ number_to_move - 1;
1078
+
1079
+ }
1080
+
1081
+ if ( num_to_read > YY_READ_BUF_SIZE )
1082
+ num_to_read = YY_READ_BUF_SIZE;
1083
+
1084
+ /* Read in more data. */
1085
+ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1086
+ yyg->yy_n_chars, num_to_read );
1087
+
1088
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1089
+ }
1090
+
1091
+ if ( yyg->yy_n_chars == 0 )
1092
+ {
1093
+ if ( number_to_move == YY_MORE_ADJ )
1094
+ {
1095
+ ret_val = EOB_ACT_END_OF_FILE;
1096
+ langscan_java_lex_restart(yyin ,yyscanner);
1097
+ }
1098
+
1099
+ else
1100
+ {
1101
+ ret_val = EOB_ACT_LAST_MATCH;
1102
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1103
+ YY_BUFFER_EOF_PENDING;
1104
+ }
1105
+ }
1106
+
1107
+ else
1108
+ ret_val = EOB_ACT_CONTINUE_SCAN;
1109
+
1110
+ if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1111
+ /* Extend the array by 50%, plus the number we really need. */
1112
+ yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1113
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) langscan_java_lex_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
1114
+ if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1115
+ YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1116
+ }
1117
+
1118
+ yyg->yy_n_chars += number_to_move;
1119
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1120
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1121
+
1122
+ yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1123
+
1124
+ return ret_val;
1125
+ }
1126
+
1127
+ /* yy_get_previous_state - get the state just before the EOB char was reached */
1128
+
1129
+ static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1130
+ {
1131
+ register yy_state_type yy_current_state;
1132
+ register char *yy_cp;
1133
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1134
+
1135
+ yy_current_state = yyg->yy_start;
1136
+
1137
+ for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1138
+ {
1139
+ register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1140
+ if ( yy_accept[yy_current_state] )
1141
+ {
1142
+ yyg->yy_last_accepting_state = yy_current_state;
1143
+ yyg->yy_last_accepting_cpos = yy_cp;
1144
+ }
1145
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1146
+ {
1147
+ yy_current_state = (int) yy_def[yy_current_state];
1148
+ if ( yy_current_state >= 47 )
1149
+ yy_c = yy_meta[(unsigned int) yy_c];
1150
+ }
1151
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1152
+ }
1153
+
1154
+ return yy_current_state;
1155
+ }
1156
+
1157
+ /* yy_try_NUL_trans - try to make a transition on the NUL character
1158
+ *
1159
+ * synopsis
1160
+ * next_state = yy_try_NUL_trans( current_state );
1161
+ */
1162
+ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
1163
+ {
1164
+ register int yy_is_jam;
1165
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
1166
+ register char *yy_cp = yyg->yy_c_buf_p;
1167
+
1168
+ register YY_CHAR yy_c = 1;
1169
+ if ( yy_accept[yy_current_state] )
1170
+ {
1171
+ yyg->yy_last_accepting_state = yy_current_state;
1172
+ yyg->yy_last_accepting_cpos = yy_cp;
1173
+ }
1174
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1175
+ {
1176
+ yy_current_state = (int) yy_def[yy_current_state];
1177
+ if ( yy_current_state >= 47 )
1178
+ yy_c = yy_meta[(unsigned int) yy_c];
1179
+ }
1180
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1181
+ yy_is_jam = (yy_current_state == 46);
1182
+
1183
+ return yy_is_jam ? 0 : yy_current_state;
1184
+ }
1185
+
1186
+ static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
1187
+ {
1188
+ register char *yy_cp;
1189
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1190
+
1191
+ yy_cp = yyg->yy_c_buf_p;
1192
+
1193
+ /* undo effects of setting up yytext */
1194
+ *yy_cp = yyg->yy_hold_char;
1195
+
1196
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1197
+ { /* need to shift things up to make room */
1198
+ /* +2 for EOB chars. */
1199
+ register yy_size_t number_to_move = yyg->yy_n_chars + 2;
1200
+ register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1201
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1202
+ register char *source =
1203
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1204
+
1205
+ while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1206
+ *--dest = *--source;
1207
+
1208
+ yy_cp += (int) (dest - source);
1209
+ yy_bp += (int) (dest - source);
1210
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1211
+ yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1212
+
1213
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1214
+ YY_FATAL_ERROR( "flex scanner push-back overflow" );
1215
+ }
1216
+
1217
+ *--yy_cp = (char) c;
1218
+
1219
+ yyg->yytext_ptr = yy_bp;
1220
+ yyg->yy_hold_char = *yy_cp;
1221
+ yyg->yy_c_buf_p = yy_cp;
1222
+ }
1223
+
1224
+ #ifndef YY_NO_INPUT
1225
+ #ifdef __cplusplus
1226
+ static int yyinput (yyscan_t yyscanner)
1227
+ #else
1228
+ static int input (yyscan_t yyscanner)
1229
+ #endif
1230
+
1231
+ {
1232
+ int c;
1233
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1234
+
1235
+ *yyg->yy_c_buf_p = yyg->yy_hold_char;
1236
+
1237
+ if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1238
+ {
1239
+ /* yy_c_buf_p now points to the character we want to return.
1240
+ * If this occurs *before* the EOB characters, then it's a
1241
+ * valid NUL; if not, then we've hit the end of the buffer.
1242
+ */
1243
+ if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1244
+ /* This was really a NUL. */
1245
+ *yyg->yy_c_buf_p = '\0';
1246
+
1247
+ else
1248
+ { /* need more input */
1249
+ yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
1250
+ ++yyg->yy_c_buf_p;
1251
+
1252
+ switch ( yy_get_next_buffer( yyscanner ) )
1253
+ {
1254
+ case EOB_ACT_LAST_MATCH:
1255
+ /* This happens because yy_g_n_b()
1256
+ * sees that we've accumulated a
1257
+ * token and flags that we need to
1258
+ * try matching the token before
1259
+ * proceeding. But for input(),
1260
+ * there's no matching to consider.
1261
+ * So convert the EOB_ACT_LAST_MATCH
1262
+ * to EOB_ACT_END_OF_FILE.
1263
+ */
1264
+
1265
+ /* Reset buffer status. */
1266
+ langscan_java_lex_restart(yyin ,yyscanner);
1267
+
1268
+ /*FALLTHROUGH*/
1269
+
1270
+ case EOB_ACT_END_OF_FILE:
1271
+ {
1272
+ if ( langscan_java_lex_wrap(yyscanner ) )
1273
+ return 0;
1274
+
1275
+ if ( ! yyg->yy_did_buffer_switch_on_eof )
1276
+ YY_NEW_FILE;
1277
+ #ifdef __cplusplus
1278
+ return yyinput(yyscanner);
1279
+ #else
1280
+ return input(yyscanner);
1281
+ #endif
1282
+ }
1283
+
1284
+ case EOB_ACT_CONTINUE_SCAN:
1285
+ yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
1286
+ break;
1287
+ }
1288
+ }
1289
+ }
1290
+
1291
+ c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
1292
+ *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
1293
+ yyg->yy_hold_char = *++yyg->yy_c_buf_p;
1294
+
1295
+ return c;
1296
+ }
1297
+ #endif /* ifndef YY_NO_INPUT */
1298
+
1299
+ /** Immediately switch to a different input stream.
1300
+ * @param input_file A readable stream.
1301
+ * @param yyscanner The scanner object.
1302
+ * @note This function does not reset the start condition to @c INITIAL .
1303
+ */
1304
+ void langscan_java_lex_restart (FILE * input_file , yyscan_t yyscanner)
1305
+ {
1306
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1307
+
1308
+ if ( ! YY_CURRENT_BUFFER ){
1309
+ langscan_java_lex_ensure_buffer_stack (yyscanner);
1310
+ YY_CURRENT_BUFFER_LVALUE =
1311
+ langscan_java_lex__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
1312
+ }
1313
+
1314
+ langscan_java_lex__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
1315
+ langscan_java_lex__load_buffer_state(yyscanner );
1316
+ }
1317
+
1318
+ /** Switch to a different input buffer.
1319
+ * @param new_buffer The new input buffer.
1320
+ * @param yyscanner The scanner object.
1321
+ */
1322
+ void langscan_java_lex__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1323
+ {
1324
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1325
+
1326
+ /* TODO. We should be able to replace this entire function body
1327
+ * with
1328
+ * langscan_java_lex_pop_buffer_state();
1329
+ * langscan_java_lex_push_buffer_state(new_buffer);
1330
+ */
1331
+ langscan_java_lex_ensure_buffer_stack (yyscanner);
1332
+ if ( YY_CURRENT_BUFFER == new_buffer )
1333
+ return;
1334
+
1335
+ if ( YY_CURRENT_BUFFER )
1336
+ {
1337
+ /* Flush out information for old buffer. */
1338
+ *yyg->yy_c_buf_p = yyg->yy_hold_char;
1339
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1340
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1341
+ }
1342
+
1343
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
1344
+ langscan_java_lex__load_buffer_state(yyscanner );
1345
+
1346
+ /* We don't actually know whether we did this switch during
1347
+ * EOF (langscan_java_lex_wrap()) processing, but the only time this flag
1348
+ * is looked at is after langscan_java_lex_wrap() is called, so it's safe
1349
+ * to go ahead and always set it.
1350
+ */
1351
+ yyg->yy_did_buffer_switch_on_eof = 1;
1352
+ }
1353
+
1354
+ static void langscan_java_lex__load_buffer_state (yyscan_t yyscanner)
1355
+ {
1356
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1357
+ yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1358
+ yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1359
+ yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1360
+ yyg->yy_hold_char = *yyg->yy_c_buf_p;
1361
+ }
1362
+
1363
+ /** Allocate and initialize an input buffer state.
1364
+ * @param file A readable stream.
1365
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1366
+ * @param yyscanner The scanner object.
1367
+ * @return the allocated buffer state.
1368
+ */
1369
+ YY_BUFFER_STATE langscan_java_lex__create_buffer (FILE * file, int size , yyscan_t yyscanner)
1370
+ {
1371
+ YY_BUFFER_STATE b;
1372
+
1373
+ b = (YY_BUFFER_STATE) langscan_java_lex_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1374
+ if ( ! b )
1375
+ YY_FATAL_ERROR( "out of dynamic memory in langscan_java_lex__create_buffer()" );
1376
+
1377
+ b->yy_buf_size = size;
1378
+
1379
+ /* yy_ch_buf has to be 2 characters longer than the size given because
1380
+ * we need to put in 2 end-of-buffer characters.
1381
+ */
1382
+ b->yy_ch_buf = (char *) langscan_java_lex_alloc(b->yy_buf_size + 2 ,yyscanner );
1383
+ if ( ! b->yy_ch_buf )
1384
+ YY_FATAL_ERROR( "out of dynamic memory in langscan_java_lex__create_buffer()" );
1385
+
1386
+ b->yy_is_our_buffer = 1;
1387
+
1388
+ langscan_java_lex__init_buffer(b,file ,yyscanner);
1389
+
1390
+ return b;
1391
+ }
1392
+
1393
+ /** Destroy the buffer.
1394
+ * @param b a buffer created with langscan_java_lex__create_buffer()
1395
+ * @param yyscanner The scanner object.
1396
+ */
1397
+ void langscan_java_lex__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
1398
+ {
1399
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1400
+
1401
+ if ( ! b )
1402
+ return;
1403
+
1404
+ if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1405
+ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1406
+
1407
+ if ( b->yy_is_our_buffer )
1408
+ langscan_java_lex_free((void *) b->yy_ch_buf ,yyscanner );
1409
+
1410
+ langscan_java_lex_free((void *) b ,yyscanner );
1411
+ }
1412
+
1413
+ #ifndef __cplusplus
1414
+ extern int isatty (int );
1415
+ #endif /* __cplusplus */
1416
+
1417
+ /* Initializes or reinitializes a buffer.
1418
+ * This function is sometimes called more than once on the same buffer,
1419
+ * such as during a langscan_java_lex_restart() or at EOF.
1420
+ */
1421
+ static void langscan_java_lex__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
1422
+
1423
+ {
1424
+ int oerrno = errno;
1425
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1426
+
1427
+ langscan_java_lex__flush_buffer(b ,yyscanner);
1428
+
1429
+ b->yy_input_file = file;
1430
+ b->yy_fill_buffer = 1;
1431
+
1432
+ /* If b is the current buffer, then langscan_java_lex__init_buffer was _probably_
1433
+ * called from langscan_java_lex_restart() or through yy_get_next_buffer.
1434
+ * In that case, we don't want to reset the lineno or column.
1435
+ */
1436
+ if (b != YY_CURRENT_BUFFER){
1437
+ b->yy_bs_lineno = 1;
1438
+ b->yy_bs_column = 0;
1439
+ }
1440
+
1441
+ b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1442
+
1443
+ errno = oerrno;
1444
+ }
1445
+
1446
+ /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1447
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1448
+ * @param yyscanner The scanner object.
1449
+ */
1450
+ void langscan_java_lex__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
1451
+ {
1452
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1453
+ if ( ! b )
1454
+ return;
1455
+
1456
+ b->yy_n_chars = 0;
1457
+
1458
+ /* We always need two end-of-buffer characters. The first causes
1459
+ * a transition to the end-of-buffer state. The second causes
1460
+ * a jam in that state.
1461
+ */
1462
+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1463
+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1464
+
1465
+ b->yy_buf_pos = &b->yy_ch_buf[0];
1466
+
1467
+ b->yy_at_bol = 1;
1468
+ b->yy_buffer_status = YY_BUFFER_NEW;
1469
+
1470
+ if ( b == YY_CURRENT_BUFFER )
1471
+ langscan_java_lex__load_buffer_state(yyscanner );
1472
+ }
1473
+
1474
+ /** Pushes the new state onto the stack. The new state becomes
1475
+ * the current state. This function will allocate the stack
1476
+ * if necessary.
1477
+ * @param new_buffer The new state.
1478
+ * @param yyscanner The scanner object.
1479
+ */
1480
+ void langscan_java_lex_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1481
+ {
1482
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1483
+ if (new_buffer == NULL)
1484
+ return;
1485
+
1486
+ langscan_java_lex_ensure_buffer_stack(yyscanner);
1487
+
1488
+ /* This block is copied from langscan_java_lex__switch_to_buffer. */
1489
+ if ( YY_CURRENT_BUFFER )
1490
+ {
1491
+ /* Flush out information for old buffer. */
1492
+ *yyg->yy_c_buf_p = yyg->yy_hold_char;
1493
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1494
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1495
+ }
1496
+
1497
+ /* Only push if top exists. Otherwise, replace top. */
1498
+ if (YY_CURRENT_BUFFER)
1499
+ yyg->yy_buffer_stack_top++;
1500
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
1501
+
1502
+ /* copied from langscan_java_lex__switch_to_buffer. */
1503
+ langscan_java_lex__load_buffer_state(yyscanner );
1504
+ yyg->yy_did_buffer_switch_on_eof = 1;
1505
+ }
1506
+
1507
+ /** Removes and deletes the top of the stack, if present.
1508
+ * The next element becomes the new top.
1509
+ * @param yyscanner The scanner object.
1510
+ */
1511
+ void langscan_java_lex_pop_buffer_state (yyscan_t yyscanner)
1512
+ {
1513
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1514
+ if (!YY_CURRENT_BUFFER)
1515
+ return;
1516
+
1517
+ langscan_java_lex__delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
1518
+ YY_CURRENT_BUFFER_LVALUE = NULL;
1519
+ if (yyg->yy_buffer_stack_top > 0)
1520
+ --yyg->yy_buffer_stack_top;
1521
+
1522
+ if (YY_CURRENT_BUFFER) {
1523
+ langscan_java_lex__load_buffer_state(yyscanner );
1524
+ yyg->yy_did_buffer_switch_on_eof = 1;
1525
+ }
1526
+ }
1527
+
1528
+ /* Allocates the stack if it does not exist.
1529
+ * Guarantees space for at least one push.
1530
+ */
1531
+ static void langscan_java_lex_ensure_buffer_stack (yyscan_t yyscanner)
1532
+ {
1533
+ yy_size_t num_to_alloc;
1534
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1535
+
1536
+ if (!yyg->yy_buffer_stack) {
1537
+
1538
+ /* First allocation is just for 2 elements, since we don't know if this
1539
+ * scanner will even need a stack. We use 2 instead of 1 to avoid an
1540
+ * immediate realloc on the next call.
1541
+ */
1542
+ num_to_alloc = 1;
1543
+ yyg->yy_buffer_stack = (struct yy_buffer_state**)langscan_java_lex_alloc
1544
+ (num_to_alloc * sizeof(struct yy_buffer_state*)
1545
+ , yyscanner);
1546
+ if ( ! yyg->yy_buffer_stack )
1547
+ YY_FATAL_ERROR( "out of dynamic memory in langscan_java_lex_ensure_buffer_stack()" );
1548
+
1549
+ memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1550
+
1551
+ yyg->yy_buffer_stack_max = num_to_alloc;
1552
+ yyg->yy_buffer_stack_top = 0;
1553
+ return;
1554
+ }
1555
+
1556
+ if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
1557
+
1558
+ /* Increase the buffer to prepare for a possible push. */
1559
+ int grow_size = 8 /* arbitrary grow size */;
1560
+
1561
+ num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
1562
+ yyg->yy_buffer_stack = (struct yy_buffer_state**)langscan_java_lex_realloc
1563
+ (yyg->yy_buffer_stack,
1564
+ num_to_alloc * sizeof(struct yy_buffer_state*)
1565
+ , yyscanner);
1566
+ if ( ! yyg->yy_buffer_stack )
1567
+ YY_FATAL_ERROR( "out of dynamic memory in langscan_java_lex_ensure_buffer_stack()" );
1568
+
1569
+ /* zero only the new slots.*/
1570
+ memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
1571
+ yyg->yy_buffer_stack_max = num_to_alloc;
1572
+ }
1573
+ }
1574
+
1575
+ /** Setup the input buffer state to scan directly from a user-specified character buffer.
1576
+ * @param base the character buffer
1577
+ * @param size the size in bytes of the character buffer
1578
+ * @param yyscanner The scanner object.
1579
+ * @return the newly allocated buffer state object.
1580
+ */
1581
+ YY_BUFFER_STATE langscan_java_lex__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
1582
+ {
1583
+ YY_BUFFER_STATE b;
1584
+
1585
+ if ( size < 2 ||
1586
+ base[size-2] != YY_END_OF_BUFFER_CHAR ||
1587
+ base[size-1] != YY_END_OF_BUFFER_CHAR )
1588
+ /* They forgot to leave room for the EOB's. */
1589
+ return 0;
1590
+
1591
+ b = (YY_BUFFER_STATE) langscan_java_lex_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1592
+ if ( ! b )
1593
+ YY_FATAL_ERROR( "out of dynamic memory in langscan_java_lex__scan_buffer()" );
1594
+
1595
+ b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1596
+ b->yy_buf_pos = b->yy_ch_buf = base;
1597
+ b->yy_is_our_buffer = 0;
1598
+ b->yy_input_file = 0;
1599
+ b->yy_n_chars = b->yy_buf_size;
1600
+ b->yy_is_interactive = 0;
1601
+ b->yy_at_bol = 1;
1602
+ b->yy_fill_buffer = 0;
1603
+ b->yy_buffer_status = YY_BUFFER_NEW;
1604
+
1605
+ langscan_java_lex__switch_to_buffer(b ,yyscanner );
1606
+
1607
+ return b;
1608
+ }
1609
+
1610
+ /** Setup the input buffer state to scan a string. The next call to langscan_java_lex_lex() will
1611
+ * scan from a @e copy of @a str.
1612
+ * @param yystr a NUL-terminated string to scan
1613
+ * @param yyscanner The scanner object.
1614
+ * @return the newly allocated buffer state object.
1615
+ * @note If you want to scan bytes that may contain NUL values, then use
1616
+ * langscan_java_lex__scan_bytes() instead.
1617
+ */
1618
+ YY_BUFFER_STATE langscan_java_lex__scan_string (yyconst char * yystr , yyscan_t yyscanner)
1619
+ {
1620
+
1621
+ return langscan_java_lex__scan_bytes(yystr,strlen(yystr) ,yyscanner);
1622
+ }
1623
+
1624
+ /** Setup the input buffer state to scan the given bytes. The next call to langscan_java_lex_lex() will
1625
+ * scan from a @e copy of @a bytes.
1626
+ * @param bytes the byte buffer to scan
1627
+ * @param len the number of bytes in the buffer pointed to by @a bytes.
1628
+ * @param yyscanner The scanner object.
1629
+ * @return the newly allocated buffer state object.
1630
+ */
1631
+ YY_BUFFER_STATE langscan_java_lex__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner)
1632
+ {
1633
+ YY_BUFFER_STATE b;
1634
+ char *buf;
1635
+ yy_size_t n, i;
1636
+
1637
+ /* Get memory for full buffer, including space for trailing EOB's. */
1638
+ n = _yybytes_len + 2;
1639
+ buf = (char *) langscan_java_lex_alloc(n ,yyscanner );
1640
+ if ( ! buf )
1641
+ YY_FATAL_ERROR( "out of dynamic memory in langscan_java_lex__scan_bytes()" );
1642
+
1643
+ for ( i = 0; i < _yybytes_len; ++i )
1644
+ buf[i] = yybytes[i];
1645
+
1646
+ buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1647
+
1648
+ b = langscan_java_lex__scan_buffer(buf,n ,yyscanner);
1649
+ if ( ! b )
1650
+ YY_FATAL_ERROR( "bad buffer in langscan_java_lex__scan_bytes()" );
1651
+
1652
+ /* It's okay to grow etc. this buffer, and we should throw it
1653
+ * away when we're done.
1654
+ */
1655
+ b->yy_is_our_buffer = 1;
1656
+
1657
+ return b;
1658
+ }
1659
+
1660
+ #ifndef YY_EXIT_FAILURE
1661
+ #define YY_EXIT_FAILURE 2
1662
+ #endif
1663
+
1664
+ static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
1665
+ {
1666
+ (void) fprintf( stderr, "%s\n", msg );
1667
+ exit( YY_EXIT_FAILURE );
1668
+ }
1669
+
1670
+ /* Redefine yyless() so it works in section 3 code. */
1671
+
1672
+ #undef yyless
1673
+ #define yyless(n) \
1674
+ do \
1675
+ { \
1676
+ /* Undo effects of setting up yytext. */ \
1677
+ int yyless_macro_arg = (n); \
1678
+ YY_LESS_LINENO(yyless_macro_arg);\
1679
+ yytext[yyleng] = yyg->yy_hold_char; \
1680
+ yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
1681
+ yyg->yy_hold_char = *yyg->yy_c_buf_p; \
1682
+ *yyg->yy_c_buf_p = '\0'; \
1683
+ yyleng = yyless_macro_arg; \
1684
+ } \
1685
+ while ( 0 )
1686
+
1687
+ /* Accessor methods (get/set functions) to struct members. */
1688
+
1689
+ /** Get the user-defined data for this scanner.
1690
+ * @param yyscanner The scanner object.
1691
+ */
1692
+ YY_EXTRA_TYPE langscan_java_lex_get_extra (yyscan_t yyscanner)
1693
+ {
1694
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1695
+ return yyextra;
1696
+ }
1697
+
1698
+ /** Get the current line number.
1699
+ * @param yyscanner The scanner object.
1700
+ */
1701
+ int langscan_java_lex_get_lineno (yyscan_t yyscanner)
1702
+ {
1703
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1704
+
1705
+ if (! YY_CURRENT_BUFFER)
1706
+ return 0;
1707
+
1708
+ return yylineno;
1709
+ }
1710
+
1711
+ /** Get the current column number.
1712
+ * @param yyscanner The scanner object.
1713
+ */
1714
+ int langscan_java_lex_get_column (yyscan_t yyscanner)
1715
+ {
1716
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1717
+
1718
+ if (! YY_CURRENT_BUFFER)
1719
+ return 0;
1720
+
1721
+ return yycolumn;
1722
+ }
1723
+
1724
+ /** Get the input stream.
1725
+ * @param yyscanner The scanner object.
1726
+ */
1727
+ FILE *langscan_java_lex_get_in (yyscan_t yyscanner)
1728
+ {
1729
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1730
+ return yyin;
1731
+ }
1732
+
1733
+ /** Get the output stream.
1734
+ * @param yyscanner The scanner object.
1735
+ */
1736
+ FILE *langscan_java_lex_get_out (yyscan_t yyscanner)
1737
+ {
1738
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1739
+ return yyout;
1740
+ }
1741
+
1742
+ /** Get the length of the current token.
1743
+ * @param yyscanner The scanner object.
1744
+ */
1745
+ yy_size_t langscan_java_lex_get_leng (yyscan_t yyscanner)
1746
+ {
1747
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1748
+ return yyleng;
1749
+ }
1750
+
1751
+ /** Get the current token.
1752
+ * @param yyscanner The scanner object.
1753
+ */
1754
+
1755
+ char *langscan_java_lex_get_text (yyscan_t yyscanner)
1756
+ {
1757
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1758
+ return yytext;
1759
+ }
1760
+
1761
+ /** Set the user-defined data. This data is never touched by the scanner.
1762
+ * @param user_defined The data to be associated with this scanner.
1763
+ * @param yyscanner The scanner object.
1764
+ */
1765
+ void langscan_java_lex_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
1766
+ {
1767
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1768
+ yyextra = user_defined ;
1769
+ }
1770
+
1771
+ /** Set the current line number.
1772
+ * @param line_number
1773
+ * @param yyscanner The scanner object.
1774
+ */
1775
+ void langscan_java_lex_set_lineno (int line_number , yyscan_t yyscanner)
1776
+ {
1777
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1778
+
1779
+ /* lineno is only valid if an input buffer exists. */
1780
+ if (! YY_CURRENT_BUFFER )
1781
+ yy_fatal_error( "langscan_java_lex_set_lineno called with no buffer" , yyscanner);
1782
+
1783
+ yylineno = line_number;
1784
+ }
1785
+
1786
+ /** Set the current column.
1787
+ * @param line_number
1788
+ * @param yyscanner The scanner object.
1789
+ */
1790
+ void langscan_java_lex_set_column (int column_no , yyscan_t yyscanner)
1791
+ {
1792
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1793
+
1794
+ /* column is only valid if an input buffer exists. */
1795
+ if (! YY_CURRENT_BUFFER )
1796
+ yy_fatal_error( "langscan_java_lex_set_column called with no buffer" , yyscanner);
1797
+
1798
+ yycolumn = column_no;
1799
+ }
1800
+
1801
+ /** Set the input stream. This does not discard the current
1802
+ * input buffer.
1803
+ * @param in_str A readable stream.
1804
+ * @param yyscanner The scanner object.
1805
+ * @see langscan_java_lex__switch_to_buffer
1806
+ */
1807
+ void langscan_java_lex_set_in (FILE * in_str , yyscan_t yyscanner)
1808
+ {
1809
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1810
+ yyin = in_str ;
1811
+ }
1812
+
1813
+ void langscan_java_lex_set_out (FILE * out_str , yyscan_t yyscanner)
1814
+ {
1815
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1816
+ yyout = out_str ;
1817
+ }
1818
+
1819
+ int langscan_java_lex_get_debug (yyscan_t yyscanner)
1820
+ {
1821
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1822
+ return yy_flex_debug;
1823
+ }
1824
+
1825
+ void langscan_java_lex_set_debug (int bdebug , yyscan_t yyscanner)
1826
+ {
1827
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1828
+ yy_flex_debug = bdebug ;
1829
+ }
1830
+
1831
+ /* Accessor methods for yylval and yylloc */
1832
+
1833
+ /* User-visible API */
1834
+
1835
+ /* langscan_java_lex_lex_init is special because it creates the scanner itself, so it is
1836
+ * the ONLY reentrant function that doesn't take the scanner as the last argument.
1837
+ * That's why we explicitly handle the declaration, instead of using our macros.
1838
+ */
1839
+
1840
+ int langscan_java_lex_lex_init(yyscan_t* ptr_yy_globals)
1841
+
1842
+ {
1843
+ if (ptr_yy_globals == NULL){
1844
+ errno = EINVAL;
1845
+ return 1;
1846
+ }
1847
+
1848
+ *ptr_yy_globals = (yyscan_t) langscan_java_lex_alloc ( sizeof( struct yyguts_t ), NULL );
1849
+
1850
+ if (*ptr_yy_globals == NULL){
1851
+ errno = ENOMEM;
1852
+ return 1;
1853
+ }
1854
+
1855
+ /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
1856
+ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
1857
+
1858
+ return yy_init_globals ( *ptr_yy_globals );
1859
+ }
1860
+
1861
+ /* langscan_java_lex_lex_init_extra has the same functionality as langscan_java_lex_lex_init, but follows the
1862
+ * convention of taking the scanner as the last argument. Note however, that
1863
+ * this is a *pointer* to a scanner, as it will be allocated by this call (and
1864
+ * is the reason, too, why this function also must handle its own declaration).
1865
+ * The user defined value in the first argument will be available to langscan_java_lex_alloc in
1866
+ * the yyextra field.
1867
+ */
1868
+
1869
+ int langscan_java_lex_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
1870
+
1871
+ {
1872
+ struct yyguts_t dummy_yyguts;
1873
+
1874
+ langscan_java_lex_set_extra (yy_user_defined, &dummy_yyguts);
1875
+
1876
+ if (ptr_yy_globals == NULL){
1877
+ errno = EINVAL;
1878
+ return 1;
1879
+ }
1880
+
1881
+ *ptr_yy_globals = (yyscan_t) langscan_java_lex_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
1882
+
1883
+ if (*ptr_yy_globals == NULL){
1884
+ errno = ENOMEM;
1885
+ return 1;
1886
+ }
1887
+
1888
+ /* By setting to 0xAA, we expose bugs in
1889
+ yy_init_globals. Leave at 0x00 for releases. */
1890
+ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
1891
+
1892
+ langscan_java_lex_set_extra (yy_user_defined, *ptr_yy_globals);
1893
+
1894
+ return yy_init_globals ( *ptr_yy_globals );
1895
+ }
1896
+
1897
+ static int yy_init_globals (yyscan_t yyscanner)
1898
+ {
1899
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1900
+ /* Initialization is the same as for the non-reentrant scanner.
1901
+ * This function is called from langscan_java_lex_lex_destroy(), so don't allocate here.
1902
+ */
1903
+
1904
+ yyg->yy_buffer_stack = 0;
1905
+ yyg->yy_buffer_stack_top = 0;
1906
+ yyg->yy_buffer_stack_max = 0;
1907
+ yyg->yy_c_buf_p = (char *) 0;
1908
+ yyg->yy_init = 0;
1909
+ yyg->yy_start = 0;
1910
+
1911
+ yyg->yy_start_stack_ptr = 0;
1912
+ yyg->yy_start_stack_depth = 0;
1913
+ yyg->yy_start_stack = NULL;
1914
+
1915
+ /* Defined in main.c */
1916
+ #ifdef YY_STDINIT
1917
+ yyin = stdin;
1918
+ yyout = stdout;
1919
+ #else
1920
+ yyin = (FILE *) 0;
1921
+ yyout = (FILE *) 0;
1922
+ #endif
1923
+
1924
+ /* For future reference: Set errno on error, since we are called by
1925
+ * langscan_java_lex_lex_init()
1926
+ */
1927
+ return 0;
1928
+ }
1929
+
1930
+ /* langscan_java_lex_lex_destroy is for both reentrant and non-reentrant scanners. */
1931
+ int langscan_java_lex_lex_destroy (yyscan_t yyscanner)
1932
+ {
1933
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1934
+
1935
+ /* Pop the buffer stack, destroying each element. */
1936
+ while(YY_CURRENT_BUFFER){
1937
+ langscan_java_lex__delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
1938
+ YY_CURRENT_BUFFER_LVALUE = NULL;
1939
+ langscan_java_lex_pop_buffer_state(yyscanner);
1940
+ }
1941
+
1942
+ /* Destroy the stack itself. */
1943
+ langscan_java_lex_free(yyg->yy_buffer_stack ,yyscanner);
1944
+ yyg->yy_buffer_stack = NULL;
1945
+
1946
+ /* Destroy the start condition stack. */
1947
+ langscan_java_lex_free(yyg->yy_start_stack ,yyscanner );
1948
+ yyg->yy_start_stack = NULL;
1949
+
1950
+ /* Reset the globals. This is important in a non-reentrant scanner so the next time
1951
+ * langscan_java_lex_lex() is called, initialization will occur. */
1952
+ yy_init_globals( yyscanner);
1953
+
1954
+ /* Destroy the main struct (reentrant only). */
1955
+ langscan_java_lex_free ( yyscanner , yyscanner );
1956
+ yyscanner = NULL;
1957
+ return 0;
1958
+ }
1959
+
1960
+ /*
1961
+ * Internal utility routines.
1962
+ */
1963
+
1964
+ #ifndef yytext_ptr
1965
+ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
1966
+ {
1967
+ register int i;
1968
+ for ( i = 0; i < n; ++i )
1969
+ s1[i] = s2[i];
1970
+ }
1971
+ #endif
1972
+
1973
+ #ifdef YY_NEED_STRLEN
1974
+ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
1975
+ {
1976
+ register int n;
1977
+ for ( n = 0; s[n]; ++n )
1978
+ ;
1979
+
1980
+ return n;
1981
+ }
1982
+ #endif
1983
+
1984
+ void *langscan_java_lex_alloc (yy_size_t size , yyscan_t yyscanner)
1985
+ {
1986
+ return (void *) malloc( size );
1987
+ }
1988
+
1989
+ void *langscan_java_lex_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
1990
+ {
1991
+ /* The cast to (char *) in the following accommodates both
1992
+ * implementations that use char* generic pointers, and those
1993
+ * that use void* generic pointers. It works with the latter
1994
+ * because both ANSI C and C++ allow castless assignment from
1995
+ * any pointer type to void*, and deal with argument conversions
1996
+ * as though doing an assignment.
1997
+ */
1998
+ return (void *) realloc( (char *) ptr, size );
1999
+ }
2000
+
2001
+ void langscan_java_lex_free (void * ptr , yyscan_t yyscanner)
2002
+ {
2003
+ free( (char *) ptr ); /* see langscan_java_lex_realloc() for (char *) cast */
2004
+ }
2005
+
2006
+ #define YYTABLES_NAME "yytables"
2007
+
2008
+ static void update_pos(
2009
+ langscan_java_lex_extra_t *extra,
2010
+ char *text,
2011
+ int leng)
2012
+ {
2013
+ int i, j;
2014
+ extra->beg_byteno = extra->end_byteno;
2015
+ extra->beg_lineno = extra->end_lineno;
2016
+ extra->beg_columnno = extra->end_columnno;
2017
+ j = 0;
2018
+ for (i = 0; i < leng; i++) {
2019
+ if (text[i] == '\n') {
2020
+ extra->end_lineno++;
2021
+ j = i + 1;
2022
+ extra->end_columnno = 0;
2023
+ }
2024
+ }
2025
+ extra->end_columnno += leng - j;
2026
+ extra->end_byteno += leng;
2027
+ }
2028
+
2029
+ langscan_java_tokenizer_t *langscan_java_make_tokenizer(
2030
+ size_t (*user_read)(void **user_data_p, char *buf, size_t maxlen),
2031
+ void *user_data)
2032
+ {
2033
+ langscan_java_tokenizer_t *tokenizer;
2034
+ langscan_java_lex_extra_t *extra;
2035
+ tokenizer = (langscan_java_tokenizer_t *)malloc(sizeof(langscan_java_tokenizer_t));
2036
+ if (tokenizer == NULL)
2037
+ return NULL;
2038
+ extra = (langscan_java_lex_extra_t *)malloc(sizeof(langscan_java_lex_extra_t));
2039
+ if (extra == NULL)
2040
+ return NULL;
2041
+ extra->user_read = user_read;
2042
+ extra->user_data = user_data;
2043
+ extra->beg_lineno = 1;
2044
+ extra->beg_columnno = 0;
2045
+ extra->beg_byteno = 0;
2046
+ extra->end_lineno = 1;
2047
+ extra->end_columnno = 0;
2048
+ extra->end_byteno = 0;
2049
+ extra->eof = 0;
2050
+ tokenizer->extra = extra;
2051
+ langscan_java_lex_lex_init(&tokenizer->scanner);
2052
+ langscan_java_lex_set_extra(extra, tokenizer->scanner);
2053
+ return tokenizer;
2054
+ }
2055
+
2056
+ langscan_java_token_t langscan_java_get_token(langscan_java_tokenizer_t *tokenizer)
2057
+ {
2058
+ return langscan_java_lex_lex(tokenizer->scanner);
2059
+ }
2060
+
2061
+ void langscan_java_free_tokenizer(langscan_java_tokenizer_t *tokenizer)
2062
+ {
2063
+ langscan_java_lex_extra_t *extra = langscan_java_lex_get_extra(tokenizer->scanner);
2064
+ free((void *)extra);
2065
+ langscan_java_lex_lex_destroy(tokenizer->scanner);
2066
+ free((void *)tokenizer);
2067
+ }
2068
+
2069
+ user_read_t langscan_java_tokenizer_get_user_read(langscan_java_tokenizer_t *tokenizer)
2070
+ {
2071
+ return tokenizer->extra->user_read;
2072
+ }
2073
+
2074
+ void *langscan_java_tokenizer_get_user_data(langscan_java_tokenizer_t *tokenizer)
2075
+ {
2076
+ return tokenizer->extra->user_data;
2077
+ }
2078
+
2079
+ const char *langscan_java_token_name(langscan_java_token_t token)
2080
+ {
2081
+ static char *token_names[] = {
2082
+ "*eof*",
2083
+ #define LANGSCAN_JAVA_TOKEN(name) #name,
2084
+ LANGSCAN_JAVA_TOKEN_LIST
2085
+ #undef LANGSCAN_JAVA_TOKEN
2086
+ };
2087
+
2088
+ return token_names[token];
2089
+ }
2090
+