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