rubinius-melbourne 1.1.0.1 → 1.1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/rubinius/melbourne/grammar.cpp +570 -480
- data/ext/rubinius/melbourne/grammar.y +129 -39
- data/ext/rubinius/melbourne/parser_state.hpp +7 -0
- data/lib/rubinius/melbourne/version.rb +1 -1
- metadata +14 -15
@@ -40,17 +40,105 @@ namespace MELBOURNE {
|
|
40
40
|
#define TRUE true
|
41
41
|
#define FALSE false
|
42
42
|
|
43
|
-
/*
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
43
|
+
/* Functions for multi-byte support imported from MRI 1.8.7
|
44
|
+
Created for grep multi-byte extension Jul., 1993 by t^2 (Takahiro Tanimoto)
|
45
|
+
Last change: Jul. 9, 1993 by t^2 */
|
46
|
+
static const unsigned char mbctab_ascii[] = {
|
47
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
48
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
49
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
50
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
51
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
52
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
53
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
54
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
55
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
56
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
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 2, 2, 2, 2, 2, 2, 2,
|
138
|
+
3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 0, 0,
|
139
|
+
};
|
140
|
+
|
141
|
+
static const unsigned char* re_mbcinit();
|
54
142
|
|
55
143
|
#define string_new(ptr, len) blk2bstr(ptr, len)
|
56
144
|
#define string_new2(ptr) cstr2bstr(ptr)
|
@@ -93,11 +181,6 @@ mel_yyerror(const char *, rb_parser_state*);
|
|
93
181
|
((id)&ID_SCOPE_MASK) == ID_CLASS))
|
94
182
|
|
95
183
|
|
96
|
-
/* FIXME these went into the ruby_state instead of parser_state
|
97
|
-
because a ton of other crap depends on it
|
98
|
-
char *ruby_sourcefile; current source file
|
99
|
-
int ruby_sourceline; current line no.
|
100
|
-
*/
|
101
184
|
static int yylex(void*, void *);
|
102
185
|
|
103
186
|
|
@@ -207,6 +290,8 @@ rb_parser_state *parser_alloc_state() {
|
|
207
290
|
magic_comments = new std::vector<bstring>;
|
208
291
|
start_lines = new std::list<StartPosition>;
|
209
292
|
|
293
|
+
re_mbctab = re_mbcinit();
|
294
|
+
|
210
295
|
quark_indexes = new quark_map();
|
211
296
|
quarks = new quark_vector();
|
212
297
|
|
@@ -2755,8 +2840,6 @@ none : /* none */ {$$ = 0;}
|
|
2755
2840
|
#endif
|
2756
2841
|
#define is_identchar(c) (SIGN_EXTEND_CHAR(c)!=-1&&(ISALNUM(c) || (c) == '_' || ismbchar(c)))
|
2757
2842
|
|
2758
|
-
#define LEAVE_BS 1
|
2759
|
-
|
2760
2843
|
static int
|
2761
2844
|
mel_yyerror(const char *msg, rb_parser_state *parser_state)
|
2762
2845
|
{
|
@@ -2791,6 +2874,28 @@ yycompile(rb_parser_state *parser_state, char *f, int line)
|
|
2791
2874
|
return n;
|
2792
2875
|
}
|
2793
2876
|
|
2877
|
+
static const unsigned char*
|
2878
|
+
re_mbcinit()
|
2879
|
+
{
|
2880
|
+
const char* code = rb_get_kcode();
|
2881
|
+
|
2882
|
+
switch(code[0]) {
|
2883
|
+
case 'E':
|
2884
|
+
return mbctab_euc;
|
2885
|
+
|
2886
|
+
case 'S':
|
2887
|
+
return mbctab_sjis;
|
2888
|
+
|
2889
|
+
case 'U':
|
2890
|
+
return mbctab_utf8;
|
2891
|
+
|
2892
|
+
case 'N':
|
2893
|
+
case 'A':
|
2894
|
+
default:
|
2895
|
+
return mbctab_ascii;
|
2896
|
+
}
|
2897
|
+
}
|
2898
|
+
|
2794
2899
|
static bool
|
2795
2900
|
lex_get_str(rb_parser_state *parser_state)
|
2796
2901
|
{
|
@@ -4502,18 +4607,11 @@ yylex(void *yylval_v, void *vstate)
|
|
4502
4607
|
c = 'Q';
|
4503
4608
|
}
|
4504
4609
|
else {
|
4505
|
-
|
4506
|
-
|
4507
|
-
|
4508
|
-
|
4509
|
-
|
4510
|
-
*cur++ = term;
|
4511
|
-
term = nextc();
|
4512
|
-
}
|
4513
|
-
*cur = 0;
|
4514
|
-
c = 1;
|
4515
|
-
|
4516
|
-
}
|
4610
|
+
term = nextc();
|
4611
|
+
if(ISALNUM(term) || ismbchar(term)) {
|
4612
|
+
yyerror("unknown type of %string");
|
4613
|
+
return 0;
|
4614
|
+
}
|
4517
4615
|
}
|
4518
4616
|
if (c == -1 || term == -1) {
|
4519
4617
|
rb_compile_error(parser_state, "unterminated quoted string meets end of file");
|
@@ -4561,17 +4659,9 @@ yylex(void *yylval_v, void *vstate)
|
|
4561
4659
|
lex_state = EXPR_FNAME;
|
4562
4660
|
return tSYMBEG;
|
4563
4661
|
|
4564
|
-
case 1:
|
4565
|
-
lex_strterm = NEW_STRTERM(str_xquote, term, paren);
|
4566
|
-
pslval->id = rb_parser_sym(parser_state, tmpstr);
|
4567
|
-
return tXSTRING_BEG;
|
4568
|
-
|
4569
4662
|
default:
|
4570
|
-
|
4571
|
-
|
4572
|
-
tmpstr[1] = 0;
|
4573
|
-
pslval->id = rb_parser_sym(parser_state, tmpstr);
|
4574
|
-
return tXSTRING_BEG;
|
4663
|
+
yyerror("unknown type of %string");
|
4664
|
+
return 0;
|
4575
4665
|
}
|
4576
4666
|
}
|
4577
4667
|
if ((c = nextc()) == '=') {
|
@@ -103,6 +103,8 @@ typedef VALUE stack_type;
|
|
103
103
|
char *sourcefile;
|
104
104
|
int sourceline;
|
105
105
|
|
106
|
+
const unsigned char* re_mbctab;
|
107
|
+
|
106
108
|
// Keeps track of lines that 'end' starters are on, to enable
|
107
109
|
// better error reporting.
|
108
110
|
std::list<StartPosition>* start_lines;
|
@@ -169,9 +171,14 @@ typedef VALUE stack_type;
|
|
169
171
|
#define start_lines PARSER_VAR(start_lines)
|
170
172
|
#define sourcefile PARSER_VAR(sourcefile)
|
171
173
|
#define sourceline PARSER_VAR(sourceline)
|
174
|
+
#define re_mbctab PARSER_VAR(re_mbctab)
|
172
175
|
#define quark_indexes PARSER_VAR(quark_indexes)
|
173
176
|
#define quarks PARSER_VAR(quarks)
|
174
177
|
|
178
|
+
#undef ismbchar
|
179
|
+
#define ismbchar(c) re_mbctab[(unsigned char)(c)]
|
180
|
+
#define mbclen(c) (re_mbctab[(unsigned char)(c)]+1)
|
181
|
+
|
175
182
|
#define node_newnode(t, a, b, c) parser_node_newnode((rb_parser_state*)parser_state, t, a, b, c)
|
176
183
|
|
177
184
|
quark id_to_quark(rb_parser_state* parser_state, QUID id);
|
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubinius-melbourne
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.0
|
4
|
+
version: 1.1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Shirai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubinius-toolset
|
15
|
-
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '2.0'
|
20
|
-
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
23
|
requirements:
|
22
24
|
- - "~>"
|
23
25
|
- !ruby/object:Gem::Version
|
24
26
|
version: '2.0'
|
25
|
-
prerelease: false
|
26
|
-
type: :runtime
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mspec
|
29
|
-
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.5'
|
34
|
-
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
35
37
|
requirements:
|
36
38
|
- - "~>"
|
37
39
|
- !ruby/object:Gem::Version
|
38
40
|
version: '1.5'
|
39
|
-
prerelease: false
|
40
|
-
type: :development
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
|
-
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '10.0'
|
48
|
-
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
51
|
requirements:
|
50
52
|
- - "~>"
|
51
53
|
- !ruby/object:Gem::Version
|
52
54
|
version: '10.0'
|
53
|
-
prerelease: false
|
54
|
-
type: :development
|
55
55
|
description: Ruby parser extracted from MRI.
|
56
56
|
email:
|
57
57
|
- brixen@gmail.com
|
@@ -117,4 +117,3 @@ signing_key:
|
|
117
117
|
specification_version: 4
|
118
118
|
summary: Rubinius Ruby Parser.
|
119
119
|
test_files: []
|
120
|
-
has_rdoc:
|