ruby_parser 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ruby_parser might be problematic. Click here for more details.
- data/History.txt +6 -0
- data/lib/ruby_lexer.rb +36 -58
- data/lib/ruby_parser_extras.rb +1 -1
- data.tar.gz.sig +2 -0
- metadata +100 -19
- metadata.gz.sig +1 -0
data/History.txt
CHANGED
data/lib/ruby_lexer.rb
CHANGED
@@ -46,6 +46,20 @@ class RubyLexer
|
|
46
46
|
STR_SSYM = STR_FUNC_SYMBOL
|
47
47
|
STR_DSYM = STR_FUNC_SYMBOL | STR_FUNC_EXPAND
|
48
48
|
|
49
|
+
TOKENS = {
|
50
|
+
"!" => :tBANG,
|
51
|
+
"!=" => :tNEQ,
|
52
|
+
"!~" => :tNMATCH,
|
53
|
+
"," => :tCOMMA,
|
54
|
+
".." => :tDOT2,
|
55
|
+
"..." => :tDOT3,
|
56
|
+
"=" => :tEQL,
|
57
|
+
"==" => :tEQ,
|
58
|
+
"===" => :tEQQ,
|
59
|
+
"=>" => :tASSOC,
|
60
|
+
"=~" => :tMATCH,
|
61
|
+
}
|
62
|
+
|
49
63
|
# How the parser advances to the next token.
|
50
64
|
#
|
51
65
|
# @return true if not at end of file (EOF).
|
@@ -633,7 +647,7 @@ class RubyLexer
|
|
633
647
|
last_state = lex_state
|
634
648
|
|
635
649
|
loop do # START OF CASE
|
636
|
-
if src.scan(
|
650
|
+
if src.scan(/[\ \t\r\f\v]/) then # \s - \n + \v
|
637
651
|
space_seen = true
|
638
652
|
next
|
639
653
|
elsif src.check(/[^a-zA-Z]/) then
|
@@ -674,29 +688,22 @@ class RubyLexer
|
|
674
688
|
"}" => :tRCURLY
|
675
689
|
}[src.matched]
|
676
690
|
return result
|
691
|
+
elsif src.scan(/\.\.\.?|,|![=~]?/) then
|
692
|
+
self.lex_state = :expr_beg
|
693
|
+
tok = self.yacc_value = src.matched
|
694
|
+
return TOKENS[tok]
|
677
695
|
elsif src.check(/\./) then
|
678
|
-
if src.scan(
|
679
|
-
self.lex_state = :expr_beg
|
680
|
-
self.yacc_value = "..."
|
681
|
-
return :tDOT3
|
682
|
-
elsif src.scan(/\.\./) then
|
683
|
-
self.lex_state = :expr_beg
|
684
|
-
self.yacc_value = ".."
|
685
|
-
return :tDOT2
|
686
|
-
elsif src.scan(/\.\d/) then
|
696
|
+
if src.scan(/\.\d/) then
|
687
697
|
rb_compile_error "no .<digit> floating literal anymore put 0 before dot"
|
688
698
|
elsif src.scan(/\./) then
|
689
699
|
self.lex_state = :expr_dot
|
690
700
|
self.yacc_value = "."
|
691
701
|
return :tDOT
|
692
702
|
end
|
693
|
-
elsif src.scan(/\,/) then
|
694
|
-
self.lex_state = :expr_beg
|
695
|
-
self.yacc_value = ","
|
696
|
-
return :tCOMMA
|
697
703
|
elsif src.scan(/\(/) then
|
698
704
|
result = :tLPAREN2
|
699
705
|
self.command_start = true
|
706
|
+
|
700
707
|
if lex_state == :expr_beg || lex_state == :expr_mid then
|
701
708
|
result = :tLPAREN
|
702
709
|
elsif space_seen then
|
@@ -712,39 +719,24 @@ class RubyLexer
|
|
712
719
|
|
713
720
|
return result
|
714
721
|
elsif src.check(/\=/) then
|
715
|
-
if src.scan(
|
716
|
-
self.fix_arg_lex_state
|
717
|
-
self.yacc_value = "==="
|
718
|
-
return :tEQQ
|
719
|
-
elsif src.scan(/\=\=/) then
|
720
|
-
self.fix_arg_lex_state
|
721
|
-
self.yacc_value = "=="
|
722
|
-
return :tEQ
|
723
|
-
elsif src.scan(/\=~/) then
|
724
|
-
self.fix_arg_lex_state
|
725
|
-
self.yacc_value = "=~"
|
726
|
-
return :tMATCH
|
727
|
-
elsif src.scan(/\=>/) then
|
722
|
+
if src.scan(/\=\=\=|\=\=|\=~|\=>|\=(?!begin\b)/) then
|
728
723
|
self.fix_arg_lex_state
|
729
|
-
self.yacc_value =
|
730
|
-
return
|
731
|
-
elsif src.scan(
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
724
|
+
tok = self.yacc_value = src.matched
|
725
|
+
return TOKENS[tok]
|
726
|
+
elsif src.was_begin_of_line and src.scan(/\=begin(?=\s)/) then
|
727
|
+
# @comments << '=' << src.matched
|
728
|
+
@comments << src.matched
|
729
|
+
|
730
|
+
unless src.scan(/.*?\n=end\s*(\n|\z)/m) then
|
731
|
+
@comments.clear
|
732
|
+
rb_compile_error("embedded document meets end of file")
|
733
|
+
end
|
739
734
|
|
740
|
-
|
735
|
+
@comments << src.matched
|
741
736
|
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
self.yacc_value = '='
|
746
|
-
return :tEQL
|
747
|
-
end
|
737
|
+
next
|
738
|
+
else
|
739
|
+
raise "you shouldn't be able to get here"
|
748
740
|
end
|
749
741
|
elsif src.scan(/\"(#{ESC_RE}|#(#{ESC_RE}|[^\{\#\@\$\"\\])|[^\"\\\#])*\"/o) then
|
750
742
|
self.yacc_value = src.matched[1..-2].gsub(ESC_RE) { unescape $1 }
|
@@ -932,20 +924,6 @@ class RubyLexer
|
|
932
924
|
|
933
925
|
return result
|
934
926
|
end
|
935
|
-
elsif src.check(/\!/) then
|
936
|
-
if src.scan(/\!\=/) then
|
937
|
-
self.lex_state = :expr_beg
|
938
|
-
self.yacc_value = "!="
|
939
|
-
return :tNEQ
|
940
|
-
elsif src.scan(/\!~/) then
|
941
|
-
self.lex_state = :expr_beg
|
942
|
-
self.yacc_value = "!~"
|
943
|
-
return :tNMATCH
|
944
|
-
elsif src.scan(/\!/) then
|
945
|
-
self.lex_state = :expr_beg
|
946
|
-
self.yacc_value = "!"
|
947
|
-
return :tBANG
|
948
|
-
end
|
949
927
|
elsif src.check(/\</) then
|
950
928
|
if src.scan(/\<\=\>/) then
|
951
929
|
self.fix_arg_lex_state
|
data/lib/ruby_parser_extras.rb
CHANGED
@@ -115,7 +115,7 @@ class RPStringScanner < StringScanner
|
|
115
115
|
end
|
116
116
|
|
117
117
|
class RubyParser < Racc::Parser
|
118
|
-
VERSION = '2.0.
|
118
|
+
VERSION = '2.0.5' unless constants.include? "VERSION" # SIGH
|
119
119
|
|
120
120
|
attr_accessor :lexer, :in_def, :in_single, :file
|
121
121
|
attr_reader :env, :comments
|
data.tar.gz.sig
ADDED
metadata
CHANGED
@@ -1,47 +1,122 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 5
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
- 5
|
10
|
+
version: 2.0.5
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Ryan Davis
|
8
14
|
autorequire:
|
9
15
|
bindir: bin
|
10
|
-
cert_chain:
|
16
|
+
cert_chain:
|
17
|
+
- |
|
18
|
+
-----BEGIN CERTIFICATE-----
|
19
|
+
MIIDPjCCAiagAwIBAgIBADANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
|
20
|
+
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
21
|
+
GRYDY29tMB4XDTA5MDMwNjE4NTMxNVoXDTEwMDMwNjE4NTMxNVowRTETMBEGA1UE
|
22
|
+
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
|
23
|
+
JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
|
24
|
+
b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
|
25
|
+
taCPaLmfYIaFcHHCSY4hYDJijRQkLxPeB3xbOfzfLoBDbjvx5JxgJxUjmGa7xhcT
|
26
|
+
oOvjtt5P8+GSK9zLzxQP0gVLS/D0FmoE44XuDr3iQkVS2ujU5zZL84mMNqNB1znh
|
27
|
+
GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
|
28
|
+
qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
|
29
|
+
gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
|
30
|
+
HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
|
31
|
+
AQAY59gYvDxqSqgC92nAP9P8dnGgfZgLxP237xS6XxFGJSghdz/nI6pusfCWKM8m
|
32
|
+
vzjjH2wUMSSf3tNudQ3rCGLf2epkcU13/rguI88wO6MrE0wi4ZqLQX+eZQFskJb/
|
33
|
+
w6x9W1ur8eR01s397LSMexySDBrJOh34cm2AlfKr/jokKCTwcM0OvVZnAutaovC0
|
34
|
+
l1SVZ0ecg88bsWHA0Yhh7NFxK1utWoIhtB6AFC/+trM0FQEB/jZkIS8SaNzn96Rl
|
35
|
+
n0sZEf77FLf5peR8TP/PtmIg7Cyqz23sLM4mCOoTGIy5OcZ8TdyiyINUHtb5ej/T
|
36
|
+
FBHgymkyj/AOSqKRIpXPhjC6
|
37
|
+
-----END CERTIFICATE-----
|
11
38
|
|
12
|
-
date:
|
39
|
+
date: 2010-09-01 00:00:00 -07:00
|
13
40
|
default_executable:
|
14
41
|
dependencies:
|
15
42
|
- !ruby/object:Gem::Dependency
|
16
43
|
name: sexp_processor
|
17
|
-
|
18
|
-
|
19
|
-
|
44
|
+
prerelease: false
|
45
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
20
47
|
requirements:
|
21
48
|
- - ~>
|
22
49
|
- !ruby/object:Gem::Version
|
50
|
+
hash: 7
|
51
|
+
segments:
|
52
|
+
- 3
|
53
|
+
- 0
|
23
54
|
version: "3.0"
|
24
|
-
|
55
|
+
type: :runtime
|
56
|
+
version_requirements: *id001
|
25
57
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
58
|
+
name: rubyforge
|
59
|
+
prerelease: false
|
60
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
hash: 7
|
66
|
+
segments:
|
67
|
+
- 2
|
68
|
+
- 0
|
69
|
+
- 4
|
70
|
+
version: 2.0.4
|
71
|
+
type: :development
|
72
|
+
version_requirements: *id002
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
name: minitest
|
75
|
+
prerelease: false
|
76
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
hash: 9
|
82
|
+
segments:
|
83
|
+
- 1
|
84
|
+
- 7
|
85
|
+
- 1
|
86
|
+
version: 1.7.1
|
27
87
|
type: :development
|
28
|
-
|
29
|
-
|
88
|
+
version_requirements: *id003
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: ParseTree
|
91
|
+
prerelease: false
|
92
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
30
94
|
requirements:
|
31
95
|
- - ~>
|
32
96
|
- !ruby/object:Gem::Version
|
97
|
+
hash: 7
|
98
|
+
segments:
|
99
|
+
- 3
|
100
|
+
- 0
|
33
101
|
version: "3.0"
|
34
|
-
|
102
|
+
type: :development
|
103
|
+
version_requirements: *id004
|
35
104
|
- !ruby/object:Gem::Dependency
|
36
105
|
name: hoe
|
37
|
-
|
38
|
-
|
39
|
-
|
106
|
+
prerelease: false
|
107
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
40
109
|
requirements:
|
41
110
|
- - ">="
|
42
111
|
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
|
112
|
+
hash: 19
|
113
|
+
segments:
|
114
|
+
- 2
|
115
|
+
- 6
|
116
|
+
- 2
|
117
|
+
version: 2.6.2
|
118
|
+
type: :development
|
119
|
+
version_requirements: *id005
|
45
120
|
description: |-
|
46
121
|
ruby_parser (RP) is a ruby parser written in pure ruby (utilizing
|
47
122
|
racc--which does by default use a C extension). RP's output is
|
@@ -104,21 +179,27 @@ rdoc_options:
|
|
104
179
|
require_paths:
|
105
180
|
- lib
|
106
181
|
required_ruby_version: !ruby/object:Gem::Requirement
|
182
|
+
none: false
|
107
183
|
requirements:
|
108
184
|
- - ">="
|
109
185
|
- !ruby/object:Gem::Version
|
186
|
+
hash: 3
|
187
|
+
segments:
|
188
|
+
- 0
|
110
189
|
version: "0"
|
111
|
-
version:
|
112
190
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
|
+
none: false
|
113
192
|
requirements:
|
114
193
|
- - ">="
|
115
194
|
- !ruby/object:Gem::Version
|
195
|
+
hash: 3
|
196
|
+
segments:
|
197
|
+
- 0
|
116
198
|
version: "0"
|
117
|
-
version:
|
118
199
|
requirements: []
|
119
200
|
|
120
201
|
rubyforge_project: parsetree
|
121
|
-
rubygems_version: 1.3.
|
202
|
+
rubygems_version: 1.3.7
|
122
203
|
signing_key:
|
123
204
|
specification_version: 3
|
124
205
|
summary: ruby_parser (RP) is a ruby parser written in pure ruby (utilizing racc--which does by default use a C extension)
|
metadata.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
���Vcc?��"��Is�D).W����)�P��bu<�E��U���EP�R0����?����+V.o��cw$IUE��g�%�6Q)�tŧ��iU�T������9���A�uX�4���# p�e>�����L�`|er�e��'ЪA
|