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,188 @@
1
+
2
+ SHELL = /bin/sh
3
+
4
+ #### Start of system configuration section. ####
5
+
6
+ srcdir = .
7
+ topdir = C:/usr/ruby/lib/ruby/1.8/i386-mswin32
8
+ hdrdir = $(topdir)
9
+ VPATH = $(srcdir);$(topdir);$(hdrdir)
10
+
11
+ DESTDIR = C:
12
+ exec_prefix = $(prefix)
13
+ prefix = $(DESTDIR)/usr/ruby
14
+ sharedstatedir = $(DESTDIR)/etc
15
+ mandir = $(prefix)/man
16
+ oldincludedir = $(DESTDIR)/usr/include
17
+ bindir = $(exec_prefix)/bin
18
+ libexecdir = $(exec_prefix)/libexec
19
+ sitedir = $(prefix)/lib/ruby/site_ruby
20
+ vendorarchdir = $(vendorlibdir)/$(sitearch)
21
+ includedir = $(prefix)/include
22
+ infodir = $(prefix)/info
23
+ vendorlibdir = $(vendordir)/$(ruby_version)
24
+ sysconfdir = $(prefix)/etc
25
+ libdir = $(exec_prefix)/lib
26
+ sbindir = $(exec_prefix)/sbin
27
+ rubylibdir = $(libdir)/ruby/$(ruby_version)
28
+ vendordir = $(prefix)/lib/ruby/vendor_ruby
29
+ archdir = $(rubylibdir)/$(arch)
30
+ sitearchdir = $(sitelibdir)/$(sitearch)
31
+ datadir = $(prefix)/share
32
+ localstatedir = $(DESTDIR)/var
33
+ sitelibdir = $(sitedir)/$(ruby_version)
34
+
35
+ CC = cl -nologo
36
+ LIBRUBY = $(RUBY_SO_NAME).lib
37
+ LIBRUBY_A = $(RUBY_SO_NAME)-static.lib
38
+ LIBRUBYARG_SHARED = $(LIBRUBY)
39
+ LIBRUBYARG_STATIC = $(LIBRUBY_A)
40
+
41
+ RUBY_EXTCONF_H =
42
+ CFLAGS = -MT -Zi -O2b2xg- -G6
43
+ INCFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir)
44
+ DEFS =
45
+ CPPFLAGS =
46
+ CXXFLAGS = $(CFLAGS)
47
+ ldflags =
48
+ dldflags = -link -incremental:no -debug -opt:ref -opt:icf -dll $(LIBPATH)
49
+ archflag =
50
+ DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
51
+ LDSHARED = cl -nologo -LD
52
+ AR = lib -nologo
53
+ EXEEXT = .exe
54
+
55
+ RUBY_INSTALL_NAME = ruby
56
+ RUBY_SO_NAME = msvcrt-ruby18
57
+ arch = i386-mswin32
58
+ sitearch = i386-msvcrt
59
+ ruby_version = 1.8
60
+ ruby = C:/usr/ruby/bin/ruby
61
+ RUBY = $(ruby:/=\)
62
+ RM = $(RUBY) -run -e rm -- -f
63
+ MAKEDIRS = @$(RUBY) -run -e mkdir -- -p
64
+ INSTALL = @$(RUBY) -run -e install -- -vp
65
+ INSTALL_PROG = $(INSTALL) -m 0755
66
+ INSTALL_DATA = $(INSTALL) -m 0644
67
+ COPY = copy > nul
68
+
69
+ #### End of system configuration section. ####
70
+
71
+ preload =
72
+
73
+ libpath = . $(libdir)
74
+ LIBPATH = -libpath:"." -libpath:"$(libdir)"
75
+ DEFFILE = $(TARGET)-$(arch).def
76
+
77
+ CLEANFILES = mkmf.log
78
+ DISTCLEANFILES = vc*.pdb $(DEFFILE)
79
+
80
+ extout =
81
+ extout_prefix =
82
+ target_prefix = /langscan/php
83
+ LOCAL_LIBS =
84
+ LIBS = $(LIBRUBYARG_SHARED) oldnames.lib user32.lib advapi32.lib shell32.lib ws2_32.lib
85
+ SRCS = php.c phptok.c
86
+ OBJS = php.obj phptok.obj
87
+ TARGET = php
88
+ DLLIB = $(TARGET).so
89
+ EXTSTATIC =
90
+ STATIC_LIB =
91
+
92
+ BINDIR = $(bindir)
93
+ RUBYCOMMONDIR = $(sitedir)$(target_prefix)
94
+ RUBYLIBDIR = C:/devel/gem/git/langscan/pkg/langscan-1.2.gem.build/lib$(target_prefix)
95
+ RUBYARCHDIR = C:/devel/gem/git/langscan/pkg/langscan-1.2.gem.build/lib$(target_prefix)
96
+
97
+ TARGET_SO = $(DLLIB)
98
+ CLEANLIBS = $(TARGET).so $(TARGET).il? $(TARGET).tds $(TARGET).map
99
+ CLEANOBJS = *.obj *.lib *.s[ol] *.pdb *.exp *.bak
100
+
101
+ all: $(DLLIB)
102
+ static: $(STATIC_LIB)
103
+
104
+ clean:
105
+ @-$(RM) $(CLEANLIBS:/=\) $(CLEANOBJS:/=\) $(CLEANFILES:/=\)
106
+
107
+ distclean: clean
108
+ @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
109
+ @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES:/=\)
110
+
111
+ realclean: distclean
112
+ install: install-so install-rb
113
+
114
+ install-so: $(RUBYARCHDIR)
115
+ install-so: $(RUBYARCHDIR)/$(DLLIB)
116
+ $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
117
+ $(INSTALL_PROG) $(DLLIB:/=\) $(RUBYARCHDIR:/=\)
118
+ install-rb: pre-install-rb install-rb-default
119
+ install-rb-default: pre-install-rb-default
120
+ pre-install-rb: Makefile
121
+ pre-install-rb-default: Makefile
122
+ $(RUBYARCHDIR):
123
+ $(MAKEDIRS) $@
124
+
125
+ site-install: site-install-so site-install-rb
126
+ site-install-so: install-so
127
+ site-install-rb: install-rb
128
+
129
+ .SUFFIXES: .c .m .cc .cxx .cpp .obj
130
+
131
+ {$(hdrdir)}.cc{}.obj:
132
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
133
+
134
+ {$(topdir)}.cc{}.obj:
135
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
136
+
137
+ {$(srcdir)}.cc{}.obj:
138
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
139
+
140
+ .cc.obj:
141
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
142
+
143
+ {$(hdrdir)}.cxx{}.obj:
144
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
145
+
146
+ {$(topdir)}.cxx{}.obj:
147
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
148
+
149
+ {$(srcdir)}.cxx{}.obj:
150
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
151
+
152
+ .cxx.obj:
153
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
154
+
155
+ {$(hdrdir)}.cpp{}.obj:
156
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
157
+
158
+ {$(topdir)}.cpp{}.obj:
159
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
160
+
161
+ {$(srcdir)}.cpp{}.obj:
162
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
163
+
164
+ .cpp.obj:
165
+ $(CXX) $(INCFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c -Tp$(<:\=/)
166
+
167
+ {$(hdrdir)}.c{}.obj:
168
+ $(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) -c -Tc$(<:\=/)
169
+
170
+ {$(topdir)}.c{}.obj:
171
+ $(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) -c -Tc$(<:\=/)
172
+
173
+ {$(srcdir)}.c{}.obj:
174
+ $(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) -c -Tc$(<:\=/)
175
+
176
+ .c.obj:
177
+ $(CC) $(INCFLAGS) $(CFLAGS) $(CPPFLAGS) -c -Tc$(<:\=/)
178
+
179
+ $(DLLIB): $(DEFFILE) $(OBJS) Makefile
180
+ @-$(RM) $@
181
+ $(LDSHARED) -Fe$(@) $(OBJS) $(LIBS) $(LOCAL_LIBS) $(DLDFLAGS) -implib:$(*F:.so=)-$(arch).lib -pdb:$(*F:.so=)-$(arch).pdb -def:$(DEFFILE)
182
+
183
+
184
+
185
+ $(DEFFILE):
186
+ $(RUBY) -e "puts 'EXPORTS', 'Init_$(TARGET)'" > $@
187
+
188
+ $(OBJS): {.;$(VPATH)}ruby.h {.;$(VPATH)}defines.h
@@ -0,0 +1,3 @@
1
+ require "mkmf"
2
+ dir_config( 'include' )
3
+ create_makefile('langscan/php/php')
@@ -0,0 +1,134 @@
1
+ /* -*- mode: C; indent-tabs-mode: nil; c-basic-offset: 2 c-style: "BSD" -*- */
2
+ /*
3
+ * _template.c - a template file for LangScan modules
4
+ *
5
+ * Copyright (C) 2004-2005 Akira Tanaka <akr@m17n.org>
6
+ * All rights reserved.
7
+ * This is free software with ABSOLUTELY NO WARRANTY.
8
+ *
9
+ * You can redistribute it and/or modify it under the terms of
10
+ * the GNU General Public License version 2.
11
+ */
12
+
13
+
14
+ #include <ruby.h>
15
+ #include "php.h"
16
+
17
+ static VALUE token_symbol_list[
18
+ #define LANGSCAN_PHP_TOKEN(token) 1 +
19
+ 1 + LANGSCAN_PHP_TOKEN_LIST 0
20
+ #undef LANGSCAN_PHP_TOKEN
21
+ ];
22
+
23
+ #ifndef RSTRING_PTR
24
+ # define RSTRING_PTR(str) (RSTRING(str)->ptr)
25
+ #endif
26
+ #ifndef RSTRING_LEN
27
+ # define RSTRING_LEN(str) (RSTRING(str)->len)
28
+ #endif
29
+
30
+ #ifndef RARRAY_PTR
31
+ # define RARRAY_PTR(str) (RARRAY(str)->ptr)
32
+ #endif
33
+ #ifndef RARRAY_LEN
34
+ # define RARRAY_LEN(str) (RARRAY(str)->len)
35
+ #endif
36
+
37
+ static size_t user_read_str(void **user_data_p, char *buf, size_t maxlen)
38
+ {
39
+ VALUE user_data = (VALUE)*user_data_p;
40
+ VALUE user_str = RARRAY_PTR(user_data)[0];
41
+ VALUE user_off = RARRAY_PTR(user_data)[1];
42
+ long off = NUM2LONG(user_off);
43
+ if (RSTRING_LEN(user_str)-off < maxlen) {
44
+ maxlen = RSTRING_LEN(user_str)-off;
45
+ }
46
+ memcpy(buf, RSTRING_PTR(user_str)+off, maxlen);
47
+ RARRAY_PTR(user_data)[1] = LONG2NUM(off+maxlen);
48
+ return maxlen;
49
+ }
50
+
51
+ static void tokenizer_mark(langscan_php_tokenizer_t *tokenizer)
52
+ {
53
+ if (tokenizer == NULL)
54
+ return;
55
+ rb_gc_mark((VALUE)langscan_php_tokenizer_get_user_data(tokenizer));
56
+ }
57
+
58
+ static void tokenizer_free(langscan_php_tokenizer_t *tokenizer)
59
+ {
60
+ if (tokenizer == NULL)
61
+ return;
62
+ langscan_php_free_tokenizer(tokenizer);
63
+ }
64
+
65
+ static VALUE tokenizer_s_allocate(VALUE klass)
66
+ {
67
+ return Data_Wrap_Struct(klass, tokenizer_mark, tokenizer_free, NULL);
68
+ }
69
+
70
+ static VALUE tokenizer_initialize(VALUE self, VALUE user_data)
71
+ {
72
+ VALUE tmp;
73
+ user_read_t user_read;
74
+ langscan_php_tokenizer_t *tokenizer;
75
+ Data_Get_Struct(self, langscan_php_tokenizer_t, tokenizer);
76
+ StringValue(user_data);
77
+ user_read = user_read_str;
78
+ user_data = rb_ary_new3(2, rb_str_new4(user_data), INT2FIX(0));
79
+ RBASIC(user_data)->klass = 0;
80
+ DATA_PTR(self) = langscan_php_make_tokenizer(user_read, (void *)user_data);
81
+ return self;
82
+ }
83
+
84
+ static VALUE tokenizer_get_token(VALUE self)
85
+ {
86
+ langscan_php_tokenizer_t *tokenizer;
87
+ langscan_php_token_t token;
88
+ Data_Get_Struct(self, langscan_php_tokenizer_t, tokenizer);
89
+ if (tokenizer == NULL) { return Qnil; }
90
+ token = langscan_php_get_token(tokenizer);
91
+ if (token == langscan_php_eof) {
92
+ DATA_PTR(self) = NULL;
93
+ langscan_php_free_tokenizer(tokenizer);
94
+ return Qnil;
95
+ }
96
+ return rb_ary_new3(8,
97
+ token_symbol_list[token],
98
+ rb_str_new(langscan_php_curtoken_text(tokenizer), langscan_php_curtoken_leng(tokenizer)),
99
+ INT2NUM(langscan_php_curtoken_beg_lineno(tokenizer)),
100
+ INT2NUM(langscan_php_curtoken_beg_columnno(tokenizer)),
101
+ INT2NUM(langscan_php_curtoken_beg_byteno(tokenizer)),
102
+ INT2NUM(langscan_php_curtoken_end_lineno(tokenizer)),
103
+ INT2NUM(langscan_php_curtoken_end_columnno(tokenizer)),
104
+ INT2NUM(langscan_php_curtoken_end_byteno(tokenizer)));
105
+ }
106
+
107
+ static VALUE tokenizer_close(VALUE self)
108
+ {
109
+ langscan_php_tokenizer_t *tokenizer;
110
+ Data_Get_Struct(self, langscan_php_tokenizer_t, tokenizer);
111
+ if (tokenizer == NULL) { return Qnil; }
112
+ DATA_PTR(self) = NULL;
113
+ langscan_php_free_tokenizer(tokenizer);
114
+ return Qnil;
115
+ }
116
+
117
+ void Init_php()
118
+ {
119
+ VALUE LangScan = rb_define_module("LangScan");
120
+ VALUE LangScan_PHP = rb_define_module_under(LangScan, "PHP");
121
+ VALUE Tokenizer = rb_define_class_under(LangScan_PHP, "Tokenizer", rb_cData);
122
+ langscan_php_token_t token_id;
123
+
124
+ token_id = 0;
125
+ token_symbol_list[token_id++] = Qnil;
126
+ #define LANGSCAN_PHP_TOKEN(token) token_symbol_list[token_id++] = ID2SYM(rb_intern(#token));
127
+ LANGSCAN_PHP_TOKEN_LIST
128
+ #undef LANGSCAN_PHP_TOKEN
129
+
130
+ rb_define_alloc_func(Tokenizer, tokenizer_s_allocate);
131
+ rb_define_method(Tokenizer, "initialize", tokenizer_initialize, 1);
132
+ rb_define_method(Tokenizer, "get_token", tokenizer_get_token, 0);
133
+ rb_define_method(Tokenizer, "close", tokenizer_close, 0);
134
+ }
@@ -0,0 +1,64 @@
1
+ #ifndef LANGSCAN_PHP_H
2
+ #define LANGSCAN_PHP_H
3
+
4
+ #define LANGSCAN_PHP_TOKEN_LIST \
5
+ LANGSCAN_PHP_TOKEN(integer) \
6
+ LANGSCAN_PHP_TOKEN(floating) \
7
+ LANGSCAN_PHP_TOKEN(string) \
8
+ LANGSCAN_PHP_TOKEN(ident) \
9
+ LANGSCAN_PHP_TOKEN(keyword) \
10
+ LANGSCAN_PHP_TOKEN(fundef) \
11
+ LANGSCAN_PHP_TOKEN(funcall) \
12
+ LANGSCAN_PHP_TOKEN(classdef) \
13
+ LANGSCAN_PHP_TOKEN(punct) \
14
+ LANGSCAN_PHP_TOKEN(comment) \
15
+ LANGSCAN_PHP_TOKEN(space)
16
+
17
+ typedef enum {
18
+ langscan_php_eof = 0,
19
+ #define LANGSCAN_PHP_TOKEN(name) langscan_php_##name,
20
+ LANGSCAN_PHP_TOKEN_LIST
21
+ #undef LANGSCAN_PHP_TOKEN
22
+ } langscan_php_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_php_lex_extra_t;
37
+
38
+ typedef struct langscan_php_tokenizer_tag {
39
+ langscan_php_lex_extra_t *extra;
40
+ void *scanner;
41
+ } langscan_php_tokenizer_t;
42
+
43
+ typedef size_t (*user_read_t)(void **user_data_p, char *buf, size_t maxlen);
44
+
45
+ langscan_php_tokenizer_t *langscan_php_make_tokenizer(user_read_t user_read, void *user_data);
46
+ langscan_php_token_t langscan_php_get_token(langscan_php_tokenizer_t *tokenizer);
47
+ void langscan_php_free_tokenizer(langscan_php_tokenizer_t *tokenizer);
48
+
49
+ user_read_t langscan_php_tokenizer_get_user_read(langscan_php_tokenizer_t *tokenizer);
50
+ void *langscan_php_tokenizer_get_user_data(langscan_php_tokenizer_t *tokenizer);
51
+
52
+ const char *langscan_php_token_name(langscan_php_token_t token);
53
+ #define langscan_php_curtoken_beg_lineno(tokenizer) ((tokenizer)->extra->beg_lineno)
54
+ #define langscan_php_curtoken_beg_columnno(tokenizer) ((tokenizer)->extra->beg_columnno)
55
+ #define langscan_php_curtoken_beg_byteno(tokenizer) ((tokenizer)->extra->beg_byteno)
56
+ #define langscan_php_curtoken_end_lineno(tokenizer) ((tokenizer)->extra->end_lineno)
57
+ #define langscan_php_curtoken_end_columnno(tokenizer) ((tokenizer)->extra->end_columnno)
58
+ #define langscan_php_curtoken_end_byteno(tokenizer) ((tokenizer)->extra->end_byteno)
59
+ #define langscan_php_curtoken_text(tokenizer) ((tokenizer)->extra->text)
60
+ #define langscan_php_curtoken_leng(tokenizer) ((tokenizer)->extra->leng)
61
+
62
+ void langscan_php_extract_functions(langscan_php_tokenizer_t *);
63
+
64
+ #endif
@@ -0,0 +1,2413 @@
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_php_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_php_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_php_lex_restart (FILE *input_file ,yyscan_t yyscanner );
289
+ void langscan_php_lex__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
290
+ YY_BUFFER_STATE langscan_php_lex__create_buffer (FILE *file,int size ,yyscan_t yyscanner );
291
+ void langscan_php_lex__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
292
+ void langscan_php_lex__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
293
+ void langscan_php_lex_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
294
+ void langscan_php_lex_pop_buffer_state (yyscan_t yyscanner );
295
+
296
+ static void langscan_php_lex_ensure_buffer_stack (yyscan_t yyscanner );
297
+ static void langscan_php_lex__load_buffer_state (yyscan_t yyscanner );
298
+ static void langscan_php_lex__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
299
+
300
+ #define YY_FLUSH_BUFFER langscan_php_lex__flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
301
+
302
+ YY_BUFFER_STATE langscan_php_lex__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
303
+ YY_BUFFER_STATE langscan_php_lex__scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
304
+ YY_BUFFER_STATE langscan_php_lex__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
305
+
306
+ void *langscan_php_lex_alloc (yy_size_t ,yyscan_t yyscanner );
307
+ void *langscan_php_lex_realloc (void *,yy_size_t ,yyscan_t yyscanner );
308
+ void langscan_php_lex_free (void * ,yyscan_t yyscanner );
309
+
310
+ #define yy_new_buffer langscan_php_lex__create_buffer
311
+
312
+ #define yy_set_interactive(is_interactive) \
313
+ { \
314
+ if ( ! YY_CURRENT_BUFFER ){ \
315
+ langscan_php_lex_ensure_buffer_stack (yyscanner); \
316
+ YY_CURRENT_BUFFER_LVALUE = \
317
+ langscan_php_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_php_lex_ensure_buffer_stack (yyscanner); \
326
+ YY_CURRENT_BUFFER_LVALUE = \
327
+ langscan_php_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_php_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 31
361
+ #define YY_END_OF_BUFFER 32
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[179] =
370
+ { 0,
371
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
372
+ 8, 8, 32, 4, 4, 5, 30, 22, 23, 23,
373
+ 24, 30, 13, 17, 17, 14, 17, 30, 17, 17,
374
+ 17, 30, 17, 17, 17, 17, 17, 26, 26, 17,
375
+ 17, 17, 17, 17, 29, 29, 29, 29, 29, 17,
376
+ 31, 7, 7, 31, 8, 10, 10, 9, 4, 0,
377
+ 2, 2, 0, 22, 23, 24, 24, 24, 0, 0,
378
+ 24, 13, 14, 19, 0, 25, 0, 29, 19, 20,
379
+ 16, 0, 0, 27, 27, 26, 0, 0, 0, 16,
380
+ 0, 16, 0, 28, 29, 29, 29, 29, 29, 0,
381
+
382
+ 7, 7, 6, 6, 0, 0, 8, 10, 9, 2,
383
+ 2, 0, 0, 0, 0, 18, 29, 0, 27, 0,
384
+ 26, 0, 15, 16, 29, 29, 0, 0, 0, 21,
385
+ 0, 27, 0, 29, 29, 0, 0, 0, 27, 0,
386
+ 11, 29, 3, 0, 0, 29, 0, 0, 29, 0,
387
+ 0, 12, 0, 0, 0, 0, 0, 0, 0, 0,
388
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
389
+ 0, 0, 0, 0, 0, 0, 1, 0
390
+ } ;
391
+
392
+ static yyconst flex_int32_t yy_ec[256] =
393
+ { 0,
394
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
395
+ 1, 4, 5, 1, 1, 1, 1, 1, 1, 1,
396
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
397
+ 1, 2, 6, 7, 8, 9, 10, 11, 12, 13,
398
+ 14, 15, 16, 14, 17, 18, 19, 20, 21, 21,
399
+ 21, 21, 21, 21, 21, 21, 21, 22, 23, 24,
400
+ 25, 26, 27, 14, 28, 29, 29, 30, 31, 29,
401
+ 32, 32, 32, 32, 32, 32, 32, 33, 34, 32,
402
+ 32, 35, 32, 32, 32, 32, 32, 36, 32, 32,
403
+ 14, 37, 14, 38, 32, 1, 39, 29, 40, 29,
404
+
405
+ 41, 42, 43, 44, 45, 32, 32, 46, 32, 47,
406
+ 48, 49, 32, 50, 51, 52, 53, 32, 32, 54,
407
+ 32, 32, 14, 55, 14, 14, 32, 32, 32, 32,
408
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
409
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
410
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
411
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
412
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
413
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
414
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
415
+
416
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
417
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
418
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
419
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
420
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
421
+ 32, 32, 32, 32, 32
422
+ } ;
423
+
424
+ static yyconst flex_int32_t yy_meta[56] =
425
+ { 0,
426
+ 1, 2, 2, 1, 2, 1, 1, 1, 1, 1,
427
+ 1, 1, 2, 1, 1, 1, 1, 1, 1, 3,
428
+ 3, 1, 1, 1, 1, 1, 1, 4, 4, 4,
429
+ 4, 5, 5, 5, 5, 5, 1, 1, 4, 4,
430
+ 4, 4, 5, 5, 5, 5, 5, 5, 5, 5,
431
+ 5, 5, 5, 5, 1
432
+ } ;
433
+
434
+ static yyconst flex_int16_t yy_base[195] =
435
+ { 0,
436
+ 0, 1, 25, 0, 80, 0, 135, 0, 190, 0,
437
+ 245, 0, 645, 620, 619, 291, 732, 3, 732, 639,
438
+ 299, 0, 0, 732, 1, 0, 616, 296, 0, 280,
439
+ 296, 298, 615, 292, 294, 295, 309, 309, 318, 617,
440
+ 322, 287, 297, 612, 349, 8, 353, 362, 366, 289,
441
+ 3, 732, 634, 419, 634, 732, 632, 0, 610, 333,
442
+ 607, 312, 587, 10, 732, 367, 732, 620, 592, 600,
443
+ 371, 0, 0, 587, 346, 732, 605, 0, 732, 732,
444
+ 732, 320, 601, 365, 368, 372, 1, 0, 552, 376,
445
+ 575, 564, 402, 732, 473, 477, 482, 486, 491, 375,
446
+
447
+ 732, 584, 732, 580, 0, 392, 577, 732, 0, 732,
448
+ 732, 534, 527, 559, 395, 732, 0, 6, 477, 391,
449
+ 0, 533, 732, 498, 507, 511, 522, 518, 540, 732,
450
+ 396, 485, 503, 524, 528, 537, 499, 532, 501, 500,
451
+ 541, 547, 732, 484, 486, 554, 559, 482, 563, 567,
452
+ 579, 583, 493, 588, 481, 480, 466, 476, 459, 451,
453
+ 592, 596, 604, 617, 434, 432, 433, 374, 358, 342,
454
+ 324, 296, 623, 324, 313, 628, 732, 732, 666, 671,
455
+ 676, 679, 682, 687, 689, 694, 698, 703, 706, 711,
456
+ 714, 717, 721, 726
457
+
458
+ } ;
459
+
460
+ static yyconst flex_int16_t yy_def[195] =
461
+ { 0,
462
+ 179, 179, 178, 3, 178, 5, 178, 7, 178, 9,
463
+ 178, 11, 178, 180, 180, 180, 178, 178, 178, 178,
464
+ 181, 178, 182, 178, 178, 183, 178, 184, 185, 178,
465
+ 178, 186, 178, 178, 178, 178, 178, 178, 178, 178,
466
+ 178, 178, 178, 178, 187, 187, 187, 187, 187, 178,
467
+ 188, 178, 178, 178, 178, 178, 178, 189, 180, 180,
468
+ 178, 178, 178, 178, 178, 181, 178, 178, 181, 190,
469
+ 181, 182, 183, 178, 184, 178, 184, 191, 178, 178,
470
+ 178, 186, 186, 178, 178, 178, 178, 192, 178, 178,
471
+ 178, 178, 178, 178, 187, 187, 187, 187, 187, 188,
472
+
473
+ 178, 178, 178, 178, 54, 188, 178, 178, 189, 178,
474
+ 178, 178, 178, 190, 193, 178, 191, 178, 178, 178,
475
+ 192, 178, 178, 187, 187, 187, 178, 178, 194, 178,
476
+ 178, 178, 178, 187, 187, 178, 178, 194, 178, 178,
477
+ 187, 187, 178, 178, 178, 187, 178, 178, 187, 178,
478
+ 178, 187, 178, 178, 178, 178, 178, 178, 178, 178,
479
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
480
+ 178, 178, 178, 178, 178, 178, 178, 0, 178, 178,
481
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
482
+ 178, 178, 178, 178
483
+
484
+ } ;
485
+
486
+ static yyconst flex_int16_t yy_nxt[788] =
487
+ { 0,
488
+ 178, 178, 15, 15, 64, 101, 64, 102, 178, 93,
489
+ 93, 64, 93, 64, 70, 70, 120, 120, 71, 71,
490
+ 94, 131, 131, 16, 16, 17, 18, 19, 18, 20,
491
+ 17, 17, 21, 17, 17, 17, 17, 17, 17, 17,
492
+ 17, 17, 17, 22, 17, 17, 17, 17, 17, 17,
493
+ 17, 17, 23, 23, 23, 23, 23, 23, 23, 23,
494
+ 23, 17, 17, 23, 23, 23, 23, 23, 23, 23,
495
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 17,
496
+ 17, 18, 19, 18, 20, 24, 17, 21, 24, 24,
497
+ 24, 17, 24, 24, 24, 24, 24, 24, 25, 17,
498
+
499
+ 17, 24, 24, 24, 24, 24, 24, 26, 26, 26,
500
+ 26, 26, 26, 26, 26, 26, 17, 24, 26, 26,
501
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
502
+ 26, 26, 26, 26, 24, 17, 18, 19, 18, 20,
503
+ 27, 28, 21, 29, 30, 31, 32, 24, 24, 33,
504
+ 34, 35, 36, 37, 38, 39, 40, 24, 41, 42,
505
+ 43, 44, 45, 46, 46, 46, 46, 46, 46, 46,
506
+ 47, 17, 33, 46, 48, 46, 49, 46, 46, 46,
507
+ 46, 46, 46, 46, 46, 46, 46, 46, 46, 50,
508
+ 51, 51, 52, 51, 53, 51, 51, 51, 51, 51,
509
+
510
+ 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
511
+ 51, 51, 51, 51, 51, 51, 51, 54, 54, 54,
512
+ 54, 54, 54, 54, 54, 54, 51, 51, 54, 54,
513
+ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
514
+ 54, 54, 54, 54, 51, 17, 55, 56, 17, 57,
515
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
516
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
517
+ 17, 17, 58, 58, 58, 58, 58, 58, 58, 58,
518
+ 58, 17, 17, 58, 58, 58, 58, 58, 58, 58,
519
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 17,
520
+
521
+ 61, 67, 76, 68, 79, 80, 81, 81, 69, 76,
522
+ 81, 91, 81, 79, 84, 84, 79, 62, 79, 79,
523
+ 79, 79, 92, 70, 173, 69, 85, 71, 86, 86,
524
+ 173, 76, 77, 79, 83, 85, 111, 86, 86, 87,
525
+ 89, 63, 178, 81, 175, 90, 79, 81, 87, 87,
526
+ 93, 93, 76, 93, 93, 93, 83, 93, 87, 178,
527
+ 112, 94, 88, 93, 93, 94, 93, 93, 93, 67,
528
+ 93, 68, 174, 67, 94, 68, 69, 101, 94, 102,
529
+ 69, 96, 77, 178, 84, 84, 97, 119, 119, 85,
530
+ 173, 86, 86, 69, 103, 118, 104, 69, 118, 123,
531
+
532
+ 116, 172, 87, 93, 93, 118, 93, 98, 118, 115,
533
+ 132, 132, 87, 130, 94, 139, 139, 171, 99, 100,
534
+ 100, 103, 100, 104, 100, 100, 100, 100, 100, 100,
535
+ 100, 100, 100, 100, 100, 100, 100, 100, 105, 105,
536
+ 100, 106, 100, 100, 100, 100, 105, 105, 105, 105,
537
+ 105, 105, 105, 105, 105, 100, 100, 105, 105, 105,
538
+ 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
539
+ 105, 105, 105, 100, 93, 93, 170, 93, 93, 93,
540
+ 169, 93, 168, 93, 93, 94, 93, 93, 93, 94,
541
+ 93, 161, 93, 93, 94, 93, 119, 119, 94, 93,
542
+
543
+ 93, 160, 93, 94, 132, 132, 124, 118, 93, 93,
544
+ 94, 93, 93, 93, 159, 93, 124, 118, 158, 94,
545
+ 139, 139, 157, 94, 125, 93, 93, 156, 93, 93,
546
+ 93, 155, 93, 151, 148, 147, 94, 126, 143, 143,
547
+ 94, 143, 93, 93, 145, 93, 115, 144, 93, 93,
548
+ 135, 93, 140, 94, 115, 93, 93, 134, 93, 94,
549
+ 150, 150, 137, 150, 93, 93, 94, 93, 150, 150,
550
+ 136, 150, 133, 115, 141, 94, 128, 127, 107, 142,
551
+ 154, 154, 103, 154, 93, 93, 101, 93, 116, 154,
552
+ 154, 146, 154, 162, 162, 94, 162, 162, 162, 116,
553
+
554
+ 162, 149, 122, 178, 80, 164, 164, 178, 164, 152,
555
+ 165, 116, 153, 80, 115, 166, 163, 178, 164, 164,
556
+ 163, 164, 67, 165, 176, 176, 113, 176, 166, 176,
557
+ 176, 110, 176, 60, 108, 107, 101, 80, 81, 79,
558
+ 74, 65, 60, 60, 178, 178, 178, 178, 177, 178,
559
+ 178, 178, 167, 177, 178, 178, 178, 178, 178, 178,
560
+ 178, 178, 178, 178, 178, 167, 14, 14, 14, 14,
561
+ 14, 59, 59, 59, 59, 59, 66, 66, 66, 66,
562
+ 66, 72, 72, 72, 73, 73, 73, 75, 75, 75,
563
+ 75, 75, 78, 78, 82, 82, 82, 82, 82, 95,
564
+
565
+ 95, 95, 95, 100, 100, 100, 100, 100, 109, 109,
566
+ 109, 114, 114, 114, 114, 114, 117, 117, 117, 121,
567
+ 121, 129, 129, 129, 129, 129, 138, 138, 138, 138,
568
+ 138, 13, 178, 178, 178, 178, 178, 178, 178, 178,
569
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
570
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
571
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
572
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
573
+ 178, 178, 178, 178, 178, 178, 178
574
+ } ;
575
+
576
+ static yyconst flex_int16_t yy_chk[788] =
577
+ { 0,
578
+ 0, 0, 1, 2, 18, 51, 18, 51, 0, 46,
579
+ 46, 64, 46, 64, 22, 25, 87, 87, 22, 25,
580
+ 46, 118, 118, 1, 2, 3, 3, 3, 3, 3,
581
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
582
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
583
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
584
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
585
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
586
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
587
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
588
+
589
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
590
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
591
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
592
+ 5, 5, 5, 5, 5, 7, 7, 7, 7, 7,
593
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
594
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
595
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
596
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
597
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
598
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
599
+
600
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
601
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
602
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
603
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
604
+ 9, 9, 9, 9, 9, 11, 11, 11, 11, 11,
605
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
606
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
607
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
608
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
609
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
610
+
611
+ 16, 21, 28, 21, 30, 30, 31, 34, 21, 32,
612
+ 35, 42, 42, 50, 36, 36, 34, 16, 35, 36,
613
+ 31, 43, 43, 37, 175, 21, 38, 37, 38, 38,
614
+ 174, 82, 28, 37, 32, 39, 62, 39, 39, 38,
615
+ 41, 16, 60, 50, 172, 41, 41, 41, 39, 38,
616
+ 45, 45, 75, 45, 47, 47, 82, 47, 39, 60,
617
+ 62, 45, 38, 48, 48, 47, 48, 49, 49, 66,
618
+ 49, 66, 171, 71, 48, 71, 66, 100, 49, 100,
619
+ 71, 45, 75, 60, 84, 84, 47, 85, 85, 86,
620
+ 170, 86, 86, 66, 106, 84, 106, 71, 85, 90,
621
+
622
+ 90, 169, 86, 93, 93, 84, 93, 48, 85, 115,
623
+ 120, 120, 86, 115, 93, 131, 131, 168, 49, 54,
624
+ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
625
+ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
626
+ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
627
+ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
628
+ 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
629
+ 54, 54, 54, 54, 95, 95, 167, 95, 96, 96,
630
+ 166, 96, 165, 97, 97, 95, 97, 98, 98, 96,
631
+ 98, 160, 99, 99, 97, 99, 119, 119, 98, 124,
632
+
633
+ 124, 159, 124, 99, 132, 132, 96, 119, 125, 125,
634
+ 124, 125, 126, 126, 158, 126, 97, 119, 157, 125,
635
+ 139, 139, 156, 126, 98, 134, 134, 155, 134, 135,
636
+ 135, 153, 135, 148, 145, 144, 134, 99, 136, 136,
637
+ 135, 136, 141, 141, 140, 141, 138, 137, 142, 142,
638
+ 126, 142, 133, 141, 129, 146, 146, 125, 146, 142,
639
+ 147, 147, 128, 147, 149, 149, 146, 149, 150, 150,
640
+ 127, 150, 122, 114, 134, 149, 113, 112, 107, 135,
641
+ 151, 151, 104, 151, 152, 152, 102, 152, 92, 154,
642
+ 154, 142, 154, 161, 161, 152, 161, 162, 162, 91,
643
+
644
+ 162, 146, 89, 83, 151, 163, 163, 77, 163, 149,
645
+ 163, 74, 150, 154, 70, 163, 161, 69, 164, 164,
646
+ 162, 164, 68, 164, 173, 173, 63, 173, 164, 176,
647
+ 176, 61, 176, 59, 57, 55, 53, 44, 40, 33,
648
+ 27, 20, 15, 14, 13, 0, 0, 0, 173, 0,
649
+ 0, 0, 163, 176, 0, 0, 0, 0, 0, 0,
650
+ 0, 0, 0, 0, 0, 164, 179, 179, 179, 179,
651
+ 179, 180, 180, 180, 180, 180, 181, 181, 181, 181,
652
+ 181, 182, 182, 182, 183, 183, 183, 184, 184, 184,
653
+ 184, 184, 185, 185, 186, 186, 186, 186, 186, 187,
654
+
655
+ 187, 187, 187, 188, 188, 188, 188, 188, 189, 189,
656
+ 189, 190, 190, 190, 190, 190, 191, 191, 191, 192,
657
+ 192, 193, 193, 193, 193, 193, 194, 194, 194, 194,
658
+ 194, 178, 178, 178, 178, 178, 178, 178, 178, 178,
659
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
660
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
661
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
662
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
663
+ 178, 178, 178, 178, 178, 178, 178
664
+ } ;
665
+
666
+ /* The intent behind this definition is that it'll catch
667
+ * any uses of REJECT which flex missed.
668
+ */
669
+ #define REJECT reject_used_but_not_detected
670
+ #define yymore() yymore_used_but_not_detected
671
+ #define YY_MORE_ADJ 0
672
+ #define YY_RESTORE_YY_MORE_OFFSET
673
+ /*
674
+ * phptok.l - a lex rule for PHP
675
+ *
676
+ * Copyright (C) 2005 MATSUNO Tokuhiro <tokuhirom at yahoo.co.jp>
677
+ * All rights reserved.
678
+ * This is free software with ABSOLUTELY NO WARRANTY.
679
+ *
680
+ * You can redistribute it and/or modify it under the terms of
681
+ * the GNU General Public License version 2.
682
+ */
683
+
684
+ #include "php.h"
685
+
686
+ #define YY_EXTRA_TYPE langscan_php_lex_extra_t *
687
+
688
+ #if YY_NULL != 0
689
+ #error "YY_NULL is not 0."
690
+ #endif
691
+
692
+ #define YY_DECL langscan_php_token_t langscan_php_lex_lex(yyscan_t yyscanner)
693
+
694
+ #define YY_INPUT(buf,result,max_size) \
695
+ if (!yyextra->eof) { \
696
+ result = yyextra->user_read(&(yyextra->user_data), (buf), (max_size)); \
697
+ if (result == 0) \
698
+ yyextra->eof = 1; \
699
+ }
700
+
701
+ #define UPD update_pos(yyextra, yytext, yyleng)
702
+ static void update_pos(langscan_php_lex_extra_t *, char *, int);
703
+
704
+ #define report(token) \
705
+ do { \
706
+ yyextra->text = yytext; \
707
+ yyextra->leng = yyleng; \
708
+ return langscan_php_##token; \
709
+ } while (0)
710
+
711
+ char *heredocident=NULL;
712
+ int heredocidentlen=0;
713
+
714
+ #define INITIAL 0
715
+ #define CLASSDEF 1
716
+ #define FUNDEF 2
717
+ #define SCRIPT 3
718
+ #define HEREDOC 4
719
+ #define HEREDOCBEG 5
720
+
721
+ #ifndef YY_EXTRA_TYPE
722
+ #define YY_EXTRA_TYPE void *
723
+ #endif
724
+
725
+ /* Holds the entire state of the reentrant scanner. */
726
+ struct yyguts_t
727
+ {
728
+
729
+ /* User-defined. Not touched by flex. */
730
+ YY_EXTRA_TYPE yyextra_r;
731
+
732
+ /* The rest are the same as the globals declared in the non-reentrant scanner. */
733
+ FILE *yyin_r, *yyout_r;
734
+ size_t yy_buffer_stack_top; /**< index of top of stack. */
735
+ size_t yy_buffer_stack_max; /**< capacity of stack. */
736
+ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
737
+ char yy_hold_char;
738
+ int yy_n_chars;
739
+ int yyleng_r;
740
+ char *yy_c_buf_p;
741
+ int yy_init;
742
+ int yy_start;
743
+ int yy_did_buffer_switch_on_eof;
744
+ int yy_start_stack_ptr;
745
+ int yy_start_stack_depth;
746
+ int *yy_start_stack;
747
+ yy_state_type yy_last_accepting_state;
748
+ char* yy_last_accepting_cpos;
749
+
750
+ int yylineno_r;
751
+ int yy_flex_debug_r;
752
+
753
+ char *yytext_r;
754
+ int yy_more_flag;
755
+ int yy_more_len;
756
+
757
+ }; /* end struct yyguts_t */
758
+
759
+ static int yy_init_globals (yyscan_t yyscanner );
760
+
761
+ int langscan_php_lex_lex_init (yyscan_t* scanner);
762
+
763
+ int langscan_php_lex_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
764
+
765
+ /* Accessor methods to globals.
766
+ These are made visible to non-reentrant scanners for convenience. */
767
+
768
+ int langscan_php_lex_lex_destroy (yyscan_t yyscanner );
769
+
770
+ int langscan_php_lex_get_debug (yyscan_t yyscanner );
771
+
772
+ void langscan_php_lex_set_debug (int debug_flag ,yyscan_t yyscanner );
773
+
774
+ YY_EXTRA_TYPE langscan_php_lex_get_extra (yyscan_t yyscanner );
775
+
776
+ void langscan_php_lex_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
777
+
778
+ FILE *langscan_php_lex_get_in (yyscan_t yyscanner );
779
+
780
+ void langscan_php_lex_set_in (FILE * in_str ,yyscan_t yyscanner );
781
+
782
+ FILE *langscan_php_lex_get_out (yyscan_t yyscanner );
783
+
784
+ void langscan_php_lex_set_out (FILE * out_str ,yyscan_t yyscanner );
785
+
786
+ int langscan_php_lex_get_leng (yyscan_t yyscanner );
787
+
788
+ char *langscan_php_lex_get_text (yyscan_t yyscanner );
789
+
790
+ int langscan_php_lex_get_lineno (yyscan_t yyscanner );
791
+
792
+ void langscan_php_lex_set_lineno (int line_number ,yyscan_t yyscanner );
793
+
794
+ /* Macros after this point can all be overridden by user definitions in
795
+ * section 1.
796
+ */
797
+
798
+ #ifndef YY_SKIP_YYWRAP
799
+ #ifdef __cplusplus
800
+ extern "C" int langscan_php_lex_wrap (yyscan_t yyscanner );
801
+ #else
802
+ extern int langscan_php_lex_wrap (yyscan_t yyscanner );
803
+ #endif
804
+ #endif
805
+
806
+ static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner);
807
+
808
+ #ifndef yytext_ptr
809
+ static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
810
+ #endif
811
+
812
+ #ifdef YY_NEED_STRLEN
813
+ static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
814
+ #endif
815
+
816
+ #ifndef YY_NO_INPUT
817
+
818
+ #ifdef __cplusplus
819
+ static int yyinput (yyscan_t yyscanner );
820
+ #else
821
+ static int input (yyscan_t yyscanner );
822
+ #endif
823
+
824
+ #endif
825
+
826
+ /* Amount of stuff to slurp up with each read. */
827
+ #ifndef YY_READ_BUF_SIZE
828
+ #ifdef __ia64__
829
+ /* On IA-64, the buffer size is 16k, not 8k */
830
+ #define YY_READ_BUF_SIZE 16384
831
+ #else
832
+ #define YY_READ_BUF_SIZE 8192
833
+ #endif /* __ia64__ */
834
+ #endif
835
+
836
+ /* Copy whatever the last rule matched to the standard output. */
837
+ #ifndef ECHO
838
+ /* This used to be an fputs(), but since the string might contain NUL's,
839
+ * we now use fwrite().
840
+ */
841
+ #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
842
+ #endif
843
+
844
+ /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
845
+ * is returned in "result".
846
+ */
847
+ #ifndef YY_INPUT
848
+ #define YY_INPUT(buf,result,max_size) \
849
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
850
+ { \
851
+ int c = '*'; \
852
+ size_t n; \
853
+ for ( n = 0; n < max_size && \
854
+ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
855
+ buf[n] = (char) c; \
856
+ if ( c == '\n' ) \
857
+ buf[n++] = (char) c; \
858
+ if ( c == EOF && ferror( yyin ) ) \
859
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
860
+ result = n; \
861
+ } \
862
+ else \
863
+ { \
864
+ errno=0; \
865
+ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
866
+ { \
867
+ if( errno != EINTR) \
868
+ { \
869
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
870
+ break; \
871
+ } \
872
+ errno=0; \
873
+ clearerr(yyin); \
874
+ } \
875
+ }\
876
+ \
877
+
878
+ #endif
879
+
880
+ /* No semi-colon after return; correct usage is to write "yyterminate();" -
881
+ * we don't want an extra ';' after the "return" because that will cause
882
+ * some compilers to complain about unreachable statements.
883
+ */
884
+ #ifndef yyterminate
885
+ #define yyterminate() return YY_NULL
886
+ #endif
887
+
888
+ /* Number of entries by which start-condition stack grows. */
889
+ #ifndef YY_START_STACK_INCR
890
+ #define YY_START_STACK_INCR 25
891
+ #endif
892
+
893
+ /* Report a fatal error. */
894
+ #ifndef YY_FATAL_ERROR
895
+ #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
896
+ #endif
897
+
898
+ /* end tables serialization structures and prototypes */
899
+
900
+ /* Default declaration of generated scanner - a define so the user can
901
+ * easily add parameters.
902
+ */
903
+ #ifndef YY_DECL
904
+ #define YY_DECL_IS_OURS 1
905
+
906
+ extern int langscan_php_lex_lex (yyscan_t yyscanner);
907
+
908
+ #define YY_DECL int langscan_php_lex_lex (yyscan_t yyscanner)
909
+ #endif /* !YY_DECL */
910
+
911
+ /* Code executed at the beginning of each rule, after yytext and yyleng
912
+ * have been set up.
913
+ */
914
+ #ifndef YY_USER_ACTION
915
+ #define YY_USER_ACTION
916
+ #endif
917
+
918
+ /* Code executed at the end of each rule. */
919
+ #ifndef YY_BREAK
920
+ #define YY_BREAK break;
921
+ #endif
922
+
923
+ #define YY_RULE_SETUP \
924
+ YY_USER_ACTION
925
+
926
+ /** The main scanner function which does all the work.
927
+ */
928
+ YY_DECL
929
+ {
930
+ register yy_state_type yy_current_state;
931
+ register char *yy_cp, *yy_bp;
932
+ register int yy_act;
933
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
934
+
935
+ if ( !yyg->yy_init )
936
+ {
937
+ yyg->yy_init = 1;
938
+
939
+ #ifdef YY_USER_INIT
940
+ YY_USER_INIT;
941
+ #endif
942
+
943
+ if ( ! yyg->yy_start )
944
+ yyg->yy_start = 1; /* first start state */
945
+
946
+ if ( ! yyin )
947
+ yyin = stdin;
948
+
949
+ if ( ! yyout )
950
+ yyout = stdout;
951
+
952
+ if ( ! YY_CURRENT_BUFFER ) {
953
+ langscan_php_lex_ensure_buffer_stack (yyscanner);
954
+ YY_CURRENT_BUFFER_LVALUE =
955
+ langscan_php_lex__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
956
+ }
957
+
958
+ langscan_php_lex__load_buffer_state(yyscanner );
959
+ }
960
+
961
+ while ( 1 ) /* loops until end-of-file is reached */
962
+ {
963
+ yy_cp = yyg->yy_c_buf_p;
964
+
965
+ /* Support of yytext. */
966
+ *yy_cp = yyg->yy_hold_char;
967
+
968
+ /* yy_bp points to the position in yy_ch_buf of the start of
969
+ * the current run.
970
+ */
971
+ yy_bp = yy_cp;
972
+
973
+ yy_current_state = yyg->yy_start;
974
+ yy_match:
975
+ do
976
+ {
977
+ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
978
+ if ( yy_accept[yy_current_state] )
979
+ {
980
+ yyg->yy_last_accepting_state = yy_current_state;
981
+ yyg->yy_last_accepting_cpos = yy_cp;
982
+ }
983
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
984
+ {
985
+ yy_current_state = (int) yy_def[yy_current_state];
986
+ if ( yy_current_state >= 179 )
987
+ yy_c = yy_meta[(unsigned int) yy_c];
988
+ }
989
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
990
+ ++yy_cp;
991
+ }
992
+ while ( yy_base[yy_current_state] != 732 );
993
+
994
+ yy_find_action:
995
+ yy_act = yy_accept[yy_current_state];
996
+ if ( yy_act == 0 )
997
+ { /* have to back up */
998
+ yy_cp = yyg->yy_last_accepting_cpos;
999
+ yy_current_state = yyg->yy_last_accepting_state;
1000
+ yy_act = yy_accept[yy_current_state];
1001
+ }
1002
+
1003
+ YY_DO_BEFORE_ACTION;
1004
+
1005
+ do_action: /* This label is used only to access EOF actions. */
1006
+
1007
+ switch ( yy_act )
1008
+ { /* beginning of action switch */
1009
+ case 0: /* must back up */
1010
+ /* undo the effects of YY_DO_BEFORE_ACTION */
1011
+ *yy_cp = yyg->yy_hold_char;
1012
+ yy_cp = yyg->yy_last_accepting_cpos;
1013
+ yy_current_state = yyg->yy_last_accepting_state;
1014
+ goto yy_find_action;
1015
+
1016
+ case 1:
1017
+ /* rule 1 can match eol */
1018
+ YY_RULE_SETUP
1019
+ { UPD; BEGIN(SCRIPT); report(ident);}
1020
+ YY_BREAK
1021
+ case 2:
1022
+ YY_RULE_SETUP
1023
+ { UPD; BEGIN(SCRIPT); report(ident);}
1024
+ YY_BREAK
1025
+ case 3:
1026
+ /* rule 3 can match eol */
1027
+ YY_RULE_SETUP
1028
+ { UPD; BEGIN(SCRIPT); report(ident);}
1029
+ YY_BREAK
1030
+ case 4:
1031
+ /* rule 4 can match eol */
1032
+ YY_RULE_SETUP
1033
+ { UPD; report(comment);}
1034
+ YY_BREAK
1035
+ case 5:
1036
+ YY_RULE_SETUP
1037
+ { UPD; report(comment);}
1038
+ YY_BREAK
1039
+ case 6:
1040
+ /* rule 6 can match eol */
1041
+ YY_RULE_SETUP
1042
+ {
1043
+ int identlen = strpbrk(yytext, ";\r\n")-yytext;
1044
+ if (heredocidentlen==identlen && !strncmp(heredocident, yytext, identlen)) {
1045
+ free(heredocident);
1046
+ heredocident = NULL;
1047
+ BEGIN(SCRIPT);
1048
+ yyless(0);
1049
+ } else {
1050
+ UPD;
1051
+ report(string);
1052
+ }
1053
+ }
1054
+ YY_BREAK
1055
+ case 7:
1056
+ /* rule 7 can match eol */
1057
+ YY_RULE_SETUP
1058
+ { UPD; report(string);}
1059
+ YY_BREAK
1060
+ case 8:
1061
+ YY_RULE_SETUP
1062
+ { UPD; report(space); }
1063
+ YY_BREAK
1064
+ case 9:
1065
+ YY_RULE_SETUP
1066
+ { UPD; heredocident=strdup(yytext); heredocidentlen=yyleng; report(ident); }
1067
+ YY_BREAK
1068
+ case 10:
1069
+ /* rule 10 can match eol */
1070
+ YY_RULE_SETUP
1071
+ { UPD;
1072
+ if(heredocident) {
1073
+ BEGIN(HEREDOC);
1074
+ report(space);
1075
+ } else { /* invalid here-document */
1076
+ BEGIN(SCRIPT);
1077
+ report(space);
1078
+ }
1079
+ }
1080
+ YY_BREAK
1081
+ case 11:
1082
+ YY_RULE_SETUP
1083
+ { UPD; BEGIN(CLASSDEF); report(keyword); }
1084
+ YY_BREAK
1085
+ case 12:
1086
+ YY_RULE_SETUP
1087
+ { UPD; BEGIN(FUNDEF); report(keyword); }
1088
+ YY_BREAK
1089
+ case 13:
1090
+ YY_RULE_SETUP
1091
+ { UPD; BEGIN(SCRIPT); report(classdef); }
1092
+ YY_BREAK
1093
+ case 14:
1094
+ YY_RULE_SETUP
1095
+ { UPD; BEGIN(SCRIPT); report(fundef); }
1096
+ YY_BREAK
1097
+ case 15:
1098
+ YY_RULE_SETUP
1099
+ { UPD; BEGIN(HEREDOCBEG); report(punct); }
1100
+ YY_BREAK
1101
+ case 16:
1102
+ YY_RULE_SETUP
1103
+ { UPD; report(punct); }
1104
+ YY_BREAK
1105
+ case 17:
1106
+ YY_RULE_SETUP
1107
+ { UPD; report(punct); }
1108
+ YY_BREAK
1109
+ case 18:
1110
+ YY_RULE_SETUP
1111
+ { UPD; report(punct); }
1112
+ YY_BREAK
1113
+ case 19:
1114
+ YY_RULE_SETUP
1115
+ { UPD; report(punct); }
1116
+ YY_BREAK
1117
+ case 20:
1118
+ /* rule 20 can match eol */
1119
+ YY_RULE_SETUP
1120
+ { UPD; BEGIN(INITIAL); report(ident);}
1121
+ YY_BREAK
1122
+ case 21:
1123
+ /* rule 21 can match eol */
1124
+ YY_RULE_SETUP
1125
+ { UPD; report(comment);}
1126
+ YY_BREAK
1127
+ case 22:
1128
+ YY_RULE_SETUP
1129
+ { UPD; report(space); }
1130
+ YY_BREAK
1131
+ case 23:
1132
+ /* rule 23 can match eol */
1133
+ YY_RULE_SETUP
1134
+ { UPD; report(space); }
1135
+ YY_BREAK
1136
+ case 24:
1137
+ /* rule 24 can match eol */
1138
+ YY_RULE_SETUP
1139
+ { UPD; report(comment); }
1140
+ YY_BREAK
1141
+ case 25:
1142
+ /* rule 25 can match eol */
1143
+ YY_RULE_SETUP
1144
+ { UPD; report(string); }
1145
+ YY_BREAK
1146
+ case 26:
1147
+ YY_RULE_SETUP
1148
+ { UPD; report(integer); }
1149
+ YY_BREAK
1150
+ case 27:
1151
+ YY_RULE_SETUP
1152
+ { UPD; report(floating); }
1153
+ YY_BREAK
1154
+ case 28:
1155
+ /* rule 28 can match eol */
1156
+ YY_RULE_SETUP
1157
+ { yyless(strpbrk(yytext, " \t\b\f\r\n(")-yytext); UPD; report(funcall); }
1158
+ YY_BREAK
1159
+ case 29:
1160
+ YY_RULE_SETUP
1161
+ { UPD; report(ident); }
1162
+ YY_BREAK
1163
+ case 30:
1164
+ YY_RULE_SETUP
1165
+ { UPD; fprintf(stderr, "Token Error : %s\n", yytext); report(punct); }
1166
+ YY_BREAK
1167
+ case 31:
1168
+ YY_RULE_SETUP
1169
+ YY_FATAL_ERROR( "flex scanner jammed" );
1170
+ YY_BREAK
1171
+ case YY_STATE_EOF(INITIAL):
1172
+ case YY_STATE_EOF(CLASSDEF):
1173
+ case YY_STATE_EOF(FUNDEF):
1174
+ case YY_STATE_EOF(SCRIPT):
1175
+ case YY_STATE_EOF(HEREDOC):
1176
+ case YY_STATE_EOF(HEREDOCBEG):
1177
+ yyterminate();
1178
+
1179
+ case YY_END_OF_BUFFER:
1180
+ {
1181
+ /* Amount of text matched not including the EOB char. */
1182
+ int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1183
+
1184
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
1185
+ *yy_cp = yyg->yy_hold_char;
1186
+ YY_RESTORE_YY_MORE_OFFSET
1187
+
1188
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1189
+ {
1190
+ /* We're scanning a new file or input source. It's
1191
+ * possible that this happened because the user
1192
+ * just pointed yyin at a new source and called
1193
+ * langscan_php_lex_lex(). If so, then we have to assure
1194
+ * consistency between YY_CURRENT_BUFFER and our
1195
+ * globals. Here is the right place to do so, because
1196
+ * this is the first action (other than possibly a
1197
+ * back-up) that will match for the new input source.
1198
+ */
1199
+ yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1200
+ YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1201
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1202
+ }
1203
+
1204
+ /* Note that here we test for yy_c_buf_p "<=" to the position
1205
+ * of the first EOB in the buffer, since yy_c_buf_p will
1206
+ * already have been incremented past the NUL character
1207
+ * (since all states make transitions on EOB to the
1208
+ * end-of-buffer state). Contrast this with the test
1209
+ * in input().
1210
+ */
1211
+ if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1212
+ { /* This was really a NUL. */
1213
+ yy_state_type yy_next_state;
1214
+
1215
+ yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1216
+
1217
+ yy_current_state = yy_get_previous_state( yyscanner );
1218
+
1219
+ /* Okay, we're now positioned to make the NUL
1220
+ * transition. We couldn't have
1221
+ * yy_get_previous_state() go ahead and do it
1222
+ * for us because it doesn't know how to deal
1223
+ * with the possibility of jamming (and we don't
1224
+ * want to build jamming into it because then it
1225
+ * will run more slowly).
1226
+ */
1227
+
1228
+ yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1229
+
1230
+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1231
+
1232
+ if ( yy_next_state )
1233
+ {
1234
+ /* Consume the NUL. */
1235
+ yy_cp = ++yyg->yy_c_buf_p;
1236
+ yy_current_state = yy_next_state;
1237
+ goto yy_match;
1238
+ }
1239
+
1240
+ else
1241
+ {
1242
+ yy_cp = yyg->yy_c_buf_p;
1243
+ goto yy_find_action;
1244
+ }
1245
+ }
1246
+
1247
+ else switch ( yy_get_next_buffer( yyscanner ) )
1248
+ {
1249
+ case EOB_ACT_END_OF_FILE:
1250
+ {
1251
+ yyg->yy_did_buffer_switch_on_eof = 0;
1252
+
1253
+ if ( langscan_php_lex_wrap(yyscanner ) )
1254
+ {
1255
+ /* Note: because we've taken care in
1256
+ * yy_get_next_buffer() to have set up
1257
+ * yytext, we can now set up
1258
+ * yy_c_buf_p so that if some total
1259
+ * hoser (like flex itself) wants to
1260
+ * call the scanner after we return the
1261
+ * YY_NULL, it'll still work - another
1262
+ * YY_NULL will get returned.
1263
+ */
1264
+ yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1265
+
1266
+ yy_act = YY_STATE_EOF(YY_START);
1267
+ goto do_action;
1268
+ }
1269
+
1270
+ else
1271
+ {
1272
+ if ( ! yyg->yy_did_buffer_switch_on_eof )
1273
+ YY_NEW_FILE;
1274
+ }
1275
+ break;
1276
+ }
1277
+
1278
+ case EOB_ACT_CONTINUE_SCAN:
1279
+ yyg->yy_c_buf_p =
1280
+ yyg->yytext_ptr + yy_amount_of_matched_text;
1281
+
1282
+ yy_current_state = yy_get_previous_state( yyscanner );
1283
+
1284
+ yy_cp = yyg->yy_c_buf_p;
1285
+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1286
+ goto yy_match;
1287
+
1288
+ case EOB_ACT_LAST_MATCH:
1289
+ yyg->yy_c_buf_p =
1290
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1291
+
1292
+ yy_current_state = yy_get_previous_state( yyscanner );
1293
+
1294
+ yy_cp = yyg->yy_c_buf_p;
1295
+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1296
+ goto yy_find_action;
1297
+ }
1298
+ break;
1299
+ }
1300
+
1301
+ default:
1302
+ YY_FATAL_ERROR(
1303
+ "fatal flex scanner internal error--no action found" );
1304
+ } /* end of action switch */
1305
+ } /* end of scanning one token */
1306
+ } /* end of langscan_php_lex_lex */
1307
+
1308
+ /* yy_get_next_buffer - try to read in a new buffer
1309
+ *
1310
+ * Returns a code representing an action:
1311
+ * EOB_ACT_LAST_MATCH -
1312
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1313
+ * EOB_ACT_END_OF_FILE - end of file
1314
+ */
1315
+ static int yy_get_next_buffer (yyscan_t yyscanner)
1316
+ {
1317
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1318
+ register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1319
+ register char *source = yyg->yytext_ptr;
1320
+ register int number_to_move, i;
1321
+ int ret_val;
1322
+
1323
+ if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1324
+ YY_FATAL_ERROR(
1325
+ "fatal flex scanner internal error--end of buffer missed" );
1326
+
1327
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1328
+ { /* Don't try to fill the buffer, so this is an EOF. */
1329
+ if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1330
+ {
1331
+ /* We matched a single character, the EOB, so
1332
+ * treat this as a final EOF.
1333
+ */
1334
+ return EOB_ACT_END_OF_FILE;
1335
+ }
1336
+
1337
+ else
1338
+ {
1339
+ /* We matched some text prior to the EOB, first
1340
+ * process it.
1341
+ */
1342
+ return EOB_ACT_LAST_MATCH;
1343
+ }
1344
+ }
1345
+
1346
+ /* Try to read more data. */
1347
+
1348
+ /* First move last chars to start of buffer. */
1349
+ number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
1350
+
1351
+ for ( i = 0; i < number_to_move; ++i )
1352
+ *(dest++) = *(source++);
1353
+
1354
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1355
+ /* don't do the read, it's not guaranteed to return an EOF,
1356
+ * just force an EOF
1357
+ */
1358
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1359
+
1360
+ else
1361
+ {
1362
+ int num_to_read =
1363
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1364
+
1365
+ while ( num_to_read <= 0 )
1366
+ { /* Not enough room in the buffer - grow it. */
1367
+
1368
+ /* just a shorter name for the current buffer */
1369
+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1370
+
1371
+ int yy_c_buf_p_offset =
1372
+ (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
1373
+
1374
+ if ( b->yy_is_our_buffer )
1375
+ {
1376
+ int new_size = b->yy_buf_size * 2;
1377
+
1378
+ if ( new_size <= 0 )
1379
+ b->yy_buf_size += b->yy_buf_size / 8;
1380
+ else
1381
+ b->yy_buf_size *= 2;
1382
+
1383
+ b->yy_ch_buf = (char *)
1384
+ /* Include room in for 2 EOB chars. */
1385
+ langscan_php_lex_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
1386
+ }
1387
+ else
1388
+ /* Can't grow it, we don't own it. */
1389
+ b->yy_ch_buf = 0;
1390
+
1391
+ if ( ! b->yy_ch_buf )
1392
+ YY_FATAL_ERROR(
1393
+ "fatal error - scanner input buffer overflow" );
1394
+
1395
+ yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1396
+
1397
+ num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1398
+ number_to_move - 1;
1399
+
1400
+ }
1401
+
1402
+ if ( num_to_read > YY_READ_BUF_SIZE )
1403
+ num_to_read = YY_READ_BUF_SIZE;
1404
+
1405
+ /* Read in more data. */
1406
+ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1407
+ yyg->yy_n_chars, (size_t) num_to_read );
1408
+
1409
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1410
+ }
1411
+
1412
+ if ( yyg->yy_n_chars == 0 )
1413
+ {
1414
+ if ( number_to_move == YY_MORE_ADJ )
1415
+ {
1416
+ ret_val = EOB_ACT_END_OF_FILE;
1417
+ langscan_php_lex_restart(yyin ,yyscanner);
1418
+ }
1419
+
1420
+ else
1421
+ {
1422
+ ret_val = EOB_ACT_LAST_MATCH;
1423
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1424
+ YY_BUFFER_EOF_PENDING;
1425
+ }
1426
+ }
1427
+
1428
+ else
1429
+ ret_val = EOB_ACT_CONTINUE_SCAN;
1430
+
1431
+ if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1432
+ /* Extend the array by 50%, plus the number we really need. */
1433
+ yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1434
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) langscan_php_lex_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
1435
+ if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1436
+ YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1437
+ }
1438
+
1439
+ yyg->yy_n_chars += number_to_move;
1440
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1441
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1442
+
1443
+ yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1444
+
1445
+ return ret_val;
1446
+ }
1447
+
1448
+ /* yy_get_previous_state - get the state just before the EOB char was reached */
1449
+
1450
+ static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1451
+ {
1452
+ register yy_state_type yy_current_state;
1453
+ register char *yy_cp;
1454
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1455
+
1456
+ yy_current_state = yyg->yy_start;
1457
+
1458
+ for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1459
+ {
1460
+ register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1461
+ if ( yy_accept[yy_current_state] )
1462
+ {
1463
+ yyg->yy_last_accepting_state = yy_current_state;
1464
+ yyg->yy_last_accepting_cpos = yy_cp;
1465
+ }
1466
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1467
+ {
1468
+ yy_current_state = (int) yy_def[yy_current_state];
1469
+ if ( yy_current_state >= 179 )
1470
+ yy_c = yy_meta[(unsigned int) yy_c];
1471
+ }
1472
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1473
+ }
1474
+
1475
+ return yy_current_state;
1476
+ }
1477
+
1478
+ /* yy_try_NUL_trans - try to make a transition on the NUL character
1479
+ *
1480
+ * synopsis
1481
+ * next_state = yy_try_NUL_trans( current_state );
1482
+ */
1483
+ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
1484
+ {
1485
+ register int yy_is_jam;
1486
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
1487
+ register char *yy_cp = yyg->yy_c_buf_p;
1488
+
1489
+ register YY_CHAR yy_c = 1;
1490
+ if ( yy_accept[yy_current_state] )
1491
+ {
1492
+ yyg->yy_last_accepting_state = yy_current_state;
1493
+ yyg->yy_last_accepting_cpos = yy_cp;
1494
+ }
1495
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1496
+ {
1497
+ yy_current_state = (int) yy_def[yy_current_state];
1498
+ if ( yy_current_state >= 179 )
1499
+ yy_c = yy_meta[(unsigned int) yy_c];
1500
+ }
1501
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1502
+ yy_is_jam = (yy_current_state == 178);
1503
+
1504
+ return yy_is_jam ? 0 : yy_current_state;
1505
+ }
1506
+
1507
+ static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
1508
+ {
1509
+ register char *yy_cp;
1510
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1511
+
1512
+ yy_cp = yyg->yy_c_buf_p;
1513
+
1514
+ /* undo effects of setting up yytext */
1515
+ *yy_cp = yyg->yy_hold_char;
1516
+
1517
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1518
+ { /* need to shift things up to make room */
1519
+ /* +2 for EOB chars. */
1520
+ register int number_to_move = yyg->yy_n_chars + 2;
1521
+ register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1522
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1523
+ register char *source =
1524
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1525
+
1526
+ while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1527
+ *--dest = *--source;
1528
+
1529
+ yy_cp += (int) (dest - source);
1530
+ yy_bp += (int) (dest - source);
1531
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1532
+ yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1533
+
1534
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1535
+ YY_FATAL_ERROR( "flex scanner push-back overflow" );
1536
+ }
1537
+
1538
+ *--yy_cp = (char) c;
1539
+
1540
+ yyg->yytext_ptr = yy_bp;
1541
+ yyg->yy_hold_char = *yy_cp;
1542
+ yyg->yy_c_buf_p = yy_cp;
1543
+ }
1544
+
1545
+ #ifndef YY_NO_INPUT
1546
+ #ifdef __cplusplus
1547
+ static int yyinput (yyscan_t yyscanner)
1548
+ #else
1549
+ static int input (yyscan_t yyscanner)
1550
+ #endif
1551
+
1552
+ {
1553
+ int c;
1554
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1555
+
1556
+ *yyg->yy_c_buf_p = yyg->yy_hold_char;
1557
+
1558
+ if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1559
+ {
1560
+ /* yy_c_buf_p now points to the character we want to return.
1561
+ * If this occurs *before* the EOB characters, then it's a
1562
+ * valid NUL; if not, then we've hit the end of the buffer.
1563
+ */
1564
+ if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1565
+ /* This was really a NUL. */
1566
+ *yyg->yy_c_buf_p = '\0';
1567
+
1568
+ else
1569
+ { /* need more input */
1570
+ int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
1571
+ ++yyg->yy_c_buf_p;
1572
+
1573
+ switch ( yy_get_next_buffer( yyscanner ) )
1574
+ {
1575
+ case EOB_ACT_LAST_MATCH:
1576
+ /* This happens because yy_g_n_b()
1577
+ * sees that we've accumulated a
1578
+ * token and flags that we need to
1579
+ * try matching the token before
1580
+ * proceeding. But for input(),
1581
+ * there's no matching to consider.
1582
+ * So convert the EOB_ACT_LAST_MATCH
1583
+ * to EOB_ACT_END_OF_FILE.
1584
+ */
1585
+
1586
+ /* Reset buffer status. */
1587
+ langscan_php_lex_restart(yyin ,yyscanner);
1588
+
1589
+ /*FALLTHROUGH*/
1590
+
1591
+ case EOB_ACT_END_OF_FILE:
1592
+ {
1593
+ if ( langscan_php_lex_wrap(yyscanner ) )
1594
+ return EOF;
1595
+
1596
+ if ( ! yyg->yy_did_buffer_switch_on_eof )
1597
+ YY_NEW_FILE;
1598
+ #ifdef __cplusplus
1599
+ return yyinput(yyscanner);
1600
+ #else
1601
+ return input(yyscanner);
1602
+ #endif
1603
+ }
1604
+
1605
+ case EOB_ACT_CONTINUE_SCAN:
1606
+ yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
1607
+ break;
1608
+ }
1609
+ }
1610
+ }
1611
+
1612
+ c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
1613
+ *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
1614
+ yyg->yy_hold_char = *++yyg->yy_c_buf_p;
1615
+
1616
+ return c;
1617
+ }
1618
+ #endif /* ifndef YY_NO_INPUT */
1619
+
1620
+ /** Immediately switch to a different input stream.
1621
+ * @param input_file A readable stream.
1622
+ * @param yyscanner The scanner object.
1623
+ * @note This function does not reset the start condition to @c INITIAL .
1624
+ */
1625
+ void langscan_php_lex_restart (FILE * input_file , yyscan_t yyscanner)
1626
+ {
1627
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1628
+
1629
+ if ( ! YY_CURRENT_BUFFER ){
1630
+ langscan_php_lex_ensure_buffer_stack (yyscanner);
1631
+ YY_CURRENT_BUFFER_LVALUE =
1632
+ langscan_php_lex__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
1633
+ }
1634
+
1635
+ langscan_php_lex__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
1636
+ langscan_php_lex__load_buffer_state(yyscanner );
1637
+ }
1638
+
1639
+ /** Switch to a different input buffer.
1640
+ * @param new_buffer The new input buffer.
1641
+ * @param yyscanner The scanner object.
1642
+ */
1643
+ void langscan_php_lex__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1644
+ {
1645
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1646
+
1647
+ /* TODO. We should be able to replace this entire function body
1648
+ * with
1649
+ * langscan_php_lex_pop_buffer_state();
1650
+ * langscan_php_lex_push_buffer_state(new_buffer);
1651
+ */
1652
+ langscan_php_lex_ensure_buffer_stack (yyscanner);
1653
+ if ( YY_CURRENT_BUFFER == new_buffer )
1654
+ return;
1655
+
1656
+ if ( YY_CURRENT_BUFFER )
1657
+ {
1658
+ /* Flush out information for old buffer. */
1659
+ *yyg->yy_c_buf_p = yyg->yy_hold_char;
1660
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1661
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1662
+ }
1663
+
1664
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
1665
+ langscan_php_lex__load_buffer_state(yyscanner );
1666
+
1667
+ /* We don't actually know whether we did this switch during
1668
+ * EOF (langscan_php_lex_wrap()) processing, but the only time this flag
1669
+ * is looked at is after langscan_php_lex_wrap() is called, so it's safe
1670
+ * to go ahead and always set it.
1671
+ */
1672
+ yyg->yy_did_buffer_switch_on_eof = 1;
1673
+ }
1674
+
1675
+ static void langscan_php_lex__load_buffer_state (yyscan_t yyscanner)
1676
+ {
1677
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1678
+ yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1679
+ yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1680
+ yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1681
+ yyg->yy_hold_char = *yyg->yy_c_buf_p;
1682
+ }
1683
+
1684
+ /** Allocate and initialize an input buffer state.
1685
+ * @param file A readable stream.
1686
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1687
+ * @param yyscanner The scanner object.
1688
+ * @return the allocated buffer state.
1689
+ */
1690
+ YY_BUFFER_STATE langscan_php_lex__create_buffer (FILE * file, int size , yyscan_t yyscanner)
1691
+ {
1692
+ YY_BUFFER_STATE b;
1693
+
1694
+ b = (YY_BUFFER_STATE) langscan_php_lex_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1695
+ if ( ! b )
1696
+ YY_FATAL_ERROR( "out of dynamic memory in langscan_php_lex__create_buffer()" );
1697
+
1698
+ b->yy_buf_size = size;
1699
+
1700
+ /* yy_ch_buf has to be 2 characters longer than the size given because
1701
+ * we need to put in 2 end-of-buffer characters.
1702
+ */
1703
+ b->yy_ch_buf = (char *) langscan_php_lex_alloc(b->yy_buf_size + 2 ,yyscanner );
1704
+ if ( ! b->yy_ch_buf )
1705
+ YY_FATAL_ERROR( "out of dynamic memory in langscan_php_lex__create_buffer()" );
1706
+
1707
+ b->yy_is_our_buffer = 1;
1708
+
1709
+ langscan_php_lex__init_buffer(b,file ,yyscanner);
1710
+
1711
+ return b;
1712
+ }
1713
+
1714
+ /** Destroy the buffer.
1715
+ * @param b a buffer created with langscan_php_lex__create_buffer()
1716
+ * @param yyscanner The scanner object.
1717
+ */
1718
+ void langscan_php_lex__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
1719
+ {
1720
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1721
+
1722
+ if ( ! b )
1723
+ return;
1724
+
1725
+ if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1726
+ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1727
+
1728
+ if ( b->yy_is_our_buffer )
1729
+ langscan_php_lex_free((void *) b->yy_ch_buf ,yyscanner );
1730
+
1731
+ langscan_php_lex_free((void *) b ,yyscanner );
1732
+ }
1733
+
1734
+ #ifndef __cplusplus
1735
+ extern int isatty (int );
1736
+ #endif /* __cplusplus */
1737
+
1738
+ /* Initializes or reinitializes a buffer.
1739
+ * This function is sometimes called more than once on the same buffer,
1740
+ * such as during a langscan_php_lex_restart() or at EOF.
1741
+ */
1742
+ static void langscan_php_lex__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
1743
+
1744
+ {
1745
+ int oerrno = errno;
1746
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1747
+
1748
+ langscan_php_lex__flush_buffer(b ,yyscanner);
1749
+
1750
+ b->yy_input_file = file;
1751
+ b->yy_fill_buffer = 1;
1752
+
1753
+ /* If b is the current buffer, then langscan_php_lex__init_buffer was _probably_
1754
+ * called from langscan_php_lex_restart() or through yy_get_next_buffer.
1755
+ * In that case, we don't want to reset the lineno or column.
1756
+ */
1757
+ if (b != YY_CURRENT_BUFFER){
1758
+ b->yy_bs_lineno = 1;
1759
+ b->yy_bs_column = 0;
1760
+ }
1761
+
1762
+ b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1763
+
1764
+ errno = oerrno;
1765
+ }
1766
+
1767
+ /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1768
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1769
+ * @param yyscanner The scanner object.
1770
+ */
1771
+ void langscan_php_lex__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
1772
+ {
1773
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1774
+ if ( ! b )
1775
+ return;
1776
+
1777
+ b->yy_n_chars = 0;
1778
+
1779
+ /* We always need two end-of-buffer characters. The first causes
1780
+ * a transition to the end-of-buffer state. The second causes
1781
+ * a jam in that state.
1782
+ */
1783
+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1784
+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1785
+
1786
+ b->yy_buf_pos = &b->yy_ch_buf[0];
1787
+
1788
+ b->yy_at_bol = 1;
1789
+ b->yy_buffer_status = YY_BUFFER_NEW;
1790
+
1791
+ if ( b == YY_CURRENT_BUFFER )
1792
+ langscan_php_lex__load_buffer_state(yyscanner );
1793
+ }
1794
+
1795
+ /** Pushes the new state onto the stack. The new state becomes
1796
+ * the current state. This function will allocate the stack
1797
+ * if necessary.
1798
+ * @param new_buffer The new state.
1799
+ * @param yyscanner The scanner object.
1800
+ */
1801
+ void langscan_php_lex_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1802
+ {
1803
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1804
+ if (new_buffer == NULL)
1805
+ return;
1806
+
1807
+ langscan_php_lex_ensure_buffer_stack(yyscanner);
1808
+
1809
+ /* This block is copied from langscan_php_lex__switch_to_buffer. */
1810
+ if ( YY_CURRENT_BUFFER )
1811
+ {
1812
+ /* Flush out information for old buffer. */
1813
+ *yyg->yy_c_buf_p = yyg->yy_hold_char;
1814
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1815
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1816
+ }
1817
+
1818
+ /* Only push if top exists. Otherwise, replace top. */
1819
+ if (YY_CURRENT_BUFFER)
1820
+ yyg->yy_buffer_stack_top++;
1821
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
1822
+
1823
+ /* copied from langscan_php_lex__switch_to_buffer. */
1824
+ langscan_php_lex__load_buffer_state(yyscanner );
1825
+ yyg->yy_did_buffer_switch_on_eof = 1;
1826
+ }
1827
+
1828
+ /** Removes and deletes the top of the stack, if present.
1829
+ * The next element becomes the new top.
1830
+ * @param yyscanner The scanner object.
1831
+ */
1832
+ void langscan_php_lex_pop_buffer_state (yyscan_t yyscanner)
1833
+ {
1834
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1835
+ if (!YY_CURRENT_BUFFER)
1836
+ return;
1837
+
1838
+ langscan_php_lex__delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
1839
+ YY_CURRENT_BUFFER_LVALUE = NULL;
1840
+ if (yyg->yy_buffer_stack_top > 0)
1841
+ --yyg->yy_buffer_stack_top;
1842
+
1843
+ if (YY_CURRENT_BUFFER) {
1844
+ langscan_php_lex__load_buffer_state(yyscanner );
1845
+ yyg->yy_did_buffer_switch_on_eof = 1;
1846
+ }
1847
+ }
1848
+
1849
+ /* Allocates the stack if it does not exist.
1850
+ * Guarantees space for at least one push.
1851
+ */
1852
+ static void langscan_php_lex_ensure_buffer_stack (yyscan_t yyscanner)
1853
+ {
1854
+ int num_to_alloc;
1855
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1856
+
1857
+ if (!yyg->yy_buffer_stack) {
1858
+
1859
+ /* First allocation is just for 2 elements, since we don't know if this
1860
+ * scanner will even need a stack. We use 2 instead of 1 to avoid an
1861
+ * immediate realloc on the next call.
1862
+ */
1863
+ num_to_alloc = 1;
1864
+ yyg->yy_buffer_stack = (struct yy_buffer_state**)langscan_php_lex_alloc
1865
+ (num_to_alloc * sizeof(struct yy_buffer_state*)
1866
+ , yyscanner);
1867
+ if ( ! yyg->yy_buffer_stack )
1868
+ YY_FATAL_ERROR( "out of dynamic memory in langscan_php_lex_ensure_buffer_stack()" );
1869
+
1870
+ memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1871
+
1872
+ yyg->yy_buffer_stack_max = num_to_alloc;
1873
+ yyg->yy_buffer_stack_top = 0;
1874
+ return;
1875
+ }
1876
+
1877
+ if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
1878
+
1879
+ /* Increase the buffer to prepare for a possible push. */
1880
+ int grow_size = 8 /* arbitrary grow size */;
1881
+
1882
+ num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
1883
+ yyg->yy_buffer_stack = (struct yy_buffer_state**)langscan_php_lex_realloc
1884
+ (yyg->yy_buffer_stack,
1885
+ num_to_alloc * sizeof(struct yy_buffer_state*)
1886
+ , yyscanner);
1887
+ if ( ! yyg->yy_buffer_stack )
1888
+ YY_FATAL_ERROR( "out of dynamic memory in langscan_php_lex_ensure_buffer_stack()" );
1889
+
1890
+ /* zero only the new slots.*/
1891
+ memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
1892
+ yyg->yy_buffer_stack_max = num_to_alloc;
1893
+ }
1894
+ }
1895
+
1896
+ /** Setup the input buffer state to scan directly from a user-specified character buffer.
1897
+ * @param base the character buffer
1898
+ * @param size the size in bytes of the character buffer
1899
+ * @param yyscanner The scanner object.
1900
+ * @return the newly allocated buffer state object.
1901
+ */
1902
+ YY_BUFFER_STATE langscan_php_lex__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
1903
+ {
1904
+ YY_BUFFER_STATE b;
1905
+
1906
+ if ( size < 2 ||
1907
+ base[size-2] != YY_END_OF_BUFFER_CHAR ||
1908
+ base[size-1] != YY_END_OF_BUFFER_CHAR )
1909
+ /* They forgot to leave room for the EOB's. */
1910
+ return 0;
1911
+
1912
+ b = (YY_BUFFER_STATE) langscan_php_lex_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1913
+ if ( ! b )
1914
+ YY_FATAL_ERROR( "out of dynamic memory in langscan_php_lex__scan_buffer()" );
1915
+
1916
+ b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1917
+ b->yy_buf_pos = b->yy_ch_buf = base;
1918
+ b->yy_is_our_buffer = 0;
1919
+ b->yy_input_file = 0;
1920
+ b->yy_n_chars = b->yy_buf_size;
1921
+ b->yy_is_interactive = 0;
1922
+ b->yy_at_bol = 1;
1923
+ b->yy_fill_buffer = 0;
1924
+ b->yy_buffer_status = YY_BUFFER_NEW;
1925
+
1926
+ langscan_php_lex__switch_to_buffer(b ,yyscanner );
1927
+
1928
+ return b;
1929
+ }
1930
+
1931
+ /** Setup the input buffer state to scan a string. The next call to langscan_php_lex_lex() will
1932
+ * scan from a @e copy of @a str.
1933
+ * @param yystr a NUL-terminated string to scan
1934
+ * @param yyscanner The scanner object.
1935
+ * @return the newly allocated buffer state object.
1936
+ * @note If you want to scan bytes that may contain NUL values, then use
1937
+ * langscan_php_lex__scan_bytes() instead.
1938
+ */
1939
+ YY_BUFFER_STATE langscan_php_lex__scan_string (yyconst char * yystr , yyscan_t yyscanner)
1940
+ {
1941
+
1942
+ return langscan_php_lex__scan_bytes(yystr,strlen(yystr) ,yyscanner);
1943
+ }
1944
+
1945
+ /** Setup the input buffer state to scan the given bytes. The next call to langscan_php_lex_lex() will
1946
+ * scan from a @e copy of @a bytes.
1947
+ * @param yybytes the byte buffer to scan
1948
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1949
+ * @param yyscanner The scanner object.
1950
+ * @return the newly allocated buffer state object.
1951
+ */
1952
+ YY_BUFFER_STATE langscan_php_lex__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
1953
+ {
1954
+ YY_BUFFER_STATE b;
1955
+ char *buf;
1956
+ yy_size_t n;
1957
+ int i;
1958
+
1959
+ /* Get memory for full buffer, including space for trailing EOB's. */
1960
+ n = _yybytes_len + 2;
1961
+ buf = (char *) langscan_php_lex_alloc(n ,yyscanner );
1962
+ if ( ! buf )
1963
+ YY_FATAL_ERROR( "out of dynamic memory in langscan_php_lex__scan_bytes()" );
1964
+
1965
+ for ( i = 0; i < _yybytes_len; ++i )
1966
+ buf[i] = yybytes[i];
1967
+
1968
+ buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1969
+
1970
+ b = langscan_php_lex__scan_buffer(buf,n ,yyscanner);
1971
+ if ( ! b )
1972
+ YY_FATAL_ERROR( "bad buffer in langscan_php_lex__scan_bytes()" );
1973
+
1974
+ /* It's okay to grow etc. this buffer, and we should throw it
1975
+ * away when we're done.
1976
+ */
1977
+ b->yy_is_our_buffer = 1;
1978
+
1979
+ return b;
1980
+ }
1981
+
1982
+ #ifndef YY_EXIT_FAILURE
1983
+ #define YY_EXIT_FAILURE 2
1984
+ #endif
1985
+
1986
+ static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
1987
+ {
1988
+ (void) fprintf( stderr, "%s\n", msg );
1989
+ exit( YY_EXIT_FAILURE );
1990
+ }
1991
+
1992
+ /* Redefine yyless() so it works in section 3 code. */
1993
+
1994
+ #undef yyless
1995
+ #define yyless(n) \
1996
+ do \
1997
+ { \
1998
+ /* Undo effects of setting up yytext. */ \
1999
+ int yyless_macro_arg = (n); \
2000
+ YY_LESS_LINENO(yyless_macro_arg);\
2001
+ yytext[yyleng] = yyg->yy_hold_char; \
2002
+ yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2003
+ yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2004
+ *yyg->yy_c_buf_p = '\0'; \
2005
+ yyleng = yyless_macro_arg; \
2006
+ } \
2007
+ while ( 0 )
2008
+
2009
+ /* Accessor methods (get/set functions) to struct members. */
2010
+
2011
+ /** Get the user-defined data for this scanner.
2012
+ * @param yyscanner The scanner object.
2013
+ */
2014
+ YY_EXTRA_TYPE langscan_php_lex_get_extra (yyscan_t yyscanner)
2015
+ {
2016
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2017
+ return yyextra;
2018
+ }
2019
+
2020
+ /** Get the current line number.
2021
+ * @param yyscanner The scanner object.
2022
+ */
2023
+ int langscan_php_lex_get_lineno (yyscan_t yyscanner)
2024
+ {
2025
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2026
+
2027
+ if (! YY_CURRENT_BUFFER)
2028
+ return 0;
2029
+
2030
+ return yylineno;
2031
+ }
2032
+
2033
+ /** Get the current column number.
2034
+ * @param yyscanner The scanner object.
2035
+ */
2036
+ int langscan_php_lex_get_column (yyscan_t yyscanner)
2037
+ {
2038
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2039
+
2040
+ if (! YY_CURRENT_BUFFER)
2041
+ return 0;
2042
+
2043
+ return yycolumn;
2044
+ }
2045
+
2046
+ /** Get the input stream.
2047
+ * @param yyscanner The scanner object.
2048
+ */
2049
+ FILE *langscan_php_lex_get_in (yyscan_t yyscanner)
2050
+ {
2051
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2052
+ return yyin;
2053
+ }
2054
+
2055
+ /** Get the output stream.
2056
+ * @param yyscanner The scanner object.
2057
+ */
2058
+ FILE *langscan_php_lex_get_out (yyscan_t yyscanner)
2059
+ {
2060
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2061
+ return yyout;
2062
+ }
2063
+
2064
+ /** Get the length of the current token.
2065
+ * @param yyscanner The scanner object.
2066
+ */
2067
+ int langscan_php_lex_get_leng (yyscan_t yyscanner)
2068
+ {
2069
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2070
+ return yyleng;
2071
+ }
2072
+
2073
+ /** Get the current token.
2074
+ * @param yyscanner The scanner object.
2075
+ */
2076
+
2077
+ char *langscan_php_lex_get_text (yyscan_t yyscanner)
2078
+ {
2079
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2080
+ return yytext;
2081
+ }
2082
+
2083
+ /** Set the user-defined data. This data is never touched by the scanner.
2084
+ * @param user_defined The data to be associated with this scanner.
2085
+ * @param yyscanner The scanner object.
2086
+ */
2087
+ void langscan_php_lex_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
2088
+ {
2089
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2090
+ yyextra = user_defined ;
2091
+ }
2092
+
2093
+ /** Set the current line number.
2094
+ * @param line_number
2095
+ * @param yyscanner The scanner object.
2096
+ */
2097
+ void langscan_php_lex_set_lineno (int line_number , yyscan_t yyscanner)
2098
+ {
2099
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2100
+
2101
+ /* lineno is only valid if an input buffer exists. */
2102
+ if (! YY_CURRENT_BUFFER )
2103
+ yy_fatal_error( "langscan_php_lex_set_lineno called with no buffer" , yyscanner);
2104
+
2105
+ yylineno = line_number;
2106
+ }
2107
+
2108
+ /** Set the current column.
2109
+ * @param line_number
2110
+ * @param yyscanner The scanner object.
2111
+ */
2112
+ void langscan_php_lex_set_column (int column_no , yyscan_t yyscanner)
2113
+ {
2114
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2115
+
2116
+ /* column is only valid if an input buffer exists. */
2117
+ if (! YY_CURRENT_BUFFER )
2118
+ yy_fatal_error( "langscan_php_lex_set_column called with no buffer" , yyscanner);
2119
+
2120
+ yycolumn = column_no;
2121
+ }
2122
+
2123
+ /** Set the input stream. This does not discard the current
2124
+ * input buffer.
2125
+ * @param in_str A readable stream.
2126
+ * @param yyscanner The scanner object.
2127
+ * @see langscan_php_lex__switch_to_buffer
2128
+ */
2129
+ void langscan_php_lex_set_in (FILE * in_str , yyscan_t yyscanner)
2130
+ {
2131
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2132
+ yyin = in_str ;
2133
+ }
2134
+
2135
+ void langscan_php_lex_set_out (FILE * out_str , yyscan_t yyscanner)
2136
+ {
2137
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2138
+ yyout = out_str ;
2139
+ }
2140
+
2141
+ int langscan_php_lex_get_debug (yyscan_t yyscanner)
2142
+ {
2143
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2144
+ return yy_flex_debug;
2145
+ }
2146
+
2147
+ void langscan_php_lex_set_debug (int bdebug , yyscan_t yyscanner)
2148
+ {
2149
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2150
+ yy_flex_debug = bdebug ;
2151
+ }
2152
+
2153
+ /* Accessor methods for yylval and yylloc */
2154
+
2155
+ /* User-visible API */
2156
+
2157
+ /* langscan_php_lex_lex_init is special because it creates the scanner itself, so it is
2158
+ * the ONLY reentrant function that doesn't take the scanner as the last argument.
2159
+ * That's why we explicitly handle the declaration, instead of using our macros.
2160
+ */
2161
+
2162
+ int langscan_php_lex_lex_init(yyscan_t* ptr_yy_globals)
2163
+
2164
+ {
2165
+ if (ptr_yy_globals == NULL){
2166
+ errno = EINVAL;
2167
+ return 1;
2168
+ }
2169
+
2170
+ *ptr_yy_globals = (yyscan_t) langscan_php_lex_alloc ( sizeof( struct yyguts_t ), NULL );
2171
+
2172
+ if (*ptr_yy_globals == NULL){
2173
+ errno = ENOMEM;
2174
+ return 1;
2175
+ }
2176
+
2177
+ /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2178
+ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2179
+
2180
+ return yy_init_globals ( *ptr_yy_globals );
2181
+ }
2182
+
2183
+ /* langscan_php_lex_lex_init_extra has the same functionality as langscan_php_lex_lex_init, but follows the
2184
+ * convention of taking the scanner as the last argument. Note however, that
2185
+ * this is a *pointer* to a scanner, as it will be allocated by this call (and
2186
+ * is the reason, too, why this function also must handle its own declaration).
2187
+ * The user defined value in the first argument will be available to langscan_php_lex_alloc in
2188
+ * the yyextra field.
2189
+ */
2190
+
2191
+ int langscan_php_lex_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
2192
+
2193
+ {
2194
+ struct yyguts_t dummy_yyguts;
2195
+
2196
+ langscan_php_lex_set_extra (yy_user_defined, &dummy_yyguts);
2197
+
2198
+ if (ptr_yy_globals == NULL){
2199
+ errno = EINVAL;
2200
+ return 1;
2201
+ }
2202
+
2203
+ *ptr_yy_globals = (yyscan_t) langscan_php_lex_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2204
+
2205
+ if (*ptr_yy_globals == NULL){
2206
+ errno = ENOMEM;
2207
+ return 1;
2208
+ }
2209
+
2210
+ /* By setting to 0xAA, we expose bugs in
2211
+ yy_init_globals. Leave at 0x00 for releases. */
2212
+ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2213
+
2214
+ langscan_php_lex_set_extra (yy_user_defined, *ptr_yy_globals);
2215
+
2216
+ return yy_init_globals ( *ptr_yy_globals );
2217
+ }
2218
+
2219
+ static int yy_init_globals (yyscan_t yyscanner)
2220
+ {
2221
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2222
+ /* Initialization is the same as for the non-reentrant scanner.
2223
+ * This function is called from langscan_php_lex_lex_destroy(), so don't allocate here.
2224
+ */
2225
+
2226
+ yyg->yy_buffer_stack = 0;
2227
+ yyg->yy_buffer_stack_top = 0;
2228
+ yyg->yy_buffer_stack_max = 0;
2229
+ yyg->yy_c_buf_p = (char *) 0;
2230
+ yyg->yy_init = 0;
2231
+ yyg->yy_start = 0;
2232
+
2233
+ yyg->yy_start_stack_ptr = 0;
2234
+ yyg->yy_start_stack_depth = 0;
2235
+ yyg->yy_start_stack = NULL;
2236
+
2237
+ /* Defined in main.c */
2238
+ #ifdef YY_STDINIT
2239
+ yyin = stdin;
2240
+ yyout = stdout;
2241
+ #else
2242
+ yyin = (FILE *) 0;
2243
+ yyout = (FILE *) 0;
2244
+ #endif
2245
+
2246
+ /* For future reference: Set errno on error, since we are called by
2247
+ * langscan_php_lex_lex_init()
2248
+ */
2249
+ return 0;
2250
+ }
2251
+
2252
+ /* langscan_php_lex_lex_destroy is for both reentrant and non-reentrant scanners. */
2253
+ int langscan_php_lex_lex_destroy (yyscan_t yyscanner)
2254
+ {
2255
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2256
+
2257
+ /* Pop the buffer stack, destroying each element. */
2258
+ while(YY_CURRENT_BUFFER){
2259
+ langscan_php_lex__delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
2260
+ YY_CURRENT_BUFFER_LVALUE = NULL;
2261
+ langscan_php_lex_pop_buffer_state(yyscanner);
2262
+ }
2263
+
2264
+ /* Destroy the stack itself. */
2265
+ langscan_php_lex_free(yyg->yy_buffer_stack ,yyscanner);
2266
+ yyg->yy_buffer_stack = NULL;
2267
+
2268
+ /* Destroy the start condition stack. */
2269
+ langscan_php_lex_free(yyg->yy_start_stack ,yyscanner );
2270
+ yyg->yy_start_stack = NULL;
2271
+
2272
+ /* Reset the globals. This is important in a non-reentrant scanner so the next time
2273
+ * langscan_php_lex_lex() is called, initialization will occur. */
2274
+ yy_init_globals( yyscanner);
2275
+
2276
+ /* Destroy the main struct (reentrant only). */
2277
+ langscan_php_lex_free ( yyscanner , yyscanner );
2278
+ yyscanner = NULL;
2279
+ return 0;
2280
+ }
2281
+
2282
+ /*
2283
+ * Internal utility routines.
2284
+ */
2285
+
2286
+ #ifndef yytext_ptr
2287
+ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
2288
+ {
2289
+ register int i;
2290
+ for ( i = 0; i < n; ++i )
2291
+ s1[i] = s2[i];
2292
+ }
2293
+ #endif
2294
+
2295
+ #ifdef YY_NEED_STRLEN
2296
+ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
2297
+ {
2298
+ register int n;
2299
+ for ( n = 0; s[n]; ++n )
2300
+ ;
2301
+
2302
+ return n;
2303
+ }
2304
+ #endif
2305
+
2306
+ void *langscan_php_lex_alloc (yy_size_t size , yyscan_t yyscanner)
2307
+ {
2308
+ return (void *) malloc( size );
2309
+ }
2310
+
2311
+ void *langscan_php_lex_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
2312
+ {
2313
+ /* The cast to (char *) in the following accommodates both
2314
+ * implementations that use char* generic pointers, and those
2315
+ * that use void* generic pointers. It works with the latter
2316
+ * because both ANSI C and C++ allow castless assignment from
2317
+ * any pointer type to void*, and deal with argument conversions
2318
+ * as though doing an assignment.
2319
+ */
2320
+ return (void *) realloc( (char *) ptr, size );
2321
+ }
2322
+
2323
+ void langscan_php_lex_free (void * ptr , yyscan_t yyscanner)
2324
+ {
2325
+ free( (char *) ptr ); /* see langscan_php_lex_realloc() for (char *) cast */
2326
+ }
2327
+
2328
+ #define YYTABLES_NAME "yytables"
2329
+
2330
+ static void update_pos(
2331
+ langscan_php_lex_extra_t *extra,
2332
+ char *text,
2333
+ int leng)
2334
+ {
2335
+ int i, j;
2336
+ extra->beg_byteno = extra->end_byteno;
2337
+ extra->beg_lineno = extra->end_lineno;
2338
+ extra->beg_columnno = extra->end_columnno;
2339
+ j = 0;
2340
+ for (i = 0; i < leng; i++) {
2341
+ if (text[i] == '\r' || (i == 0 || text[i - 1] != '\r') && text[i] == '\n') {
2342
+ extra->end_lineno++;
2343
+ j = i + 1;
2344
+ extra->end_columnno = 0;
2345
+ }
2346
+ }
2347
+ extra->end_columnno += leng - j;
2348
+ extra->end_byteno += leng;
2349
+ }
2350
+
2351
+ langscan_php_tokenizer_t *langscan_php_make_tokenizer(
2352
+ size_t (*user_read)(void **user_data_p, char *buf, size_t maxlen),
2353
+ void *user_data)
2354
+ {
2355
+ langscan_php_tokenizer_t *tokenizer;
2356
+ langscan_php_lex_extra_t *extra;
2357
+ tokenizer = (langscan_php_tokenizer_t *)malloc(sizeof(langscan_php_tokenizer_t));
2358
+ if (tokenizer == NULL)
2359
+ return NULL;
2360
+ extra = (langscan_php_lex_extra_t *)malloc(sizeof(langscan_php_lex_extra_t));
2361
+ if (extra == NULL)
2362
+ return NULL;
2363
+ extra->user_read = user_read;
2364
+ extra->user_data = user_data;
2365
+ extra->beg_lineno = 1;
2366
+ extra->beg_columnno = 0;
2367
+ extra->beg_byteno = 0;
2368
+ extra->end_lineno = 1;
2369
+ extra->end_columnno = 0;
2370
+ extra->end_byteno = 0;
2371
+ extra->eof = 0;
2372
+ tokenizer->extra = extra;
2373
+ langscan_php_lex_lex_init(&tokenizer->scanner);
2374
+ langscan_php_lex_set_extra(extra, tokenizer->scanner);
2375
+ return tokenizer;
2376
+ }
2377
+
2378
+ langscan_php_token_t langscan_php_get_token(langscan_php_tokenizer_t *tokenizer)
2379
+ {
2380
+ return langscan_php_lex_lex(tokenizer->scanner);
2381
+ }
2382
+
2383
+ void langscan_php_free_tokenizer(langscan_php_tokenizer_t *tokenizer)
2384
+ {
2385
+ langscan_php_lex_extra_t *extra = langscan_php_lex_get_extra(tokenizer->scanner);
2386
+ free((void *)extra);
2387
+ langscan_php_lex_lex_destroy(tokenizer->scanner);
2388
+ free((void *)tokenizer);
2389
+ free(heredocident);
2390
+ }
2391
+
2392
+ user_read_t langscan_php_tokenizer_get_user_read(langscan_php_tokenizer_t *tokenizer)
2393
+ {
2394
+ return tokenizer->extra->user_read;
2395
+ }
2396
+
2397
+ void *langscan_php_tokenizer_get_user_data(langscan_php_tokenizer_t *tokenizer)
2398
+ {
2399
+ return tokenizer->extra->user_data;
2400
+ }
2401
+
2402
+ const char *langscan_php_token_name(langscan_php_token_t token)
2403
+ {
2404
+ static char *token_names[] = {
2405
+ "*eof*",
2406
+ #define LANGSCAN_PHP_TOKEN(name) #name,
2407
+ LANGSCAN_PHP_TOKEN_LIST
2408
+ #undef LANGSCAN_PHP_TOKEN
2409
+ };
2410
+
2411
+ return token_names[token];
2412
+ }
2413
+