mail 2.1.5.2 → 2.1.5.3

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.

Files changed (134) hide show
  1. data/CHANGELOG.rdoc +6 -0
  2. data/Rakefile +2 -1
  3. data/lib/mail.rb +0 -1
  4. data/lib/mail/elements.rb +0 -1
  5. data/lib/mail/utilities.rb +1 -1
  6. data/lib/mail/version.rb +1 -1
  7. data/lib/tasks/treetop.rake +4 -4
  8. metadata +17 -129
  9. data/lib/mail/vendor/treetop-1.4.4/History.txt +0 -18
  10. data/lib/mail/vendor/treetop-1.4.4/LICENSE +0 -19
  11. data/lib/mail/vendor/treetop-1.4.4/README.md +0 -164
  12. data/lib/mail/vendor/treetop-1.4.4/Rakefile +0 -28
  13. data/lib/mail/vendor/treetop-1.4.4/Treetop.tmbundle/Preferences/Comments.tmPreferences +0 -22
  14. data/lib/mail/vendor/treetop-1.4.4/Treetop.tmbundle/Snippets/grammar ___ end.tmSnippet +0 -20
  15. data/lib/mail/vendor/treetop-1.4.4/Treetop.tmbundle/Snippets/rule ___ end.tmSnippet +0 -18
  16. data/lib/mail/vendor/treetop-1.4.4/Treetop.tmbundle/Support/nibs/SyntaxTreeViewer.nib/designable.nib +0 -1524
  17. data/lib/mail/vendor/treetop-1.4.4/Treetop.tmbundle/Support/nibs/SyntaxTreeViewer.nib/keyedobjects.nib +0 -0
  18. data/lib/mail/vendor/treetop-1.4.4/Treetop.tmbundle/Support/syntax_tree_viewer.rb +0 -117
  19. data/lib/mail/vendor/treetop-1.4.4/Treetop.tmbundle/Syntaxes/Treetop Grammar.tmLanguage +0 -278
  20. data/lib/mail/vendor/treetop-1.4.4/Treetop.tmbundle/info.plist +0 -10
  21. data/lib/mail/vendor/treetop-1.4.4/benchmark/seqpar.gnuplot +0 -15
  22. data/lib/mail/vendor/treetop-1.4.4/benchmark/seqpar.treetop +0 -16
  23. data/lib/mail/vendor/treetop-1.4.4/benchmark/seqpar_benchmark.rb +0 -107
  24. data/lib/mail/vendor/treetop-1.4.4/bin/tt +0 -112
  25. data/lib/mail/vendor/treetop-1.4.4/doc/contributing_and_planned_features.markdown +0 -103
  26. data/lib/mail/vendor/treetop-1.4.4/doc/grammar_composition.markdown +0 -65
  27. data/lib/mail/vendor/treetop-1.4.4/doc/index.markdown +0 -90
  28. data/lib/mail/vendor/treetop-1.4.4/doc/pitfalls_and_advanced_techniques.markdown +0 -51
  29. data/lib/mail/vendor/treetop-1.4.4/doc/semantic_interpretation.markdown +0 -189
  30. data/lib/mail/vendor/treetop-1.4.4/doc/site.rb +0 -112
  31. data/lib/mail/vendor/treetop-1.4.4/doc/sitegen.rb +0 -65
  32. data/lib/mail/vendor/treetop-1.4.4/doc/syntactic_recognition.markdown +0 -100
  33. data/lib/mail/vendor/treetop-1.4.4/doc/using_in_ruby.markdown +0 -28
  34. data/lib/mail/vendor/treetop-1.4.4/examples/lambda_calculus/arithmetic.rb +0 -551
  35. data/lib/mail/vendor/treetop-1.4.4/examples/lambda_calculus/arithmetic.treetop +0 -97
  36. data/lib/mail/vendor/treetop-1.4.4/examples/lambda_calculus/arithmetic_node_classes.rb +0 -7
  37. data/lib/mail/vendor/treetop-1.4.4/examples/lambda_calculus/arithmetic_test.rb +0 -54
  38. data/lib/mail/vendor/treetop-1.4.4/examples/lambda_calculus/lambda_calculus +0 -0
  39. data/lib/mail/vendor/treetop-1.4.4/examples/lambda_calculus/lambda_calculus.rb +0 -718
  40. data/lib/mail/vendor/treetop-1.4.4/examples/lambda_calculus/lambda_calculus.treetop +0 -132
  41. data/lib/mail/vendor/treetop-1.4.4/examples/lambda_calculus/lambda_calculus_node_classes.rb +0 -5
  42. data/lib/mail/vendor/treetop-1.4.4/examples/lambda_calculus/lambda_calculus_test.rb +0 -89
  43. data/lib/mail/vendor/treetop-1.4.4/examples/lambda_calculus/test_helper.rb +0 -18
  44. data/lib/mail/vendor/treetop-1.4.4/lib/treetop.rb +0 -3
  45. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/bootstrap_gen_1_metagrammar.rb +0 -42
  46. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler.rb +0 -7
  47. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/grammar_compiler.rb +0 -44
  48. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/lexical_address_space.rb +0 -17
  49. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/metagrammar.rb +0 -3366
  50. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/metagrammar.treetop +0 -436
  51. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes.rb +0 -19
  52. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/anything_symbol.rb +0 -18
  53. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/atomic_expression.rb +0 -14
  54. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/character_class.rb +0 -28
  55. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/choice.rb +0 -31
  56. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/declaration_sequence.rb +0 -24
  57. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/grammar.rb +0 -28
  58. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/inline_module.rb +0 -27
  59. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/nonterminal.rb +0 -13
  60. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/optional.rb +0 -19
  61. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/parenthesized_expression.rb +0 -9
  62. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/parsing_expression.rb +0 -146
  63. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/parsing_rule.rb +0 -58
  64. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/predicate.rb +0 -45
  65. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/predicate_block.rb +0 -16
  66. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/repetition.rb +0 -55
  67. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/sequence.rb +0 -71
  68. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/terminal.rb +0 -20
  69. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/transient_prefix.rb +0 -9
  70. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/node_classes/treetop_file.rb +0 -9
  71. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/compiler/ruby_builder.rb +0 -113
  72. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/polyglot.rb +0 -9
  73. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/ruby_extensions.rb +0 -1
  74. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/ruby_extensions/string.rb +0 -42
  75. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/runtime.rb +0 -6
  76. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/runtime/compiled_parser.rb +0 -110
  77. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/runtime/interval_skip_list.rb +0 -3
  78. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/runtime/interval_skip_list/head_node.rb +0 -15
  79. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/runtime/interval_skip_list/interval_skip_list.rb +0 -200
  80. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/runtime/interval_skip_list/node.rb +0 -164
  81. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/runtime/syntax_node.rb +0 -114
  82. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/runtime/terminal_parse_failure.rb +0 -16
  83. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/runtime/terminal_syntax_node.rb +0 -17
  84. data/lib/mail/vendor/treetop-1.4.4/lib/treetop/version.rb +0 -9
  85. data/lib/mail/vendor/treetop-1.4.4/script/generate_metagrammar.rb +0 -13
  86. data/lib/mail/vendor/treetop-1.4.4/script/svnadd +0 -11
  87. data/lib/mail/vendor/treetop-1.4.4/script/svnrm +0 -11
  88. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/and_predicate_spec.rb +0 -36
  89. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/anything_symbol_spec.rb +0 -44
  90. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/character_class_spec.rb +0 -276
  91. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/choice_spec.rb +0 -80
  92. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/circular_compilation_spec.rb +0 -30
  93. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/failure_propagation_functional_spec.rb +0 -21
  94. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/grammar_compiler_spec.rb +0 -84
  95. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/grammar_spec.rb +0 -41
  96. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/multibyte_chars_spec.rb +0 -38
  97. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/nonterminal_symbol_spec.rb +0 -40
  98. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/not_predicate_spec.rb +0 -38
  99. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/one_or_more_spec.rb +0 -35
  100. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/optional_spec.rb +0 -37
  101. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/parenthesized_expression_spec.rb +0 -19
  102. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/parsing_rule_spec.rb +0 -61
  103. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/repeated_subrule_spec.rb +0 -29
  104. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/semantic_predicate_spec.rb +0 -175
  105. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/sequence_spec.rb +0 -115
  106. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/terminal_spec.rb +0 -81
  107. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/terminal_symbol_spec.rb +0 -37
  108. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/test_grammar.treetop +0 -7
  109. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/test_grammar.tt +0 -7
  110. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/test_grammar_do.treetop +0 -7
  111. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/tt_compiler_spec.rb +0 -216
  112. data/lib/mail/vendor/treetop-1.4.4/spec/compiler/zero_or_more_spec.rb +0 -56
  113. data/lib/mail/vendor/treetop-1.4.4/spec/composition/a.treetop +0 -11
  114. data/lib/mail/vendor/treetop-1.4.4/spec/composition/b.treetop +0 -11
  115. data/lib/mail/vendor/treetop-1.4.4/spec/composition/c.treetop +0 -10
  116. data/lib/mail/vendor/treetop-1.4.4/spec/composition/d.treetop +0 -10
  117. data/lib/mail/vendor/treetop-1.4.4/spec/composition/f.treetop +0 -17
  118. data/lib/mail/vendor/treetop-1.4.4/spec/composition/grammar_composition_spec.rb +0 -40
  119. data/lib/mail/vendor/treetop-1.4.4/spec/composition/subfolder/e_includes_c.treetop +0 -15
  120. data/lib/mail/vendor/treetop-1.4.4/spec/ruby_extensions/string_spec.rb +0 -32
  121. data/lib/mail/vendor/treetop-1.4.4/spec/runtime/compiled_parser_spec.rb +0 -101
  122. data/lib/mail/vendor/treetop-1.4.4/spec/runtime/interval_skip_list/delete_spec.rb +0 -147
  123. data/lib/mail/vendor/treetop-1.4.4/spec/runtime/interval_skip_list/expire_range_spec.rb +0 -349
  124. data/lib/mail/vendor/treetop-1.4.4/spec/runtime/interval_skip_list/insert_and_delete_node.rb +0 -385
  125. data/lib/mail/vendor/treetop-1.4.4/spec/runtime/interval_skip_list/insert_spec.rb +0 -660
  126. data/lib/mail/vendor/treetop-1.4.4/spec/runtime/interval_skip_list/interval_skip_list_spec.graffle +0 -6175
  127. data/lib/mail/vendor/treetop-1.4.4/spec/runtime/interval_skip_list/interval_skip_list_spec.rb +0 -58
  128. data/lib/mail/vendor/treetop-1.4.4/spec/runtime/interval_skip_list/palindromic_fixture.rb +0 -23
  129. data/lib/mail/vendor/treetop-1.4.4/spec/runtime/interval_skip_list/palindromic_fixture_spec.rb +0 -163
  130. data/lib/mail/vendor/treetop-1.4.4/spec/runtime/interval_skip_list/spec_helper.rb +0 -84
  131. data/lib/mail/vendor/treetop-1.4.4/spec/runtime/syntax_node_spec.rb +0 -77
  132. data/lib/mail/vendor/treetop-1.4.4/spec/spec_helper.rb +0 -110
  133. data/lib/mail/vendor/treetop-1.4.4/treetop.gemspec +0 -18
  134. data/lib/mail/vendor/treetop.rb +0 -2
@@ -1,29 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module RepeatedSubruleSpec
4
- describe "a repeated subrule" do
5
- testing_grammar %{
6
- grammar Foo
7
- rule foo
8
- a:'a' space b:'b' space 'c'
9
- end
10
-
11
- rule space
12
- ' '
13
- end
14
- end
15
- }
16
-
17
- it "should produce a parser having sequence-numbered node accessor methods" do
18
- parse("a b c") do |result|
19
- result.should_not be_nil
20
- result.should respond_to(:space1)
21
- result.should respond_to(:space2)
22
- result.should_not respond_to(:space)
23
- result.should respond_to(:a)
24
- result.should respond_to(:b)
25
- result.should_not respond_to(:c)
26
- end
27
- end
28
- end
29
- end
@@ -1,175 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module SemanticPredicateSpec
4
- describe "An &-predicate block" do
5
- testing_expression '& {|| $ok_to_succeed}'
6
-
7
- it "succeeds if it returns true, returning an epsilon syntax node" do
8
- $ok_to_succeed = true
9
- parse('foo', :consume_all_input => false) do |result|
10
- result.should_not be_nil
11
- result.interval.should == (0...0)
12
- end
13
- end
14
-
15
- it "fails if it returns false" do
16
- $ok_to_succeed = false
17
- parse('foo', :consume_all_input => false) do |result|
18
- result.should be_nil
19
- terminal_failures = parser.terminal_failures
20
- terminal_failures.size.should == 0
21
- end
22
- end
23
-
24
- end
25
-
26
- describe "A sequence of a terminal and an &-predicate block" do
27
- testing_expression '"prior " &{|s| $value = s[0].text_value; $ok_to_succeed }'
28
-
29
- it "matches the input terminal and consumes it if the block returns true, seeing the terminal in the sequence" do
30
- $ok_to_succeed = true
31
- $value = nil
32
- parse('prior foo', :consume_all_input => false) do |result|
33
- result.should_not be_nil
34
- result.elements[0].text_value.should == "prior "
35
- result.text_value.should == 'prior '
36
- $value.should == 'prior '
37
- end
38
- end
39
-
40
- it "fails if the block returns false, but sees the terminal in the sequence" do
41
- $ok_to_succeed = false
42
- $value = nil
43
- parse('prior foo', :consume_all_input => false) do |result|
44
- result.should be_nil
45
- $value.should == 'prior '
46
- terminal_failures = parser.terminal_failures
47
- terminal_failures.size.should == 0
48
- end
49
- end
50
-
51
- end
52
-
53
- describe "A sequence of an optional terminal and an &-predicate block" do
54
- testing_expression '"prior "? &{|s| $value = s[0].text_value; $ok_to_succeed}'
55
-
56
- it "matches the input terminal and consumes it if the block returns true" do
57
- $ok_to_succeed = true
58
- parse('prior foo', :consume_all_input => false) do |result|
59
- result.should_not be_nil
60
- result.elements[0].text_value.should == "prior "
61
- result.text_value.should == 'prior '
62
- $value.should == 'prior '
63
- end
64
- end
65
-
66
- it "fails with no terminal_failures if the block returns false" do
67
- $ok_to_succeed = false
68
- parse('prior foo', :consume_all_input => false) do |result|
69
- result.should be_nil
70
- $value.should == 'prior '
71
- terminal_failures = parser.terminal_failures
72
- terminal_failures.size.should == 0
73
- end
74
- end
75
-
76
- it "fail and return the expected optional preceeding terminal as expected input if the block returns false" do
77
- $ok_to_succeed = false
78
- parse('foo', :consume_all_input => false) do |result|
79
- result.should be_nil
80
- terminal_failures = parser.terminal_failures
81
- terminal_failures.size.should == 1
82
- failure = terminal_failures[0]
83
- failure.index.should == 0
84
- failure.expected_string.should == 'prior '
85
- end
86
- end
87
-
88
- end
89
-
90
- describe "A !-predicate block" do
91
- testing_expression '! {|| $ok_to_succeed}'
92
-
93
- it "succeeds if it returns false, returning an epsilon syntax node" do
94
- $ok_to_succeed = false
95
- parse('foo', :consume_all_input => false) do |result|
96
- result.should_not be_nil
97
- result.interval.should == (0...0)
98
- end
99
- end
100
-
101
- it "fails if it returns true" do
102
- $ok_to_succeed = true
103
- parse('foo', :consume_all_input => false) do |result|
104
- result.should be_nil
105
- terminal_failures = parser.terminal_failures
106
- terminal_failures.size.should == 0
107
- end
108
- end
109
-
110
- end
111
-
112
- describe "A sequence of a terminal and an !-predicate block" do
113
- testing_expression '"prior " !{|s| $value = s[0].text_value; $ok_to_succeed }'
114
-
115
- it "matches the input terminal and consumes it if the block returns false, seeing the terminal in the sequence" do
116
- $ok_to_succeed = false
117
- $value = nil
118
- parse('prior foo', :consume_all_input => false) do |result|
119
- result.should_not be_nil
120
- result.elements[0].text_value.should == "prior "
121
- result.text_value.should == 'prior '
122
- $value.should == 'prior '
123
- end
124
- end
125
-
126
- it "fails if the block returns true, but sees the terminal in the sequence" do
127
- $ok_to_succeed = true
128
- $value = nil
129
- parse('prior foo', :consume_all_input => false) do |result|
130
- result.should be_nil
131
- $value.should == 'prior '
132
- terminal_failures = parser.terminal_failures
133
- terminal_failures.size.should == 0
134
- end
135
- end
136
-
137
- end
138
-
139
- describe "A sequence of an optional terminal and an !-predicate block" do
140
- testing_expression '"prior "? !{|s| $value = s[0].text_value; $ok_to_succeed}'
141
-
142
- it "matches the input terminal and consumes it if the block returns false" do
143
- $ok_to_succeed = false
144
- parse('prior foo', :consume_all_input => false) do |result|
145
- result.should_not be_nil
146
- result.elements[0].text_value.should == "prior "
147
- result.text_value.should == 'prior '
148
- $value.should == 'prior '
149
- end
150
- end
151
-
152
- it "fails with no terminal_failures if the block returns true" do
153
- $ok_to_succeed = true
154
- parse('prior foo', :consume_all_input => false) do |result|
155
- result.should be_nil
156
- $value.should == 'prior '
157
- terminal_failures = parser.terminal_failures
158
- terminal_failures.size.should == 0
159
- end
160
- end
161
-
162
- it "fail and return the expected optional preceeding terminal as expected input if the block returns true" do
163
- $ok_to_succeed = true
164
- parse('foo', :consume_all_input => false) do |result|
165
- result.should be_nil
166
- terminal_failures = parser.terminal_failures
167
- terminal_failures.size.should == 1
168
- failure = terminal_failures[0]
169
- failure.index.should == 0
170
- failure.expected_string.should == 'prior '
171
- end
172
- end
173
-
174
- end
175
- end
@@ -1,115 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module SequenceSpec
4
- class Foo < Treetop::Runtime::SyntaxNode
5
- end
6
-
7
- describe "a sequence of labeled terminal symbols followed by a node class declaration and a block" do
8
- testing_expression 'foo:"foo" bar:"bar" baz:"baz" <SequenceSpec::Foo> { def a_method; end }'
9
-
10
- it "upon successfully matching input, instantiates an instance of the declared node class with element accessor methods and the method from the inline module" do
11
- parse('foobarbaz') do |result|
12
- result.should_not be_nil
13
- result.should be_an_instance_of(Foo)
14
- result.should respond_to(:a_method)
15
- result.foo.text_value.should == 'foo'
16
- result.bar.text_value.should == 'bar'
17
- result.baz.text_value.should == 'baz'
18
- end
19
- end
20
-
21
- it "successfully matches at a non-zero index" do
22
- parse('---foobarbaz', :index => 3) do |result|
23
- result.should_not be_nil
24
- result.should be_nonterminal
25
- (result.elements.map {|elt| elt.text_value}).join.should == 'foobarbaz'
26
- end
27
- end
28
-
29
- it "fails to match non-matching input, recording the parse failure of first non-matching terminal" do
30
- parse('---foobazbaz', :index => 3) do |result|
31
- result.should be_nil
32
- parser.index.should == 3
33
- terminal_failures = parser.terminal_failures
34
- terminal_failures.size.should == 1
35
- failure = terminal_failures.first
36
- failure.index.should == 6
37
- failure.expected_string.should == 'bar'
38
- end
39
- end
40
- end
41
-
42
- module ModFoo
43
- def mod_method; end
44
- end
45
-
46
- describe "a sequence of labeled terminal symbols followed by a node module declaration and a block" do
47
- testing_expression 'foo:"foo" bar:"bar" baz:"baz" <SequenceSpec::ModFoo> { def a_method; end }'
48
-
49
- it "upon successfully matching input, instantiates a syntax node and extends it with the declared module, element accessor methods, and the method from the inline module" do
50
- parse('foobarbaz') do |result|
51
- result.should_not be_nil
52
- result.should respond_to(:mod_method)
53
- result.should be_an_instance_of(Treetop::Runtime::SyntaxNode)
54
- result.should be_a_kind_of(ModFoo)
55
- result.should respond_to(:a_method)
56
- result.foo.text_value.should == 'foo'
57
- result.bar.text_value.should == 'bar'
58
- result.baz.text_value.should == 'baz'
59
- end
60
- end
61
- end
62
-
63
- describe "a sequence of non-terminals" do
64
- testing_grammar %{
65
- grammar TestGrammar
66
- rule sequence
67
- foo bar baz {
68
- def baz
69
- 'override' + super.text_value
70
- end
71
- }
72
- end
73
-
74
- rule foo 'foo' end
75
- rule bar 'bar' end
76
- rule baz 'baz' end
77
- end
78
- }
79
-
80
- it "defines accessors for non-terminals automatically that can be overridden in the inline block" do
81
- parse('foobarbaz') do |result|
82
- result.foo.text_value.should == 'foo'
83
- result.bar.text_value.should == 'bar'
84
- result.baz.should == 'overridebaz'
85
- end
86
- end
87
- end
88
-
89
- describe "Compiling a sequence containing various white-space errors" do
90
- it "should succeed on a valid sequence" do
91
- compiling_expression('foo:"foo" "bar" <SequenceSpec::Foo> { def a_method; end }').should_not raise_error
92
- end
93
-
94
- it "rejects space after a label" do
95
- compiling_expression('foo :"foo" "bar"').should raise_error(RuntimeError)
96
- end
97
-
98
- it "rejects space after label's colon" do
99
- compiling_expression('foo: "foo" "bar"').should raise_error(RuntimeError)
100
- end
101
-
102
- it "rejects missing space after a primary" do
103
- compiling_expression('foo:"foo""bar"').should raise_error(RuntimeError)
104
- end
105
-
106
- it "rejects missing space before node class declaration" do
107
- compiling_expression('foo:"foo" "bar"<SequenceSpec::Foo>').should raise_error(RuntimeError)
108
- end
109
-
110
- it "rejects missing space before inline module" do
111
- compiling_expression('foo:"foo" "bar" <SequenceSpec::Foo>{def a_method; end}').should raise_error(RuntimeError)
112
- end
113
- end
114
-
115
- end
@@ -1,81 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module TerminalSymbolSpec
4
- class Foo < Treetop::Runtime::SyntaxNode
5
- end
6
-
7
- describe "a terminal symbol followed by a node class declaration and a block" do
8
- testing_expression "'foo' <TerminalSymbolSpec::Foo> { def a_method; end }"
9
-
10
- it "correctly parses matching input prefixes at various indices, returning an instance of the declared class that can respond to methods defined in the inline module" do
11
- parse "foo", :index => 0 do |result|
12
- result.should be_an_instance_of(Foo)
13
- result.should respond_to(:a_method)
14
- result.interval.should == (0...3)
15
- result.text_value.should == 'foo'
16
- end
17
-
18
- parse "xfoo", :index => 1 do |result|
19
- result.should be_an_instance_of(Foo)
20
- result.should respond_to(:a_method)
21
- result.interval.should == (1...4)
22
- result.text_value.should == 'foo'
23
- end
24
-
25
- parse "---foo", :index => 3 do |result|
26
- result.should be_an_instance_of(Foo)
27
- result.should respond_to(:a_method)
28
- result.interval.should == (3...6)
29
- result.text_value.should == 'foo'
30
- end
31
- end
32
-
33
- it "fails to parse nonmatching input at the index even if a match occurs later" do
34
- parse(" foo", :index => 0).should be_nil
35
- end
36
- end
37
-
38
- module ModFoo
39
- end
40
-
41
- describe "a terminal symbol followed by a node class declaration and a block" do
42
- testing_expression "'foo' <TerminalSymbolSpec::ModFoo> { def a_method; end }"
43
-
44
- it "correctly parses matching input prefixes at various indices, returning an instance of SyntaxNode extended with the declared module that can respond to methods defined in the inline module" do
45
- parse "foo", :index => 0 do |result|
46
- result.should be_an_instance_of(Treetop::Runtime::SyntaxNode)
47
- result.should be_a_kind_of(ModFoo)
48
- result.should respond_to(:a_method)
49
- result.interval.should == (0...3)
50
- result.text_value.should == 'foo'
51
- end
52
-
53
- parse "xfoo", :index => 1 do |result|
54
- result.should be_an_instance_of(Treetop::Runtime::SyntaxNode)
55
- result.should be_a_kind_of(ModFoo)
56
- result.should respond_to(:a_method)
57
- result.interval.should == (1...4)
58
- result.text_value.should == 'foo'
59
- end
60
-
61
- parse "---foo", :index => 3 do |result|
62
- result.should be_an_instance_of(Treetop::Runtime::SyntaxNode)
63
- result.should be_a_kind_of(ModFoo)
64
- result.should respond_to(:a_method)
65
- result.interval.should == (3...6)
66
- result.text_value.should == 'foo'
67
- end
68
- end
69
- end
70
-
71
- describe "a transient terminal symbol" do
72
- testing_expression "~'foo'"
73
-
74
- it "returns true upon parsing matching input prefixes at various indices" do
75
- pending "transient terminal expressions"
76
- parse("foo", :index => 0).should be_true
77
- parse("-foo", :index => 1).should be_true
78
- parse("---foo", :index => 3).should be_true
79
- end
80
- end
81
- end
@@ -1,37 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module TerminalSymbolSpec
4
- class Foo < Treetop::Runtime::SyntaxNode
5
- end
6
-
7
- describe "a terminal symbol followed by a node class declaration and a block" do
8
- testing_expression "'foo' <TerminalSymbolSpec::Foo> { def a_method; end }"
9
-
10
- it "correctly parses matching input prefixes at various indices, returning an instance of the declared class that can respond to methods defined in the inline module" do
11
- parse "foo", :index => 0 do |result|
12
- result.should be_an_instance_of(Foo)
13
- result.should respond_to(:a_method)
14
- result.interval.should == (0...3)
15
- result.text_value.should == 'foo'
16
- end
17
-
18
- parse "xfoo", :index => 1 do |result|
19
- result.should be_an_instance_of(Foo)
20
- result.should respond_to(:a_method)
21
- result.interval.should == (1...4)
22
- result.text_value.should == 'foo'
23
- end
24
-
25
- parse "---foo", :index => 3 do |result|
26
- result.should be_an_instance_of(Foo)
27
- result.should respond_to(:a_method)
28
- result.interval.should == (3...6)
29
- result.text_value.should == 'foo'
30
- end
31
- end
32
-
33
- it "fails to parse nonmatching input at the index even if a match occurs later" do
34
- parse(" foo", :index => 0).should be_nil
35
- end
36
- end
37
- end
@@ -1,7 +0,0 @@
1
- module Test
2
- grammar Grammar
3
- rule foo
4
- 'foo'
5
- end
6
- end
7
- end