rexical 1.0.5.beta2 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rexical might be problematic. Click here for more details.

data/Rakefile CHANGED
@@ -3,6 +3,10 @@
3
3
  require 'rubygems'
4
4
  require 'hoe'
5
5
 
6
+ Hoe.plugin :debugging
7
+ Hoe.plugin :git
8
+ Hoe.plugins.delete :rubyforge
9
+
6
10
  Hoe.spec 'rexical' do
7
11
  self.readme_file = 'README.rdoc'
8
12
  self.history_file = 'CHANGELOG.rdoc'
@@ -2,7 +2,7 @@ require 'rexical/generator'
2
2
  require 'rexical/rexcmd'
3
3
 
4
4
  module Rexical
5
- VERSION = "1.0.5.beta2"
5
+ VERSION = "1.0.5"
6
6
  Copyright = 'Copyright (c) 2005-2006 ARIMA Yasuhiro'
7
7
  Mailto = 'arima.yasuhiro@nifty.com'
8
8
  end
@@ -400,7 +400,13 @@ REX_EOT
400
400
 
401
401
  def next_token
402
402
  return if @ss.eos?
403
+
404
+ # skips empty actions
405
+ until token = _next_token or @ss.eos?; end
406
+ token
407
+ end
403
408
 
409
+ def _next_token
404
410
  text = @ss.peek(1)
405
411
  @lineno += 1 if text == "\\n"
406
412
  token = case @state
@@ -418,7 +424,7 @@ REX_EOT
418
424
  if rule_action
419
425
  if start_state
420
426
  f.print <<-REX_EOT
421
- when (state == #{start_state}) and (text = @ss.scan(/#{rule_expr}/#{flag}))
427
+ when((state == #{start_state}) and (text = @ss.scan(/#{rule_expr}/#{flag})))
422
428
  action #{rule_action}
423
429
 
424
430
  REX_EOT
@@ -467,7 +473,7 @@ REX_EOT
467
473
  end
468
474
  f.print <<-REX_EOT
469
475
  token
470
- end # def next_token
476
+ end # def _next_token
471
477
 
472
478
  REX_EOT
473
479
 
@@ -90,6 +90,23 @@ end
90
90
  [:NUMBER, 10]], calc
91
91
  end
92
92
 
93
+ def test_simple_scanner_with_empty_action
94
+ m = build_lexer %q{
95
+ class Calculator
96
+ rule
97
+ \d+ { [:NUMBER, text.to_i] }
98
+ \s+ # skips whitespaces
99
+ end
100
+ }
101
+
102
+ calc = m::Calculator.new
103
+ calc.scan_setup('1 2 10')
104
+
105
+ assert_tokens [[:NUMBER, 1],
106
+ [:NUMBER, 2],
107
+ [:NUMBER, 10]], calc
108
+ end
109
+
93
110
  def test_parses_macros_with_escapes
94
111
  source = parse_lexer %q{
95
112
  class Foo
metadata CHANGED
@@ -1,14 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rexical
3
3
  version: !ruby/object:Gem::Version
4
- hash: -1848230066
5
- prerelease: true
4
+ prerelease: false
6
5
  segments:
7
6
  - 1
8
7
  - 0
9
8
  - 5
10
- - beta2
11
- version: 1.0.5.beta2
9
+ version: 1.0.5
12
10
  platform: ruby
13
11
  authors:
14
12
  - Aaron Patterson
@@ -16,41 +14,24 @@ autorequire:
16
14
  bindir: bin
17
15
  cert_chain: []
18
16
 
19
- date: 2010-06-21 00:00:00 -07:00
17
+ date: 2010-12-08 00:00:00 -08:00
20
18
  default_executable:
21
19
  dependencies:
22
- - !ruby/object:Gem::Dependency
23
- name: rubyforge
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
26
- none: false
27
- requirements:
28
- - - ">="
29
- - !ruby/object:Gem::Version
30
- hash: 7
31
- segments:
32
- - 2
33
- - 0
34
- - 4
35
- version: 2.0.4
36
- type: :development
37
- version_requirements: *id001
38
20
  - !ruby/object:Gem::Dependency
39
21
  name: hoe
40
22
  prerelease: false
41
- requirement: &id002 !ruby/object:Gem::Requirement
23
+ requirement: &id001 !ruby/object:Gem::Requirement
42
24
  none: false
43
25
  requirements:
44
26
  - - ">="
45
27
  - !ruby/object:Gem::Version
46
- hash: 23
47
28
  segments:
48
29
  - 2
49
30
  - 6
50
- - 0
51
- version: 2.6.0
31
+ - 2
32
+ version: 2.6.2
52
33
  type: :development
53
- version_requirements: *id002
34
+ version_requirements: *id001
54
35
  description: |-
55
36
  Rexical is a lexical scanner generator.
56
37
  It is written in Ruby itself, and generates Ruby program.
@@ -119,21 +100,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
100
  requirements:
120
101
  - - ">="
121
102
  - !ruby/object:Gem::Version
122
- hash: 3
123
103
  segments:
124
104
  - 0
125
105
  version: "0"
126
106
  required_rubygems_version: !ruby/object:Gem::Requirement
127
107
  none: false
128
108
  requirements:
129
- - - ">"
109
+ - - ">="
130
110
  - !ruby/object:Gem::Version
131
- hash: 25
132
111
  segments:
133
- - 1
134
- - 3
135
- - 1
136
- version: 1.3.1
112
+ - 0
113
+ version: "0"
137
114
  requirements: []
138
115
 
139
116
  rubyforge_project: ruby-rex