parser 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ffeb12159b6b536bbd1d47f0d0fd6c5f00726972
4
- data.tar.gz: 9a9af81cd8070c6a7ec4b48aaeb09c2ba68a66f2
3
+ metadata.gz: d62cbf813cac258da20e47d807e808d4a5d86d98
4
+ data.tar.gz: e708512bed38b4f38419882d82847f2272c11604
5
5
  SHA512:
6
- metadata.gz: c6e0265a8b7621a76d4aa1068452f87efb7edc48feb4f744e188c69eb4c19110908b924f7a1ff49a76e569d9f8045e1a5fc27741c4a8facc3862a5cb5f15d224
7
- data.tar.gz: 851a3cc71aacef3107b54636092d3579eb65b0c4f9914e24324bf3a9ba21490cff67e8d0a96911dcb99af18f0cdde45313b49ebc260d834007e7fed830d7100b
6
+ metadata.gz: 250e93427ef7b9907fe8157f1ec494bb8a2e0d589760c137ffb553a81a1056ed079237d3cbe7d9ded2e15ff95a4e27d4bc6e74f19fede3050def8b06b37a9da3
7
+ data.tar.gz: 05778b96f9bbe5d31ec2e5a071e09b4a9e6336ea06f447b80eb04dd8ed1ae53d45638f0653f3e594abdb35a9bc22d07e68de770e94c0ab190ea5af25022343ef
@@ -2,10 +2,19 @@ module Parser
2
2
 
3
3
  module Lexer::Explanation
4
4
 
5
+ def self.included(klass)
6
+ klass.class_exec do
7
+ alias_method :state_before_explanation=, :state=
8
+ alias_method :advance_before_explanation, :advance
9
+
10
+ remove_method :state=, :advance
11
+ end
12
+ end
13
+
5
14
  # Like #advance, but also pretty-print the token and its position
6
15
  # in the stream to `stdout`.
7
16
  def advance
8
- type, (val, range) = super
17
+ type, (val, range) = advance_before_explanation
9
18
 
10
19
  puts decorate(range,
11
20
  "\e[0;32m#{type} #{val.inspect}\e[0m",
@@ -18,7 +27,7 @@ module Parser
18
27
  puts " \e[1;33m>>> STATE SET <<<\e[0m " +
19
28
  "#{new_state.to_s.ljust(12)} #{@cond} #{@cmdarg}".rjust(66)
20
29
 
21
- super
30
+ self.state_before_explanation = new_state
22
31
  end
23
32
 
24
33
  private
@@ -107,7 +107,7 @@ module Parser
107
107
  @slop.on 'E', 'explain', 'Explain how the source is tokenized' do
108
108
  ENV['RACC_DEBUG'] = '1'
109
109
 
110
- Lexer.send :prepend, Lexer::Explanation
110
+ Lexer.send :include, Lexer::Explanation
111
111
  end
112
112
  end
113
113
 
@@ -1,3 +1,3 @@
1
1
  module Parser
2
- VERSION = '1.4.1'
2
+ VERSION = '1.4.2'
3
3
  end
data/test/test_parser.rb CHANGED
@@ -4140,7 +4140,7 @@ class TestParser < MiniTest::Unit::TestCase
4140
4140
  #
4141
4141
 
4142
4142
  def test_crlf_line_endings
4143
- with_versions(ALL_VERSIONS) do |_ver, parser|
4143
+ with_versions(nil, ALL_VERSIONS) do |_ver, parser|
4144
4144
  source_file = Parser::Source::Buffer.new('(comments)')
4145
4145
  source_file.source = "\r\nfoo"
4146
4146
 
@@ -4154,7 +4154,7 @@ class TestParser < MiniTest::Unit::TestCase
4154
4154
  ast
4155
4155
 
4156
4156
  assert_equal range.call(2, 5),
4157
- ast.loc.expression
4157
+ ast.src.expression
4158
4158
  end
4159
4159
  end
4160
4160
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Zotov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-29 00:00:00.000000000 Z
11
+ date: 2013-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ast