treetop 1.4.3 → 1.4.4

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -18,6 +18,15 @@ Rake::GemPackageTask.new($gemspec) do |pkg|
18
18
  pkg.need_tar = true
19
19
  end
20
20
 
21
+ task :spec => :regenerate_metagrammar
22
+ task :regenerate_metagrammar => 'lib/treetop/compiler/metagrammar.treetop' do |t|
23
+ unless $bootstrapped_gen_1_metagrammar
24
+ load File.join(File.dirname(__FILE__), 'lib', 'treetop', 'bootstrap_gen_1_metagrammar.rb')
25
+ end
26
+
27
+ Treetop::Compiler::GrammarCompiler.new.compile(METAGRAMMAR_PATH)
28
+ end
29
+
21
30
  task :version do
22
31
  puts RUBY_VERSION
23
32
  end
data/bin/tt CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'optparse'
3
3
  require 'rubygems'
4
- require 'treetop'
5
4
 
6
5
  $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
7
6
  require 'treetop'
@@ -3,9 +3,6 @@ module Treetop
3
3
  class SyntaxNode
4
4
  attr_reader :input, :interval
5
5
  attr_accessor :parent
6
- attr_reader :dot_id
7
-
8
- @@dot_id_counter = 0
9
6
 
10
7
  def initialize(input, interval, elements = nil)
11
8
  @input = input
@@ -26,9 +23,6 @@ module Treetop
26
23
  last_element = element
27
24
  end
28
25
 
29
- @dot_id = @@dot_id_counter
30
- @@dot_id_counter += 1
31
-
32
26
  @comprehensive_elements
33
27
  end
34
28
 
@@ -90,8 +84,14 @@ module Treetop
90
84
  )
91
85
  end
92
86
 
87
+ @@dot_id_counter = 0
88
+
89
+ def dot_id
90
+ @dot_id ||= @@dot_id_counter += 1
91
+ end
92
+
93
93
  def write_dot(io)
94
- io.puts "node#{dot_id} [label=\"#{text_value}\"];"
94
+ io.puts "node#{dot_id} [label=\"'#{text_value}'\"];"
95
95
  if nonterminal? then
96
96
  elements.each do
97
97
  |x|
@@ -2,7 +2,7 @@ module Treetop #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 4
5
- TINY = 3
5
+ TINY = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: treetop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Sobo
@@ -9,7 +9,7 @@ autorequire: treetop
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-08 00:00:00 +11:00
12
+ date: 2010-02-20 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.2.5
23
+ version: 0.3.0
24
24
  version:
25
25
  description:
26
26
  email: nathansobo@gmail.com