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,117 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'rubygems'
3
- require 'treetop'
4
- require "#{ENV["TM_SUPPORT_PATH"]}/lib/ui"
5
-
6
- # Monkey-patch SyntaxNode in a gross violation of its privacy.
7
- module Treetop
8
- module Runtime
9
- class SyntaxNode
10
- def interesting_methods
11
- # Copied from SyntaxNode#inspect
12
- methods-[extension_modules.last ? extension_modules.last.methods : nil]-self.class.instance_methods
13
- end
14
-
15
- def to_hash
16
- {
17
- "class_and_modules" => self.class.to_s.sub(/.*:/,'') + extension_modules.map{|m| "+"+m.to_s.sub(/.*:/,'')}*"",
18
- "offset" => interval.first,
19
- "text_value" => text_value,
20
- "methods" => interesting_methods * ", ",
21
- "elements" => elements ? elements.map {|e| e.to_hash} : []
22
- }
23
- end
24
- end
25
- end
26
- end
27
-
28
- class SyntaxTreeViewer
29
- def self.nib_path
30
- File.dirname(__FILE__) + "/SyntaxTreeViewer.nib"
31
- end
32
-
33
- def self.new_with_unknown_grammar
34
- parser = if ENV['TM_SCOPE'] =~ /source\.ruby/ && ENV['TM_SELECTED_TEXT']
35
- eval(ENV['TM_SELECTED_TEXT'])
36
- else
37
- parser_file = if ENV['TM_SCOPE'] =~ /source\.treetop/
38
- ENV['TM_FILEPATH']
39
- else
40
- ask_for_grammar
41
- end
42
- return unless parser_file
43
- Treetop.load(parser_file)
44
- end
45
- new(parser.new)
46
- end
47
-
48
- def self.ask_for_grammar
49
- files = TextMate::UI.request_file("title" => "Select a Grammar File")
50
- if files.nil? || files.empty?
51
- nil
52
- else
53
- files[0]
54
- end
55
- end
56
-
57
- def self.nib_path
58
- File.dirname(__FILE__) + "/nibs/SyntaxTreeViewer.nib"
59
- end
60
-
61
- def initialize(_parser)
62
- @parser = _parser
63
- run_parser!
64
- end
65
-
66
- def dialog
67
- TextMate::UI.dialog(
68
- :nib => self.class.nib_path,
69
- :parameters => parameters
70
- ) do |d|
71
- d.wait_for_input do |params|
72
- if params["returnArgument"]
73
- self.input = params["returnArgument"]
74
- run_parser!
75
- d.parameters = parameters
76
- true
77
- else
78
- false
79
- end
80
- end
81
- end
82
- end
83
-
84
- def input
85
- ENV['TM_TREETOP_SYNTAX_VIEWER_INPUT'] ||= ""
86
- end
87
-
88
- def input=(new_input)
89
- ENV['TM_TREETOP_SYNTAX_VIEWER_INPUT'] = new_input
90
- end
91
-
92
- private
93
- def run_parser!
94
- if input && !input.empty?
95
- @syntax_tree = @parser.parse(input)
96
- TextMate::UI.alert(:warning, "Parse error", @parser.failure_reason) unless @syntax_tree
97
- end
98
- end
99
-
100
- def parameters
101
- p = {
102
- "input" => input,
103
- "syntax_tree" => @syntax_tree ? @syntax_tree.to_hash : {},
104
- "selected_tab" => !input.empty? && @syntax_tree ? "Syntax Tree" : "Input"
105
- }
106
- puts p
107
- p
108
- end
109
- end
110
-
111
- if __FILE__ == $0
112
- Dir.chdir("/Users/aobrien/Work/canopy/play/sparql/")
113
- require "/Users/aobrien/Work/canopy/play/sparql/lib/sparql"
114
- v = SyntaxTreeViewer.new(SparqlParser.new)
115
- v.input = %{PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?foo WHERE { ?x foaf:knows ?y . ?z foaf:knows ?x .}}
116
- v.dialog
117
- end
@@ -1,278 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>fileTypes</key>
6
- <array>
7
- <string>treetop</string>
8
- </array>
9
- <key>foldingStartMarker</key>
10
- <string>(grammer|rule).*$</string>
11
- <key>foldingStopMarker</key>
12
- <string>^\s*end</string>
13
- <key>keyEquivalent</key>
14
- <string>^~T</string>
15
- <key>name</key>
16
- <string>Treetop Grammar</string>
17
- <key>patterns</key>
18
- <array>
19
- <dict>
20
- <key>include</key>
21
- <string>#comment</string>
22
- </dict>
23
- <dict>
24
- <key>begin</key>
25
- <string>^(grammar) ([A-Z]\w+)</string>
26
- <key>beginCaptures</key>
27
- <dict>
28
- <key>1</key>
29
- <dict>
30
- <key>name</key>
31
- <string>keyword.begin.grammar.treetop</string>
32
- </dict>
33
- <key>2</key>
34
- <dict>
35
- <key>name</key>
36
- <string>entity.name.grammar.treetop</string>
37
- </dict>
38
- </dict>
39
- <key>end</key>
40
- <string>^end$</string>
41
- <key>endCaptures</key>
42
- <dict>
43
- <key>0</key>
44
- <dict>
45
- <key>name</key>
46
- <string>keyword.end.grammar.treetop</string>
47
- </dict>
48
- </dict>
49
- <key>name</key>
50
- <string>meta.grammar.treetop</string>
51
- <key>patterns</key>
52
- <array>
53
- <dict>
54
- <key>include</key>
55
- <string>#comment</string>
56
- </dict>
57
- <dict>
58
- <key>begin</key>
59
- <string>\b(rule)\b (\w+)</string>
60
- <key>beginCaptures</key>
61
- <dict>
62
- <key>1</key>
63
- <dict>
64
- <key>name</key>
65
- <string>keyword.begin.rule.treetop</string>
66
- </dict>
67
- <key>2</key>
68
- <dict>
69
- <key>name</key>
70
- <string>entity.name.rule.treetop</string>
71
- </dict>
72
- </dict>
73
- <key>end</key>
74
- <string>^\s+\bend\b\s*$</string>
75
- <key>endCaptures</key>
76
- <dict>
77
- <key>0</key>
78
- <dict>
79
- <key>name</key>
80
- <string>keyword.end.rule.treetop</string>
81
- </dict>
82
- </dict>
83
- <key>name</key>
84
- <string>meta.rule.treetop</string>
85
- <key>patterns</key>
86
- <array>
87
- <dict>
88
- <key>include</key>
89
- <string>#comment</string>
90
- </dict>
91
- <dict>
92
- <key>include</key>
93
- <string>#strings</string>
94
- </dict>
95
- <dict>
96
- <key>include</key>
97
- <string>#character-class</string>
98
- </dict>
99
- <dict>
100
- <key>match</key>
101
- <string>\/</string>
102
- <key>name</key>
103
- <string>keyword.operator.or.treetop</string>
104
- </dict>
105
- <dict>
106
- <key>match</key>
107
- <string>&lt;\w+?&gt;</string>
108
- <key>name</key>
109
- <string>variable.class-instance.treetop</string>
110
- </dict>
111
- <dict>
112
- <key>match</key>
113
- <string>\w+?:</string>
114
- <key>name</key>
115
- <string>support.operand.treetop</string>
116
- </dict>
117
- <dict>
118
- <key>begin</key>
119
- <string>\{</string>
120
- <key>end</key>
121
- <string>\}</string>
122
- <key>name</key>
123
- <string>meta.embedded-ruby.treetop</string>
124
- <key>patterns</key>
125
- <array>
126
- <dict>
127
- <key>include</key>
128
- <string>source.ruby</string>
129
- </dict>
130
- </array>
131
- </dict>
132
- </array>
133
- </dict>
134
- </array>
135
- </dict>
136
- </array>
137
- <key>repository</key>
138
- <dict>
139
- <key>character-class</key>
140
- <dict>
141
- <key>patterns</key>
142
- <array>
143
- <dict>
144
- <key>match</key>
145
- <string>\\[wWsSdDhH]|\.</string>
146
- <key>name</key>
147
- <string>constant.character.character-class.regexp</string>
148
- </dict>
149
- <dict>
150
- <key>match</key>
151
- <string>\\.</string>
152
- <key>name</key>
153
- <string>constant.character.escape.backslash.regexp</string>
154
- </dict>
155
- <dict>
156
- <key>begin</key>
157
- <string>(\[)(\^)?</string>
158
- <key>beginCaptures</key>
159
- <dict>
160
- <key>1</key>
161
- <dict>
162
- <key>name</key>
163
- <string>punctuation.definition.character-class.regexp</string>
164
- </dict>
165
- <key>2</key>
166
- <dict>
167
- <key>name</key>
168
- <string>keyword.operator.negation.regexp</string>
169
- </dict>
170
- </dict>
171
- <key>end</key>
172
- <string>(\])</string>
173
- <key>endCaptures</key>
174
- <dict>
175
- <key>1</key>
176
- <dict>
177
- <key>name</key>
178
- <string>punctuation.definition.character-class.regexp</string>
179
- </dict>
180
- </dict>
181
- <key>name</key>
182
- <string>constant.other.character-class.set.regexp</string>
183
- <key>patterns</key>
184
- <array>
185
- <dict>
186
- <key>include</key>
187
- <string>#character-class</string>
188
- </dict>
189
- <dict>
190
- <key>captures</key>
191
- <dict>
192
- <key>2</key>
193
- <dict>
194
- <key>name</key>
195
- <string>constant.character.escape.backslash.regexp</string>
196
- </dict>
197
- <key>4</key>
198
- <dict>
199
- <key>name</key>
200
- <string>constant.character.escape.backslash.regexp</string>
201
- </dict>
202
- </dict>
203
- <key>match</key>
204
- <string>(.|(\\.))\-([^\]]|(\\.))</string>
205
- <key>name</key>
206
- <string>constant.other.character-class.range.regexp</string>
207
- </dict>
208
- <dict>
209
- <key>match</key>
210
- <string>&amp;&amp;</string>
211
- <key>name</key>
212
- <string>keyword.operator.intersection.regexp</string>
213
- </dict>
214
- </array>
215
- </dict>
216
- </array>
217
- </dict>
218
- <key>comment</key>
219
- <dict>
220
- <key>captures</key>
221
- <dict>
222
- <key>1</key>
223
- <dict>
224
- <key>name</key>
225
- <string>punctuation.definition.comment.treetop</string>
226
- </dict>
227
- </dict>
228
- <key>match</key>
229
- <string>(#).*$\n?</string>
230
- <key>name</key>
231
- <string>comment.line.number-sign.treetop</string>
232
- </dict>
233
- <key>strings</key>
234
- <dict>
235
- <key>patterns</key>
236
- <array>
237
- <dict>
238
- <key>begin</key>
239
- <string>'</string>
240
- <key>beginCaptures</key>
241
- <dict>
242
- <key>0</key>
243
- <dict>
244
- <key>name</key>
245
- <string>punctuation.definition.string.begin.treetop</string>
246
- </dict>
247
- </dict>
248
- <key>end</key>
249
- <string>'</string>
250
- <key>endCaptures</key>
251
- <dict>
252
- <key>0</key>
253
- <dict>
254
- <key>name</key>
255
- <string>punctuation.definition.string.end.treetop</string>
256
- </dict>
257
- </dict>
258
- <key>name</key>
259
- <string>string.quoted.single.treetop</string>
260
- <key>patterns</key>
261
- <array>
262
- <dict>
263
- <key>match</key>
264
- <string>\\(u\h{4}|.)</string>
265
- <key>name</key>
266
- <string>constant.character.escape.antlr</string>
267
- </dict>
268
- </array>
269
- </dict>
270
- </array>
271
- </dict>
272
- </dict>
273
- <key>scopeName</key>
274
- <string>source.treetop</string>
275
- <key>uuid</key>
276
- <string>A1604A34-0B73-4D5A-9499-87D881DFA8D5</string>
277
- </dict>
278
- </plist>
@@ -1,10 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>name</key>
6
- <string>Treetop</string>
7
- <key>uuid</key>
8
- <string>83A8B700-143D-4BD6-B4EA-D73796E8F883</string>
9
- </dict>
10
- </plist>
@@ -1,15 +0,0 @@
1
- f1(x) = a*x
2
- a = 0.5
3
- fit f1(x) 'before.dat' using 1:2 via a
4
-
5
- f2(x) = b*x
6
- b = 0.5
7
- fit f2(x) 'after.dat' using 1:2 via b
8
-
9
- set xlabel "Length of input"
10
- set ylabel "CPU time to parse"
11
-
12
- plot a*x title 'a*x (Before)',\
13
- b*x title 'b*x (After)',\
14
- "before.dat" using 1:2 title 'Before', \
15
- "after.dat" using 1:2 title 'After'
@@ -1,16 +0,0 @@
1
- grammar SeqPar
2
-
3
- rule statement
4
- 'par ' (statement ' ')+ 'end'
5
- / 'sequence' ' ' (statement ' ')+ 'end'
6
- / 'seq' ' ' (statement ' ')+ 'end'
7
- / ('fit' [\s] (statement ' ')+ 'end') {
8
- def foo
9
- "foo"
10
- end
11
- }
12
- / 'art'+ [ ] (statement ' ')+ 'end'
13
- / [A-Z] [a-zA-z0-9]*
14
- end
15
-
16
- end
@@ -1,107 +0,0 @@
1
- # Benchmarking written by Bernard Lambeau, improved by Jason Garber
2
- #
3
- # To test your optimizations:
4
- # 1. Run ruby seqpar_benchmark.rb
5
- # 2. cp after.dat before.dat
6
- # 3. Make your modifications to the treetop code
7
- # 4. Run ruby seqpar_benchmark.rb
8
- # 5. Run gnuplot seqpar.gnuplot
9
- #
10
- $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
11
- require 'treetop'
12
- require 'benchmark'
13
-
14
- srand(47562) # So it runs the same each time
15
-
16
- class Array; def sum; inject( nil ) { |sum,x| sum ? sum+x : x }; end; end
17
- class Array; def mean; sum / size; end; end
18
-
19
- class SeqParBenchmark
20
-
21
- OPERATORS = ["seq", "fit", "art"*5, "par", "sequence"]
22
-
23
- # Loads the grammar and returns a parser
24
- def initialize
25
- compiler = Treetop::Compiler::GrammarCompiler.new
26
- @where = File.expand_path(File.dirname(__FILE__))
27
- grammar = File.join(@where, 'seqpar.treetop')
28
- output = File.join(@where, 'seqpar.rb')
29
- compiler.compile(grammar, output)
30
- load output
31
- File.delete(output)
32
- @parser = SeqParParser.new
33
- end
34
-
35
- # Checks the grammar
36
- def check
37
- ["Task",
38
- "seq Task end",
39
- "par Task end",
40
- "seq Task Task end",
41
- "par Task Task end",
42
- "par seq Task end Task end",
43
- "par seq seq Task end end Task end",
44
- "seq Task par seq Task end Task end Task end"].each do |input|
45
- raise ParseError.new(@parser) if @parser.parse(input).nil?
46
- end
47
- end
48
-
49
- # Generates an input text
50
- def generate(depth=0)
51
- return "Task" if depth>7
52
- return "seq #{generate(depth+1)} end" if depth==0
53
- which = rand(OPERATORS.length)
54
- case which
55
- when 0
56
- "Task"
57
- else
58
- raise unless OPERATORS[which]
59
- buffer = "#{OPERATORS[which]} "
60
- 0.upto(rand(4)+1) do
61
- buffer << generate(depth+1) << " "
62
- end
63
- buffer << "end"
64
- buffer
65
- end
66
- end
67
-
68
- # Launches benchmarking
69
- def benchmark
70
- number_by_size = Hash.new {|h,k| h[k] = 0}
71
- time_by_size = Hash.new {|h,k| h[k] = 0}
72
- 0.upto(250) do |i|
73
- input = generate
74
- length = input.length
75
- puts "Launching #{i}: #{input.length}"
76
- # puts input
77
- tms = Benchmark.measure { @parser.parse(input) }
78
- number_by_size[length] += 1
79
- time_by_size[length] += tms.total*1000
80
- end
81
- # puts number_by_size.inspect
82
- # puts time_by_size.inspect
83
-
84
- File.open(File.join(@where, 'after.dat'), 'w') do |dat|
85
- number_by_size.keys.sort.each do |size|
86
- dat << "#{size} #{(time_by_size[size]/number_by_size[size]).truncate}\n"
87
- end
88
- end
89
-
90
- if File.exists?(File.join(@where, 'before.dat'))
91
- before = {}
92
- performance_increases = []
93
- File.foreach(File.join(@where, 'before.dat')) do |line|
94
- size, time = line.split(' ')
95
- before[size] = time
96
- end
97
- File.foreach(File.join(@where, 'after.dat')) do |line|
98
- size, time = line.split(' ')
99
- performance_increases << (before[size].to_f - time.to_f) / before[size].to_f unless time == "0" || before[size] == "0"
100
- end
101
- puts "Average performance increase: #{performance_increases.mean * 100}%"
102
- end
103
- end
104
-
105
- end
106
-
107
- SeqParBenchmark.new.benchmark