langscan 1.2

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