parser 2.0.0 → 2.1.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +9 -7
- data/Rakefile +2 -2
- data/doc/AST_FORMAT.md +10 -0
- data/lib/parser.rb +4 -2
- data/lib/parser/ast/processor.rb +0 -2
- data/lib/parser/builders/default.rb +30 -26
- data/lib/parser/current.rb +4 -0
- data/lib/parser/lexer.rl +85 -30
- data/lib/parser/ruby18.y +4 -2
- data/lib/parser/ruby19.y +4 -2
- data/lib/parser/ruby20.y +4 -2
- data/lib/parser/ruby21.y +33 -49
- data/lib/parser/version.rb +1 -1
- data/parser.gemspec +6 -5
- data/test/test_current.rb +2 -0
- data/test/test_lexer.rb +106 -8
- data/test/test_parser.rb +44 -2
- metadata +77 -63
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85ff1f420d063d29c4d333d54a120569fd0429e9
|
4
|
+
data.tar.gz: f7fbd9186d41a3e8ca2561cbb590f8bde8067a6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40f6351913140cd1b73bf9b2d2ada48dd56ce29dad4e7c08bb347762b5d36a9bac95aa5b2b59c9f46155d35fa2db7e6e3400da72ceabe6d847381d932886e030
|
7
|
+
data.tar.gz: d1f1581bffe9ebecbd6fa02eaac2125db6ce329203d2d28061361588101b8442ace659f1b53e9a09189a6430506bc3662f323d7bebadef3cf41c2b98eb43634c
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
Changelog
|
2
2
|
=========
|
3
3
|
|
4
|
+
v2.1.0.pre1 (2013-11-12)
|
5
|
+
------------------------
|
6
|
+
|
7
|
+
API modifications:
|
8
|
+
* lexer.rl: correctly handle __END__ with non-whitespace after it (Peter Zotov)
|
9
|
+
* lexer.rl: handle \r in middle of a line as mere whitespace (Peter Zotov)
|
10
|
+
* ruby{18,19,20,21}.y, builders/default: precisely point to tUMINUS_NUM. (Peter Zotov)
|
11
|
+
|
12
|
+
Features implemented:
|
13
|
+
* lexer.rl, ruby21.y, builders/default: rational/complex literals. (Peter Zotov)
|
14
|
+
|
4
15
|
v2.0.0 (2013-10-06)
|
5
16
|
-------------------
|
6
17
|
|
@@ -26,6 +37,7 @@ v2.0.0.pre7 (2013-09-10)
|
|
26
37
|
|
27
38
|
Features implemented:
|
28
39
|
* Parser::Base: add #parse_with_comments, #parse_file_with_comments. (Trent Ogren)
|
40
|
+
* lexer.rl (Ruby 2.1): "1end": lex non-exponent `e' separate from number. (Peter Zotov)
|
29
41
|
|
30
42
|
Bugs fixed:
|
31
43
|
* lexer.rl: "->*{}": tLAMBEG at expr_beg (fixes #103). (Peter Zotov)
|
data/README.md
CHANGED
@@ -15,7 +15,7 @@ Sponsored by [Evil Martians](http://evilmartians.com).
|
|
15
15
|
|
16
16
|
## Installation
|
17
17
|
|
18
|
-
$ gem install parser
|
18
|
+
$ gem install parser
|
19
19
|
|
20
20
|
## Usage
|
21
21
|
|
@@ -31,11 +31,11 @@ Parse a chunk of code:
|
|
31
31
|
Access the AST's source map:
|
32
32
|
|
33
33
|
p Parser::CurrentRuby.parse("2 + 2").loc
|
34
|
-
# #<Parser::Source::Map::Send:0x007fe5a1ac2388
|
35
|
-
# @dot=nil,
|
36
|
-
# @begin=nil,
|
37
|
-
# @end=nil,
|
38
|
-
# @selector=#<Source::Range (string) 2...3>,
|
34
|
+
# #<Parser::Source::Map::Send:0x007fe5a1ac2388
|
35
|
+
# @dot=nil,
|
36
|
+
# @begin=nil,
|
37
|
+
# @end=nil,
|
38
|
+
# @selector=#<Source::Range (string) 2...3>,
|
39
39
|
# @expression=#<Source::Range (string) 0...5>>
|
40
40
|
|
41
41
|
p Parser::CurrentRuby.parse("2 + 2").loc.selector.source
|
@@ -98,6 +98,7 @@ with Parser:
|
|
98
98
|
* A simple interface and a powerful, tweakable one.
|
99
99
|
* Parses 1.8, 1.9, 2.0 and 2.1 (preliminary) syntax with backwards-compatible
|
100
100
|
AST formats.
|
101
|
+
* [Rewriting][rewriting] support.
|
101
102
|
* Parsing error recovery.
|
102
103
|
* Improved [clang-like][] diagnostic messages with location information.
|
103
104
|
* Written in pure Ruby, runs on MRI 1.8.7 or >=1.9.2, JRuby and Rubinius in 1.8
|
@@ -111,6 +112,7 @@ with Parser:
|
|
111
112
|
[ast]: http://rubygems.org/gems/ast
|
112
113
|
[slop]: http://rubygems.org/gems/slop
|
113
114
|
[insane-lexer]: http://whitequark.org/blog/2013/04/01/ruby-hacking-guide-ch-11-finite-state-lexer/
|
115
|
+
[rewriting]: http://whitequark.org/blog/2013/04/26/lets-play-with-ruby-code/
|
114
116
|
|
115
117
|
## Documentation
|
116
118
|
|
@@ -224,7 +226,7 @@ As of 2013-07-25, affected gems are: activerdf, activerdf_net7, fastreader, gkel
|
|
224
226
|
|
225
227
|
### Invalid Unicode escape sequences
|
226
228
|
|
227
|
-
Ruby MRI 1.9+ permits to specify invalid
|
229
|
+
Ruby MRI 1.9+ permits to specify invalid Unicode codepoints in Unicode escape sequences, such as `\u{d800}`.
|
228
230
|
|
229
231
|
As of 2013-07-25, affected gems are: aws_cloud_search.
|
230
232
|
|
data/Rakefile
CHANGED
@@ -65,7 +65,7 @@ task :changelog do
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
-
IO.popen("git log --pretty='#{format}'
|
68
|
+
IO.popen("git log --pretty='#{format}' 2.0 master", 'r') do |io|
|
69
69
|
current_version = nil
|
70
70
|
|
71
71
|
io.each_line do |line|
|
@@ -102,7 +102,7 @@ task :changelog do
|
|
102
102
|
next unless commits[sigil].any?
|
103
103
|
|
104
104
|
io.puts description
|
105
|
-
commits[sigil].each do |commit|
|
105
|
+
commits[sigil].uniq.each do |commit|
|
106
106
|
io.puts " * #{commit.gsub('<', '\<').lstrip}"
|
107
107
|
end
|
108
108
|
io.puts
|
data/doc/AST_FORMAT.md
CHANGED
@@ -29,6 +29,11 @@ Format:
|
|
29
29
|
(int 123)
|
30
30
|
"123"
|
31
31
|
~~~ expression
|
32
|
+
|
33
|
+
(int -123)
|
34
|
+
"-123"
|
35
|
+
^ operator
|
36
|
+
~~~ expression
|
32
37
|
~~~
|
33
38
|
|
34
39
|
### Float
|
@@ -39,6 +44,11 @@ Format:
|
|
39
44
|
(float 1.0)
|
40
45
|
"1.0"
|
41
46
|
~~~ expression
|
47
|
+
|
48
|
+
(float -1.0)
|
49
|
+
"-1.0"
|
50
|
+
^ operator
|
51
|
+
~~~~ expression
|
42
52
|
~~~
|
43
53
|
|
44
54
|
### String
|
data/lib/parser.rb
CHANGED
@@ -17,8 +17,10 @@ end
|
|
17
17
|
module Parser
|
18
18
|
require 'parser/version'
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
module AST
|
21
|
+
require 'parser/ast/node'
|
22
|
+
require 'parser/ast/processor'
|
23
|
+
end
|
22
24
|
|
23
25
|
module Source
|
24
26
|
require 'parser/source/buffer'
|
data/lib/parser/ast/processor.rb
CHANGED
@@ -53,25 +53,42 @@ module Parser
|
|
53
53
|
|
54
54
|
# Numerics
|
55
55
|
|
56
|
-
def integer(integer_t
|
57
|
-
|
58
|
-
|
56
|
+
def integer(integer_t)
|
57
|
+
numeric(:int, integer_t)
|
58
|
+
end
|
59
59
|
|
60
|
-
|
61
|
-
|
60
|
+
def float(float_t)
|
61
|
+
numeric(:float, float_t)
|
62
62
|
end
|
63
63
|
|
64
|
-
def
|
65
|
-
|
66
|
-
token_map(__LINE__t))
|
64
|
+
def rational(rational_t)
|
65
|
+
numeric(:rational, rational_t)
|
67
66
|
end
|
68
67
|
|
69
|
-
def
|
70
|
-
|
71
|
-
|
68
|
+
def complex(complex_t)
|
69
|
+
numeric(:complex, complex_t)
|
70
|
+
end
|
71
|
+
|
72
|
+
def numeric(kind, token)
|
73
|
+
n(kind, [ value(token) ],
|
74
|
+
Source::Map::Operator.new(nil, loc(token)))
|
75
|
+
end
|
76
|
+
private :numeric
|
77
|
+
|
78
|
+
def negate(uminus_t, numeric)
|
79
|
+
value, = *numeric
|
80
|
+
operator_loc = loc(uminus_t)
|
81
|
+
|
82
|
+
numeric.updated(nil, [ -value ],
|
83
|
+
:location =>
|
84
|
+
Source::Map::Operator.new(
|
85
|
+
operator_loc,
|
86
|
+
operator_loc.join(numeric.loc.expression)))
|
87
|
+
end
|
72
88
|
|
73
|
-
|
74
|
-
|
89
|
+
def __LINE__(__LINE__t)
|
90
|
+
n0(:__LINE__,
|
91
|
+
token_map(__LINE__t))
|
75
92
|
end
|
76
93
|
|
77
94
|
# Strings
|
@@ -1017,19 +1034,6 @@ module Parser
|
|
1017
1034
|
Source::Map.new(loc(token))
|
1018
1035
|
end
|
1019
1036
|
|
1020
|
-
def numeric_map(num_t, negate)
|
1021
|
-
if negate
|
1022
|
-
num_range = loc(num_t)
|
1023
|
-
range = Source::Range.new(num_range.source_buffer,
|
1024
|
-
num_range.begin_pos - 1,
|
1025
|
-
num_range.end_pos)
|
1026
|
-
|
1027
|
-
Source::Map.new(range)
|
1028
|
-
else
|
1029
|
-
token_map(num_t)
|
1030
|
-
end
|
1031
|
-
end
|
1032
|
-
|
1033
1037
|
def delimited_string_map(string_t)
|
1034
1038
|
str_range = loc(string_t)
|
1035
1039
|
|
data/lib/parser/current.rb
CHANGED
data/lib/parser/lexer.rl
CHANGED
@@ -134,6 +134,8 @@ class Parser::Lexer
|
|
134
134
|
|
135
135
|
@num_base = nil # last numeric base
|
136
136
|
@num_digits_s = nil # starting position of numeric digits
|
137
|
+
@num_suffix_s = nil # starting position of numeric suffix
|
138
|
+
@num_xfrm = nil # numeric suffix-induced transformation
|
137
139
|
|
138
140
|
@escape_s = nil # starting position of current sequence
|
139
141
|
@escape = nil # last escaped sequence, as string
|
@@ -500,8 +502,7 @@ class Parser::Lexer
|
|
500
502
|
|
501
503
|
# A list of operators which can occur within an assignment shortcut (+ → +=).
|
502
504
|
operator_arithmetic = '&' | '|' | '&&' | '||' | '^' | '+' | '-' |
|
503
|
-
'*' | '/' | '**' | '~' | '
|
504
|
-
'%' ;
|
505
|
+
'*' | '/' | '**' | '~' | '<<' | '>>' | '%' ;
|
505
506
|
|
506
507
|
# A list of all user-definable operators not covered by groups above.
|
507
508
|
operator_rest = '=~' | '!~' | '==' | '!=' | '!' | '===' |
|
@@ -570,6 +571,33 @@ class Parser::Lexer
|
|
570
571
|
|
571
572
|
label = bareword [?!]? ':';
|
572
573
|
|
574
|
+
#
|
575
|
+
# === NUMERIC PARSING ===
|
576
|
+
#
|
577
|
+
|
578
|
+
int_hex = ( xdigit+ '_' )* xdigit* '_'? ;
|
579
|
+
int_dec = ( digit+ '_' )* digit* '_'? ;
|
580
|
+
int_bin = ( [01]+ '_' )* [01]* '_'? ;
|
581
|
+
|
582
|
+
flo_int = [1-9] [0-9]* ( '_' digit+ )* | '0';
|
583
|
+
flo_frac = '.' ( digit+ '_' )* digit+;
|
584
|
+
flo_pow = [eE] [+\-]? ( digit+ '_' )* digit+;
|
585
|
+
|
586
|
+
int_suffix =
|
587
|
+
'' % { @num_xfrm = lambda { |value| emit(:tINTEGER, value) } }
|
588
|
+
| 'r' % { @num_xfrm = lambda { |value| emit(:tRATIONAL, Rational(value)) } }
|
589
|
+
| 'i' % { @num_xfrm = lambda { |value| emit(:tIMAGINARY, Complex(0, value)) } }
|
590
|
+
| 'ri' % { @num_xfrm = lambda { |value| emit(:tIMAGINARY, Complex(0, Rational(value))) } };
|
591
|
+
|
592
|
+
flo_pow_suffix =
|
593
|
+
'' % { @num_xfrm = lambda { |digits| emit(:tFLOAT, Float(digits)) } }
|
594
|
+
| 'i' % { @num_xfrm = lambda { |digits| emit(:tIMAGINARY, Complex(0, Float(digits))) } };
|
595
|
+
|
596
|
+
flo_suffix =
|
597
|
+
flo_pow_suffix
|
598
|
+
| 'r' % { @num_xfrm = lambda { |digits| emit(:tRATIONAL, Rational(digits)) } }
|
599
|
+
| 'ri' % { @num_xfrm = lambda { |digits| emit(:tIMAGINARY, Complex(0, Rational(digits))) } };
|
600
|
+
|
573
601
|
#
|
574
602
|
# === ESCAPE SEQUENCE PARSING ===
|
575
603
|
#
|
@@ -835,6 +863,11 @@ class Parser::Lexer
|
|
835
863
|
if literal.heredoc?
|
836
864
|
line = tok(@herebody_s, @ts).gsub(/\r+$/, '')
|
837
865
|
|
866
|
+
if version?(18, 19, 20)
|
867
|
+
# See ruby:c48b4209c
|
868
|
+
line = line.gsub(/\r.*$/, '')
|
869
|
+
end
|
870
|
+
|
838
871
|
# Try ending the heredoc with the complete most recently
|
839
872
|
# scanned line. @herebody_s always refers to the start of such line.
|
840
873
|
if literal.nest_and_try_closing(line, @herebody_s, @ts)
|
@@ -1870,23 +1903,15 @@ class Parser::Lexer
|
|
1870
1903
|
# NUMERIC LITERALS
|
1871
1904
|
#
|
1872
1905
|
|
1873
|
-
( '0' [Xx]
|
1874
|
-
|
1875
|
-
| '0' [
|
1876
|
-
|
1877
|
-
| '
|
1878
|
-
|
1879
|
-
|
1880
|
-
( [01]+ '_' )* [01]* '_'?
|
1881
|
-
| [1-9] digit*
|
1882
|
-
%{ @num_base = 10; @num_digits_s = @ts }
|
1883
|
-
( '_' digit+ )* digit* '_'?
|
1884
|
-
| '0' digit*
|
1885
|
-
%{ @num_base = 8; @num_digits_s = @ts }
|
1886
|
-
( '_' digit+ )* digit* '_'?
|
1887
|
-
)
|
1906
|
+
( '0' [Xx] %{ @num_base = 16; @num_digits_s = p } int_hex
|
1907
|
+
| '0' [Dd] %{ @num_base = 10; @num_digits_s = p } int_dec
|
1908
|
+
| '0' [Oo] %{ @num_base = 8; @num_digits_s = p } int_dec
|
1909
|
+
| '0' [Bb] %{ @num_base = 2; @num_digits_s = p } int_bin
|
1910
|
+
| [1-9] digit* '_'? %{ @num_base = 10; @num_digits_s = @ts } int_dec
|
1911
|
+
| '0' digit* '_'? %{ @num_base = 8; @num_digits_s = @ts } int_dec
|
1912
|
+
) %{ @num_suffix_s = p } int_suffix
|
1888
1913
|
=> {
|
1889
|
-
digits = tok(@num_digits_s)
|
1914
|
+
digits = tok(@num_digits_s, @num_suffix_s)
|
1890
1915
|
|
1891
1916
|
if digits.end_with? '_'
|
1892
1917
|
diagnostic :error, Parser::ERRORS[:trailing_in_number] % { :character => '_' },
|
@@ -1902,27 +1927,57 @@ class Parser::Lexer
|
|
1902
1927
|
range(invalid_s, invalid_s + 1)
|
1903
1928
|
end
|
1904
1929
|
|
1905
|
-
|
1930
|
+
if version?(18, 19, 20)
|
1931
|
+
emit(:tINTEGER, digits.to_i(@num_base))
|
1932
|
+
p = @num_suffix_s - 1
|
1933
|
+
else
|
1934
|
+
@num_xfrm.call(digits.to_i(@num_base))
|
1935
|
+
end
|
1906
1936
|
fbreak;
|
1907
1937
|
};
|
1908
1938
|
|
1909
|
-
|
1939
|
+
flo_frac flo_pow?
|
1910
1940
|
=> {
|
1911
1941
|
diagnostic :error, Parser::ERRORS[:no_dot_digit_literal]
|
1912
1942
|
};
|
1913
1943
|
|
1914
|
-
|
1915
|
-
( [1-9] [0-9]* ( '_' digit+ )* | '0' )
|
1916
|
-
( '.' ( digit+ '_' )* digit+ )?
|
1917
|
-
( [eE] [+\-]? ( digit+ '_' )* digit* )?
|
1918
|
-
)
|
1944
|
+
flo_int [eE]
|
1919
1945
|
=> {
|
1920
|
-
if
|
1921
|
-
diagnostic :error,
|
1946
|
+
if version?(18, 19, 20)
|
1947
|
+
diagnostic :error,
|
1948
|
+
Parser::ERRORS[:trailing_in_number] % { :character => tok(@te - 1, @te) },
|
1922
1949
|
range(@te - 1, @te)
|
1950
|
+
else
|
1951
|
+
emit(:tINTEGER, tok(@ts, @te - 1).to_i)
|
1952
|
+
fhold; fbreak;
|
1923
1953
|
end
|
1954
|
+
};
|
1924
1955
|
|
1925
|
-
|
1956
|
+
flo_int flo_frac [eE]
|
1957
|
+
=> {
|
1958
|
+
if version?(18, 19, 20)
|
1959
|
+
diagnostic :error,
|
1960
|
+
Parser::ERRORS[:trailing_in_number] % { :character => tok(@te - 1, @te) },
|
1961
|
+
range(@te - 1, @te)
|
1962
|
+
else
|
1963
|
+
emit(:tFLOAT, tok(@ts, @te - 1).to_f)
|
1964
|
+
fhold; fbreak;
|
1965
|
+
end
|
1966
|
+
};
|
1967
|
+
|
1968
|
+
flo_int
|
1969
|
+
( flo_frac? flo_pow %{ @num_suffix_s = p } flo_pow_suffix
|
1970
|
+
| flo_frac %{ @num_suffix_s = p } flo_suffix
|
1971
|
+
)
|
1972
|
+
=> {
|
1973
|
+
digits = tok(@ts, @num_suffix_s)
|
1974
|
+
|
1975
|
+
if version?(18, 19, 20)
|
1976
|
+
emit(:tFLOAT, Float(digits))
|
1977
|
+
p = @num_suffix_s - 1
|
1978
|
+
else
|
1979
|
+
@num_xfrm.call(digits)
|
1980
|
+
end
|
1926
1981
|
fbreak;
|
1927
1982
|
};
|
1928
1983
|
|
@@ -2077,8 +2132,8 @@ class Parser::Lexer
|
|
2077
2132
|
=> { @eq_begin_s = @ts
|
2078
2133
|
fgoto line_comment; };
|
2079
2134
|
|
2080
|
-
'__END__'
|
2081
|
-
=> { p = pe -
|
2135
|
+
'__END__' ( c_eol - zlen )
|
2136
|
+
=> { p = pe - 3 };
|
2082
2137
|
|
2083
2138
|
c_any
|
2084
2139
|
=> { fhold; fgoto expr_value; };
|
data/lib/parser/ruby18.y
CHANGED
@@ -1619,11 +1619,13 @@ xstring_contents: # nothing
|
|
1619
1619
|
}
|
1620
1620
|
| tUMINUS_NUM tINTEGER =tLOWEST
|
1621
1621
|
{
|
1622
|
-
result = @builder.
|
1622
|
+
result = @builder.negate(val[0],
|
1623
|
+
@builder.integer(val[1]))
|
1623
1624
|
}
|
1624
1625
|
| tUMINUS_NUM tFLOAT =tLOWEST
|
1625
1626
|
{
|
1626
|
-
result = @builder.
|
1627
|
+
result = @builder.negate(val[0],
|
1628
|
+
@builder.float(val[1]))
|
1627
1629
|
}
|
1628
1630
|
|
1629
1631
|
variable: tIDENTIFIER
|
data/lib/parser/ruby19.y
CHANGED
@@ -1749,11 +1749,13 @@ regexp_contents: # nothing
|
|
1749
1749
|
}
|
1750
1750
|
| tUMINUS_NUM tINTEGER =tLOWEST
|
1751
1751
|
{
|
1752
|
-
result = @builder.
|
1752
|
+
result = @builder.negate(val[0],
|
1753
|
+
@builder.integer(val[1]))
|
1753
1754
|
}
|
1754
1755
|
| tUMINUS_NUM tFLOAT =tLOWEST
|
1755
1756
|
{
|
1756
|
-
result = @builder.
|
1757
|
+
result = @builder.negate(val[0],
|
1758
|
+
@builder.float(val[1]))
|
1757
1759
|
}
|
1758
1760
|
|
1759
1761
|
user_variable: tIDENTIFIER
|
data/lib/parser/ruby20.y
CHANGED
@@ -1842,11 +1842,13 @@ regexp_contents: # nothing
|
|
1842
1842
|
}
|
1843
1843
|
| tUMINUS_NUM tINTEGER =tLOWEST
|
1844
1844
|
{
|
1845
|
-
result = @builder.
|
1845
|
+
result = @builder.negate(val[0],
|
1846
|
+
@builder.integer(val[1]))
|
1846
1847
|
}
|
1847
1848
|
| tUMINUS_NUM tFLOAT =tLOWEST
|
1848
1849
|
{
|
1849
|
-
result = @builder.
|
1850
|
+
result = @builder.negate(val[0],
|
1851
|
+
@builder.float(val[1]))
|
1850
1852
|
}
|
1851
1853
|
|
1852
1854
|
user_variable: tIDENTIFIER
|
data/lib/parser/ruby21.y
CHANGED
@@ -17,6 +17,7 @@ token kCLASS kMODULE kDEF kUNDEF kBEGIN kRESCUE kENSURE kEND kIF kUNLESS
|
|
17
17
|
tWORDS_BEG tQWORDS_BEG tSYMBOLS_BEG tQSYMBOLS_BEG tSTRING_DBEG
|
18
18
|
tSTRING_DVAR tSTRING_END tSTRING_DEND tSTRING tSYMBOL
|
19
19
|
tNL tEH tCOLON tCOMMA tSPACE tSEMI tLAMBDA tLAMBEG tCHARACTER
|
20
|
+
tRATIONAL tIMAGINARY
|
20
21
|
|
21
22
|
prechigh
|
22
23
|
right tBANG tTILDE tUPLUS
|
@@ -689,19 +690,11 @@ rule
|
|
689
690
|
{
|
690
691
|
result = @builder.binary_op(val[0], val[1], val[2])
|
691
692
|
}
|
692
|
-
| tUMINUS_NUM
|
693
|
+
| tUMINUS_NUM simple_numeric tPOW arg
|
693
694
|
{
|
694
695
|
result = @builder.unary_op(val[0],
|
695
696
|
@builder.binary_op(
|
696
|
-
|
697
|
-
val[2], val[3]))
|
698
|
-
}
|
699
|
-
| tUMINUS_NUM tFLOAT tPOW arg
|
700
|
-
{
|
701
|
-
result = @builder.unary_op(val[0],
|
702
|
-
@builder.binary_op(
|
703
|
-
@builder.float(val[1]),
|
704
|
-
val[2], val[3]))
|
697
|
+
val[1], val[2], val[3]))
|
705
698
|
}
|
706
699
|
| tUPLUS arg
|
707
700
|
{
|
@@ -1235,8 +1228,6 @@ rule
|
|
1235
1228
|
|
1236
1229
|
f_marg: f_norm_arg
|
1237
1230
|
{
|
1238
|
-
@static_env.declare val[0][0]
|
1239
|
-
|
1240
1231
|
result = @builder.arg(val[0])
|
1241
1232
|
}
|
1242
1233
|
| tLPAREN f_margs rparen
|
@@ -1256,15 +1247,11 @@ rule
|
|
1256
1247
|
f_margs: f_marg_list
|
1257
1248
|
| f_marg_list tCOMMA tSTAR f_norm_arg
|
1258
1249
|
{
|
1259
|
-
@static_env.declare val[3][0]
|
1260
|
-
|
1261
1250
|
result = val[0].
|
1262
1251
|
push(@builder.restarg(val[2], val[3]))
|
1263
1252
|
}
|
1264
1253
|
| f_marg_list tCOMMA tSTAR f_norm_arg tCOMMA f_marg_list
|
1265
1254
|
{
|
1266
|
-
@static_env.declare val[3][0]
|
1267
|
-
|
1268
1255
|
result = val[0].
|
1269
1256
|
push(@builder.restarg(val[2], val[3])).
|
1270
1257
|
concat(val[5])
|
@@ -1282,14 +1269,10 @@ rule
|
|
1282
1269
|
}
|
1283
1270
|
| tSTAR f_norm_arg
|
1284
1271
|
{
|
1285
|
-
@static_env.declare val[1][0]
|
1286
|
-
|
1287
1272
|
result = [ @builder.restarg(val[0], val[1]) ]
|
1288
1273
|
}
|
1289
1274
|
| tSTAR f_norm_arg tCOMMA f_marg_list
|
1290
1275
|
{
|
1291
|
-
@static_env.declare val[1][0]
|
1292
|
-
|
1293
1276
|
result = [ @builder.restarg(val[0], val[1]),
|
1294
1277
|
*val[3] ]
|
1295
1278
|
}
|
@@ -1829,7 +1812,16 @@ regexp_contents: # nothing
|
|
1829
1812
|
result = @builder.symbol_compose(val[0], val[1], val[2])
|
1830
1813
|
}
|
1831
1814
|
|
1832
|
-
numeric:
|
1815
|
+
numeric: simple_numeric
|
1816
|
+
{
|
1817
|
+
result = val[0]
|
1818
|
+
}
|
1819
|
+
| tUMINUS_NUM simple_numeric =tLOWEST
|
1820
|
+
{
|
1821
|
+
result = @builder.negate(val[0], val[1])
|
1822
|
+
}
|
1823
|
+
|
1824
|
+
simple_numeric: tINTEGER
|
1833
1825
|
{
|
1834
1826
|
result = @builder.integer(val[0])
|
1835
1827
|
}
|
@@ -1837,13 +1829,13 @@ regexp_contents: # nothing
|
|
1837
1829
|
{
|
1838
1830
|
result = @builder.float(val[0])
|
1839
1831
|
}
|
1840
|
-
|
|
1832
|
+
| tRATIONAL
|
1841
1833
|
{
|
1842
|
-
result = @builder.
|
1834
|
+
result = @builder.rational(val[0])
|
1843
1835
|
}
|
1844
|
-
|
|
1836
|
+
| tIMAGINARY
|
1845
1837
|
{
|
1846
|
-
result = @builder.
|
1838
|
+
result = @builder.complex(val[0])
|
1847
1839
|
}
|
1848
1840
|
|
1849
1841
|
user_variable: tIDENTIFIER
|
@@ -2087,11 +2079,14 @@ keyword_variable: kNIL
|
|
2087
2079
|
|
2088
2080
|
f_norm_arg: f_bad_arg
|
2089
2081
|
| tIDENTIFIER
|
2090
|
-
|
2091
|
-
f_arg_item: f_norm_arg
|
2092
2082
|
{
|
2093
2083
|
@static_env.declare val[0][0]
|
2094
2084
|
|
2085
|
+
result = val[0]
|
2086
|
+
}
|
2087
|
+
|
2088
|
+
f_arg_item: f_norm_arg
|
2089
|
+
{
|
2095
2090
|
result = @builder.arg(val[0])
|
2096
2091
|
}
|
2097
2092
|
| tLPAREN f_margs rparen
|
@@ -2108,37 +2103,30 @@ keyword_variable: kNIL
|
|
2108
2103
|
result = val[0] << val[2]
|
2109
2104
|
}
|
2110
2105
|
|
2111
|
-
|
2106
|
+
f_label: tLABEL
|
2112
2107
|
{
|
2113
2108
|
check_kwarg_name(val[0])
|
2114
2109
|
|
2115
2110
|
@static_env.declare val[0][0]
|
2116
2111
|
|
2112
|
+
result = val[0]
|
2113
|
+
}
|
2114
|
+
|
2115
|
+
f_kw: f_label arg_value
|
2116
|
+
{
|
2117
2117
|
result = @builder.kwoptarg(val[0], val[1])
|
2118
2118
|
}
|
2119
|
-
|
|
2119
|
+
| f_label
|
2120
2120
|
{
|
2121
|
-
check_kwarg_name(val[0])
|
2122
|
-
|
2123
|
-
@static_env.declare val[0][0]
|
2124
|
-
|
2125
2121
|
result = @builder.kwarg(val[0])
|
2126
2122
|
}
|
2127
2123
|
|
2128
|
-
f_block_kw:
|
2124
|
+
f_block_kw: f_label primary_value
|
2129
2125
|
{
|
2130
|
-
check_kwarg_name(val[0])
|
2131
|
-
|
2132
|
-
@static_env.declare val[0][0]
|
2133
|
-
|
2134
2126
|
result = @builder.kwoptarg(val[0], val[1])
|
2135
2127
|
}
|
2136
|
-
|
|
2128
|
+
| f_label
|
2137
2129
|
{
|
2138
|
-
check_kwarg_name(val[0])
|
2139
|
-
|
2140
|
-
@static_env.declare val[0][0]
|
2141
|
-
|
2142
2130
|
result = @builder.kwarg(val[0])
|
2143
2131
|
}
|
2144
2132
|
|
@@ -2173,17 +2161,13 @@ keyword_variable: kNIL
|
|
2173
2161
|
result = [ @builder.kwrestarg(val[0]) ]
|
2174
2162
|
}
|
2175
2163
|
|
2176
|
-
f_opt:
|
2164
|
+
f_opt: f_norm_arg tEQL arg_value
|
2177
2165
|
{
|
2178
|
-
@static_env.declare val[0][0]
|
2179
|
-
|
2180
2166
|
result = @builder.optarg(val[0], val[1], val[2])
|
2181
2167
|
}
|
2182
2168
|
|
2183
|
-
f_block_opt:
|
2169
|
+
f_block_opt: f_norm_arg tEQL primary_value
|
2184
2170
|
{
|
2185
|
-
@static_env.declare val[0][0]
|
2186
|
-
|
2187
2171
|
result = @builder.optarg(val[0], val[1], val[2])
|
2188
2172
|
}
|
2189
2173
|
|
data/lib/parser/version.rb
CHANGED
data/parser.gemspec
CHANGED
@@ -29,18 +29,19 @@ Gem::Specification.new do |spec|
|
|
29
29
|
|
30
30
|
spec.add_development_dependency 'bundler', '~> 1.2'
|
31
31
|
spec.add_development_dependency 'rake', '~> 0.9'
|
32
|
-
spec.add_development_dependency 'racc'
|
32
|
+
spec.add_development_dependency 'racc', '= 1.4.9' # update to 1.4.11 when it's done
|
33
|
+
spec.add_development_dependency 'cliver', '~> 0.3.0'
|
34
|
+
|
35
|
+
spec.add_development_dependency 'yard'
|
36
|
+
spec.add_development_dependency 'kramdown'
|
33
37
|
|
34
38
|
spec.add_development_dependency 'minitest', '~> 5.0'
|
35
39
|
spec.add_development_dependency 'simplecov', '~> 0.7'
|
36
40
|
spec.add_development_dependency 'coveralls'
|
37
41
|
spec.add_development_dependency 'json_pure' # for coveralls on 1.9.2
|
38
|
-
spec.add_development_dependency '
|
42
|
+
spec.add_development_dependency 'mime-types', '~> 1.25' # for coveralls on 1.8.7
|
39
43
|
|
40
44
|
spec.add_development_dependency 'simplecov-sublime-ruby-coverage'
|
41
45
|
|
42
|
-
spec.add_development_dependency 'yard'
|
43
|
-
spec.add_development_dependency 'kramdown'
|
44
|
-
|
45
46
|
spec.add_development_dependency 'gauntlet'
|
46
47
|
end
|
data/test/test_current.rb
CHANGED
@@ -10,6 +10,8 @@ class TestCurrent < Minitest::Test
|
|
10
10
|
assert_equal Parser::Ruby19, Parser::CurrentRuby
|
11
11
|
when '2.0.0'
|
12
12
|
assert_equal Parser::Ruby20, Parser::CurrentRuby
|
13
|
+
when '2.1.0'
|
14
|
+
assert_equal Parser::Ruby21, Parser::CurrentRuby
|
13
15
|
else
|
14
16
|
flunk "Update test_parser_current for #{RUBY_VERSION}"
|
15
17
|
end
|
data/test/test_lexer.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: ascii-8bit
|
2
2
|
|
3
3
|
require 'helper'
|
4
|
+
require 'complex'
|
4
5
|
|
5
6
|
class TestLexer < Minitest::Test
|
6
7
|
def setup_lexer(version)
|
@@ -86,7 +87,7 @@ class TestLexer < Minitest::Test
|
|
86
87
|
|
87
88
|
lex_token, (lex_value, *) = @lex.advance
|
88
89
|
assert lex_token, 'no more tokens'
|
89
|
-
|
90
|
+
assert_operator [lex_token, lex_value], :eql?, [token, value], input
|
90
91
|
end
|
91
92
|
|
92
93
|
lex_token, (lex_value, *) = @lex.advance
|
@@ -646,6 +647,24 @@ class TestLexer < Minitest::Test
|
|
646
647
|
assert_scanned "0e0", :tFLOAT, 0e0
|
647
648
|
end
|
648
649
|
|
650
|
+
def test_float_e_nothing
|
651
|
+
[18, 19, 20].each do |version|
|
652
|
+
setup_lexer version
|
653
|
+
|
654
|
+
refute_scanned "1end"
|
655
|
+
refute_scanned "1.1end"
|
656
|
+
end
|
657
|
+
|
658
|
+
setup_lexer 21
|
659
|
+
|
660
|
+
assert_scanned("1end",
|
661
|
+
:tINTEGER, 1,
|
662
|
+
:kEND, 'end')
|
663
|
+
assert_scanned("1.1end",
|
664
|
+
:tFLOAT, 1.1,
|
665
|
+
:kEND, 'end')
|
666
|
+
end
|
667
|
+
|
649
668
|
def test_float_neg
|
650
669
|
assert_scanned("-1.0",
|
651
670
|
:tUMINUS_NUM, "-",
|
@@ -2109,13 +2128,14 @@ class TestLexer < Minitest::Test
|
|
2109
2128
|
end
|
2110
2129
|
|
2111
2130
|
def test_underscore_end
|
2112
|
-
|
2113
|
-
|
2114
|
-
|
2115
|
-
|
2116
|
-
|
2117
|
-
|
2118
|
-
|
2131
|
+
assert_scanned("__END__\n")
|
2132
|
+
assert_scanned("__END__")
|
2133
|
+
assert_scanned("__END__ foo",
|
2134
|
+
:tIDENTIFIER, '__END__',
|
2135
|
+
:tIDENTIFIER, 'foo')
|
2136
|
+
assert_scanned("__END__\rfoo",
|
2137
|
+
:tIDENTIFIER, '__END__',
|
2138
|
+
:tIDENTIFIER, 'foo')
|
2119
2139
|
end
|
2120
2140
|
|
2121
2141
|
def test_uplus
|
@@ -2163,6 +2183,71 @@ class TestLexer < Minitest::Test
|
|
2163
2183
|
:tRBRACK, "]")
|
2164
2184
|
end
|
2165
2185
|
|
2186
|
+
def test_int_suffix
|
2187
|
+
[18, 19, 20].each do |version|
|
2188
|
+
setup_lexer version
|
2189
|
+
|
2190
|
+
assert_scanned("42r",
|
2191
|
+
:tINTEGER, 42,
|
2192
|
+
:tIDENTIFIER, 'r')
|
2193
|
+
|
2194
|
+
assert_scanned("42if",
|
2195
|
+
:tINTEGER, 42,
|
2196
|
+
:kIF_MOD, 'if')
|
2197
|
+
end
|
2198
|
+
|
2199
|
+
setup_lexer 21
|
2200
|
+
|
2201
|
+
assert_scanned("42r", :tRATIONAL, Rational(42))
|
2202
|
+
assert_scanned("42i", :tIMAGINARY, Complex(0, 42))
|
2203
|
+
assert_scanned("42ri", :tIMAGINARY, Complex(0, Rational(42)))
|
2204
|
+
end
|
2205
|
+
|
2206
|
+
def test_float_suffix
|
2207
|
+
[18, 19, 20].each do |version|
|
2208
|
+
setup_lexer version
|
2209
|
+
|
2210
|
+
assert_scanned("42.1r",
|
2211
|
+
:tFLOAT, 42.1,
|
2212
|
+
:tIDENTIFIER, 'r')
|
2213
|
+
|
2214
|
+
assert_scanned("42.1if",
|
2215
|
+
:tFLOAT, 42.1,
|
2216
|
+
:kIF_MOD, 'if')
|
2217
|
+
|
2218
|
+
assert_scanned("1e1r",
|
2219
|
+
:tFLOAT, 1e1,
|
2220
|
+
:tIDENTIFIER, 'r')
|
2221
|
+
end
|
2222
|
+
|
2223
|
+
begin
|
2224
|
+
# Feature-check.
|
2225
|
+
Rational("10")
|
2226
|
+
|
2227
|
+
setup_lexer 21
|
2228
|
+
|
2229
|
+
assert_scanned("42.1r", :tRATIONAL, Rational(421, 10))
|
2230
|
+
assert_scanned("42.1i", :tIMAGINARY, Complex(0, 42.1))
|
2231
|
+
assert_scanned("42.1ri", :tIMAGINARY, Complex(0, Rational(421, 10)))
|
2232
|
+
assert_scanned("42.1ir",
|
2233
|
+
:tIMAGINARY, Complex(0, 42.1),
|
2234
|
+
:tIDENTIFIER, 'r')
|
2235
|
+
|
2236
|
+
assert_scanned("1e1i", :tIMAGINARY, Complex(0, 1e1))
|
2237
|
+
assert_scanned("1e1r",
|
2238
|
+
:tFLOAT, 1e1,
|
2239
|
+
:tIDENTIFIER, 'r')
|
2240
|
+
assert_scanned("1e1ri",
|
2241
|
+
:tFLOAT, 1e1,
|
2242
|
+
:tIDENTIFIER, 'ri')
|
2243
|
+
assert_scanned("1e1ir",
|
2244
|
+
:tIMAGINARY, Complex(0, 1e1),
|
2245
|
+
:tIDENTIFIER, 'r')
|
2246
|
+
rescue NoMethodError
|
2247
|
+
# Ruby not modern enough
|
2248
|
+
end
|
2249
|
+
end
|
2250
|
+
|
2166
2251
|
#
|
2167
2252
|
# Tests for whitespace.
|
2168
2253
|
#
|
@@ -2407,6 +2492,19 @@ class TestLexer < Minitest::Test
|
|
2407
2492
|
:tINTEGER, 1)
|
2408
2493
|
end
|
2409
2494
|
|
2495
|
+
def test_whitespace_cr
|
2496
|
+
setup_lexer(20)
|
2497
|
+
assert_scanned("<<E\nfoo\nE\rO",
|
2498
|
+
:tSTRING_BEG, '"',
|
2499
|
+
:tSTRING_CONTENT, "foo\n",
|
2500
|
+
:tSTRING_END, 'E',
|
2501
|
+
:tNL, nil)
|
2502
|
+
|
2503
|
+
setup_lexer(21)
|
2504
|
+
refute_scanned("<<E\nfoo\nE\rO",
|
2505
|
+
:tSTRING_BEG, '"',
|
2506
|
+
:tSTRING_CONTENT, "foo\n")
|
2507
|
+
end
|
2410
2508
|
|
2411
2509
|
#
|
2412
2510
|
# Tests for bugs.
|
data/test/test_parser.rb
CHANGED
@@ -92,7 +92,8 @@ class TestParser < Minitest::Test
|
|
92
92
|
assert_parses(
|
93
93
|
s(:int, -42),
|
94
94
|
%q{-42},
|
95
|
-
%q{
|
95
|
+
%q{^ operator
|
96
|
+
|~~~ expression})
|
96
97
|
end
|
97
98
|
|
98
99
|
def test_int___LINE__
|
@@ -111,7 +112,48 @@ class TestParser < Minitest::Test
|
|
111
112
|
assert_parses(
|
112
113
|
s(:float, -1.33),
|
113
114
|
%q{-1.33},
|
114
|
-
%q{
|
115
|
+
%q{^ operator
|
116
|
+
|~~~~~ expression})
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_rational
|
120
|
+
assert_parses(
|
121
|
+
s(:rational, Rational(42)),
|
122
|
+
%q{42r},
|
123
|
+
%q{~~~ expression},
|
124
|
+
ALL_VERSIONS - %w(1.8 1.9 2.0))
|
125
|
+
|
126
|
+
assert_parses(
|
127
|
+
s(:rational, Rational(421, 10)),
|
128
|
+
%q{42.1r},
|
129
|
+
%q{~~~~~ expression},
|
130
|
+
ALL_VERSIONS - %w(1.8 1.9 2.0))
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_complex
|
134
|
+
assert_parses(
|
135
|
+
s(:complex, Complex(0, 42)),
|
136
|
+
%q{42i},
|
137
|
+
%q{~~~ expression},
|
138
|
+
ALL_VERSIONS - %w(1.8 1.9 2.0))
|
139
|
+
|
140
|
+
assert_parses(
|
141
|
+
s(:complex, Complex(0, Rational(42))),
|
142
|
+
%q{42ri},
|
143
|
+
%q{~~~~ expression},
|
144
|
+
ALL_VERSIONS - %w(1.8 1.9 2.0))
|
145
|
+
|
146
|
+
assert_parses(
|
147
|
+
s(:complex, Complex(0, 42.1)),
|
148
|
+
%q{42.1i},
|
149
|
+
%q{~~~~~ expression},
|
150
|
+
ALL_VERSIONS - %w(1.8 1.9 2.0))
|
151
|
+
|
152
|
+
assert_parses(
|
153
|
+
s(:complex, Complex(0, Rational(421, 10))),
|
154
|
+
%q{42.1ri},
|
155
|
+
%q{~~~~~~ expression},
|
156
|
+
ALL_VERSIONS - %w(1.8 1.9 2.0))
|
115
157
|
end
|
116
158
|
|
117
159
|
# Strings
|
metadata
CHANGED
@@ -1,215 +1,229 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.1.0.pre1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Zotov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ast
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: slop
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3.4'
|
34
|
-
- -
|
34
|
+
- - ">="
|
35
35
|
- !ruby/object:Gem::Version
|
36
36
|
version: 3.4.5
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
|
-
- - ~>
|
41
|
+
- - "~>"
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: '3.4'
|
44
|
-
- -
|
44
|
+
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 3.4.5
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - ~>
|
51
|
+
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '1.2'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- - ~>
|
58
|
+
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '1.2'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rake
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- - ~>
|
65
|
+
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '0.9'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- - ~>
|
72
|
+
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0.9'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: racc
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- - '
|
79
|
+
- - '='
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
81
|
+
version: 1.4.9
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
|
-
- - '
|
86
|
+
- - '='
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
88
|
+
version: 1.4.9
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
90
|
+
name: cliver
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- - ~>
|
93
|
+
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
95
|
+
version: 0.3.0
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- - ~>
|
100
|
+
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
102
|
+
version: 0.3.0
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
|
-
name:
|
104
|
+
name: yard
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- -
|
107
|
+
- - ">="
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '0
|
109
|
+
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
|
-
- -
|
114
|
+
- - ">="
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: '0
|
116
|
+
version: '0'
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
|
-
name:
|
118
|
+
name: kramdown
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
|
-
- -
|
121
|
+
- - ">="
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '0'
|
124
124
|
type: :development
|
125
125
|
prerelease: false
|
126
126
|
version_requirements: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
|
-
- -
|
128
|
+
- - ">="
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
131
|
- !ruby/object:Gem::Dependency
|
132
|
-
name:
|
132
|
+
name: minitest
|
133
133
|
requirement: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
|
-
- -
|
135
|
+
- - "~>"
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version: '0'
|
137
|
+
version: '5.0'
|
138
138
|
type: :development
|
139
139
|
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
|
-
- -
|
142
|
+
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version: '0'
|
144
|
+
version: '5.0'
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
|
-
name:
|
146
|
+
name: simplecov
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
148
148
|
requirements:
|
149
|
-
- - ~>
|
149
|
+
- - "~>"
|
150
150
|
- !ruby/object:Gem::Version
|
151
|
-
version: 0.
|
151
|
+
version: '0.7'
|
152
152
|
type: :development
|
153
153
|
prerelease: false
|
154
154
|
version_requirements: !ruby/object:Gem::Requirement
|
155
155
|
requirements:
|
156
|
-
- - ~>
|
156
|
+
- - "~>"
|
157
157
|
- !ruby/object:Gem::Version
|
158
|
-
version: 0.
|
158
|
+
version: '0.7'
|
159
159
|
- !ruby/object:Gem::Dependency
|
160
|
-
name:
|
160
|
+
name: coveralls
|
161
161
|
requirement: !ruby/object:Gem::Requirement
|
162
162
|
requirements:
|
163
|
-
- -
|
163
|
+
- - ">="
|
164
164
|
- !ruby/object:Gem::Version
|
165
165
|
version: '0'
|
166
166
|
type: :development
|
167
167
|
prerelease: false
|
168
168
|
version_requirements: !ruby/object:Gem::Requirement
|
169
169
|
requirements:
|
170
|
-
- -
|
170
|
+
- - ">="
|
171
171
|
- !ruby/object:Gem::Version
|
172
172
|
version: '0'
|
173
173
|
- !ruby/object:Gem::Dependency
|
174
|
-
name:
|
174
|
+
name: json_pure
|
175
175
|
requirement: !ruby/object:Gem::Requirement
|
176
176
|
requirements:
|
177
|
-
- -
|
177
|
+
- - ">="
|
178
178
|
- !ruby/object:Gem::Version
|
179
179
|
version: '0'
|
180
180
|
type: :development
|
181
181
|
prerelease: false
|
182
182
|
version_requirements: !ruby/object:Gem::Requirement
|
183
183
|
requirements:
|
184
|
-
- -
|
184
|
+
- - ">="
|
185
185
|
- !ruby/object:Gem::Version
|
186
186
|
version: '0'
|
187
187
|
- !ruby/object:Gem::Dependency
|
188
|
-
name:
|
188
|
+
name: mime-types
|
189
189
|
requirement: !ruby/object:Gem::Requirement
|
190
190
|
requirements:
|
191
|
-
- -
|
191
|
+
- - "~>"
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '1.25'
|
194
|
+
type: :development
|
195
|
+
prerelease: false
|
196
|
+
version_requirements: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - "~>"
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '1.25'
|
201
|
+
- !ruby/object:Gem::Dependency
|
202
|
+
name: simplecov-sublime-ruby-coverage
|
203
|
+
requirement: !ruby/object:Gem::Requirement
|
204
|
+
requirements:
|
205
|
+
- - ">="
|
192
206
|
- !ruby/object:Gem::Version
|
193
207
|
version: '0'
|
194
208
|
type: :development
|
195
209
|
prerelease: false
|
196
210
|
version_requirements: !ruby/object:Gem::Requirement
|
197
211
|
requirements:
|
198
|
-
- -
|
212
|
+
- - ">="
|
199
213
|
- !ruby/object:Gem::Version
|
200
214
|
version: '0'
|
201
215
|
- !ruby/object:Gem::Dependency
|
202
216
|
name: gauntlet
|
203
217
|
requirement: !ruby/object:Gem::Requirement
|
204
218
|
requirements:
|
205
|
-
- -
|
219
|
+
- - ">="
|
206
220
|
- !ruby/object:Gem::Version
|
207
221
|
version: '0'
|
208
222
|
type: :development
|
209
223
|
prerelease: false
|
210
224
|
version_requirements: !ruby/object:Gem::Requirement
|
211
225
|
requirements:
|
212
|
-
- -
|
226
|
+
- - ">="
|
213
227
|
- !ruby/object:Gem::Version
|
214
228
|
version: '0'
|
215
229
|
description: A Ruby parser written in pure Ruby.
|
@@ -221,10 +235,10 @@ executables:
|
|
221
235
|
extensions: []
|
222
236
|
extra_rdoc_files: []
|
223
237
|
files:
|
224
|
-
- .gitignore
|
225
|
-
- .rubocop.yml
|
226
|
-
- .travis.yml
|
227
|
-
- .yardopts
|
238
|
+
- ".gitignore"
|
239
|
+
- ".rubocop.yml"
|
240
|
+
- ".travis.yml"
|
241
|
+
- ".yardopts"
|
228
242
|
- CHANGELOG.md
|
229
243
|
- CONTRIBUTING.md
|
230
244
|
- Gemfile
|
@@ -250,14 +264,19 @@ files:
|
|
250
264
|
- lib/parser/current.rb
|
251
265
|
- lib/parser/diagnostic.rb
|
252
266
|
- lib/parser/diagnostic/engine.rb
|
267
|
+
- lib/parser/lexer.rb
|
253
268
|
- lib/parser/lexer.rl
|
254
269
|
- lib/parser/lexer/explanation.rb
|
255
270
|
- lib/parser/lexer/literal.rb
|
256
271
|
- lib/parser/lexer/stack_state.rb
|
257
272
|
- lib/parser/rewriter.rb
|
273
|
+
- lib/parser/ruby18.rb
|
258
274
|
- lib/parser/ruby18.y
|
275
|
+
- lib/parser/ruby19.rb
|
259
276
|
- lib/parser/ruby19.y
|
277
|
+
- lib/parser/ruby20.rb
|
260
278
|
- lib/parser/ruby20.y
|
279
|
+
- lib/parser/ruby21.rb
|
261
280
|
- lib/parser/ruby21.y
|
262
281
|
- lib/parser/runner.rb
|
263
282
|
- lib/parser/runner/ruby_parse.rb
|
@@ -302,11 +321,6 @@ files:
|
|
302
321
|
- test/test_source_rewriter.rb
|
303
322
|
- test/test_source_rewriter_action.rb
|
304
323
|
- test/test_static_environment.rb
|
305
|
-
- lib/parser/lexer.rb
|
306
|
-
- lib/parser/ruby18.rb
|
307
|
-
- lib/parser/ruby19.rb
|
308
|
-
- lib/parser/ruby20.rb
|
309
|
-
- lib/parser/ruby21.rb
|
310
324
|
homepage: http://github.com/whitequark/parser
|
311
325
|
licenses:
|
312
326
|
- MIT
|
@@ -317,17 +331,17 @@ require_paths:
|
|
317
331
|
- lib
|
318
332
|
required_ruby_version: !ruby/object:Gem::Requirement
|
319
333
|
requirements:
|
320
|
-
- -
|
334
|
+
- - ">="
|
321
335
|
- !ruby/object:Gem::Version
|
322
336
|
version: '0'
|
323
337
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
324
338
|
requirements:
|
325
|
-
- -
|
339
|
+
- - ">"
|
326
340
|
- !ruby/object:Gem::Version
|
327
|
-
version:
|
341
|
+
version: 1.3.1
|
328
342
|
requirements: []
|
329
343
|
rubyforge_project:
|
330
|
-
rubygems_version: 2.0.
|
344
|
+
rubygems_version: 2.2.0.preview.1
|
331
345
|
signing_key:
|
332
346
|
specification_version: 4
|
333
347
|
summary: A Ruby parser written in pure Ruby.
|