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