langscan 1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS.txt +19 -0
- data/History.txt +126 -0
- data/Manifest.txt +167 -0
- data/README.rdoc +89 -0
- data/Rakefile +40 -0
- data/ext/langscan/_make_c.rb +20 -0
- data/ext/langscan/_make_h.rb +30 -0
- data/ext/langscan/_template.c +134 -0
- data/ext/langscan/_template.h +53 -0
- data/ext/langscan/c/c/Makefile +157 -0
- data/ext/langscan/c/c/c.c +134 -0
- data/ext/langscan/c/c/c.h +66 -0
- data/ext/langscan/c/c/ctok.c +4622 -0
- data/ext/langscan/c/c/ctok.l +212 -0
- data/ext/langscan/c/c/extconf.rb +3 -0
- data/ext/langscan/c/c/modulename.txt +1 -0
- data/ext/langscan/c/c/tokenlist.txt +13 -0
- data/ext/langscan/csharp/csharp/Makefile +157 -0
- data/ext/langscan/csharp/csharp/csharp.c +134 -0
- data/ext/langscan/csharp/csharp/csharp.h +65 -0
- data/ext/langscan/csharp/csharp/csharptok.c +2965 -0
- data/ext/langscan/csharp/csharp/csharptok.l +200 -0
- data/ext/langscan/csharp/csharp/extconf.rb +3 -0
- data/ext/langscan/csharp/csharp/modulename.txt +1 -0
- data/ext/langscan/csharp/csharp/tokenlist.txt +12 -0
- data/ext/langscan/d/d/Makefile +157 -0
- data/ext/langscan/d/d/d.c +134 -0
- data/ext/langscan/d/d/d.h +64 -0
- data/ext/langscan/d/d/dtok.c +5461 -0
- data/ext/langscan/d/d/dtok.l +282 -0
- data/ext/langscan/d/d/extconf.rb +3 -0
- data/ext/langscan/d/d/modulename.txt +1 -0
- data/ext/langscan/d/d/tokenlist.txt +11 -0
- data/ext/langscan/elisp/elisp/Makefile +157 -0
- data/ext/langscan/elisp/elisp/elisp.c +134 -0
- data/ext/langscan/elisp/elisp/elisp.h +62 -0
- data/ext/langscan/elisp/elisp/elisptok.c +2101 -0
- data/ext/langscan/elisp/elisp/elisptok.l +151 -0
- data/ext/langscan/elisp/elisp/extconf.rb +3 -0
- data/ext/langscan/elisp/elisp/modulename.txt +1 -0
- data/ext/langscan/elisp/elisp/tokenlist.txt +9 -0
- data/ext/langscan/java/java/Makefile +157 -0
- data/ext/langscan/java/java/extconf.rb +3 -0
- data/ext/langscan/java/java/java.c +134 -0
- data/ext/langscan/java/java/java.h +64 -0
- data/ext/langscan/java/java/javatok.c +2090 -0
- data/ext/langscan/java/java/javatok.l +155 -0
- data/ext/langscan/java/java/modulename.txt +1 -0
- data/ext/langscan/java/java/tokenlist.txt +11 -0
- data/ext/langscan/javascript/javascript/Makefile +157 -0
- data/ext/langscan/javascript/javascript/extconf.rb +3 -0
- data/ext/langscan/javascript/javascript/javascript.c +134 -0
- data/ext/langscan/javascript/javascript/javascript.h +63 -0
- data/ext/langscan/javascript/javascript/javascripttok.c +2051 -0
- data/ext/langscan/javascript/javascript/javascripttok.l +147 -0
- data/ext/langscan/javascript/javascript/modulename.txt +1 -0
- data/ext/langscan/javascript/javascript/tokenlist.txt +10 -0
- data/ext/langscan/pairmatcher/pairmatcher/Makefile +157 -0
- data/ext/langscan/pairmatcher/pairmatcher/extconf.rb +3 -0
- data/ext/langscan/pairmatcher/pairmatcher/pairmatcher.c +890 -0
- data/ext/langscan/php/php/Makefile +157 -0
- data/ext/langscan/php/php/extconf.rb +3 -0
- data/ext/langscan/php/php/modulename.txt +1 -0
- data/ext/langscan/php/php/php.c +134 -0
- data/ext/langscan/php/php/php.h +64 -0
- data/ext/langscan/php/php/phptok.c +2406 -0
- data/ext/langscan/php/php/phptok.l +212 -0
- data/ext/langscan/php/php/tokenlist.txt +11 -0
- data/ext/langscan/post-distclean.rb +21 -0
- data/ext/langscan/pre-config.rb +57 -0
- data/ext/langscan/python/python/Makefile +157 -0
- data/ext/langscan/python/python/extconf.rb +3 -0
- data/ext/langscan/python/python/modulename.txt +1 -0
- data/ext/langscan/python/python/python.c +134 -0
- data/ext/langscan/python/python/python.h +61 -0
- data/ext/langscan/python/python/pythontok.c +2102 -0
- data/ext/langscan/python/python/pythontok.l +155 -0
- data/ext/langscan/python/python/tokenlist.txt +8 -0
- data/ext/langscan/ruby/compat/ripper/Makefile +158 -0
- data/ext/langscan/ruby/compat/ripper/depend +1 -0
- data/ext/langscan/ruby/compat/ripper/extconf.rb +4 -0
- data/ext/langscan/ruby/compat/ripper/include/eventids1.c +251 -0
- data/ext/langscan/ruby/compat/ripper/include/eventids2.c +277 -0
- data/ext/langscan/ruby/compat/ripper/include/lex.c +138 -0
- data/ext/langscan/ruby/compat/ripper/ripper.c +14420 -0
- data/ext/langscan/scheme/scheme/Makefile +157 -0
- data/ext/langscan/scheme/scheme/extconf.rb +3 -0
- data/ext/langscan/scheme/scheme/modulename.txt +1 -0
- data/ext/langscan/scheme/scheme/scheme.c +134 -0
- data/ext/langscan/scheme/scheme/scheme.h +60 -0
- data/ext/langscan/scheme/scheme/schemetok.c +2447 -0
- data/ext/langscan/scheme/scheme/schemetok.l +177 -0
- data/ext/langscan/scheme/scheme/tokenlist.txt +7 -0
- data/ext/langscan/sh/sh/Makefile +157 -0
- data/ext/langscan/sh/sh/extconf.rb +3 -0
- data/ext/langscan/sh/sh/modulename.txt +1 -0
- data/ext/langscan/sh/sh/sh.c +134 -0
- data/ext/langscan/sh/sh/sh.h +61 -0
- data/ext/langscan/sh/sh/shtok.c +2470 -0
- data/ext/langscan/sh/sh/shtok.l +325 -0
- data/ext/langscan/sh/sh/tokenlist.txt +8 -0
- data/lib/langscan.rb +124 -0
- data/lib/langscan/_common.rb +50 -0
- data/lib/langscan/_easyscanner.rb +78 -0
- data/lib/langscan/_pairmatcher.rb +46 -0
- data/lib/langscan/_type.rb +125 -0
- data/lib/langscan/autoconf.rb +51 -0
- data/lib/langscan/automake.rb +51 -0
- data/lib/langscan/brainfuck.rb +48 -0
- data/lib/langscan/c.rb +144 -0
- data/lib/langscan/csharp.rb +101 -0
- data/lib/langscan/css.rb +109 -0
- data/lib/langscan/d.rb +201 -0
- data/lib/langscan/eiffel.rb +167 -0
- data/lib/langscan/elisp.rb +132 -0
- data/lib/langscan/io.rb +84 -0
- data/lib/langscan/java.rb +95 -0
- data/lib/langscan/javascript.rb +97 -0
- data/lib/langscan/lua.rb +116 -0
- data/lib/langscan/ocaml.rb +298 -0
- data/lib/langscan/ocaml/camlexer.ml +28 -0
- data/lib/langscan/ocaml/lexer.mll +230 -0
- data/lib/langscan/ocaml/types.ml +36 -0
- data/lib/langscan/perl.rb +87 -0
- data/lib/langscan/perl/tokenizer.pl +231 -0
- data/lib/langscan/php.rb +80 -0
- data/lib/langscan/python.rb +101 -0
- data/lib/langscan/rpmspec.rb +71 -0
- data/lib/langscan/ruby.rb +164 -0
- data/lib/langscan/ruby/compat/README +5 -0
- data/lib/langscan/ruby/compat/ripper.rb +4 -0
- data/lib/langscan/ruby/compat/ripper/core.rb +918 -0
- data/lib/langscan/ruby/compat/ripper/filter.rb +70 -0
- data/lib/langscan/ruby/compat/ripper/lexer.rb +179 -0
- data/lib/langscan/ruby/compat/ripper/sexp.rb +100 -0
- data/lib/langscan/scheme.rb +160 -0
- data/lib/langscan/sh.rb +116 -0
- data/lib/langscan/text.rb +37 -0
- data/metaconfig +2 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/makemanifest.rb +21 -0
- data/setup.rb +1604 -0
- data/tasks/extconf.rake +13 -0
- data/tasks/extconf/langscan.rake +42 -0
- data/test/langscan/brainfuck/test/test_scan.rb +55 -0
- data/test/langscan/c/test/test_scan.rb +216 -0
- data/test/langscan/c/test/test_token.rb +41 -0
- data/test/langscan/csharp/test/test_scan.rb +157 -0
- data/test/langscan/css/test/test_css.rb +79 -0
- data/test/langscan/d/test/test_scan.rb +233 -0
- data/test/langscan/d/test/test_token.rb +205 -0
- data/test/langscan/eiffel/test/test_eiffel.rb +95 -0
- data/test/langscan/elisp/test/test_elisp.rb +177 -0
- data/test/langscan/io/test/test_io.rb +79 -0
- data/test/langscan/java/test/test_java.rb +74 -0
- data/test/langscan/javascript/test/test_javascript.rb +39 -0
- data/test/langscan/lua/test/test_lua.rb +69 -0
- data/test/langscan/ocaml/test/test_ocaml.rb +161 -0
- data/test/langscan/php/test/test_scan.rb +138 -0
- data/test/langscan/python/test/test_scan.rb +105 -0
- data/test/langscan/rpmspec/test/test_rpmspec.rb +51 -0
- data/test/langscan/ruby/test/test_scan.rb +71 -0
- data/test/langscan/scheme/test/test_scan.rb +198 -0
- data/test/test_helper.rb +7 -0
- data/test/test_langscan.rb +123 -0
- metadata +296 -0
@@ -0,0 +1,282 @@
|
|
1
|
+
/*
|
2
|
+
* dtok.l - a lex rule for D
|
3
|
+
*
|
4
|
+
* Copyright (C) 2005 Shinichiro Hamaji <hamaji@nii.ac.jp>
|
5
|
+
* All rights reserved.
|
6
|
+
* This is free software with ABSOLUTELY NO WARRANTY.
|
7
|
+
*
|
8
|
+
* You can redistribute it and/or modify it under the terms of
|
9
|
+
* the GNU General Public License version 2.
|
10
|
+
*/
|
11
|
+
|
12
|
+
%option reentrant
|
13
|
+
%option prefix="langscan_d_lex_"
|
14
|
+
%option noyywrap
|
15
|
+
%option nodefault
|
16
|
+
%s CLASSHEAD
|
17
|
+
%s CLASSHEAD_TRAILER
|
18
|
+
%x D_COMMENT
|
19
|
+
|
20
|
+
escchar [a-z'"?\\0]
|
21
|
+
escoct [0-7]|[0-7][0-7]|[0-3][0-7][0-7]
|
22
|
+
eschex [0-9a-fA-F][0-9a-fA-F]
|
23
|
+
escname &[a-zA-Z]+;
|
24
|
+
esccont ({escchar}|{escoct}|x{eschex}|u{eschex}{eschex}|U{eschex}{eschex}{eschex}{eschex}|{escname})
|
25
|
+
escseq \\{esccont}
|
26
|
+
|
27
|
+
intsuf [lLuU]*
|
28
|
+
integer ((0[bB][01]+{intsuf})|(0[0-7]*{intsuf})|([1-9][0-9]*{intsuf})|(0[xX][0-9A-Fa-f]+{intsuf}))
|
29
|
+
|
30
|
+
hex [0-9a-fA-F_]
|
31
|
+
decfloat ([0-9_]+\.[0-9_]*|[0-9_]*\.[0-9_]+)([eE][+\-]?[0-9_]+)?
|
32
|
+
hexfloat 0x({hex}+\.{hex}*|{hex}*\.{hex}+)([pP][+\-]?{hex}+)?
|
33
|
+
floating ({decfloat}|{hexfloat})[fFlL]?[iI]?
|
34
|
+
|
35
|
+
slash \/
|
36
|
+
star \*
|
37
|
+
nonstar [^\*]
|
38
|
+
nonslashstar [^\/\*]
|
39
|
+
commentcontent {star}+{nonslashstar}{nonstar}*
|
40
|
+
kandr_comment {slash}{star}{nonstar}*{commentcontent}*{star}+{slash}
|
41
|
+
c99_comment {slash}{slash}[^\n]*
|
42
|
+
|
43
|
+
comment {kandr_comment}|{c99_comment}
|
44
|
+
|
45
|
+
id ~?[A-Za-z_][0-9A-Za-z_]*
|
46
|
+
whtespace [ \t\n]|{comment}|{c99_comment}
|
47
|
+
|
48
|
+
%{
|
49
|
+
|
50
|
+
#include "d.h"
|
51
|
+
|
52
|
+
#define YY_EXTRA_TYPE langscan_d_lex_extra_t *
|
53
|
+
|
54
|
+
#if YY_NULL != 0
|
55
|
+
#error "YY_NULL is not 0."
|
56
|
+
#endif
|
57
|
+
|
58
|
+
#define YY_DECL langscan_d_token_t langscan_d_lex_lex(yyscan_t yyscanner)
|
59
|
+
|
60
|
+
#define YY_INPUT(buf,result,max_size) \
|
61
|
+
if (!yyextra->eof) { \
|
62
|
+
result = yyextra->user_read(&(yyextra->user_data), (buf), (max_size)); \
|
63
|
+
if (result == 0) \
|
64
|
+
yyextra->eof = 1; \
|
65
|
+
}
|
66
|
+
|
67
|
+
#define UPD update_pos(yyextra, yytext, yyleng)
|
68
|
+
static void update_pos(langscan_d_lex_extra_t *, char *, int);
|
69
|
+
|
70
|
+
#define report(token) \
|
71
|
+
do { \
|
72
|
+
yyextra->text = yytext; \
|
73
|
+
yyextra->leng = yyleng; \
|
74
|
+
return langscan_d_##token; \
|
75
|
+
} while (0)
|
76
|
+
|
77
|
+
#define matched_is(str) (yyleng == sizeof(str)-1 && strncmp(str, yytext, sizeof(str)-1) == 0)
|
78
|
+
|
79
|
+
static int ident_length(unsigned char *ptr, int max);
|
80
|
+
|
81
|
+
static char *d_comment;
|
82
|
+
|
83
|
+
%}
|
84
|
+
|
85
|
+
%%
|
86
|
+
|
87
|
+
#[^\n]+ { UPD; report(preproc); }
|
88
|
+
"/+" {
|
89
|
+
int a, b;
|
90
|
+
int level = 1;
|
91
|
+
int i = 2;
|
92
|
+
int buf_len = 256;
|
93
|
+
int next_skip = 0;
|
94
|
+
|
95
|
+
free(d_comment);
|
96
|
+
d_comment = (char *)malloc(buf_len);
|
97
|
+
|
98
|
+
d_comment[0] = '/';
|
99
|
+
d_comment[1] = '+';
|
100
|
+
|
101
|
+
yyextra->beg_byteno = yyextra->end_byteno;
|
102
|
+
yyextra->beg_lineno = yyextra->end_lineno;
|
103
|
+
yyextra->beg_columnno = yyextra->end_columnno;
|
104
|
+
|
105
|
+
yyextra->end_byteno += 3;
|
106
|
+
yyextra->end_columnno += 3;
|
107
|
+
|
108
|
+
a = input(yyscanner);
|
109
|
+
d_comment[i++] = a;
|
110
|
+
while (a != EOF && level) {
|
111
|
+
b = input(yyscanner);
|
112
|
+
if (i > buf_len-2) {
|
113
|
+
char *tmp;
|
114
|
+
buf_len *= 2;
|
115
|
+
tmp = (char *)malloc(buf_len);
|
116
|
+
strcpy(tmp, d_comment);
|
117
|
+
free(d_comment);
|
118
|
+
d_comment = tmp;
|
119
|
+
}
|
120
|
+
d_comment[i++] = b;
|
121
|
+
if (next_skip) {
|
122
|
+
next_skip = 0;
|
123
|
+
}
|
124
|
+
else {
|
125
|
+
if (a == '+' && b == '/') {
|
126
|
+
level--;
|
127
|
+
next_skip = 1;
|
128
|
+
}
|
129
|
+
else if (a == '/' && b == '+') {
|
130
|
+
level++;
|
131
|
+
next_skip = 1;
|
132
|
+
}
|
133
|
+
}
|
134
|
+
yyextra->end_byteno++;
|
135
|
+
if (b == '\n' || a == '\r') {
|
136
|
+
yyextra->end_lineno++;
|
137
|
+
}
|
138
|
+
if (b == '\n' || b == '\r') {
|
139
|
+
yyextra->end_columnno = 0;
|
140
|
+
}
|
141
|
+
else {
|
142
|
+
yyextra->end_columnno++;
|
143
|
+
}
|
144
|
+
a = b;
|
145
|
+
}
|
146
|
+
if (a == EOF) {
|
147
|
+
/* EOF in comment */
|
148
|
+
}
|
149
|
+
|
150
|
+
d_comment[i++] = '\0';
|
151
|
+
yyextra->text = d_comment;
|
152
|
+
yyextra->leng = yyextra->end_byteno - yyextra->beg_byteno;
|
153
|
+
return langscan_d_comment;
|
154
|
+
}
|
155
|
+
|
156
|
+
<CLASSHEAD>{id}{whtespace}*[:;\{] { yyless(ident_length(yytext, yyleng)); UPD; BEGIN(CLASSHEAD_TRAILER); report(classdef); }
|
157
|
+
<CLASSHEAD,CLASSHEAD_TRAILER>{id} { UPD; report(classref); }
|
158
|
+
<CLASSHEAD,CLASSHEAD_TRAILER>\{ { UPD; BEGIN(INITIAL); report(punct); }
|
159
|
+
|
160
|
+
class/{whtespace}[^\{;]*\{ { UPD; BEGIN(CLASSHEAD); report(ident); }
|
161
|
+
struct/{whtespace}[^\{;]*\{ { UPD; BEGIN(CLASSHEAD); report(ident); }
|
162
|
+
interface/{whtespace}[^\{;]*\{ { UPD; BEGIN(CLASSHEAD); report(ident); }
|
163
|
+
union/{whtespace}[^\{;]*\{ { UPD; BEGIN(CLASSHEAD); report(ident); }
|
164
|
+
enum/{whtespace}[^\{;]*\{ { UPD; BEGIN(CLASSHEAD); report(ident); }
|
165
|
+
|
166
|
+
[ \t\f\r]+ { UPD; report(space); }
|
167
|
+
\n { UPD; report(space); }
|
168
|
+
{comment} { UPD; report(comment); }
|
169
|
+
{escseq} { UPD; report(string); }
|
170
|
+
[rx]?\"([^\\\"]|{escseq})*\"[cwd]? { UPD; report(string); }
|
171
|
+
`[^`]*`[cwd]? { UPD; report(string); }
|
172
|
+
'([^\\\']|{escseq})' { UPD; report(character); }
|
173
|
+
{integer}(_+{integer})*_* { UPD; report(integer); }
|
174
|
+
{floating} { UPD; report(floating); }
|
175
|
+
{id} { UPD; report(ident); }
|
176
|
+
>>>|>>>=|~=|\+\+|--|<<|>>|<=|>=|==|!=|&&|\|\||\*=|\/=|%=|\+=|-=|<<=|>>=|&=|^=|\|=|->|. { UPD; report(punct); }
|
177
|
+
|
178
|
+
%%
|
179
|
+
|
180
|
+
static void update_pos(
|
181
|
+
langscan_d_lex_extra_t *extra,
|
182
|
+
char *text,
|
183
|
+
int leng)
|
184
|
+
{
|
185
|
+
int i, j;
|
186
|
+
extra->beg_byteno = extra->end_byteno;
|
187
|
+
extra->beg_lineno = extra->end_lineno;
|
188
|
+
extra->beg_columnno = extra->end_columnno;
|
189
|
+
j = 0;
|
190
|
+
for (i = 0; i < leng; i++) {
|
191
|
+
if (text[i] == '\n') {
|
192
|
+
extra->end_lineno++;
|
193
|
+
j = i + 1;
|
194
|
+
extra->end_columnno = 0;
|
195
|
+
}
|
196
|
+
}
|
197
|
+
extra->end_columnno += leng - j;
|
198
|
+
extra->end_byteno += leng;
|
199
|
+
}
|
200
|
+
|
201
|
+
static int ident_length(unsigned char *ptr, int max)
|
202
|
+
{
|
203
|
+
int len = 0;
|
204
|
+
while (0 < max &&
|
205
|
+
(('0' <= *ptr && *ptr <= '9') ||
|
206
|
+
('A' <= *ptr && *ptr <= 'Z') ||
|
207
|
+
('a' <= *ptr && *ptr <= 'z') ||
|
208
|
+
*ptr == '_')) {
|
209
|
+
ptr++;
|
210
|
+
len++;
|
211
|
+
max--;
|
212
|
+
}
|
213
|
+
return len;
|
214
|
+
}
|
215
|
+
|
216
|
+
langscan_d_tokenizer_t *langscan_d_make_tokenizer(
|
217
|
+
size_t (*user_read)(void **user_data_p, char *buf, size_t maxlen),
|
218
|
+
void *user_data)
|
219
|
+
{
|
220
|
+
langscan_d_tokenizer_t *tokenizer;
|
221
|
+
langscan_d_lex_extra_t *extra;
|
222
|
+
tokenizer = (langscan_d_tokenizer_t *)malloc(sizeof(langscan_d_tokenizer_t));
|
223
|
+
if (tokenizer == NULL)
|
224
|
+
return NULL;
|
225
|
+
extra = (langscan_d_lex_extra_t *)malloc(sizeof(langscan_d_lex_extra_t));
|
226
|
+
if (extra == NULL)
|
227
|
+
return NULL;
|
228
|
+
extra->user_read = user_read;
|
229
|
+
extra->user_data = user_data;
|
230
|
+
extra->beg_lineno = 1;
|
231
|
+
extra->beg_columnno = 0;
|
232
|
+
extra->beg_byteno = 0;
|
233
|
+
extra->end_lineno = 1;
|
234
|
+
extra->end_columnno = 0;
|
235
|
+
extra->end_byteno = 0;
|
236
|
+
extra->eof = 0;
|
237
|
+
tokenizer->extra = extra;
|
238
|
+
langscan_d_lex_lex_init(&tokenizer->scanner);
|
239
|
+
langscan_d_lex_set_extra(extra, tokenizer->scanner);
|
240
|
+
|
241
|
+
d_comment = NULL;
|
242
|
+
|
243
|
+
return tokenizer;
|
244
|
+
}
|
245
|
+
|
246
|
+
langscan_d_token_t langscan_d_get_token(langscan_d_tokenizer_t *tokenizer)
|
247
|
+
{
|
248
|
+
return langscan_d_lex_lex(tokenizer->scanner);
|
249
|
+
}
|
250
|
+
|
251
|
+
void langscan_d_free_tokenizer(langscan_d_tokenizer_t *tokenizer)
|
252
|
+
{
|
253
|
+
langscan_d_lex_extra_t *extra = langscan_d_lex_get_extra(tokenizer->scanner);
|
254
|
+
free((void *)extra);
|
255
|
+
langscan_d_lex_lex_destroy(tokenizer->scanner);
|
256
|
+
free((void *)tokenizer);
|
257
|
+
|
258
|
+
free(d_comment);
|
259
|
+
d_comment = NULL;
|
260
|
+
}
|
261
|
+
|
262
|
+
user_read_t langscan_d_tokenizer_get_user_read(langscan_d_tokenizer_t *tokenizer)
|
263
|
+
{
|
264
|
+
return tokenizer->extra->user_read;
|
265
|
+
}
|
266
|
+
|
267
|
+
void *langscan_d_tokenizer_get_user_data(langscan_d_tokenizer_t *tokenizer)
|
268
|
+
{
|
269
|
+
return tokenizer->extra->user_data;
|
270
|
+
}
|
271
|
+
|
272
|
+
const char *langscan_d_token_name(langscan_d_token_t token)
|
273
|
+
{
|
274
|
+
static char *token_names[] = {
|
275
|
+
"*eof*",
|
276
|
+
#define LANGSCAN_D_TOKEN(name) #name,
|
277
|
+
LANGSCAN_D_TOKEN_LIST
|
278
|
+
#undef LANGSCAN_D_TOKEN
|
279
|
+
};
|
280
|
+
|
281
|
+
return token_names[token];
|
282
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
D
|
@@ -0,0 +1,157 @@
|
|
1
|
+
|
2
|
+
SHELL = /bin/sh
|
3
|
+
|
4
|
+
#### Start of system configuration section. ####
|
5
|
+
|
6
|
+
srcdir = /Users/osuka/devel/git/langscan/ext/langscan/elisp/elisp
|
7
|
+
topdir = /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0
|
8
|
+
hdrdir = $(topdir)
|
9
|
+
VPATH = $(srcdir):$(topdir):$(hdrdir)
|
10
|
+
exec_prefix = $(prefix)
|
11
|
+
prefix = $(DESTDIR)/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr
|
12
|
+
sharedstatedir = $(prefix)/com
|
13
|
+
mandir = $(DESTDIR)/usr/share/man
|
14
|
+
psdir = $(docdir)
|
15
|
+
oldincludedir = $(DESTDIR)/usr/include
|
16
|
+
localedir = $(datarootdir)/locale
|
17
|
+
bindir = $(exec_prefix)/bin
|
18
|
+
libexecdir = $(exec_prefix)/libexec
|
19
|
+
sitedir = $(DESTDIR)/Library/Ruby/Site
|
20
|
+
htmldir = $(docdir)
|
21
|
+
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
22
|
+
includedir = $(prefix)/include
|
23
|
+
infodir = $(DESTDIR)/usr/share/info
|
24
|
+
vendorlibdir = $(vendordir)/$(ruby_version)
|
25
|
+
sysconfdir = $(prefix)/etc
|
26
|
+
libdir = $(exec_prefix)/lib
|
27
|
+
sbindir = $(exec_prefix)/sbin
|
28
|
+
rubylibdir = $(libdir)/ruby/$(ruby_version)
|
29
|
+
docdir = $(datarootdir)/doc/$(PACKAGE)
|
30
|
+
dvidir = $(docdir)
|
31
|
+
vendordir = $(libdir)/ruby/vendor_ruby
|
32
|
+
datarootdir = $(prefix)/share
|
33
|
+
pdfdir = $(docdir)
|
34
|
+
archdir = $(rubylibdir)/$(arch)
|
35
|
+
sitearchdir = $(sitelibdir)/$(sitearch)
|
36
|
+
datadir = $(datarootdir)
|
37
|
+
localstatedir = $(prefix)/var
|
38
|
+
sitelibdir = $(sitedir)/$(ruby_version)
|
39
|
+
|
40
|
+
CC = gcc
|
41
|
+
LIBRUBY = $(LIBRUBY_SO)
|
42
|
+
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
43
|
+
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
44
|
+
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)
|
45
|
+
|
46
|
+
RUBY_EXTCONF_H =
|
47
|
+
CFLAGS = -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common $(cflags)
|
48
|
+
INCFLAGS = -I. -I$(topdir) -I$(hdrdir) -I$(srcdir)
|
49
|
+
DEFS =
|
50
|
+
CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags)
|
51
|
+
CXXFLAGS = $(CFLAGS)
|
52
|
+
ldflags = -L. -arch i386 -arch x86_64
|
53
|
+
dldflags =
|
54
|
+
archflag =
|
55
|
+
DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
|
56
|
+
LDSHARED = cc -arch i386 -arch x86_64 -pipe -bundle -undefined dynamic_lookup
|
57
|
+
AR = ar
|
58
|
+
EXEEXT =
|
59
|
+
|
60
|
+
RUBY_INSTALL_NAME = ruby
|
61
|
+
RUBY_SO_NAME = ruby
|
62
|
+
arch = universal-darwin10.0
|
63
|
+
sitearch = universal-darwin10.0
|
64
|
+
ruby_version = 1.8
|
65
|
+
ruby = /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
|
66
|
+
RUBY = $(ruby)
|
67
|
+
RM = rm -f
|
68
|
+
MAKEDIRS = mkdir -p
|
69
|
+
INSTALL = /usr/bin/install -c
|
70
|
+
INSTALL_PROG = $(INSTALL) -m 0755
|
71
|
+
INSTALL_DATA = $(INSTALL) -m 644
|
72
|
+
COPY = cp
|
73
|
+
|
74
|
+
#### End of system configuration section. ####
|
75
|
+
|
76
|
+
preload =
|
77
|
+
|
78
|
+
libpath = . $(libdir)
|
79
|
+
LIBPATH = -L. -L$(libdir)
|
80
|
+
DEFFILE =
|
81
|
+
|
82
|
+
CLEANFILES = mkmf.log
|
83
|
+
DISTCLEANFILES =
|
84
|
+
|
85
|
+
extout =
|
86
|
+
extout_prefix =
|
87
|
+
target_prefix = /langscan/elisp
|
88
|
+
LOCAL_LIBS =
|
89
|
+
LIBS = $(LIBRUBYARG_SHARED) -lpthread -ldl
|
90
|
+
SRCS = elisp.c elisptok.c
|
91
|
+
OBJS = elisp.o elisptok.o
|
92
|
+
TARGET = elisp
|
93
|
+
DLLIB = $(TARGET).bundle
|
94
|
+
EXTSTATIC =
|
95
|
+
STATIC_LIB =
|
96
|
+
|
97
|
+
BINDIR = $(bindir)
|
98
|
+
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
99
|
+
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
100
|
+
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
101
|
+
|
102
|
+
TARGET_SO = $(DLLIB)
|
103
|
+
CLEANLIBS = $(TARGET).bundle $(TARGET).il? $(TARGET).tds $(TARGET).map
|
104
|
+
CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
|
105
|
+
|
106
|
+
all: $(DLLIB)
|
107
|
+
static: $(STATIC_LIB)
|
108
|
+
|
109
|
+
clean:
|
110
|
+
@-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
|
111
|
+
|
112
|
+
distclean: clean
|
113
|
+
@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
114
|
+
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
115
|
+
|
116
|
+
realclean: distclean
|
117
|
+
install: install-so install-rb
|
118
|
+
|
119
|
+
install-so: $(RUBYARCHDIR)
|
120
|
+
install-so: $(RUBYARCHDIR)/$(DLLIB)
|
121
|
+
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
|
122
|
+
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
123
|
+
install-rb: pre-install-rb install-rb-default
|
124
|
+
install-rb-default: pre-install-rb-default
|
125
|
+
pre-install-rb: Makefile
|
126
|
+
pre-install-rb-default: Makefile
|
127
|
+
$(RUBYARCHDIR):
|
128
|
+
$(MAKEDIRS) $@
|
129
|
+
|
130
|
+
site-install: site-install-so site-install-rb
|
131
|
+
site-install-so: install-so
|
132
|
+
site-install-rb: install-rb
|
133
|
+
|
134
|
+
.SUFFIXES: .c .m .cc .cxx .cpp .C .o
|
135
|
+
|
136
|
+
.cc.o:
|
137
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
138
|
+
|
139
|
+
.cxx.o:
|
140
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
141
|
+
|
142
|
+
.cpp.o:
|
143
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
144
|
+
|
145
|
+
.C.o:
|
146
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
147
|
+
|
148
|
+
.c.o:
|
149
|
+
$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
|
150
|
+
|
151
|
+
$(DLLIB): $(OBJS) Makefile
|
152
|
+
@-$(RM) $@
|
153
|
+
$(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
$(OBJS): ruby.h defines.h
|