otherinbox-mail 2.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +607 -0
- data/CONTRIBUTING.md +45 -0
- data/Dependencies.txt +3 -0
- data/Gemfile +26 -0
- data/Gemfile.lock +44 -0
- data/README.md +663 -0
- data/Rakefile +40 -0
- data/TODO.rdoc +9 -0
- data/lib/VERSION +4 -0
- data/lib/mail.rb +101 -0
- data/lib/mail/attachments_list.rb +104 -0
- data/lib/mail/body.rb +291 -0
- data/lib/mail/configuration.rb +75 -0
- data/lib/mail/core_extensions/nil.rb +17 -0
- data/lib/mail/core_extensions/object.rb +13 -0
- data/lib/mail/core_extensions/shell_escape.rb +56 -0
- data/lib/mail/core_extensions/smtp.rb +25 -0
- data/lib/mail/core_extensions/string.rb +33 -0
- data/lib/mail/core_extensions/string/access.rb +145 -0
- data/lib/mail/core_extensions/string/multibyte.rb +78 -0
- data/lib/mail/elements.rb +14 -0
- data/lib/mail/elements/address.rb +306 -0
- data/lib/mail/elements/address_list.rb +74 -0
- data/lib/mail/elements/content_disposition_element.rb +30 -0
- data/lib/mail/elements/content_location_element.rb +25 -0
- data/lib/mail/elements/content_transfer_encoding_element.rb +24 -0
- data/lib/mail/elements/content_type_element.rb +35 -0
- data/lib/mail/elements/date_time_element.rb +26 -0
- data/lib/mail/elements/envelope_from_element.rb +34 -0
- data/lib/mail/elements/message_ids_element.rb +29 -0
- data/lib/mail/elements/mime_version_element.rb +26 -0
- data/lib/mail/elements/phrase_list.rb +21 -0
- data/lib/mail/elements/received_element.rb +30 -0
- data/lib/mail/encodings.rb +274 -0
- data/lib/mail/encodings/7bit.rb +31 -0
- data/lib/mail/encodings/8bit.rb +31 -0
- data/lib/mail/encodings/base64.rb +33 -0
- data/lib/mail/encodings/binary.rb +31 -0
- data/lib/mail/encodings/quoted_printable.rb +38 -0
- data/lib/mail/encodings/transfer_encoding.rb +58 -0
- data/lib/mail/envelope.rb +35 -0
- data/lib/mail/field.rb +234 -0
- data/lib/mail/field_list.rb +33 -0
- data/lib/mail/fields.rb +35 -0
- data/lib/mail/fields/bcc_field.rb +56 -0
- data/lib/mail/fields/cc_field.rb +55 -0
- data/lib/mail/fields/comments_field.rb +41 -0
- data/lib/mail/fields/common/address_container.rb +16 -0
- data/lib/mail/fields/common/common_address.rb +125 -0
- data/lib/mail/fields/common/common_date.rb +42 -0
- data/lib/mail/fields/common/common_field.rb +51 -0
- data/lib/mail/fields/common/common_message_id.rb +44 -0
- data/lib/mail/fields/common/parameter_hash.rb +58 -0
- data/lib/mail/fields/content_description_field.rb +19 -0
- data/lib/mail/fields/content_disposition_field.rb +69 -0
- data/lib/mail/fields/content_id_field.rb +63 -0
- data/lib/mail/fields/content_location_field.rb +42 -0
- data/lib/mail/fields/content_transfer_encoding_field.rb +50 -0
- data/lib/mail/fields/content_type_field.rb +198 -0
- data/lib/mail/fields/date_field.rb +57 -0
- data/lib/mail/fields/from_field.rb +55 -0
- data/lib/mail/fields/in_reply_to_field.rb +55 -0
- data/lib/mail/fields/keywords_field.rb +44 -0
- data/lib/mail/fields/message_id_field.rb +83 -0
- data/lib/mail/fields/mime_version_field.rb +53 -0
- data/lib/mail/fields/optional_field.rb +13 -0
- data/lib/mail/fields/received_field.rb +75 -0
- data/lib/mail/fields/references_field.rb +55 -0
- data/lib/mail/fields/reply_to_field.rb +55 -0
- data/lib/mail/fields/resent_bcc_field.rb +55 -0
- data/lib/mail/fields/resent_cc_field.rb +55 -0
- data/lib/mail/fields/resent_date_field.rb +35 -0
- data/lib/mail/fields/resent_from_field.rb +55 -0
- data/lib/mail/fields/resent_message_id_field.rb +34 -0
- data/lib/mail/fields/resent_sender_field.rb +62 -0
- data/lib/mail/fields/resent_to_field.rb +55 -0
- data/lib/mail/fields/return_path_field.rb +65 -0
- data/lib/mail/fields/sender_field.rb +67 -0
- data/lib/mail/fields/structured_field.rb +51 -0
- data/lib/mail/fields/subject_field.rb +16 -0
- data/lib/mail/fields/to_field.rb +55 -0
- data/lib/mail/fields/unstructured_field.rb +191 -0
- data/lib/mail/header.rb +265 -0
- data/lib/mail/indifferent_hash.rb +146 -0
- data/lib/mail/mail.rb +255 -0
- data/lib/mail/matchers/has_sent_mail.rb +124 -0
- data/lib/mail/message.rb +2059 -0
- data/lib/mail/multibyte.rb +42 -0
- data/lib/mail/multibyte/chars.rb +474 -0
- data/lib/mail/multibyte/exceptions.rb +8 -0
- data/lib/mail/multibyte/unicode.rb +392 -0
- data/lib/mail/multibyte/utils.rb +60 -0
- data/lib/mail/network.rb +14 -0
- data/lib/mail/network/delivery_methods/exim.rb +53 -0
- data/lib/mail/network/delivery_methods/file_delivery.rb +40 -0
- data/lib/mail/network/delivery_methods/sendmail.rb +62 -0
- data/lib/mail/network/delivery_methods/smtp.rb +153 -0
- data/lib/mail/network/delivery_methods/smtp_connection.rb +74 -0
- data/lib/mail/network/delivery_methods/test_mailer.rb +40 -0
- data/lib/mail/network/retriever_methods/base.rb +63 -0
- data/lib/mail/network/retriever_methods/imap.rb +168 -0
- data/lib/mail/network/retriever_methods/pop3.rb +140 -0
- data/lib/mail/network/retriever_methods/test_retriever.rb +47 -0
- data/lib/mail/parsers/address_lists.rb +64 -0
- data/lib/mail/parsers/address_lists.treetop +19 -0
- data/lib/mail/parsers/content_disposition.rb +535 -0
- data/lib/mail/parsers/content_disposition.treetop +46 -0
- data/lib/mail/parsers/content_location.rb +139 -0
- data/lib/mail/parsers/content_location.treetop +20 -0
- data/lib/mail/parsers/content_transfer_encoding.rb +162 -0
- data/lib/mail/parsers/content_transfer_encoding.treetop +20 -0
- data/lib/mail/parsers/content_type.rb +967 -0
- data/lib/mail/parsers/content_type.treetop +68 -0
- data/lib/mail/parsers/date_time.rb +114 -0
- data/lib/mail/parsers/date_time.treetop +11 -0
- data/lib/mail/parsers/envelope_from.rb +194 -0
- data/lib/mail/parsers/envelope_from.treetop +32 -0
- data/lib/mail/parsers/message_ids.rb +45 -0
- data/lib/mail/parsers/message_ids.treetop +15 -0
- data/lib/mail/parsers/mime_version.rb +144 -0
- data/lib/mail/parsers/mime_version.treetop +19 -0
- data/lib/mail/parsers/phrase_lists.rb +45 -0
- data/lib/mail/parsers/phrase_lists.treetop +15 -0
- data/lib/mail/parsers/received.rb +71 -0
- data/lib/mail/parsers/received.treetop +11 -0
- data/lib/mail/parsers/rfc2045.rb +464 -0
- data/lib/mail/parsers/rfc2045.treetop +36 -0
- data/lib/mail/parsers/rfc2822.rb +5341 -0
- data/lib/mail/parsers/rfc2822.treetop +410 -0
- data/lib/mail/parsers/rfc2822_obsolete.rb +3768 -0
- data/lib/mail/parsers/rfc2822_obsolete.treetop +241 -0
- data/lib/mail/part.rb +116 -0
- data/lib/mail/parts_list.rb +55 -0
- data/lib/mail/patterns.rb +34 -0
- data/lib/mail/utilities.rb +215 -0
- data/lib/mail/version.rb +24 -0
- data/lib/mail/version_specific/ruby_1_8.rb +98 -0
- data/lib/mail/version_specific/ruby_1_9.rb +113 -0
- data/lib/tasks/corpus.rake +125 -0
- data/lib/tasks/treetop.rake +10 -0
- metadata +253 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
module Mail
|
2
|
+
grammar ContentDisposition
|
3
|
+
|
4
|
+
include RFC2822
|
5
|
+
include RFC2045
|
6
|
+
|
7
|
+
rule content_disposition
|
8
|
+
disposition_type param_hashes:(CFWS ";" parameter CFWS)* {
|
9
|
+
def parameters
|
10
|
+
param_hashes.elements.map do |param|
|
11
|
+
param.parameter.param_hash
|
12
|
+
end
|
13
|
+
end
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
rule disposition_type
|
18
|
+
[iI] [nN] [lL] [iI] [nN] [eE] / [aA] [tT] [tT] [aA] [cC] [hH] [mM] [eE] [nN] [tT] / extension_token / ''
|
19
|
+
end
|
20
|
+
|
21
|
+
rule extension_token
|
22
|
+
ietf_token / custom_x_token
|
23
|
+
end
|
24
|
+
|
25
|
+
rule parameter
|
26
|
+
CFWS? attr:attribute "=" val:value CFWS? {
|
27
|
+
def param_hash
|
28
|
+
{attr.text_value => val.text_value}
|
29
|
+
end
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
rule attribute
|
34
|
+
token+
|
35
|
+
end
|
36
|
+
|
37
|
+
rule value
|
38
|
+
quoted_string {
|
39
|
+
def text_value
|
40
|
+
quoted_content.text_value
|
41
|
+
end
|
42
|
+
} / (token / [\x3d])+
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
+
|
3
|
+
|
4
|
+
module Mail
|
5
|
+
module ContentLocation
|
6
|
+
include Treetop::Runtime
|
7
|
+
|
8
|
+
def root
|
9
|
+
@root ||= :primary
|
10
|
+
end
|
11
|
+
|
12
|
+
include RFC2822
|
13
|
+
|
14
|
+
include RFC2045
|
15
|
+
|
16
|
+
module Primary0
|
17
|
+
def CFWS1
|
18
|
+
elements[0]
|
19
|
+
end
|
20
|
+
|
21
|
+
def location
|
22
|
+
elements[1]
|
23
|
+
end
|
24
|
+
|
25
|
+
def CFWS2
|
26
|
+
elements[2]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def _nt_primary
|
31
|
+
start_index = index
|
32
|
+
if node_cache[:primary].has_key?(index)
|
33
|
+
cached = node_cache[:primary][index]
|
34
|
+
if cached
|
35
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
36
|
+
@index = cached.interval.end
|
37
|
+
end
|
38
|
+
return cached
|
39
|
+
end
|
40
|
+
|
41
|
+
i0, s0 = index, []
|
42
|
+
r1 = _nt_CFWS
|
43
|
+
s0 << r1
|
44
|
+
if r1
|
45
|
+
r2 = _nt_location
|
46
|
+
s0 << r2
|
47
|
+
if r2
|
48
|
+
r3 = _nt_CFWS
|
49
|
+
s0 << r3
|
50
|
+
end
|
51
|
+
end
|
52
|
+
if s0.last
|
53
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
54
|
+
r0.extend(Primary0)
|
55
|
+
else
|
56
|
+
@index = i0
|
57
|
+
r0 = nil
|
58
|
+
end
|
59
|
+
|
60
|
+
node_cache[:primary][start_index] = r0
|
61
|
+
|
62
|
+
r0
|
63
|
+
end
|
64
|
+
|
65
|
+
module Location0
|
66
|
+
def text_value
|
67
|
+
quoted_content.text_value
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def _nt_location
|
72
|
+
start_index = index
|
73
|
+
if node_cache[:location].has_key?(index)
|
74
|
+
cached = node_cache[:location][index]
|
75
|
+
if cached
|
76
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
77
|
+
@index = cached.interval.end
|
78
|
+
end
|
79
|
+
return cached
|
80
|
+
end
|
81
|
+
|
82
|
+
i0 = index
|
83
|
+
r1 = _nt_quoted_string
|
84
|
+
r1.extend(Location0)
|
85
|
+
if r1
|
86
|
+
r0 = r1
|
87
|
+
else
|
88
|
+
s2, i2 = [], index
|
89
|
+
loop do
|
90
|
+
i3 = index
|
91
|
+
r4 = _nt_token
|
92
|
+
if r4
|
93
|
+
r3 = r4
|
94
|
+
else
|
95
|
+
if has_terminal?('\G[\\x3d]', true, index)
|
96
|
+
r5 = true
|
97
|
+
@index += 1
|
98
|
+
else
|
99
|
+
r5 = nil
|
100
|
+
end
|
101
|
+
if r5
|
102
|
+
r3 = r5
|
103
|
+
else
|
104
|
+
@index = i3
|
105
|
+
r3 = nil
|
106
|
+
end
|
107
|
+
end
|
108
|
+
if r3
|
109
|
+
s2 << r3
|
110
|
+
else
|
111
|
+
break
|
112
|
+
end
|
113
|
+
end
|
114
|
+
if s2.empty?
|
115
|
+
@index = i2
|
116
|
+
r2 = nil
|
117
|
+
else
|
118
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
119
|
+
end
|
120
|
+
if r2
|
121
|
+
r0 = r2
|
122
|
+
else
|
123
|
+
@index = i0
|
124
|
+
r0 = nil
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
node_cache[:location][start_index] = r0
|
129
|
+
|
130
|
+
r0
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
class ContentLocationParser < Treetop::Runtime::CompiledParser
|
136
|
+
include ContentLocation
|
137
|
+
end
|
138
|
+
|
139
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Mail
|
2
|
+
grammar ContentLocation
|
3
|
+
|
4
|
+
include RFC2822
|
5
|
+
include RFC2045
|
6
|
+
|
7
|
+
rule primary
|
8
|
+
CFWS location CFWS
|
9
|
+
end
|
10
|
+
|
11
|
+
rule location
|
12
|
+
quoted_string {
|
13
|
+
def text_value
|
14
|
+
quoted_content.text_value
|
15
|
+
end
|
16
|
+
} / (token / [\x3d])+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,162 @@
|
|
1
|
+
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
+
|
3
|
+
|
4
|
+
module Mail
|
5
|
+
module ContentTransferEncoding
|
6
|
+
include Treetop::Runtime
|
7
|
+
|
8
|
+
def root
|
9
|
+
@root ||= :primary
|
10
|
+
end
|
11
|
+
|
12
|
+
include RFC2822
|
13
|
+
|
14
|
+
include RFC2045
|
15
|
+
|
16
|
+
module Primary0
|
17
|
+
def CFWS1
|
18
|
+
elements[0]
|
19
|
+
end
|
20
|
+
|
21
|
+
def encoding
|
22
|
+
elements[1]
|
23
|
+
end
|
24
|
+
|
25
|
+
def CFWS2
|
26
|
+
elements[2]
|
27
|
+
end
|
28
|
+
|
29
|
+
def CFWS3
|
30
|
+
elements[4]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def _nt_primary
|
35
|
+
start_index = index
|
36
|
+
if node_cache[:primary].has_key?(index)
|
37
|
+
cached = node_cache[:primary][index]
|
38
|
+
if cached
|
39
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
40
|
+
@index = cached.interval.end
|
41
|
+
end
|
42
|
+
return cached
|
43
|
+
end
|
44
|
+
|
45
|
+
i0, s0 = index, []
|
46
|
+
r1 = _nt_CFWS
|
47
|
+
s0 << r1
|
48
|
+
if r1
|
49
|
+
r2 = _nt_encoding
|
50
|
+
s0 << r2
|
51
|
+
if r2
|
52
|
+
r3 = _nt_CFWS
|
53
|
+
s0 << r3
|
54
|
+
if r3
|
55
|
+
if has_terminal?(";", false, index)
|
56
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
57
|
+
@index += 1
|
58
|
+
else
|
59
|
+
terminal_parse_failure(";")
|
60
|
+
r5 = nil
|
61
|
+
end
|
62
|
+
if r5
|
63
|
+
r4 = r5
|
64
|
+
else
|
65
|
+
r4 = instantiate_node(SyntaxNode,input, index...index)
|
66
|
+
end
|
67
|
+
s0 << r4
|
68
|
+
if r4
|
69
|
+
r6 = _nt_CFWS
|
70
|
+
s0 << r6
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
if s0.last
|
76
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
77
|
+
r0.extend(Primary0)
|
78
|
+
else
|
79
|
+
@index = i0
|
80
|
+
r0 = nil
|
81
|
+
end
|
82
|
+
|
83
|
+
node_cache[:primary][start_index] = r0
|
84
|
+
|
85
|
+
r0
|
86
|
+
end
|
87
|
+
|
88
|
+
module Encoding0
|
89
|
+
def ietf_token
|
90
|
+
elements[0]
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
module Encoding1
|
96
|
+
def text_value
|
97
|
+
ietf_token.text_value
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def _nt_encoding
|
102
|
+
start_index = index
|
103
|
+
if node_cache[:encoding].has_key?(index)
|
104
|
+
cached = node_cache[:encoding][index]
|
105
|
+
if cached
|
106
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
107
|
+
@index = cached.interval.end
|
108
|
+
end
|
109
|
+
return cached
|
110
|
+
end
|
111
|
+
|
112
|
+
i0 = index
|
113
|
+
i1, s1 = index, []
|
114
|
+
r2 = _nt_ietf_token
|
115
|
+
s1 << r2
|
116
|
+
if r2
|
117
|
+
if has_terminal?("s", false, index)
|
118
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
119
|
+
@index += 1
|
120
|
+
else
|
121
|
+
terminal_parse_failure("s")
|
122
|
+
r4 = nil
|
123
|
+
end
|
124
|
+
if r4
|
125
|
+
r3 = r4
|
126
|
+
else
|
127
|
+
r3 = instantiate_node(SyntaxNode,input, index...index)
|
128
|
+
end
|
129
|
+
s1 << r3
|
130
|
+
end
|
131
|
+
if s1.last
|
132
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
133
|
+
r1.extend(Encoding0)
|
134
|
+
r1.extend(Encoding1)
|
135
|
+
else
|
136
|
+
@index = i1
|
137
|
+
r1 = nil
|
138
|
+
end
|
139
|
+
if r1
|
140
|
+
r0 = r1
|
141
|
+
else
|
142
|
+
r5 = _nt_custom_x_token
|
143
|
+
if r5
|
144
|
+
r0 = r5
|
145
|
+
else
|
146
|
+
@index = i0
|
147
|
+
r0 = nil
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
node_cache[:encoding][start_index] = r0
|
152
|
+
|
153
|
+
r0
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
157
|
+
|
158
|
+
class ContentTransferEncodingParser < Treetop::Runtime::CompiledParser
|
159
|
+
include ContentTransferEncoding
|
160
|
+
end
|
161
|
+
|
162
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Mail
|
2
|
+
grammar ContentTransferEncoding
|
3
|
+
|
4
|
+
include RFC2822
|
5
|
+
include RFC2045
|
6
|
+
|
7
|
+
rule primary
|
8
|
+
CFWS encoding CFWS ";"? CFWS
|
9
|
+
end
|
10
|
+
|
11
|
+
rule encoding
|
12
|
+
ietf_token "s"? {
|
13
|
+
def text_value
|
14
|
+
ietf_token.text_value
|
15
|
+
end
|
16
|
+
} / custom_x_token
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,967 @@
|
|
1
|
+
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
+
|
3
|
+
|
4
|
+
module Mail
|
5
|
+
module ContentType
|
6
|
+
include Treetop::Runtime
|
7
|
+
|
8
|
+
def root
|
9
|
+
@root ||= :content_type
|
10
|
+
end
|
11
|
+
|
12
|
+
include RFC2822
|
13
|
+
|
14
|
+
include RFC2045
|
15
|
+
|
16
|
+
module ContentType0
|
17
|
+
def CFWS1
|
18
|
+
elements[0]
|
19
|
+
end
|
20
|
+
|
21
|
+
def parameter
|
22
|
+
elements[2]
|
23
|
+
end
|
24
|
+
|
25
|
+
def CFWS2
|
26
|
+
elements[3]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
module ContentType1
|
31
|
+
def main_type
|
32
|
+
elements[0]
|
33
|
+
end
|
34
|
+
|
35
|
+
def sub_type
|
36
|
+
elements[2]
|
37
|
+
end
|
38
|
+
|
39
|
+
def param_hashes
|
40
|
+
elements[3]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
module ContentType2
|
45
|
+
def parameters
|
46
|
+
param_hashes.elements.map do |param|
|
47
|
+
param.parameter.param_hash
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def _nt_content_type
|
53
|
+
start_index = index
|
54
|
+
if node_cache[:content_type].has_key?(index)
|
55
|
+
cached = node_cache[:content_type][index]
|
56
|
+
if cached
|
57
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
58
|
+
@index = cached.interval.end
|
59
|
+
end
|
60
|
+
return cached
|
61
|
+
end
|
62
|
+
|
63
|
+
i0, s0 = index, []
|
64
|
+
r1 = _nt_main_type
|
65
|
+
s0 << r1
|
66
|
+
if r1
|
67
|
+
if has_terminal?("/", false, index)
|
68
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
69
|
+
@index += 1
|
70
|
+
else
|
71
|
+
terminal_parse_failure("/")
|
72
|
+
r2 = nil
|
73
|
+
end
|
74
|
+
s0 << r2
|
75
|
+
if r2
|
76
|
+
r3 = _nt_sub_type
|
77
|
+
s0 << r3
|
78
|
+
if r3
|
79
|
+
s4, i4 = [], index
|
80
|
+
loop do
|
81
|
+
i5, s5 = index, []
|
82
|
+
r6 = _nt_CFWS
|
83
|
+
s5 << r6
|
84
|
+
if r6
|
85
|
+
if has_terminal?(";", false, index)
|
86
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
87
|
+
@index += 1
|
88
|
+
else
|
89
|
+
terminal_parse_failure(";")
|
90
|
+
r8 = nil
|
91
|
+
end
|
92
|
+
if r8
|
93
|
+
r7 = r8
|
94
|
+
else
|
95
|
+
r7 = instantiate_node(SyntaxNode,input, index...index)
|
96
|
+
end
|
97
|
+
s5 << r7
|
98
|
+
if r7
|
99
|
+
r9 = _nt_parameter
|
100
|
+
s5 << r9
|
101
|
+
if r9
|
102
|
+
r10 = _nt_CFWS
|
103
|
+
s5 << r10
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
if s5.last
|
108
|
+
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
109
|
+
r5.extend(ContentType0)
|
110
|
+
else
|
111
|
+
@index = i5
|
112
|
+
r5 = nil
|
113
|
+
end
|
114
|
+
if r5
|
115
|
+
s4 << r5
|
116
|
+
else
|
117
|
+
break
|
118
|
+
end
|
119
|
+
end
|
120
|
+
r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
|
121
|
+
s0 << r4
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
if s0.last
|
126
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
127
|
+
r0.extend(ContentType1)
|
128
|
+
r0.extend(ContentType2)
|
129
|
+
else
|
130
|
+
@index = i0
|
131
|
+
r0 = nil
|
132
|
+
end
|
133
|
+
|
134
|
+
node_cache[:content_type][start_index] = r0
|
135
|
+
|
136
|
+
r0
|
137
|
+
end
|
138
|
+
|
139
|
+
def _nt_main_type
|
140
|
+
start_index = index
|
141
|
+
if node_cache[:main_type].has_key?(index)
|
142
|
+
cached = node_cache[:main_type][index]
|
143
|
+
if cached
|
144
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
145
|
+
@index = cached.interval.end
|
146
|
+
end
|
147
|
+
return cached
|
148
|
+
end
|
149
|
+
|
150
|
+
i0 = index
|
151
|
+
r1 = _nt_discrete_type
|
152
|
+
if r1
|
153
|
+
r0 = r1
|
154
|
+
else
|
155
|
+
r2 = _nt_composite_type
|
156
|
+
if r2
|
157
|
+
r0 = r2
|
158
|
+
else
|
159
|
+
@index = i0
|
160
|
+
r0 = nil
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
node_cache[:main_type][start_index] = r0
|
165
|
+
|
166
|
+
r0
|
167
|
+
end
|
168
|
+
|
169
|
+
module DiscreteType0
|
170
|
+
end
|
171
|
+
|
172
|
+
module DiscreteType1
|
173
|
+
end
|
174
|
+
|
175
|
+
module DiscreteType2
|
176
|
+
end
|
177
|
+
|
178
|
+
module DiscreteType3
|
179
|
+
end
|
180
|
+
|
181
|
+
module DiscreteType4
|
182
|
+
end
|
183
|
+
|
184
|
+
def _nt_discrete_type
|
185
|
+
start_index = index
|
186
|
+
if node_cache[:discrete_type].has_key?(index)
|
187
|
+
cached = node_cache[:discrete_type][index]
|
188
|
+
if cached
|
189
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
190
|
+
@index = cached.interval.end
|
191
|
+
end
|
192
|
+
return cached
|
193
|
+
end
|
194
|
+
|
195
|
+
i0 = index
|
196
|
+
i1, s1 = index, []
|
197
|
+
if has_terminal?('\G[tT]', true, index)
|
198
|
+
r2 = true
|
199
|
+
@index += 1
|
200
|
+
else
|
201
|
+
r2 = nil
|
202
|
+
end
|
203
|
+
s1 << r2
|
204
|
+
if r2
|
205
|
+
if has_terminal?('\G[eE]', true, index)
|
206
|
+
r3 = true
|
207
|
+
@index += 1
|
208
|
+
else
|
209
|
+
r3 = nil
|
210
|
+
end
|
211
|
+
s1 << r3
|
212
|
+
if r3
|
213
|
+
if has_terminal?('\G[xX]', true, index)
|
214
|
+
r4 = true
|
215
|
+
@index += 1
|
216
|
+
else
|
217
|
+
r4 = nil
|
218
|
+
end
|
219
|
+
s1 << r4
|
220
|
+
if r4
|
221
|
+
if has_terminal?('\G[tT]', true, index)
|
222
|
+
r5 = true
|
223
|
+
@index += 1
|
224
|
+
else
|
225
|
+
r5 = nil
|
226
|
+
end
|
227
|
+
s1 << r5
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
if s1.last
|
232
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
233
|
+
r1.extend(DiscreteType0)
|
234
|
+
else
|
235
|
+
@index = i1
|
236
|
+
r1 = nil
|
237
|
+
end
|
238
|
+
if r1
|
239
|
+
r0 = r1
|
240
|
+
else
|
241
|
+
i6, s6 = index, []
|
242
|
+
if has_terminal?('\G[iI]', true, index)
|
243
|
+
r7 = true
|
244
|
+
@index += 1
|
245
|
+
else
|
246
|
+
r7 = nil
|
247
|
+
end
|
248
|
+
s6 << r7
|
249
|
+
if r7
|
250
|
+
if has_terminal?('\G[mM]', true, index)
|
251
|
+
r8 = true
|
252
|
+
@index += 1
|
253
|
+
else
|
254
|
+
r8 = nil
|
255
|
+
end
|
256
|
+
s6 << r8
|
257
|
+
if r8
|
258
|
+
if has_terminal?('\G[aA]', true, index)
|
259
|
+
r9 = true
|
260
|
+
@index += 1
|
261
|
+
else
|
262
|
+
r9 = nil
|
263
|
+
end
|
264
|
+
s6 << r9
|
265
|
+
if r9
|
266
|
+
if has_terminal?('\G[gG]', true, index)
|
267
|
+
r10 = true
|
268
|
+
@index += 1
|
269
|
+
else
|
270
|
+
r10 = nil
|
271
|
+
end
|
272
|
+
s6 << r10
|
273
|
+
if r10
|
274
|
+
if has_terminal?('\G[eE]', true, index)
|
275
|
+
r11 = true
|
276
|
+
@index += 1
|
277
|
+
else
|
278
|
+
r11 = nil
|
279
|
+
end
|
280
|
+
s6 << r11
|
281
|
+
end
|
282
|
+
end
|
283
|
+
end
|
284
|
+
end
|
285
|
+
if s6.last
|
286
|
+
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
287
|
+
r6.extend(DiscreteType1)
|
288
|
+
else
|
289
|
+
@index = i6
|
290
|
+
r6 = nil
|
291
|
+
end
|
292
|
+
if r6
|
293
|
+
r0 = r6
|
294
|
+
else
|
295
|
+
i12, s12 = index, []
|
296
|
+
if has_terminal?('\G[aA]', true, index)
|
297
|
+
r13 = true
|
298
|
+
@index += 1
|
299
|
+
else
|
300
|
+
r13 = nil
|
301
|
+
end
|
302
|
+
s12 << r13
|
303
|
+
if r13
|
304
|
+
if has_terminal?('\G[uU]', true, index)
|
305
|
+
r14 = true
|
306
|
+
@index += 1
|
307
|
+
else
|
308
|
+
r14 = nil
|
309
|
+
end
|
310
|
+
s12 << r14
|
311
|
+
if r14
|
312
|
+
if has_terminal?('\G[dD]', true, index)
|
313
|
+
r15 = true
|
314
|
+
@index += 1
|
315
|
+
else
|
316
|
+
r15 = nil
|
317
|
+
end
|
318
|
+
s12 << r15
|
319
|
+
if r15
|
320
|
+
if has_terminal?('\G[iI]', true, index)
|
321
|
+
r16 = true
|
322
|
+
@index += 1
|
323
|
+
else
|
324
|
+
r16 = nil
|
325
|
+
end
|
326
|
+
s12 << r16
|
327
|
+
if r16
|
328
|
+
if has_terminal?('\G[oO]', true, index)
|
329
|
+
r17 = true
|
330
|
+
@index += 1
|
331
|
+
else
|
332
|
+
r17 = nil
|
333
|
+
end
|
334
|
+
s12 << r17
|
335
|
+
end
|
336
|
+
end
|
337
|
+
end
|
338
|
+
end
|
339
|
+
if s12.last
|
340
|
+
r12 = instantiate_node(SyntaxNode,input, i12...index, s12)
|
341
|
+
r12.extend(DiscreteType2)
|
342
|
+
else
|
343
|
+
@index = i12
|
344
|
+
r12 = nil
|
345
|
+
end
|
346
|
+
if r12
|
347
|
+
r0 = r12
|
348
|
+
else
|
349
|
+
i18, s18 = index, []
|
350
|
+
if has_terminal?('\G[vV]', true, index)
|
351
|
+
r19 = true
|
352
|
+
@index += 1
|
353
|
+
else
|
354
|
+
r19 = nil
|
355
|
+
end
|
356
|
+
s18 << r19
|
357
|
+
if r19
|
358
|
+
if has_terminal?('\G[iI]', true, index)
|
359
|
+
r20 = true
|
360
|
+
@index += 1
|
361
|
+
else
|
362
|
+
r20 = nil
|
363
|
+
end
|
364
|
+
s18 << r20
|
365
|
+
if r20
|
366
|
+
if has_terminal?('\G[dD]', true, index)
|
367
|
+
r21 = true
|
368
|
+
@index += 1
|
369
|
+
else
|
370
|
+
r21 = nil
|
371
|
+
end
|
372
|
+
s18 << r21
|
373
|
+
if r21
|
374
|
+
if has_terminal?('\G[eE]', true, index)
|
375
|
+
r22 = true
|
376
|
+
@index += 1
|
377
|
+
else
|
378
|
+
r22 = nil
|
379
|
+
end
|
380
|
+
s18 << r22
|
381
|
+
if r22
|
382
|
+
if has_terminal?('\G[oO]', true, index)
|
383
|
+
r23 = true
|
384
|
+
@index += 1
|
385
|
+
else
|
386
|
+
r23 = nil
|
387
|
+
end
|
388
|
+
s18 << r23
|
389
|
+
end
|
390
|
+
end
|
391
|
+
end
|
392
|
+
end
|
393
|
+
if s18.last
|
394
|
+
r18 = instantiate_node(SyntaxNode,input, i18...index, s18)
|
395
|
+
r18.extend(DiscreteType3)
|
396
|
+
else
|
397
|
+
@index = i18
|
398
|
+
r18 = nil
|
399
|
+
end
|
400
|
+
if r18
|
401
|
+
r0 = r18
|
402
|
+
else
|
403
|
+
i24, s24 = index, []
|
404
|
+
if has_terminal?('\G[aA]', true, index)
|
405
|
+
r25 = true
|
406
|
+
@index += 1
|
407
|
+
else
|
408
|
+
r25 = nil
|
409
|
+
end
|
410
|
+
s24 << r25
|
411
|
+
if r25
|
412
|
+
if has_terminal?('\G[pP]', true, index)
|
413
|
+
r26 = true
|
414
|
+
@index += 1
|
415
|
+
else
|
416
|
+
r26 = nil
|
417
|
+
end
|
418
|
+
s24 << r26
|
419
|
+
if r26
|
420
|
+
if has_terminal?('\G[pP]', true, index)
|
421
|
+
r27 = true
|
422
|
+
@index += 1
|
423
|
+
else
|
424
|
+
r27 = nil
|
425
|
+
end
|
426
|
+
s24 << r27
|
427
|
+
if r27
|
428
|
+
if has_terminal?('\G[lL]', true, index)
|
429
|
+
r28 = true
|
430
|
+
@index += 1
|
431
|
+
else
|
432
|
+
r28 = nil
|
433
|
+
end
|
434
|
+
s24 << r28
|
435
|
+
if r28
|
436
|
+
if has_terminal?('\G[iI]', true, index)
|
437
|
+
r29 = true
|
438
|
+
@index += 1
|
439
|
+
else
|
440
|
+
r29 = nil
|
441
|
+
end
|
442
|
+
s24 << r29
|
443
|
+
if r29
|
444
|
+
if has_terminal?('\G[cC]', true, index)
|
445
|
+
r30 = true
|
446
|
+
@index += 1
|
447
|
+
else
|
448
|
+
r30 = nil
|
449
|
+
end
|
450
|
+
s24 << r30
|
451
|
+
if r30
|
452
|
+
if has_terminal?('\G[aA]', true, index)
|
453
|
+
r31 = true
|
454
|
+
@index += 1
|
455
|
+
else
|
456
|
+
r31 = nil
|
457
|
+
end
|
458
|
+
s24 << r31
|
459
|
+
if r31
|
460
|
+
if has_terminal?('\G[tT]', true, index)
|
461
|
+
r32 = true
|
462
|
+
@index += 1
|
463
|
+
else
|
464
|
+
r32 = nil
|
465
|
+
end
|
466
|
+
s24 << r32
|
467
|
+
if r32
|
468
|
+
if has_terminal?('\G[iI]', true, index)
|
469
|
+
r33 = true
|
470
|
+
@index += 1
|
471
|
+
else
|
472
|
+
r33 = nil
|
473
|
+
end
|
474
|
+
s24 << r33
|
475
|
+
if r33
|
476
|
+
if has_terminal?('\G[oO]', true, index)
|
477
|
+
r34 = true
|
478
|
+
@index += 1
|
479
|
+
else
|
480
|
+
r34 = nil
|
481
|
+
end
|
482
|
+
s24 << r34
|
483
|
+
if r34
|
484
|
+
if has_terminal?('\G[nN]', true, index)
|
485
|
+
r35 = true
|
486
|
+
@index += 1
|
487
|
+
else
|
488
|
+
r35 = nil
|
489
|
+
end
|
490
|
+
s24 << r35
|
491
|
+
end
|
492
|
+
end
|
493
|
+
end
|
494
|
+
end
|
495
|
+
end
|
496
|
+
end
|
497
|
+
end
|
498
|
+
end
|
499
|
+
end
|
500
|
+
end
|
501
|
+
if s24.last
|
502
|
+
r24 = instantiate_node(SyntaxNode,input, i24...index, s24)
|
503
|
+
r24.extend(DiscreteType4)
|
504
|
+
else
|
505
|
+
@index = i24
|
506
|
+
r24 = nil
|
507
|
+
end
|
508
|
+
if r24
|
509
|
+
r0 = r24
|
510
|
+
else
|
511
|
+
r36 = _nt_extension_token
|
512
|
+
if r36
|
513
|
+
r0 = r36
|
514
|
+
else
|
515
|
+
@index = i0
|
516
|
+
r0 = nil
|
517
|
+
end
|
518
|
+
end
|
519
|
+
end
|
520
|
+
end
|
521
|
+
end
|
522
|
+
end
|
523
|
+
|
524
|
+
node_cache[:discrete_type][start_index] = r0
|
525
|
+
|
526
|
+
r0
|
527
|
+
end
|
528
|
+
|
529
|
+
module CompositeType0
|
530
|
+
end
|
531
|
+
|
532
|
+
module CompositeType1
|
533
|
+
end
|
534
|
+
|
535
|
+
def _nt_composite_type
|
536
|
+
start_index = index
|
537
|
+
if node_cache[:composite_type].has_key?(index)
|
538
|
+
cached = node_cache[:composite_type][index]
|
539
|
+
if cached
|
540
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
541
|
+
@index = cached.interval.end
|
542
|
+
end
|
543
|
+
return cached
|
544
|
+
end
|
545
|
+
|
546
|
+
i0 = index
|
547
|
+
i1, s1 = index, []
|
548
|
+
if has_terminal?('\G[mM]', true, index)
|
549
|
+
r2 = true
|
550
|
+
@index += 1
|
551
|
+
else
|
552
|
+
r2 = nil
|
553
|
+
end
|
554
|
+
s1 << r2
|
555
|
+
if r2
|
556
|
+
if has_terminal?('\G[eE]', true, index)
|
557
|
+
r3 = true
|
558
|
+
@index += 1
|
559
|
+
else
|
560
|
+
r3 = nil
|
561
|
+
end
|
562
|
+
s1 << r3
|
563
|
+
if r3
|
564
|
+
if has_terminal?('\G[sS]', true, index)
|
565
|
+
r4 = true
|
566
|
+
@index += 1
|
567
|
+
else
|
568
|
+
r4 = nil
|
569
|
+
end
|
570
|
+
s1 << r4
|
571
|
+
if r4
|
572
|
+
if has_terminal?('\G[sS]', true, index)
|
573
|
+
r5 = true
|
574
|
+
@index += 1
|
575
|
+
else
|
576
|
+
r5 = nil
|
577
|
+
end
|
578
|
+
s1 << r5
|
579
|
+
if r5
|
580
|
+
if has_terminal?('\G[aA]', true, index)
|
581
|
+
r6 = true
|
582
|
+
@index += 1
|
583
|
+
else
|
584
|
+
r6 = nil
|
585
|
+
end
|
586
|
+
s1 << r6
|
587
|
+
if r6
|
588
|
+
if has_terminal?('\G[gG]', true, index)
|
589
|
+
r7 = true
|
590
|
+
@index += 1
|
591
|
+
else
|
592
|
+
r7 = nil
|
593
|
+
end
|
594
|
+
s1 << r7
|
595
|
+
if r7
|
596
|
+
if has_terminal?('\G[eE]', true, index)
|
597
|
+
r8 = true
|
598
|
+
@index += 1
|
599
|
+
else
|
600
|
+
r8 = nil
|
601
|
+
end
|
602
|
+
s1 << r8
|
603
|
+
end
|
604
|
+
end
|
605
|
+
end
|
606
|
+
end
|
607
|
+
end
|
608
|
+
end
|
609
|
+
if s1.last
|
610
|
+
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
|
611
|
+
r1.extend(CompositeType0)
|
612
|
+
else
|
613
|
+
@index = i1
|
614
|
+
r1 = nil
|
615
|
+
end
|
616
|
+
if r1
|
617
|
+
r0 = r1
|
618
|
+
else
|
619
|
+
i9, s9 = index, []
|
620
|
+
if has_terminal?('\G[mM]', true, index)
|
621
|
+
r10 = true
|
622
|
+
@index += 1
|
623
|
+
else
|
624
|
+
r10 = nil
|
625
|
+
end
|
626
|
+
s9 << r10
|
627
|
+
if r10
|
628
|
+
if has_terminal?('\G[uU]', true, index)
|
629
|
+
r11 = true
|
630
|
+
@index += 1
|
631
|
+
else
|
632
|
+
r11 = nil
|
633
|
+
end
|
634
|
+
s9 << r11
|
635
|
+
if r11
|
636
|
+
if has_terminal?('\G[lL]', true, index)
|
637
|
+
r12 = true
|
638
|
+
@index += 1
|
639
|
+
else
|
640
|
+
r12 = nil
|
641
|
+
end
|
642
|
+
s9 << r12
|
643
|
+
if r12
|
644
|
+
if has_terminal?('\G[tT]', true, index)
|
645
|
+
r13 = true
|
646
|
+
@index += 1
|
647
|
+
else
|
648
|
+
r13 = nil
|
649
|
+
end
|
650
|
+
s9 << r13
|
651
|
+
if r13
|
652
|
+
if has_terminal?('\G[iI]', true, index)
|
653
|
+
r14 = true
|
654
|
+
@index += 1
|
655
|
+
else
|
656
|
+
r14 = nil
|
657
|
+
end
|
658
|
+
s9 << r14
|
659
|
+
if r14
|
660
|
+
if has_terminal?('\G[pP]', true, index)
|
661
|
+
r15 = true
|
662
|
+
@index += 1
|
663
|
+
else
|
664
|
+
r15 = nil
|
665
|
+
end
|
666
|
+
s9 << r15
|
667
|
+
if r15
|
668
|
+
if has_terminal?('\G[aA]', true, index)
|
669
|
+
r16 = true
|
670
|
+
@index += 1
|
671
|
+
else
|
672
|
+
r16 = nil
|
673
|
+
end
|
674
|
+
s9 << r16
|
675
|
+
if r16
|
676
|
+
if has_terminal?('\G[rR]', true, index)
|
677
|
+
r17 = true
|
678
|
+
@index += 1
|
679
|
+
else
|
680
|
+
r17 = nil
|
681
|
+
end
|
682
|
+
s9 << r17
|
683
|
+
if r17
|
684
|
+
if has_terminal?('\G[tT]', true, index)
|
685
|
+
r18 = true
|
686
|
+
@index += 1
|
687
|
+
else
|
688
|
+
r18 = nil
|
689
|
+
end
|
690
|
+
s9 << r18
|
691
|
+
end
|
692
|
+
end
|
693
|
+
end
|
694
|
+
end
|
695
|
+
end
|
696
|
+
end
|
697
|
+
end
|
698
|
+
end
|
699
|
+
if s9.last
|
700
|
+
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
|
701
|
+
r9.extend(CompositeType1)
|
702
|
+
else
|
703
|
+
@index = i9
|
704
|
+
r9 = nil
|
705
|
+
end
|
706
|
+
if r9
|
707
|
+
r0 = r9
|
708
|
+
else
|
709
|
+
r19 = _nt_extension_token
|
710
|
+
if r19
|
711
|
+
r0 = r19
|
712
|
+
else
|
713
|
+
@index = i0
|
714
|
+
r0 = nil
|
715
|
+
end
|
716
|
+
end
|
717
|
+
end
|
718
|
+
|
719
|
+
node_cache[:composite_type][start_index] = r0
|
720
|
+
|
721
|
+
r0
|
722
|
+
end
|
723
|
+
|
724
|
+
def _nt_extension_token
|
725
|
+
start_index = index
|
726
|
+
if node_cache[:extension_token].has_key?(index)
|
727
|
+
cached = node_cache[:extension_token][index]
|
728
|
+
if cached
|
729
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
730
|
+
@index = cached.interval.end
|
731
|
+
end
|
732
|
+
return cached
|
733
|
+
end
|
734
|
+
|
735
|
+
i0 = index
|
736
|
+
r1 = _nt_ietf_token
|
737
|
+
if r1
|
738
|
+
r0 = r1
|
739
|
+
else
|
740
|
+
r2 = _nt_custom_x_token
|
741
|
+
if r2
|
742
|
+
r0 = r2
|
743
|
+
else
|
744
|
+
@index = i0
|
745
|
+
r0 = nil
|
746
|
+
end
|
747
|
+
end
|
748
|
+
|
749
|
+
node_cache[:extension_token][start_index] = r0
|
750
|
+
|
751
|
+
r0
|
752
|
+
end
|
753
|
+
|
754
|
+
def _nt_sub_type
|
755
|
+
start_index = index
|
756
|
+
if node_cache[:sub_type].has_key?(index)
|
757
|
+
cached = node_cache[:sub_type][index]
|
758
|
+
if cached
|
759
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
760
|
+
@index = cached.interval.end
|
761
|
+
end
|
762
|
+
return cached
|
763
|
+
end
|
764
|
+
|
765
|
+
i0 = index
|
766
|
+
r1 = _nt_extension_token
|
767
|
+
if r1
|
768
|
+
r0 = r1
|
769
|
+
else
|
770
|
+
r2 = _nt_iana_token
|
771
|
+
if r2
|
772
|
+
r0 = r2
|
773
|
+
else
|
774
|
+
@index = i0
|
775
|
+
r0 = nil
|
776
|
+
end
|
777
|
+
end
|
778
|
+
|
779
|
+
node_cache[:sub_type][start_index] = r0
|
780
|
+
|
781
|
+
r0
|
782
|
+
end
|
783
|
+
|
784
|
+
module Parameter0
|
785
|
+
def attr
|
786
|
+
elements[1]
|
787
|
+
end
|
788
|
+
|
789
|
+
def val
|
790
|
+
elements[3]
|
791
|
+
end
|
792
|
+
|
793
|
+
end
|
794
|
+
|
795
|
+
module Parameter1
|
796
|
+
def param_hash
|
797
|
+
{attr.text_value => val.text_value}
|
798
|
+
end
|
799
|
+
end
|
800
|
+
|
801
|
+
def _nt_parameter
|
802
|
+
start_index = index
|
803
|
+
if node_cache[:parameter].has_key?(index)
|
804
|
+
cached = node_cache[:parameter][index]
|
805
|
+
if cached
|
806
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
807
|
+
@index = cached.interval.end
|
808
|
+
end
|
809
|
+
return cached
|
810
|
+
end
|
811
|
+
|
812
|
+
i0, s0 = index, []
|
813
|
+
r2 = _nt_CFWS
|
814
|
+
if r2
|
815
|
+
r1 = r2
|
816
|
+
else
|
817
|
+
r1 = instantiate_node(SyntaxNode,input, index...index)
|
818
|
+
end
|
819
|
+
s0 << r1
|
820
|
+
if r1
|
821
|
+
r3 = _nt_attribute
|
822
|
+
s0 << r3
|
823
|
+
if r3
|
824
|
+
if has_terminal?("=", false, index)
|
825
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
826
|
+
@index += 1
|
827
|
+
else
|
828
|
+
terminal_parse_failure("=")
|
829
|
+
r4 = nil
|
830
|
+
end
|
831
|
+
s0 << r4
|
832
|
+
if r4
|
833
|
+
r5 = _nt_value
|
834
|
+
s0 << r5
|
835
|
+
if r5
|
836
|
+
r7 = _nt_CFWS
|
837
|
+
if r7
|
838
|
+
r6 = r7
|
839
|
+
else
|
840
|
+
r6 = instantiate_node(SyntaxNode,input, index...index)
|
841
|
+
end
|
842
|
+
s0 << r6
|
843
|
+
end
|
844
|
+
end
|
845
|
+
end
|
846
|
+
end
|
847
|
+
if s0.last
|
848
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
849
|
+
r0.extend(Parameter0)
|
850
|
+
r0.extend(Parameter1)
|
851
|
+
else
|
852
|
+
@index = i0
|
853
|
+
r0 = nil
|
854
|
+
end
|
855
|
+
|
856
|
+
node_cache[:parameter][start_index] = r0
|
857
|
+
|
858
|
+
r0
|
859
|
+
end
|
860
|
+
|
861
|
+
def _nt_attribute
|
862
|
+
start_index = index
|
863
|
+
if node_cache[:attribute].has_key?(index)
|
864
|
+
cached = node_cache[:attribute][index]
|
865
|
+
if cached
|
866
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
867
|
+
@index = cached.interval.end
|
868
|
+
end
|
869
|
+
return cached
|
870
|
+
end
|
871
|
+
|
872
|
+
s0, i0 = [], index
|
873
|
+
loop do
|
874
|
+
r1 = _nt_token
|
875
|
+
if r1
|
876
|
+
s0 << r1
|
877
|
+
else
|
878
|
+
break
|
879
|
+
end
|
880
|
+
end
|
881
|
+
if s0.empty?
|
882
|
+
@index = i0
|
883
|
+
r0 = nil
|
884
|
+
else
|
885
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
886
|
+
end
|
887
|
+
|
888
|
+
node_cache[:attribute][start_index] = r0
|
889
|
+
|
890
|
+
r0
|
891
|
+
end
|
892
|
+
|
893
|
+
module Value0
|
894
|
+
def text_value
|
895
|
+
quoted_content.text_value
|
896
|
+
end
|
897
|
+
end
|
898
|
+
|
899
|
+
def _nt_value
|
900
|
+
start_index = index
|
901
|
+
if node_cache[:value].has_key?(index)
|
902
|
+
cached = node_cache[:value][index]
|
903
|
+
if cached
|
904
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
905
|
+
@index = cached.interval.end
|
906
|
+
end
|
907
|
+
return cached
|
908
|
+
end
|
909
|
+
|
910
|
+
i0 = index
|
911
|
+
r1 = _nt_quoted_string
|
912
|
+
r1.extend(Value0)
|
913
|
+
if r1
|
914
|
+
r0 = r1
|
915
|
+
else
|
916
|
+
s2, i2 = [], index
|
917
|
+
loop do
|
918
|
+
i3 = index
|
919
|
+
r4 = _nt_token
|
920
|
+
if r4
|
921
|
+
r3 = r4
|
922
|
+
else
|
923
|
+
if has_terminal?('\G[\\x3d]', true, index)
|
924
|
+
r5 = true
|
925
|
+
@index += 1
|
926
|
+
else
|
927
|
+
r5 = nil
|
928
|
+
end
|
929
|
+
if r5
|
930
|
+
r3 = r5
|
931
|
+
else
|
932
|
+
@index = i3
|
933
|
+
r3 = nil
|
934
|
+
end
|
935
|
+
end
|
936
|
+
if r3
|
937
|
+
s2 << r3
|
938
|
+
else
|
939
|
+
break
|
940
|
+
end
|
941
|
+
end
|
942
|
+
if s2.empty?
|
943
|
+
@index = i2
|
944
|
+
r2 = nil
|
945
|
+
else
|
946
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
947
|
+
end
|
948
|
+
if r2
|
949
|
+
r0 = r2
|
950
|
+
else
|
951
|
+
@index = i0
|
952
|
+
r0 = nil
|
953
|
+
end
|
954
|
+
end
|
955
|
+
|
956
|
+
node_cache[:value][start_index] = r0
|
957
|
+
|
958
|
+
r0
|
959
|
+
end
|
960
|
+
|
961
|
+
end
|
962
|
+
|
963
|
+
class ContentTypeParser < Treetop::Runtime::CompiledParser
|
964
|
+
include ContentType
|
965
|
+
end
|
966
|
+
|
967
|
+
end
|