langscan 1.2-x86-mswin32-60

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