mail 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of mail might be problematic. Click here for more details.
- data/.gitignore +4 -0
- data/Manifest.txt +106 -0
- data/README.rdoc +441 -0
- data/Rakefile +38 -0
- data/lib/mail.rb +86 -0
- data/lib/mail/attachment.rb +90 -0
- data/lib/mail/body.rb +149 -0
- data/lib/mail/configuration.rb +90 -0
- data/lib/mail/core_extensions.rb +6 -0
- data/lib/mail/core_extensions/blank.rb +41 -0
- data/lib/mail/core_extensions/nil.rb +15 -0
- data/lib/mail/core_extensions/string.rb +31 -0
- data/lib/mail/elements/address.rb +293 -0
- data/lib/mail/elements/address_list.rb +62 -0
- data/lib/mail/elements/content_disposition_element.rb +34 -0
- data/lib/mail/elements/content_transfer_encoding_element.rb +21 -0
- data/lib/mail/elements/content_type_element.rb +39 -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/base64.rb +17 -0
- data/lib/mail/encodings/encodings.rb +24 -0
- data/lib/mail/encodings/quoted_printable.rb +26 -0
- data/lib/mail/envelope.rb +35 -0
- data/lib/mail/field.rb +202 -0
- data/lib/mail/field_list.rb +33 -0
- data/lib/mail/fields/bcc_field.rb +40 -0
- data/lib/mail/fields/cc_field.rb +40 -0
- data/lib/mail/fields/comments_field.rb +41 -0
- data/lib/mail/fields/common/common_address.rb +62 -0
- data/lib/mail/fields/common/common_date.rb +35 -0
- data/lib/mail/fields/common/common_field.rb +128 -0
- data/lib/mail/fields/common/common_message_id.rb +35 -0
- data/lib/mail/fields/content_description_field.rb +15 -0
- data/lib/mail/fields/content_disposition_field.rb +34 -0
- data/lib/mail/fields/content_id_field.rb +50 -0
- data/lib/mail/fields/content_transfer_encoding_field.rb +28 -0
- data/lib/mail/fields/content_type_field.rb +50 -0
- data/lib/mail/fields/date_field.rb +44 -0
- data/lib/mail/fields/from_field.rb +40 -0
- data/lib/mail/fields/in_reply_to_field.rb +42 -0
- data/lib/mail/fields/keywords_field.rb +22 -0
- data/lib/mail/fields/message_id_field.rb +70 -0
- data/lib/mail/fields/mime_version_field.rb +42 -0
- data/lib/mail/fields/optional_field.rb +11 -0
- data/lib/mail/fields/received_field.rb +49 -0
- data/lib/mail/fields/references_field.rb +42 -0
- data/lib/mail/fields/reply_to_field.rb +40 -0
- data/lib/mail/fields/resent_bcc_field.rb +40 -0
- data/lib/mail/fields/resent_cc_field.rb +40 -0
- data/lib/mail/fields/resent_date_field.rb +16 -0
- data/lib/mail/fields/resent_from_field.rb +40 -0
- data/lib/mail/fields/resent_message_id_field.rb +20 -0
- data/lib/mail/fields/resent_sender_field.rb +48 -0
- data/lib/mail/fields/resent_to_field.rb +40 -0
- data/lib/mail/fields/return_path_field.rb +34 -0
- data/lib/mail/fields/sender_field.rb +48 -0
- data/lib/mail/fields/structured_field.rb +32 -0
- data/lib/mail/fields/subject_field.rb +14 -0
- data/lib/mail/fields/to_field.rb +40 -0
- data/lib/mail/fields/unstructured_field.rb +27 -0
- data/lib/mail/header.rb +213 -0
- data/lib/mail/mail.rb +120 -0
- data/lib/mail/message.rb +648 -0
- data/lib/mail/network/deliverable.rb +42 -0
- data/lib/mail/network/retrievable.rb +63 -0
- data/lib/mail/parsers/address_lists.rb +61 -0
- data/lib/mail/parsers/address_lists.treetop +19 -0
- data/lib/mail/parsers/content_disposition.rb +358 -0
- data/lib/mail/parsers/content_disposition.treetop +45 -0
- data/lib/mail/parsers/content_transfer_encoding.rb +179 -0
- data/lib/mail/parsers/content_transfer_encoding.treetop +25 -0
- data/lib/mail/parsers/content_type.rb +507 -0
- data/lib/mail/parsers/content_type.treetop +58 -0
- data/lib/mail/parsers/date_time.rb +111 -0
- data/lib/mail/parsers/date_time.treetop +11 -0
- data/lib/mail/parsers/envelope_from.rb +188 -0
- data/lib/mail/parsers/envelope_from.treetop +32 -0
- data/lib/mail/parsers/message_ids.rb +42 -0
- data/lib/mail/parsers/message_ids.treetop +15 -0
- data/lib/mail/parsers/mime_version.rb +141 -0
- data/lib/mail/parsers/mime_version.treetop +19 -0
- data/lib/mail/parsers/phrase_lists.rb +42 -0
- data/lib/mail/parsers/phrase_lists.treetop +15 -0
- data/lib/mail/parsers/received.rb +68 -0
- data/lib/mail/parsers/received.treetop +11 -0
- data/lib/mail/parsers/rfc2045.rb +406 -0
- data/lib/mail/parsers/rfc2045.treetop +35 -0
- data/lib/mail/parsers/rfc2822.rb +5005 -0
- data/lib/mail/parsers/rfc2822.treetop +402 -0
- data/lib/mail/parsers/rfc2822_obsolete.rb +3607 -0
- data/lib/mail/parsers/rfc2822_obsolete.treetop +241 -0
- data/lib/mail/part.rb +120 -0
- data/lib/mail/patterns.rb +42 -0
- data/lib/mail/utilities.rb +142 -0
- data/lib/mail/version.rb +10 -0
- data/lib/mail/version_specific/multibyte.rb +62 -0
- data/lib/mail/version_specific/multibyte/chars.rb +701 -0
- data/lib/mail/version_specific/multibyte/exceptions.rb +8 -0
- data/lib/mail/version_specific/multibyte/unicode_database.rb +71 -0
- data/lib/mail/version_specific/ruby_1_8.rb +61 -0
- data/lib/mail/version_specific/ruby_1_8_string.rb +88 -0
- data/lib/mail/version_specific/ruby_1_9.rb +49 -0
- metadata +192 -0
@@ -0,0 +1,141 @@
|
|
1
|
+
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
+
|
3
|
+
|
4
|
+
module Mail
|
5
|
+
module MimeVersion
|
6
|
+
include Treetop::Runtime
|
7
|
+
|
8
|
+
def root
|
9
|
+
@root || :version
|
10
|
+
end
|
11
|
+
|
12
|
+
include RFC2822
|
13
|
+
|
14
|
+
module Version0
|
15
|
+
def CFWS1
|
16
|
+
elements[0]
|
17
|
+
end
|
18
|
+
|
19
|
+
def major_digits
|
20
|
+
elements[1]
|
21
|
+
end
|
22
|
+
|
23
|
+
def minor_digits
|
24
|
+
elements[5]
|
25
|
+
end
|
26
|
+
|
27
|
+
def CFWS2
|
28
|
+
elements[6]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
module Version1
|
33
|
+
def major
|
34
|
+
major_digits
|
35
|
+
end
|
36
|
+
|
37
|
+
def minor
|
38
|
+
minor_digits
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def _nt_version
|
43
|
+
start_index = index
|
44
|
+
if node_cache[:version].has_key?(index)
|
45
|
+
cached = node_cache[:version][index]
|
46
|
+
@index = cached.interval.end if cached
|
47
|
+
return cached
|
48
|
+
end
|
49
|
+
|
50
|
+
i0, s0 = index, []
|
51
|
+
r1 = _nt_CFWS
|
52
|
+
s0 << r1
|
53
|
+
if r1
|
54
|
+
s2, i2 = [], index
|
55
|
+
loop do
|
56
|
+
r3 = _nt_DIGIT
|
57
|
+
if r3
|
58
|
+
s2 << r3
|
59
|
+
else
|
60
|
+
break
|
61
|
+
end
|
62
|
+
end
|
63
|
+
if s2.empty?
|
64
|
+
@index = i2
|
65
|
+
r2 = nil
|
66
|
+
else
|
67
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
68
|
+
end
|
69
|
+
s0 << r2
|
70
|
+
if r2
|
71
|
+
r5 = _nt_comment
|
72
|
+
if r5
|
73
|
+
r4 = r5
|
74
|
+
else
|
75
|
+
r4 = instantiate_node(SyntaxNode,input, index...index)
|
76
|
+
end
|
77
|
+
s0 << r4
|
78
|
+
if r4
|
79
|
+
if has_terminal?(".", false, index)
|
80
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
81
|
+
@index += 1
|
82
|
+
else
|
83
|
+
terminal_parse_failure(".")
|
84
|
+
r6 = nil
|
85
|
+
end
|
86
|
+
s0 << r6
|
87
|
+
if r6
|
88
|
+
r8 = _nt_comment
|
89
|
+
if r8
|
90
|
+
r7 = r8
|
91
|
+
else
|
92
|
+
r7 = instantiate_node(SyntaxNode,input, index...index)
|
93
|
+
end
|
94
|
+
s0 << r7
|
95
|
+
if r7
|
96
|
+
s9, i9 = [], index
|
97
|
+
loop do
|
98
|
+
r10 = _nt_DIGIT
|
99
|
+
if r10
|
100
|
+
s9 << r10
|
101
|
+
else
|
102
|
+
break
|
103
|
+
end
|
104
|
+
end
|
105
|
+
if s9.empty?
|
106
|
+
@index = i9
|
107
|
+
r9 = nil
|
108
|
+
else
|
109
|
+
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
|
110
|
+
end
|
111
|
+
s0 << r9
|
112
|
+
if r9
|
113
|
+
r11 = _nt_CFWS
|
114
|
+
s0 << r11
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
if s0.last
|
122
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
123
|
+
r0.extend(Version0)
|
124
|
+
r0.extend(Version1)
|
125
|
+
else
|
126
|
+
@index = i0
|
127
|
+
r0 = nil
|
128
|
+
end
|
129
|
+
|
130
|
+
node_cache[:version][start_index] = r0
|
131
|
+
|
132
|
+
r0
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
class MimeVersionParser < Treetop::Runtime::CompiledParser
|
138
|
+
include MimeVersion
|
139
|
+
end
|
140
|
+
|
141
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Mail
|
2
|
+
grammar MimeVersion
|
3
|
+
|
4
|
+
include RFC2822
|
5
|
+
|
6
|
+
rule version
|
7
|
+
CFWS major_digits:DIGIT+ comment? "." comment? minor_digits:DIGIT+ CFWS {
|
8
|
+
def major
|
9
|
+
major_digits
|
10
|
+
end
|
11
|
+
|
12
|
+
def minor
|
13
|
+
minor_digits
|
14
|
+
end
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
+
|
3
|
+
|
4
|
+
module Mail
|
5
|
+
module PhraseLists
|
6
|
+
include Treetop::Runtime
|
7
|
+
|
8
|
+
def root
|
9
|
+
@root || :primary_phrase
|
10
|
+
end
|
11
|
+
|
12
|
+
include RFC2822
|
13
|
+
|
14
|
+
module PrimaryPhrase0
|
15
|
+
def phrases
|
16
|
+
[first_phrase] + other_phrases.elements.map { |o| o.phrase_value }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def _nt_primary_phrase
|
21
|
+
start_index = index
|
22
|
+
if node_cache[:primary_phrase].has_key?(index)
|
23
|
+
cached = node_cache[:primary_phrase][index]
|
24
|
+
@index = cached.interval.end if cached
|
25
|
+
return cached
|
26
|
+
end
|
27
|
+
|
28
|
+
r0 = _nt_phrase_list
|
29
|
+
r0.extend(PrimaryPhrase0)
|
30
|
+
|
31
|
+
node_cache[:primary_phrase][start_index] = r0
|
32
|
+
|
33
|
+
r0
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
class PhraseListsParser < Treetop::Runtime::CompiledParser
|
39
|
+
include PhraseLists
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
+
|
3
|
+
|
4
|
+
module Mail
|
5
|
+
module Received
|
6
|
+
include Treetop::Runtime
|
7
|
+
|
8
|
+
def root
|
9
|
+
@root || :primary
|
10
|
+
end
|
11
|
+
|
12
|
+
include RFC2822
|
13
|
+
|
14
|
+
module Primary0
|
15
|
+
def name_val_list
|
16
|
+
elements[0]
|
17
|
+
end
|
18
|
+
|
19
|
+
def date_time
|
20
|
+
elements[2]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def _nt_primary
|
25
|
+
start_index = index
|
26
|
+
if node_cache[:primary].has_key?(index)
|
27
|
+
cached = node_cache[:primary][index]
|
28
|
+
@index = cached.interval.end if cached
|
29
|
+
return cached
|
30
|
+
end
|
31
|
+
|
32
|
+
i0, s0 = index, []
|
33
|
+
r1 = _nt_name_val_list
|
34
|
+
s0 << r1
|
35
|
+
if r1
|
36
|
+
if has_terminal?(";", false, index)
|
37
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
38
|
+
@index += 1
|
39
|
+
else
|
40
|
+
terminal_parse_failure(";")
|
41
|
+
r2 = nil
|
42
|
+
end
|
43
|
+
s0 << r2
|
44
|
+
if r2
|
45
|
+
r3 = _nt_date_time
|
46
|
+
s0 << r3
|
47
|
+
end
|
48
|
+
end
|
49
|
+
if s0.last
|
50
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
51
|
+
r0.extend(Primary0)
|
52
|
+
else
|
53
|
+
@index = i0
|
54
|
+
r0 = nil
|
55
|
+
end
|
56
|
+
|
57
|
+
node_cache[:primary][start_index] = r0
|
58
|
+
|
59
|
+
r0
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
class ReceivedParser < Treetop::Runtime::CompiledParser
|
65
|
+
include Received
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
@@ -0,0 +1,406 @@
|
|
1
|
+
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
+
|
3
|
+
|
4
|
+
module Mail
|
5
|
+
module RFC2045
|
6
|
+
include Treetop::Runtime
|
7
|
+
|
8
|
+
def root
|
9
|
+
@root || :tspecials
|
10
|
+
end
|
11
|
+
|
12
|
+
def _nt_tspecials
|
13
|
+
start_index = index
|
14
|
+
if node_cache[:tspecials].has_key?(index)
|
15
|
+
cached = node_cache[:tspecials][index]
|
16
|
+
@index = cached.interval.end if cached
|
17
|
+
return cached
|
18
|
+
end
|
19
|
+
|
20
|
+
i0 = index
|
21
|
+
if has_terminal?("(", false, index)
|
22
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
23
|
+
@index += 1
|
24
|
+
else
|
25
|
+
terminal_parse_failure("(")
|
26
|
+
r1 = nil
|
27
|
+
end
|
28
|
+
if r1
|
29
|
+
r0 = r1
|
30
|
+
else
|
31
|
+
if has_terminal?(")", false, index)
|
32
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
33
|
+
@index += 1
|
34
|
+
else
|
35
|
+
terminal_parse_failure(")")
|
36
|
+
r2 = nil
|
37
|
+
end
|
38
|
+
if r2
|
39
|
+
r0 = r2
|
40
|
+
else
|
41
|
+
if has_terminal?("<", false, index)
|
42
|
+
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
43
|
+
@index += 1
|
44
|
+
else
|
45
|
+
terminal_parse_failure("<")
|
46
|
+
r3 = nil
|
47
|
+
end
|
48
|
+
if r3
|
49
|
+
r0 = r3
|
50
|
+
else
|
51
|
+
if has_terminal?(">", false, index)
|
52
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
53
|
+
@index += 1
|
54
|
+
else
|
55
|
+
terminal_parse_failure(">")
|
56
|
+
r4 = nil
|
57
|
+
end
|
58
|
+
if r4
|
59
|
+
r0 = r4
|
60
|
+
else
|
61
|
+
if has_terminal?("@", false, index)
|
62
|
+
r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
63
|
+
@index += 1
|
64
|
+
else
|
65
|
+
terminal_parse_failure("@")
|
66
|
+
r5 = nil
|
67
|
+
end
|
68
|
+
if r5
|
69
|
+
r0 = r5
|
70
|
+
else
|
71
|
+
if has_terminal?(",", false, index)
|
72
|
+
r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
73
|
+
@index += 1
|
74
|
+
else
|
75
|
+
terminal_parse_failure(",")
|
76
|
+
r6 = nil
|
77
|
+
end
|
78
|
+
if r6
|
79
|
+
r0 = r6
|
80
|
+
else
|
81
|
+
if has_terminal?(";", false, index)
|
82
|
+
r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
83
|
+
@index += 1
|
84
|
+
else
|
85
|
+
terminal_parse_failure(";")
|
86
|
+
r7 = nil
|
87
|
+
end
|
88
|
+
if r7
|
89
|
+
r0 = r7
|
90
|
+
else
|
91
|
+
if has_terminal?(":", false, index)
|
92
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
93
|
+
@index += 1
|
94
|
+
else
|
95
|
+
terminal_parse_failure(":")
|
96
|
+
r8 = nil
|
97
|
+
end
|
98
|
+
if r8
|
99
|
+
r0 = r8
|
100
|
+
else
|
101
|
+
if has_terminal?('\\', false, index)
|
102
|
+
r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
103
|
+
@index += 1
|
104
|
+
else
|
105
|
+
terminal_parse_failure('\\')
|
106
|
+
r9 = nil
|
107
|
+
end
|
108
|
+
if r9
|
109
|
+
r0 = r9
|
110
|
+
else
|
111
|
+
if has_terminal?("<", false, index)
|
112
|
+
r10 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
113
|
+
@index += 1
|
114
|
+
else
|
115
|
+
terminal_parse_failure("<")
|
116
|
+
r10 = nil
|
117
|
+
end
|
118
|
+
if r10
|
119
|
+
r0 = r10
|
120
|
+
else
|
121
|
+
if has_terminal?(">", false, index)
|
122
|
+
r11 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
123
|
+
@index += 1
|
124
|
+
else
|
125
|
+
terminal_parse_failure(">")
|
126
|
+
r11 = nil
|
127
|
+
end
|
128
|
+
if r11
|
129
|
+
r0 = r11
|
130
|
+
else
|
131
|
+
if has_terminal?("/", false, index)
|
132
|
+
r12 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
133
|
+
@index += 1
|
134
|
+
else
|
135
|
+
terminal_parse_failure("/")
|
136
|
+
r12 = nil
|
137
|
+
end
|
138
|
+
if r12
|
139
|
+
r0 = r12
|
140
|
+
else
|
141
|
+
if has_terminal?("[", false, index)
|
142
|
+
r13 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
143
|
+
@index += 1
|
144
|
+
else
|
145
|
+
terminal_parse_failure("[")
|
146
|
+
r13 = nil
|
147
|
+
end
|
148
|
+
if r13
|
149
|
+
r0 = r13
|
150
|
+
else
|
151
|
+
if has_terminal?("]", false, index)
|
152
|
+
r14 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
153
|
+
@index += 1
|
154
|
+
else
|
155
|
+
terminal_parse_failure("]")
|
156
|
+
r14 = nil
|
157
|
+
end
|
158
|
+
if r14
|
159
|
+
r0 = r14
|
160
|
+
else
|
161
|
+
if has_terminal?("?", false, index)
|
162
|
+
r15 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
163
|
+
@index += 1
|
164
|
+
else
|
165
|
+
terminal_parse_failure("?")
|
166
|
+
r15 = nil
|
167
|
+
end
|
168
|
+
if r15
|
169
|
+
r0 = r15
|
170
|
+
else
|
171
|
+
if has_terminal?("=", false, index)
|
172
|
+
r16 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
173
|
+
@index += 1
|
174
|
+
else
|
175
|
+
terminal_parse_failure("=")
|
176
|
+
r16 = nil
|
177
|
+
end
|
178
|
+
if r16
|
179
|
+
r0 = r16
|
180
|
+
else
|
181
|
+
@index = i0
|
182
|
+
r0 = nil
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
node_cache[:tspecials][start_index] = r0
|
201
|
+
|
202
|
+
r0
|
203
|
+
end
|
204
|
+
|
205
|
+
def _nt_ietf_token
|
206
|
+
start_index = index
|
207
|
+
if node_cache[:ietf_token].has_key?(index)
|
208
|
+
cached = node_cache[:ietf_token][index]
|
209
|
+
@index = cached.interval.end if cached
|
210
|
+
return cached
|
211
|
+
end
|
212
|
+
|
213
|
+
s0, i0 = [], index
|
214
|
+
loop do
|
215
|
+
r1 = _nt_token
|
216
|
+
if r1
|
217
|
+
s0 << r1
|
218
|
+
else
|
219
|
+
break
|
220
|
+
end
|
221
|
+
end
|
222
|
+
if s0.empty?
|
223
|
+
@index = i0
|
224
|
+
r0 = nil
|
225
|
+
else
|
226
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
227
|
+
end
|
228
|
+
|
229
|
+
node_cache[:ietf_token][start_index] = r0
|
230
|
+
|
231
|
+
r0
|
232
|
+
end
|
233
|
+
|
234
|
+
module XToken0
|
235
|
+
end
|
236
|
+
|
237
|
+
def _nt_x_token
|
238
|
+
start_index = index
|
239
|
+
if node_cache[:x_token].has_key?(index)
|
240
|
+
cached = node_cache[:x_token][index]
|
241
|
+
@index = cached.interval.end if cached
|
242
|
+
return cached
|
243
|
+
end
|
244
|
+
|
245
|
+
i0, s0 = index, []
|
246
|
+
if has_terminal?('\G[xX]', true, index)
|
247
|
+
r1 = true
|
248
|
+
@index += 1
|
249
|
+
else
|
250
|
+
r1 = nil
|
251
|
+
end
|
252
|
+
s0 << r1
|
253
|
+
if r1
|
254
|
+
if has_terminal?("-", false, index)
|
255
|
+
r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
256
|
+
@index += 1
|
257
|
+
else
|
258
|
+
terminal_parse_failure("-")
|
259
|
+
r2 = nil
|
260
|
+
end
|
261
|
+
s0 << r2
|
262
|
+
if r2
|
263
|
+
s3, i3 = [], index
|
264
|
+
loop do
|
265
|
+
r4 = _nt_token
|
266
|
+
if r4
|
267
|
+
s3 << r4
|
268
|
+
else
|
269
|
+
break
|
270
|
+
end
|
271
|
+
end
|
272
|
+
if s3.empty?
|
273
|
+
@index = i3
|
274
|
+
r3 = nil
|
275
|
+
else
|
276
|
+
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
|
277
|
+
end
|
278
|
+
s0 << r3
|
279
|
+
end
|
280
|
+
end
|
281
|
+
if s0.last
|
282
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
283
|
+
r0.extend(XToken0)
|
284
|
+
else
|
285
|
+
@index = i0
|
286
|
+
r0 = nil
|
287
|
+
end
|
288
|
+
|
289
|
+
node_cache[:x_token][start_index] = r0
|
290
|
+
|
291
|
+
r0
|
292
|
+
end
|
293
|
+
|
294
|
+
def _nt_iana_token
|
295
|
+
start_index = index
|
296
|
+
if node_cache[:iana_token].has_key?(index)
|
297
|
+
cached = node_cache[:iana_token][index]
|
298
|
+
@index = cached.interval.end if cached
|
299
|
+
return cached
|
300
|
+
end
|
301
|
+
|
302
|
+
s0, i0 = [], index
|
303
|
+
loop do
|
304
|
+
r1 = _nt_token
|
305
|
+
if r1
|
306
|
+
s0 << r1
|
307
|
+
else
|
308
|
+
break
|
309
|
+
end
|
310
|
+
end
|
311
|
+
if s0.empty?
|
312
|
+
@index = i0
|
313
|
+
r0 = nil
|
314
|
+
else
|
315
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
316
|
+
end
|
317
|
+
|
318
|
+
node_cache[:iana_token][start_index] = r0
|
319
|
+
|
320
|
+
r0
|
321
|
+
end
|
322
|
+
|
323
|
+
def _nt_token
|
324
|
+
start_index = index
|
325
|
+
if node_cache[:token].has_key?(index)
|
326
|
+
cached = node_cache[:token][index]
|
327
|
+
@index = cached.interval.end if cached
|
328
|
+
return cached
|
329
|
+
end
|
330
|
+
|
331
|
+
i0 = index
|
332
|
+
if has_terminal?('\G[\\x21-\\x27]', true, index)
|
333
|
+
r1 = true
|
334
|
+
@index += 1
|
335
|
+
else
|
336
|
+
r1 = nil
|
337
|
+
end
|
338
|
+
if r1
|
339
|
+
r0 = r1
|
340
|
+
else
|
341
|
+
if has_terminal?('\G[\\x2a-\\x2b]', true, index)
|
342
|
+
r2 = true
|
343
|
+
@index += 1
|
344
|
+
else
|
345
|
+
r2 = nil
|
346
|
+
end
|
347
|
+
if r2
|
348
|
+
r0 = r2
|
349
|
+
else
|
350
|
+
if has_terminal?('\G[\\x2c-\\x2e]', true, index)
|
351
|
+
r3 = true
|
352
|
+
@index += 1
|
353
|
+
else
|
354
|
+
r3 = nil
|
355
|
+
end
|
356
|
+
if r3
|
357
|
+
r0 = r3
|
358
|
+
else
|
359
|
+
if has_terminal?('\G[\\x30-\\x39]', true, index)
|
360
|
+
r4 = true
|
361
|
+
@index += 1
|
362
|
+
else
|
363
|
+
r4 = nil
|
364
|
+
end
|
365
|
+
if r4
|
366
|
+
r0 = r4
|
367
|
+
else
|
368
|
+
if has_terminal?('\G[\\x41-\\x5a]', true, index)
|
369
|
+
r5 = true
|
370
|
+
@index += 1
|
371
|
+
else
|
372
|
+
r5 = nil
|
373
|
+
end
|
374
|
+
if r5
|
375
|
+
r0 = r5
|
376
|
+
else
|
377
|
+
if has_terminal?('\G[\\x5e-\\x7e]', true, index)
|
378
|
+
r6 = true
|
379
|
+
@index += 1
|
380
|
+
else
|
381
|
+
r6 = nil
|
382
|
+
end
|
383
|
+
if r6
|
384
|
+
r0 = r6
|
385
|
+
else
|
386
|
+
@index = i0
|
387
|
+
r0 = nil
|
388
|
+
end
|
389
|
+
end
|
390
|
+
end
|
391
|
+
end
|
392
|
+
end
|
393
|
+
end
|
394
|
+
|
395
|
+
node_cache[:token][start_index] = r0
|
396
|
+
|
397
|
+
r0
|
398
|
+
end
|
399
|
+
|
400
|
+
end
|
401
|
+
|
402
|
+
class RFC2045Parser < Treetop::Runtime::CompiledParser
|
403
|
+
include RFC2045
|
404
|
+
end
|
405
|
+
|
406
|
+
end
|