srl_ruby 0.3.5 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +9 -3
  3. data/CHANGELOG.md +20 -0
  4. data/README.md +326 -52
  5. data/bin/srl2ruby +95 -0
  6. data/bin/srl2ruby_cli_parser.rb +89 -0
  7. data/lib/regex/abstract_method.rb +1 -1
  8. data/lib/regex/alternation.rb +1 -1
  9. data/lib/regex/anchor.rb +3 -3
  10. data/lib/regex/atomic_expression.rb +2 -2
  11. data/lib/regex/capturing_group.rb +3 -3
  12. data/lib/regex/char_class.rb +5 -5
  13. data/lib/regex/char_range.rb +5 -5
  14. data/lib/regex/char_shorthand.rb +2 -2
  15. data/lib/regex/character.rb +6 -6
  16. data/lib/regex/compound_expression.rb +2 -2
  17. data/lib/regex/concatenation.rb +3 -3
  18. data/lib/regex/expression.rb +4 -4
  19. data/lib/regex/lookaround.rb +1 -1
  20. data/lib/regex/match_option.rb +2 -2
  21. data/lib/regex/monadic_expression.rb +3 -3
  22. data/lib/regex/multiplicity.rb +1 -1
  23. data/lib/regex/non_capturing_group.rb +1 -1
  24. data/lib/regex/polyadic_expression.rb +3 -3
  25. data/lib/regex/repetition.rb +2 -2
  26. data/lib/regex/wildcard.rb +3 -3
  27. data/lib/srl_ruby/ast_builder.rb +22 -22
  28. data/lib/srl_ruby/srl_token.rb +1 -1
  29. data/lib/srl_ruby/tokenizer.rb +7 -7
  30. data/lib/srl_ruby/version.rb +1 -1
  31. data/spec/acceptance/srl_test_suite_spec.rb +1 -1
  32. data/spec/acceptance/support/rule_file_ast_builder.rb +8 -8
  33. data/spec/acceptance/support/rule_file_token.rb +1 -1
  34. data/spec/acceptance/support/rule_file_tokenizer.rb +8 -8
  35. data/spec/regex/character_spec.rb +30 -30
  36. data/spec/regex/multiplicity_spec.rb +24 -24
  37. data/srl_ruby.gemspec +8 -5
  38. data/templates/base.erb +2 -0
  39. data/templates/srl_and_ruby.erb +9 -0
  40. data/templates/srl_block_and_ruby.erb +10 -0
  41. metadata +8 -4
  42. data/bin/srl_ruby +0 -51
@@ -13,7 +13,7 @@ module AbstractMethod
13
13
  #
14
14
  # def some_method() abstract_method
15
15
  # end
16
- def abstract_method()
16
+ def abstract_method
17
17
  # Determine the short class name of self
18
18
  className = self.class.name.split(/::/).last
19
19
 
@@ -15,7 +15,7 @@ module Regex # This module is used as a namespace
15
15
 
16
16
  # Conversion method re-definition.
17
17
  # Purpose: Return the String representation of the concatented expressions.
18
- def text_repr()
18
+ def text_repr
19
19
  result_children = children.map(&:to_str)
20
20
  result = '(?:' + result_children.join('|') + ')'
21
21
 
data/lib/regex/anchor.rb CHANGED
@@ -29,15 +29,15 @@ module Regex # This module is used as a namespace
29
29
 
30
30
  # Conversion method re-definition.
31
31
  # Purpose: Return the String representation of the expression.
32
- def to_str()
33
- return AnchorToSymbol.rassoc(kind).first
32
+ def to_str
33
+ AnchorToSymbol.rassoc(kind).first
34
34
  end
35
35
 
36
36
  private
37
37
 
38
38
  # Return the symbolic value corresponding to the given lexeme.
39
39
  def valid_kind(aKind)
40
- return AnchorToSymbol[aKind]
40
+ AnchorToSymbol[aKind]
41
41
  end
42
42
  end # class
43
43
  end # module
@@ -13,12 +13,12 @@ module Regex # This module is used as a namespace
13
13
  end
14
14
 
15
15
  # Notification that the parse tree construction is complete.
16
- def done!()
16
+ def done!
17
17
  # Do nothing
18
18
  end
19
19
 
20
20
  # Notification that all quantifiers are lazy
21
- def lazy!()
21
+ def lazy!
22
22
  # Do nothing
23
23
  end
24
24
  end # class
@@ -29,13 +29,13 @@ module Regex # This module is used as a namespace
29
29
  end
30
30
 
31
31
  # Return true iff the capturing group has a name
32
- def named?()
33
- return id.kind_of?(String)
32
+ def named?
33
+ id.kind_of?(String)
34
34
  end
35
35
 
36
36
  # Conversion method re-definition.
37
37
  # Purpose: Return the String representation of the captured expression.
38
- def to_str()
38
+ def to_str
39
39
  prefix = named? ? "?<#{id}>" : ''
40
40
  atomic = no_backtrack ? '?>' : ''
41
41
  if child.is_a?(Regex::NonCapturingGroup)
@@ -21,12 +21,12 @@ module Regex # This module is used as a namespace
21
21
 
22
22
  # Conversion method re-definition.
23
23
  # Purpose: Return the String representation of the character class.
24
- def text_repr()
25
- result_children = children.inject('') do |subResult, aChild|
26
- if aChild.kind_of?(Regex::Character) && Metachars.include?(aChild.codepoint)
27
- subResult << '\\' # Escape meta-character...
24
+ def text_repr
25
+ result_children = children.inject('') do |sub_result, child|
26
+ if child.kind_of?(Regex::Character) && Metachars.include?(child.codepoint)
27
+ sub_result << '\\' # Escape meta-character...
28
28
  end
29
- subResult << aChild.to_str
29
+ sub_result << child.to_str
30
30
  end
31
31
  result = '[' + (negated ? '^' : '') + result_children + ']'
32
32
 
@@ -18,20 +18,20 @@ module Regex # This module is used as a namespace
18
18
  end
19
19
 
20
20
  # Return the lower bound of the range.
21
- def lower()
22
- return children.first
21
+ def lower
22
+ children.first
23
23
  end
24
24
 
25
25
  # Return the upper bound of the range.
26
- def upper()
27
- return children.last
26
+ def upper
27
+ children.last
28
28
  end
29
29
 
30
30
  protected
31
31
 
32
32
  # Conversion method re-definition.
33
33
  # Purpose: Return the String representation of the concatented expressions.
34
- def text_repr()
34
+ def text_repr
35
35
  result = lower.to_str + '-' + upper.to_str
36
36
 
37
37
  return result
@@ -31,8 +31,8 @@ module Regex # This module is used as a namespace
31
31
 
32
32
  # Conversion method re-definition.
33
33
  # Purpose: Return the String representation of the expression.
34
- def text_repr()
35
- return "\\#{shortname}"
34
+ def text_repr
35
+ "\\#{shortname}"
36
36
  end
37
37
 
38
38
  private
@@ -80,14 +80,14 @@ module Regex # This module is used as a namespace
80
80
  # RegAn::Character::codepoint2char(0x3a3) # Returns: Σ (
81
81
  # The Unicode GREEK CAPITAL LETTER SIGMA)
82
82
  def self.codepoint2char(aCodepoint)
83
- return [aCodepoint].pack('U') # Remark: chr() fails with codepoints > 256
83
+ [aCodepoint].pack('U') # Remark: chr() fails with codepoints > 256
84
84
  end
85
85
 
86
86
  # Convertion method that returns the codepoint for the given single character.
87
87
  # Example:
88
88
  # RegAn::Character::char2codepoint('Σ') # Returns: 0x3a3
89
89
  def self.char2codepoint(aChar)
90
- return aChar.ord
90
+ aChar.ord
91
91
  end
92
92
 
93
93
  # Convertion method that returns the codepoint for the given escape
@@ -109,7 +109,7 @@ module Regex # This module is used as a namespace
109
109
  end
110
110
 
111
111
  # Return the character as a String object
112
- def char()
112
+ def char
113
113
  self.class.codepoint2char(@codepoint)
114
114
  end
115
115
 
@@ -142,8 +142,8 @@ module Regex # This module is used as a namespace
142
142
  end
143
143
 
144
144
  # Return a plain English description of the character
145
- def explain()
146
- return "the character '#{to_str}'"
145
+ def explain
146
+ "the character '#{to_str}'"
147
147
  end
148
148
 
149
149
  protected
@@ -153,7 +153,7 @@ module Regex # This module is used as a namespace
153
153
  # If the Character was initially from a text (the lexeme), then the lexeme
154
154
  # is returned back.
155
155
  # Otherwise the character corresponding to the codepoint is returned.
156
- def text_repr()
156
+ def text_repr
157
157
  return char if lexeme.nil?
158
158
  return lexeme.dup
159
159
  end
@@ -8,7 +8,7 @@ module Regex # This module is used as a namespace
8
8
  class CompoundExpression < Expression
9
9
  # Redefined method. Return false since it may have one or more children.
10
10
  def atomic?
11
- return false
11
+ false
12
12
  end
13
13
 
14
14
  =begin
@@ -48,7 +48,7 @@ module Regex # This module is used as a namespace
48
48
  protected
49
49
 
50
50
  # Abstract method. Return the text representation of the child (if any)
51
- def all_child_text()
51
+ def all_child_text
52
52
  abstract_method
53
53
  end
54
54
  end # class
@@ -16,9 +16,9 @@ module Regex # This module is used as a namespace
16
16
 
17
17
  # Conversion method re-definition.
18
18
  # Purpose: Return the String representation of the concatented expressions.
19
- def text_repr()
20
- outcome = children.inject('') do |result, aChild|
21
- result << aChild.to_str
19
+ def text_repr
20
+ outcome = children.inject('') do |result, child|
21
+ result << child.to_str
22
22
  end
23
23
 
24
24
  return outcome
@@ -14,7 +14,7 @@ module Regex # This module is used as a namespace
14
14
  # Abstract method. Return true iff the expression is atomic
15
15
  # (= doesn't not have any child).
16
16
  # @return [Boolean]
17
- def atomic?()
17
+ def atomic?
18
18
  abstract_method
19
19
  end
20
20
 
@@ -30,7 +30,7 @@ module Regex # This module is used as a namespace
30
30
 
31
31
  # Template method.
32
32
  # @return [String] text representation of the expression.
33
- def to_str()
33
+ def to_str
34
34
  result = ''
35
35
  result << prefix
36
36
  result << text_repr
@@ -41,11 +41,11 @@ module Regex # This module is used as a namespace
41
41
 
42
42
  protected
43
43
 
44
- def prefix()
44
+ def prefix
45
45
  begin_anchor ? begin_anchor.to_str : ''
46
46
  end
47
47
 
48
- def suffix()
48
+ def suffix
49
49
  end_anchor ? end_anchor.to_str : ''
50
50
  end
51
51
  end # class
@@ -37,7 +37,7 @@ module Regex # This module is used as a namespace
37
37
 
38
38
  # Conversion method re-definition.
39
39
  # Purpose: Return the String representation of the captured expression.
40
- def to_str()
40
+ def to_str
41
41
  dir_syntax = (dir == :ahead) ? '' : '<'
42
42
  kind_syntax = (kind == :positive) ? '=' : '!'
43
43
  result = '(?' + dir_syntax + kind_syntax + child.to_str + ')'
@@ -20,7 +20,7 @@ module Regex # This module is used as a namespace
20
20
  # Combine all options/flags into one integer value that
21
21
  # is compliant as second argument of with Regexp#new method.
22
22
  # return [Integer]
23
- def combine_opts()
23
+ def combine_opts
24
24
  result = 0
25
25
  flags.each { |f| result |= f }
26
26
 
@@ -45,7 +45,7 @@ module Regex # This module is used as a namespace
45
45
 
46
46
  # Conversion method re-definition.
47
47
  # Purpose: Return the String representation of the concatented expressions.
48
- def text_repr()
48
+ def text_repr
49
49
  all_child_text
50
50
  end
51
51
  end # class
@@ -17,19 +17,19 @@ module Regex # This module is used as a namespace
17
17
  end
18
18
 
19
19
  # Notification that the parse tree construction is complete.
20
- def done!()
20
+ def done!
21
21
  child.done!
22
22
  end
23
23
 
24
24
  # Notification that all quantifiers are lazy
25
- def lazy!()
25
+ def lazy!
26
26
  child.lazy!
27
27
  end
28
28
 
29
29
  protected
30
30
 
31
31
  # Return the text representation of the child (if any)
32
- def all_child_text()
32
+ def all_child_text
33
33
  result = child.nil? ? '' : child.to_str
34
34
 
35
35
  return result
@@ -26,7 +26,7 @@ module Regex # This module is used as a namespace
26
26
  end
27
27
 
28
28
  # @return [String] String representation of the multiplicity.
29
- def to_str()
29
+ def to_str
30
30
  case upper_bound
31
31
  when :more
32
32
  case lower_bound
@@ -19,7 +19,7 @@ module Regex # This module is used as a namespace
19
19
 
20
20
  # Conversion method re-definition.
21
21
  # Purpose: Return the String representation of the captured expression.
22
- def text_repr()
22
+ def text_repr
23
23
  result = '(?:' + all_child_text + ')'
24
24
  return result
25
25
  end
@@ -26,7 +26,7 @@ module Regex # This module is used as a namespace
26
26
  end
27
27
 
28
28
  # Notification that the parse tree construction is complete.
29
- def done!()
29
+ def done!
30
30
  children.each(&:done!)
31
31
  children.each_with_index do |child, index|
32
32
  break if index == children.size - 1
@@ -40,13 +40,13 @@ module Regex # This module is used as a namespace
40
40
  end
41
41
 
42
42
  # Apply the 'lazy' option to the child elements
43
- def lazy!()
43
+ def lazy!
44
44
  children.each(&:lazy!)
45
45
  end
46
46
 
47
47
  # Build a depth-first in-order children visitor.
48
48
  # The visitor is implemented as an Enumerator.
49
- def df_visitor()
49
+ def df_visitor
50
50
  root = children # The visit will start from the children of this object
51
51
 
52
52
  visitor = Enumerator.new do |result| # result is a Yielder
@@ -18,7 +18,7 @@ module Regex # This module is used as a namespace
18
18
  end
19
19
 
20
20
  # Apply the `lazy` flag.
21
- def lazy!()
21
+ def lazy!
22
22
  multiplicity.policy = :lazy
23
23
  super
24
24
  end
@@ -27,7 +27,7 @@ module Regex # This module is used as a namespace
27
27
 
28
28
  # Conversion method re-definition.
29
29
  # @return [String] String representation of the concatented expressions.
30
- def text_repr()
30
+ def text_repr
31
31
  result = all_child_text + multiplicity.to_str
32
32
  return result
33
33
  end
@@ -6,7 +6,7 @@ module Regex # This module is used as a namespace
6
6
  # A wildcard matches any character (except for the newline).
7
7
  class Wildcard < AtomicExpression
8
8
  # Constructor
9
- def initialize()
9
+ def initialize
10
10
  super
11
11
  end
12
12
 
@@ -14,8 +14,8 @@ module Regex # This module is used as a namespace
14
14
 
15
15
  # Conversion method re-definition.
16
16
  # Purpose: Return the String representation of the expression.
17
- def text_repr()
18
- return '.'
17
+ def text_repr
18
+ '.'
19
19
  end
20
20
  end # class
21
21
  end # module
@@ -22,18 +22,18 @@ module SrlRuby
22
22
  end
23
23
 
24
24
  # Notification that the parse tree construction is complete.
25
- def done!()
25
+ def done!
26
26
  apply_options
27
27
  super
28
28
  end
29
29
 
30
30
  protected
31
31
 
32
- def terminal2node()
32
+ def terminal2node
33
33
  Terminal2NodeClass
34
34
  end
35
35
 
36
- def apply_options()
36
+ def apply_options
37
37
  tree_root = result.root
38
38
  regexp_opts = []
39
39
  options.each do |opt|
@@ -100,16 +100,16 @@ module SrlRuby
100
100
  Regex::CharShorthand.new(shortName)
101
101
  end
102
102
 
103
- def wildcard()
103
+ def wildcard
104
104
  Regex::Wildcard.new
105
105
  end
106
106
 
107
107
  def repetition(expressionToRepeat, aMultiplicity)
108
- return Regex::Repetition.new(expressionToRepeat, aMultiplicity)
108
+ Regex::Repetition.new(expressionToRepeat, aMultiplicity)
109
109
  end
110
110
 
111
111
  def begin_anchor
112
- return Regex::Anchor.new('^')
112
+ Regex::Anchor.new('^')
113
113
  end
114
114
 
115
115
  # rule('expression' => %w[pattern flags]).as 'flagged_expr'
@@ -120,7 +120,7 @@ module SrlRuby
120
120
 
121
121
  # rule('pattern' => %w[pattern separator sub_pattern]).as 'pattern_sequence'
122
122
  def reduce_pattern_sequence(_production, _range, _tokens, theChildren)
123
- return Regex::Concatenation.new(theChildren[0], theChildren[2])
123
+ Regex::Concatenation.new(theChildren[0], theChildren[2])
124
124
  end
125
125
 
126
126
  # rule('pattern' => 'sub_pattern').as 'basic_pattern'
@@ -145,27 +145,27 @@ module SrlRuby
145
145
 
146
146
  # rule('single_flag' => %w[CASE INSENSITIVE]).as 'case_insensitive'
147
147
  def reduce_case_insensitive(_production, _range, _tokens, _children)
148
- return Regexp::IGNORECASE
148
+ Regexp::IGNORECASE
149
149
  end
150
150
 
151
151
  # rule('single_flag' => %w[MULTI LINE]).as 'multi_line'
152
152
  def reduce_multi_line(_production, _range, _tokens, _children)
153
- return Regexp::MULTILINE
153
+ Regexp::MULTILINE
154
154
  end
155
155
 
156
156
  # rule('single_flag' => %w[ALL LAZY]).as 'all_lazy'
157
157
  def reduce_all_lazy(_production, _range, _tokens, _children)
158
- return :ALL_LAZY
158
+ :ALL_LAZY
159
159
  end
160
160
 
161
161
  # rule 'quantifiable' => %w[begin_anchor anchorable end_anchor]
162
162
  def reduce_pinned_quantifiable(_production, _range, _tokens, theChildren)
163
- return Regex::Concatenation.new(*theChildren)
163
+ Regex::Concatenation.new(*theChildren)
164
164
  end
165
165
 
166
166
  # rule 'quantifiable' => %w[begin_anchor anchorable]
167
167
  def reduce_begin_anchor_quantifiable(_production, _range, _tokens, theChildren)
168
- return Regex::Concatenation.new(*theChildren)
168
+ Regex::Concatenation.new(*theChildren)
169
169
  end
170
170
 
171
171
  # rule 'quantifiable' => %w[anchorable end_anchor]
@@ -185,27 +185,27 @@ module SrlRuby
185
185
 
186
186
  # rule('end_anchor' => %w[separator MUST END]).as 'end_anchor'
187
187
  def reduce_end_anchor(_production, _range, _tokens, _children)
188
- return Regex::Anchor.new('$')
188
+ Regex::Anchor.new('$')
189
189
  end
190
190
 
191
191
  # rule('assertion' => %w[IF FOLLOWED BY assertable]).as 'if_followed'
192
192
  def reduce_if_followed(_production, _range, _tokens, theChildren)
193
- return Regex::Lookaround.new(theChildren.last, :ahead, :positive)
193
+ Regex::Lookaround.new(theChildren.last, :ahead, :positive)
194
194
  end
195
195
 
196
196
  # rule('assertion' => %w[IF NOT FOLLOWED BY assertable]).as 'if_not_followed'
197
197
  def reduce_if_not_followed(_production, _range, _tokens, theChildren)
198
- return Regex::Lookaround.new(theChildren.last, :ahead, :negative)
198
+ Regex::Lookaround.new(theChildren.last, :ahead, :negative)
199
199
  end
200
200
 
201
201
  # rule('assertion' => %w[IF ALREADY HAD assertable]).as 'if_had'
202
202
  def reduce_if_had(_production, _range, _tokens, theChildren)
203
- return Regex::Lookaround.new(theChildren.last, :behind, :positive)
203
+ Regex::Lookaround.new(theChildren.last, :behind, :positive)
204
204
  end
205
205
 
206
206
  # rule('assertion' => %w[IF NOT ALREADY HAD assertable]).as 'if_not_had'
207
207
  def reduce_if_not_had(_production, _range, _tokens, theChildren)
208
- return Regex::Lookaround.new(theChildren.last, :behind, :negative)
208
+ Regex::Lookaround.new(theChildren.last, :behind, :negative)
209
209
  end
210
210
 
211
211
  # rule('assertable' => %w[term quantifier]).as 'quantified_assertable'
@@ -384,17 +384,17 @@ module SrlRuby
384
384
 
385
385
  # rule('alternatives' => 'quantifiable').as 'simple_alternative'
386
386
  def reduce_simple_alternative(_production, _range, _tokens, theChildren)
387
- return [theChildren.last]
387
+ [theChildren.last]
388
388
  end
389
389
 
390
390
  # rule('grouping' => %w[LPAREN pattern RPAREN]).as 'grouping_parenthenses'
391
391
  def reduce_grouping_parenthenses(_production, _range, _tokens, theChildren)
392
- return Regex::NonCapturingGroup.new(theChildren[1])
392
+ Regex::NonCapturingGroup.new(theChildren[1])
393
393
  end
394
394
 
395
395
  # rule('capturing_group' => %w[CAPTURE assertable]).as 'capture'
396
396
  def reduce_capture(_production, _range, _tokens, theChildren)
397
- return Regex::CapturingGroup.new(theChildren[1])
397
+ Regex::CapturingGroup.new(theChildren[1])
398
398
  end
399
399
 
400
400
  # If the rightmost (sub)expression is a repetition, then make it lazy
@@ -491,12 +491,12 @@ module SrlRuby
491
491
 
492
492
  # rule('times_suffix' => 'TIMES').as 'times_keyword'
493
493
  def reduce_times_keyword(_production, _range, _tokens, _children)
494
- return nil
494
+ nil
495
495
  end
496
496
 
497
497
  # rule('times_suffix' => []).as 'times_dropped'
498
498
  def reduce_times_dropped(_production, _range, _tokens, _children)
499
- return nil
499
+ nil
500
500
  end
501
501
  end # class
502
502
  end # module
@@ -3,7 +3,7 @@ require 'rley' # Load the Rley gem
3
3
 
4
4
  module SrlRuby
5
5
  Position = Struct.new(:line, :column) do
6
- def to_s()
6
+ def to_s
7
7
  "line #{line}, column #{column}"
8
8
  end
9
9
  end
@@ -96,7 +96,7 @@ module SrlRuby
96
96
  @line_start = 0
97
97
  end
98
98
 
99
- def tokens()
99
+ def tokens
100
100
  tok_sequence = []
101
101
  until @scanner.eos?
102
102
  token = _next_token
@@ -108,7 +108,7 @@ module SrlRuby
108
108
 
109
109
  private
110
110
 
111
- def _next_token()
111
+ def _next_token
112
112
  skip_whitespaces
113
113
  curr_ch = scanner.peek(1)
114
114
  return nil if curr_ch.nil? || curr_ch.empty?
@@ -118,9 +118,9 @@ module SrlRuby
118
118
  if '(),'.include? curr_ch
119
119
  # Delimiters, separators => single character token
120
120
  token = build_token(@@lexeme2name[curr_ch], scanner.getch)
121
- elsif (lexeme = scanner.scan(/[0-9]{2,}((?=\s|,)|$)/))
121
+ elsif (lexeme = scanner.scan(/[0-9]{2,}((?=\s|,|\))|$)/))
122
122
  token = build_token('INTEGER', lexeme) # An integer has 2..* digits
123
- elsif (lexeme = scanner.scan(/[0-9]((?=\s|,)|$)/))
123
+ elsif (lexeme = scanner.scan(/[0-9]((?=\s|,|\))|$)/))
124
124
  token = build_token('DIGIT_LIT', lexeme)
125
125
  elsif (lexeme = scanner.scan(/"(?:\\"|[^"])*"/)) # Double quotes literal?
126
126
  unquoted = lexeme.gsub(/(^")|("$)/, '')
@@ -128,7 +128,7 @@ module SrlRuby
128
128
  elsif (lexeme = scanner.scan(/'(?:\\'|[^'])*'/)) # Single quotes literal?
129
129
  unquoted = lexeme.gsub(/(^')|('$)/, '')
130
130
  token = build_token('STRING_LIT', unquoted)
131
- elsif (lexeme = scanner.scan(/[a-zA-Z]((?=\s|,)|$)/))
131
+ elsif (lexeme = scanner.scan(/[a-zA-Z]((?=\s|,|\))|$)/))
132
132
  token = build_token('LETTER_LIT', lexeme)
133
133
  elsif (lexeme = scanner.scan(/[a-zA-Z_][a-zA-Z0-9_]+/))
134
134
  keyw = @@keywords[lexeme.upcase]
@@ -159,7 +159,7 @@ module SrlRuby
159
159
  return token
160
160
  end
161
161
 
162
- def skip_whitespaces()
162
+ def skip_whitespaces
163
163
  pre_pos = scanner.pos
164
164
 
165
165
  loop do
@@ -186,7 +186,7 @@ module SrlRuby
186
186
  # @column += triplet[2].size + tab_count * (tab_size - 1) - 1
187
187
  end
188
188
 
189
- def tab_size()
189
+ def tab_size
190
190
  2
191
191
  end
192
192
  end # class
@@ -1,3 +1,3 @@
1
1
  module SrlRuby
2
- VERSION = '0.3.5'.freeze
2
+ VERSION = '0.4.0'.freeze
3
3
  end
@@ -16,7 +16,7 @@ RSpec.describe SrlRuby do
16
16
  end
17
17
 
18
18
  def load_file(aFilename)
19
- return Acceptance::RuleFileParser.load_file(rule_path + aFilename)
19
+ Acceptance::RuleFileParser.load_file(rule_path + aFilename)
20
20
  end
21
21
 
22
22
  def test_rule_file(aRuleFileRepr)
@@ -20,13 +20,13 @@ module Acceptance
20
20
 
21
21
  attr_reader :options
22
22
 
23
- def done!()
23
+ def done!
24
24
  # Do nothing!
25
25
  end
26
26
 
27
27
  protected
28
28
 
29
- def terminal2node()
29
+ def terminal2node
30
30
  Terminal2NodeClass
31
31
  end
32
32
 
@@ -49,17 +49,17 @@ module Acceptance
49
49
 
50
50
  # rule('srl_heading' => %w[SRL: SRL_SOURCE]).as 'srl_source'
51
51
  def reduce_srl_source(_production, _range, _tokens, theChildren)
52
- return theChildren.last
52
+ theChildren.last
53
53
  end
54
54
 
55
55
  # rule('srl_tests' => %w[srl_tests single_test]).as 'test_list'
56
56
  def reduce_test_list(_production, _range, _tokens, theChildren)
57
- return theChildren[0] << theChildren[1]
57
+ theChildren[0] << theChildren[1]
58
58
  end
59
59
 
60
60
  # rule('srl_tests' => 'single_test').as 'one_test'
61
61
  def reduce_one_test(_production, _range, _tokens, theChildren)
62
- return [theChildren.last]
62
+ [theChildren.last]
63
63
  end
64
64
 
65
65
  # rule('match_test' => %w[MATCH: STRING_LIT]).as 'match_string'
@@ -80,18 +80,18 @@ module Acceptance
80
80
 
81
81
  # rule('capture_heading' => %w[CAPTURE FOR STRING_LIT COLON]).as 'capture_string'
82
82
  def reduce_capture_string(_production, _range, _tokens, theChildren)
83
- return theChildren[2]
83
+ theChildren[2]
84
84
  end
85
85
 
86
86
  # rule('capture_expectations' => %w[capture_expectations
87
87
  # single_expectation]).as 'assertion_list'
88
88
  def reduce_assertion_list(_production, _range, _tokens, theChildren)
89
- return theChildren[0] << theChildren[1]
89
+ theChildren[0] << theChildren[1]
90
90
  end
91
91
 
92
92
  # rule('capture_expectations' => 'single_expectation').as 'one_expectation'
93
93
  def reduce_one_expectation(_production, _range, _tokens, theChildren)
94
- return [theChildren.last]
94
+ [theChildren.last]
95
95
  end
96
96
 
97
97
  # rule('single_expectation' => %w[DASH INTEGER COLON capture_variable