langscan 1.2-x86-mswin32-60

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