treetop 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ end
15
15
 
16
16
  gemspec = Gem::Specification.new do |s|
17
17
  s.name = "treetop"
18
- s.version = "1.2.2"
18
+ s.version = "1.2.3"
19
19
  s.author = "Nathan Sobo"
20
20
  s.email = "nathansobo@gmail.com"
21
21
  s.homepage = "http://functionalform.blogspot.com"
@@ -27,7 +27,6 @@ gemspec = Gem::Specification.new do |s|
27
27
  s.require_path = "lib"
28
28
  s.autorequire = "treetop"
29
29
  s.has_rdoc = false
30
- s.add_dependency "facets", "=2.0.2"
31
30
  s.add_dependency "polyglot"
32
31
  end
33
32
 
data/lib/treetop.rb CHANGED
@@ -1,6 +1,4 @@
1
1
  require 'rubygems'
2
- require 'facets/string/tabs'
3
- require 'facets/stylize'
4
2
 
5
3
  dir = File.dirname(__FILE__)
6
4
 
@@ -4,7 +4,7 @@ module Treetop
4
4
  attr_reader :module_name
5
5
 
6
6
  def compile(index, rule, builder)
7
- @module_name = "#{rule.name.camelize}#{index}"
7
+ @module_name = "#{rule.name.treetop_camelize}#{index}"
8
8
  end
9
9
  end
10
10
 
@@ -12,8 +12,31 @@ class String
12
12
  def line_of(index)
13
13
  self[0...index].count("\n") + 1
14
14
  end
15
-
16
- def blank?
17
- self == ""
15
+
16
+ unless method_defined?(:blank?)
17
+ def blank?
18
+ self == ""
19
+ end
20
+ end
21
+
22
+ # The following methods are lifted from Facets 2.0.2
23
+ def tabto(n)
24
+ if self =~ /^( *)\S/
25
+ indent(n - $1.length)
26
+ else
27
+ self
28
+ end
29
+ end
30
+
31
+ def indent(n)
32
+ if n >= 0
33
+ gsub(/^/, ' ' * n)
34
+ else
35
+ gsub(/^ {0,#{-n}}/, "")
36
+ end
37
+ end
38
+
39
+ def treetop_camelize
40
+ to_s.gsub(/\/(.?)/){ "::" + $1.upcase }.gsub(/(^|_)(.)/){ $2.upcase }
18
41
  end
19
42
  end
metadata CHANGED
@@ -1,52 +1,45 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
4
2
  name: treetop
5
3
  version: !ruby/object:Gem::Version
6
- version: 1.2.2
7
- date: 2008-02-29 00:00:00 -08:00
8
- summary: A Ruby-based text parsing and interpretation DSL
9
- require_paths:
10
- - lib
11
- email: nathansobo@gmail.com
12
- homepage: http://functionalform.blogspot.com
13
- rubyforge_project:
14
- description:
15
- autorequire: treetop
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: false
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ version: 1.2.3
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - Nathan Sobo
8
+ autorequire: treetop
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-03-07 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: polyglot
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: "0"
23
+ version:
24
+ description:
25
+ email: nathansobo@gmail.com
26
+ executables:
27
+ - tt
28
+ extensions: []
29
+
30
+ extra_rdoc_files: []
31
+
31
32
  files:
32
33
  - README
33
34
  - Rakefile
34
35
  - lib/treetop
35
- - lib/treetop.rb
36
36
  - lib/treetop/bootstrap_gen_1_metagrammar.rb
37
37
  - lib/treetop/compiler
38
- - lib/treetop/compiler.rb
39
- - lib/treetop/ruby_extensions
40
- - lib/treetop/ruby_extensions.rb
41
- - lib/treetop/runtime
42
- - lib/treetop/runtime.rb
43
38
  - lib/treetop/compiler/grammar_compiler.rb
44
39
  - lib/treetop/compiler/lexical_address_space.rb
45
40
  - lib/treetop/compiler/metagrammar.rb
46
41
  - lib/treetop/compiler/metagrammar.treetop
47
42
  - lib/treetop/compiler/node_classes
48
- - lib/treetop/compiler/node_classes.rb
49
- - lib/treetop/compiler/ruby_builder.rb
50
43
  - lib/treetop/compiler/node_classes/anything_symbol.rb
51
44
  - lib/treetop/compiler/node_classes/atomic_expression.rb
52
45
  - lib/treetop/compiler/node_classes/character_class.rb
@@ -65,16 +58,24 @@ files:
65
58
  - lib/treetop/compiler/node_classes/terminal.rb
66
59
  - lib/treetop/compiler/node_classes/transient_prefix.rb
67
60
  - lib/treetop/compiler/node_classes/treetop_file.rb
61
+ - lib/treetop/compiler/node_classes.rb
62
+ - lib/treetop/compiler/ruby_builder.rb
63
+ - lib/treetop/compiler.rb
64
+ - lib/treetop/ruby_extensions
68
65
  - lib/treetop/ruby_extensions/string.rb
66
+ - lib/treetop/ruby_extensions.rb
67
+ - lib/treetop/runtime
69
68
  - lib/treetop/runtime/compiled_parser.rb
70
69
  - lib/treetop/runtime/interval_skip_list
70
+ - lib/treetop/runtime/interval_skip_list/head_node.rb
71
+ - lib/treetop/runtime/interval_skip_list/interval_skip_list.rb
72
+ - lib/treetop/runtime/interval_skip_list/node.rb
71
73
  - lib/treetop/runtime/interval_skip_list.rb
72
74
  - lib/treetop/runtime/syntax_node.rb
73
75
  - lib/treetop/runtime/terminal_parse_failure.rb
74
76
  - lib/treetop/runtime/terminal_syntax_node.rb
75
- - lib/treetop/runtime/interval_skip_list/head_node.rb
76
- - lib/treetop/runtime/interval_skip_list/interval_skip_list.rb
77
- - lib/treetop/runtime/interval_skip_list/node.rb
77
+ - lib/treetop/runtime.rb
78
+ - lib/treetop.rb
78
79
  - bin/tt
79
80
  - doc/contributing_and_planned_features.markdown
80
81
  - doc/grammar_composition.markdown
@@ -82,23 +83,23 @@ files:
82
83
  - doc/pitfalls_and_advanced_techniques.markdown
83
84
  - doc/semantic_interpretation.markdown
84
85
  - doc/site
85
- - doc/site.rb
86
- - doc/sitegen.rb
87
- - doc/syntactic_recognition.markdown
88
- - doc/using_in_ruby.markdown
89
86
  - doc/site/contribute.html
90
87
  - doc/site/images
88
+ - doc/site/images/bottom_background.png
89
+ - doc/site/images/middle_background.png
90
+ - doc/site/images/paren_language_output.png
91
+ - doc/site/images/pivotal.gif
92
+ - doc/site/images/top_background.png
91
93
  - doc/site/index.html
92
94
  - doc/site/pitfalls_and_advanced_techniques.html
93
95
  - doc/site/screen.css
94
96
  - doc/site/semantic_interpretation.html
95
97
  - doc/site/syntactic_recognition.html
96
98
  - doc/site/using_in_ruby.html
97
- - doc/site/images/bottom_background.png
98
- - doc/site/images/middle_background.png
99
- - doc/site/images/paren_language_output.png
100
- - doc/site/images/pivotal.gif
101
- - doc/site/images/top_background.png
99
+ - doc/site.rb
100
+ - doc/sitegen.rb
101
+ - doc/syntactic_recognition.markdown
102
+ - doc/using_in_ruby.markdown
102
103
  - examples/lambda_calculus
103
104
  - examples/lambda_calculus/arithmetic.rb
104
105
  - examples/lambda_calculus/arithmetic.treetop
@@ -110,34 +111,31 @@ files:
110
111
  - examples/lambda_calculus/lambda_calculus_node_classes.rb
111
112
  - examples/lambda_calculus/lambda_calculus_test.rb
112
113
  - examples/lambda_calculus/test_helper.rb
113
- test_files: []
114
-
114
+ has_rdoc: false
115
+ homepage: http://functionalform.blogspot.com
116
+ post_install_message:
115
117
  rdoc_options: []
116
118
 
117
- extra_rdoc_files: []
118
-
119
- executables:
120
- - tt
121
- extensions: []
122
-
119
+ require_paths:
120
+ - lib
121
+ required_ruby_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: "0"
126
+ version:
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: "0"
132
+ version:
123
133
  requirements: []
124
134
 
125
- dependencies:
126
- - !ruby/object:Gem::Dependency
127
- name: facets
128
- version_requirement:
129
- version_requirements: !ruby/object:Gem::Version::Requirement
130
- requirements:
131
- - - "="
132
- - !ruby/object:Gem::Version
133
- version: 2.0.2
134
- version:
135
- - !ruby/object:Gem::Dependency
136
- name: polyglot
137
- version_requirement:
138
- version_requirements: !ruby/object:Gem::Version::Requirement
139
- requirements:
140
- - - ">"
141
- - !ruby/object:Gem::Version
142
- version: 0.0.0
143
- version:
135
+ rubyforge_project:
136
+ rubygems_version: 1.0.1
137
+ signing_key:
138
+ specification_version: 2
139
+ summary: A Ruby-based text parsing and interpretation DSL
140
+ test_files: []
141
+