rley 0.4.06 → 0.4.07

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +22 -13
  3. data/.travis.yml +8 -7
  4. data/CHANGELOG.md +9 -0
  5. data/README.md +9 -10
  6. data/examples/NLP/mini_en_demo.rb +7 -7
  7. data/examples/data_formats/JSON/cli_options.rb +5 -6
  8. data/examples/data_formats/JSON/{JSON_demo.rb → json_demo.rb} +2 -2
  9. data/examples/data_formats/JSON/{JSON_grammar.rb → json_grammar.rb} +10 -10
  10. data/examples/data_formats/JSON/{JSON_lexer.rb → json_lexer.rb} +17 -22
  11. data/examples/data_formats/JSON/{JSON_parser.rb → json_parser.rb} +2 -2
  12. data/examples/general/calc/calc_demo.rb +1 -1
  13. data/examples/general/calc/calc_grammar.rb +5 -5
  14. data/examples/general/calc/calc_lexer.rb +14 -17
  15. data/examples/general/calc/calc_parser.rb +2 -2
  16. data/lib/rley/constants.rb +1 -1
  17. data/lib/rley/formatter/asciitree.rb +15 -16
  18. data/lib/rley/formatter/bracket_notation.rb +3 -6
  19. data/lib/rley/formatter/debug.rb +0 -1
  20. data/lib/rley/formatter/json.rb +0 -1
  21. data/lib/rley/gfg/grm_flow_graph.rb +11 -10
  22. data/lib/rley/parse_forest_visitor.rb +0 -3
  23. data/lib/rley/parse_tree_visitor.rb +0 -3
  24. data/lib/rley/parser/error_reason.rb +1 -5
  25. data/lib/rley/parser/gfg_chart.rb +2 -2
  26. data/lib/rley/parser/gfg_earley_parser.rb +1 -2
  27. data/lib/rley/parser/gfg_parsing.rb +3 -7
  28. data/lib/rley/parser/parse_entry.rb +0 -1
  29. data/lib/rley/parser/parse_entry_set.rb +15 -16
  30. data/lib/rley/parser/parse_forest_builder.rb +8 -23
  31. data/lib/rley/parser/parse_state.rb +1 -1
  32. data/lib/rley/parser/parse_tree_builder.rb +2 -30
  33. data/lib/rley/parser/parse_tree_factory.rb +1 -1
  34. data/lib/rley/parser/parse_walker_factory.rb +3 -6
  35. data/lib/rley/parser/state_set.rb +0 -1
  36. data/lib/rley/ptree/parse_tree.rb +0 -1
  37. data/lib/rley/ptree/terminal_node.rb +4 -1
  38. data/lib/rley/rley_error.rb +1 -1
  39. data/lib/rley/sppf/composite_node.rb +0 -1
  40. data/lib/rley/sppf/parse_forest.rb +0 -1
  41. data/lib/rley/syntax/grammar.rb +5 -9
  42. data/lib/rley/syntax/grammar_builder.rb +8 -11
  43. data/lib/rley/syntax/grm_symbol.rb +0 -1
  44. data/lib/rley/syntax/production.rb +5 -4
  45. data/lib/rley/tokens/token_range.rb +0 -1
  46. data/spec/rley/formatter/bracket_notation_spec.rb +3 -1
  47. data/spec/rley/gfg/grm_flow_graph_spec.rb +15 -46
  48. data/spec/rley/gfg/item_vertex_spec.rb +1 -1
  49. data/spec/rley/parse_forest_visitor_spec.rb +1 -1
  50. data/spec/rley/parse_tree_visitor_spec.rb +2 -2
  51. data/spec/rley/parser/error_reason_spec.rb +19 -14
  52. data/spec/rley/parser/gfg_chart_spec.rb +1 -1
  53. data/spec/rley/parser/gfg_earley_parser_spec.rb +15 -15
  54. data/spec/rley/parser/gfg_parsing_spec.rb +3 -3
  55. data/spec/rley/parser/groucho_spec.rb +6 -7
  56. data/spec/rley/parser/parse_forest_builder_spec.rb +5 -5
  57. data/spec/rley/parser/parse_forest_factory_spec.rb +5 -5
  58. data/spec/rley/parser/parse_state_spec.rb +8 -0
  59. data/spec/rley/parser/parse_tracer_spec.rb +1 -1
  60. data/spec/rley/parser/parse_tree_builder_spec.rb +26 -29
  61. data/spec/rley/parser/parse_tree_factory_spec.rb +5 -5
  62. data/spec/rley/parser/parse_walker_factory_spec.rb +5 -5
  63. data/spec/rley/ptree/parse_tree_node_spec.rb +2 -2
  64. data/spec/rley/ptree/terminal_node_spec.rb +1 -1
  65. data/spec/rley/support/ambiguous_grammar_helper.rb +1 -1
  66. data/spec/rley/support/expectation_helper.rb +0 -1
  67. data/spec/rley/support/grammar_abc_helper.rb +1 -1
  68. data/spec/rley/support/grammar_ambig01_helper.rb +2 -3
  69. data/spec/rley/support/grammar_b_expr_helper.rb +2 -2
  70. data/spec/rley/support/grammar_l0_helper.rb +7 -8
  71. data/spec/rley/support/grammar_pb_helper.rb +3 -4
  72. data/spec/rley/support/grammar_sppf_helper.rb +4 -4
  73. data/spec/rley/syntax/grammar_builder_spec.rb +5 -4
  74. data/spec/rley/syntax/grammar_spec.rb +10 -11
  75. data/spec/rley/syntax/symbol_seq_spec.rb +2 -2
  76. data/spec/rley/syntax/terminal_spec.rb +1 -1
  77. metadata +31 -31
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57136a1796f3625b841a2f1fdb0965b4314b6224
4
- data.tar.gz: 80fd87d6ad9f68314278d5b4c15ef85a241647c3
3
+ metadata.gz: 3ddc536143d5391aac2c513060d9f0afa43656f7
4
+ data.tar.gz: 69e5069295d886ea1287b17cdb7453506d589552
5
5
  SHA512:
6
- metadata.gz: 3922fe824b8d721892b71022e64a79f4117ed0135f0b02fdaf76f5edfef083d345192328f3086a80fc0484e7dac14f7ec188a51c942bab2b14c8a196e4c9ffc4
7
- data.tar.gz: 836625169012043daeba92c142fda1e80e6f4eaf085437c2d1bc006e57ca8de99d70619fce22f2d6d8f000468e9c93c65b8e073d80f68084619d7c2070e18197
6
+ metadata.gz: 18f44cd59717551570814e180c735e62badf109c291cb1b41cbaf709bfc2af6cc78864ceb34060b9eb3ca017ab7cfd2e642f1848770b87cced6b1752d27896c0
7
+ data.tar.gz: 668c3f7737921db9ad35301034be75b91faa584d1ede14fabb253a0dffa6d5a43dc09c94289df714236f0e184a59eb3f10775a2bbd16a6f5a39e8c746969871e
@@ -1,13 +1,9 @@
1
1
  AllCops:
2
2
  Exclude:
3
- - 'examples/**/*'
4
3
  - 'features/**/*'
5
4
  - 'exp/**/*'
6
5
  - 'gems/**/*'
7
6
  - 'refs/**/*'
8
-
9
- AbcSize:
10
- Max: 45
11
7
 
12
8
  # This is disabled because some demos use UTF-8
13
9
  AsciiComments:
@@ -20,7 +16,7 @@ BlockComments:
20
16
  Enabled: false
21
17
 
22
18
  CaseIndentation:
23
- IndentWhenRelativeTo: end
19
+ EnforcedStyle: end
24
20
  IndentOneStep: true
25
21
 
26
22
  # Rubocop enforces the use of is_a? instead of kind_of?
@@ -50,18 +46,34 @@ EmptyLines:
50
46
  Encoding:
51
47
  Enabled: false
52
48
 
49
+ EndOfLine:
50
+ Enabled: false
51
+ # SupportedStyles: lf
52
+
53
+
53
54
  IndentationWidth :
54
55
  Enabled: false
55
56
 
57
+ # Enabled after end of support of Rubies < 2.3
58
+ Layout/IndentHeredoc:
59
+ Enabled: false
60
+
61
+ Metrics/AbcSize:
62
+ Max: 50
56
63
 
57
64
  # Avoid methods longer than 50 lines of code
58
- MethodLength:
65
+ Metrics/MethodLength:
59
66
  Max: 50
60
67
  CountComments: false
61
-
62
- # Avoid modules longer than 700 lines of code
63
- ModuleLength:
64
- Max: 700
68
+
69
+ # Avoid modules longer than 200 lines of code
70
+ Metrics/ModuleLength:
71
+ CountComments: false
72
+ Max: 200
73
+
74
+ Metrics/PerceivedComplexity:
75
+ Enabled: true
76
+ Max: 50
65
77
 
66
78
  NonNilCheck:
67
79
  Enabled: false
@@ -69,9 +81,6 @@ NonNilCheck:
69
81
  NumericLiterals:
70
82
  Enabled: false
71
83
 
72
- PerceivedComplexity:
73
- Max: 10
74
-
75
84
  RaiseArgs:
76
85
  Enabled: false
77
86
 
@@ -1,17 +1,18 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0.0
4
- - 2.1.9
5
- - 2.2.6
6
- - 2.3.3
3
+ - 2.0.0-p648
4
+ - 2.1.10
5
+ - 2.2.7
6
+ - 2.3.4
7
+ - 2.4.1
7
8
  - ruby-head
8
- - rbx-2.2
9
- - jruby-9.1.0.0
9
+ - rbx-2.7
10
+ - jruby-9.1.9.0
10
11
  - jruby-head
11
12
  matrix:
12
13
  allow_failures:
13
14
  - rvm: ruby-head
14
- - rvm: rbx-2.2
15
+ - rvm: rbx-2.7
15
16
  - rvm: jruby-head
16
17
 
17
18
  gemfile:
@@ -1,3 +1,12 @@
1
+ ### 0.4.07 / 2017-05-25
2
+ * [FIX] To avoid Fixnum deprecation error in Ruby 2.4 abd higher, all explicit references to Fixnum has been removed.
3
+ * [FIX] File `.rubocop.yml`: folder `examples` was excluded from Rubocop control. Now it is in code analysis scope.
4
+ * [NEW] File `spec\.rubocop.yml` to tune the code analysis for Rspec files
5
+ * [NEW] File `examples\.rubocop.yml` to tune the code analysis for example files
6
+ * [CHANGE] Code re-styling to please Rubocop 0.49.0: less than 10 offences remain (from above 200 count!)
7
+ * [CHANGE] Added support for Ruby 2.4.x. Files `.travis.yml` and `README.md` updated.
8
+
9
+
1
10
  ### 0.4.06 / 2017-05-25
2
11
  * [FIX] File `formatter\asciitree.rb` fixed inconsistency in comments that caused Yard warnings.
3
12
  * [FIX] File `formatter\bracket_notation.rb` fixed inconsistency in comments that caused Yard warnings.
data/README.md CHANGED
@@ -55,8 +55,9 @@ Rley supports the following Ruby implementations:
55
55
  - MRI 2.0
56
56
  - MRI 2.1
57
57
  - MRI 2.2
58
- - MRI 2.3
59
- - JRuby 9.0+
58
+ - MRI 2.3
59
+ - MRI 2.4
60
+ - JRuby 9.1+
60
61
 
61
62
  ---
62
63
 
@@ -88,7 +89,7 @@ directory
88
89
  The subset of English grammar is based on an example from the NLTK book.
89
90
 
90
91
  ```ruby
91
- require 'rley' # Load Rley library
92
+ require 'rley' # Load Rley library
92
93
 
93
94
  # Instantiate a builder object that will build the grammar for us
94
95
  builder = Rley::Syntax::GrammarBuilder.new do
@@ -134,7 +135,7 @@ The subset of English grammar is based on an example from the NLTK book.
134
135
  'on' => 'Preposition',
135
136
  'by' => 'Preposition',
136
137
  'with' => 'Preposition'
137
- }
138
+ }.freeze
138
139
  ```
139
140
 
140
141
 
@@ -142,12 +143,10 @@ The subset of English grammar is based on an example from the NLTK book.
142
143
  ```ruby
143
144
  # A tokenizer reads the input string and converts it into a sequence of tokens
144
145
  # Highly simplified tokenizer implementation.
145
- def tokenizer(aText, aGrammar)
146
- tokens = aText.scan(/\S+/).map do |word|
146
+ def tokenizer(aTextToParse, aGrammar)
147
+ tokens = aTextToParse.scan(/\S+/).map do |word|
147
148
  term_name = Lexicon[word]
148
- if term_name.nil?
149
- raise StandardError, "Word '#{word}' not found in lexicon"
150
- end
149
+ raise StandardError, "Word '#{word}' not found in lexicon" if term_name.nil?
151
150
  terminal = aGrammar.name2symbol[term_name]
152
151
  Rley::Tokens::Token.new(word, terminal)
153
152
  end
@@ -441,7 +440,7 @@ The extensive resource list not to miss: [Awesome NLP with Ruby](https://github.
441
440
  actively curated by Andrei Beliankou (aka arbox).
442
441
 
443
442
  ## Thanks to:
444
- * Professor Keshav Pingali, one of the creators of the Grammar Flow Graph parsing approach for his encouraging e-mail exchanges.
443
+ * Professor Keshav Pingali, one of the creators of the Grammar Flow Graph parsing approach for his encouraging e-mail exchange.
445
444
 
446
445
  ## Grammar Flow Graph
447
446
  Since the Grammar Flow Graph parsing approach is quite new, it has not yet taken a place in
@@ -1,4 +1,4 @@
1
- require 'rley' # Load Rley library
1
+ require 'rley' # Load Rley library
2
2
 
3
3
  ########################################
4
4
  # Step 1. Define a grammar for a micro English-like language
@@ -10,7 +10,8 @@ require 'rley' # Load Rley library
10
10
 
11
11
  # Instantiate a builder object that will build the grammar for us
12
12
  builder = Rley::Syntax::GrammarBuilder.new do
13
- # Next 2 lines we define the terminal symbols (=word categories in the lexicon)
13
+ # Next 2 lines we define the terminal symbols
14
+ # (= word categories in the lexicon)
14
15
  add_terminals('Noun', 'Proper-Noun', 'Verb')
15
16
  add_terminals('Determiner', 'Preposition')
16
17
 
@@ -51,7 +52,7 @@ Lexicon = {
51
52
  'on' => 'Preposition',
52
53
  'by' => 'Preposition',
53
54
  'with' => 'Preposition'
54
- }
55
+ }.freeze
55
56
 
56
57
  ########################################
57
58
  # Step 3. Creating a tokenizer
@@ -60,9 +61,7 @@ Lexicon = {
60
61
  def tokenizer(aTextToParse, aGrammar)
61
62
  tokens = aTextToParse.scan(/\S+/).map do |word|
62
63
  term_name = Lexicon[word]
63
- if term_name.nil?
64
- raise StandardError, "Word '#{word}' not found in lexicon"
65
- end
64
+ raise StandardError, "Word '#{word}' not found in lexicon" if term_name.nil?
66
65
  terminal = aGrammar.name2symbol[term_name]
67
66
  Rley::Tokens::Token.new(word, terminal)
68
67
  end
@@ -102,7 +101,8 @@ visitor = Rley::ParseTreeVisitor.new(ptree)
102
101
  # Let's create a formatter that will render the parse tree with characters
103
102
  renderer = Rley::Formatter::Asciitree.new($stdout)
104
103
 
105
- # Let's create a formatter that will render the parse tree in labelled bracket notation
104
+ # Let's create a formatter that will render the parse tree in labelled
105
+ # bracket notation
106
106
  # renderer = Rley::Formatter::BracketNotation.new($stdout)
107
107
 
108
108
  # Subscribe the formatter to the visitor's event and launch the visit
@@ -2,10 +2,9 @@ require 'optparse'
2
2
 
3
3
  # A Hash specialization that collects the command-line options
4
4
  class CLIOptions < Hash
5
- #labelled square notation (LBN).
6
- #Use online tools (e.g. http://yohasebe.com/rsyntaxtree/) to visualize
7
- #parse trees from LBN output.
8
-
5
+ # labelled square notation (LBN).
6
+ # Use online tools (e.g. http://yohasebe.com/rsyntaxtree/) to visualize
7
+ # parse trees from LBN output.
9
8
  def initialize(progName, progVersion, args)
10
9
  super()
11
10
 
@@ -42,7 +41,7 @@ Select the output format (default: ascii_tree). Available formats:
42
41
  Use online tools (e.g. http://yohasebe.com/rsyntaxtree/)
43
42
  to visualize parse trees from LBN output.
44
43
  END_TEXT
45
- formats = %i(ascii_tree labelled)
44
+ formats = %i[ascii_tree labelled]
46
45
  opts.on('-f', '--format FORMAT', formats, format_help) do |frm|
47
46
  self[:format] = frm
48
47
  end
@@ -62,4 +61,4 @@ END_TEXT
62
61
  end
63
62
  end
64
63
  end
65
- end # class
64
+ end # class
@@ -1,7 +1,7 @@
1
1
  require_relative 'cli_options'
2
- require_relative 'JSON_parser'
2
+ require_relative 'json_parser'
3
3
 
4
- prog_name = 'JSON_demo'
4
+ prog_name = 'json_demo'
5
5
  prog_version = '0.1.0'
6
6
 
7
7
  cli_options = CLIOptions.new(prog_name, prog_version, ARGV)
@@ -1,5 +1,5 @@
1
1
  # Grammar for JSON data representation
2
- require 'rley' # Load the gem
2
+ require 'rley' # Load the gem
3
3
 
4
4
 
5
5
  ########################################
@@ -21,17 +21,17 @@ builder = Rley::Syntax::GrammarBuilder.new do
21
21
  rule 'value' => 'array'
22
22
  rule 'value' => 'number'
23
23
  rule 'value' => 'string'
24
- rule 'object' => %w(begin-object member-list end-object)
25
- rule 'object' => %w(begin-object end-object)
24
+ rule 'object' => %w[begin-object member-list end-object]
25
+ rule 'object' => %w[begin-object end-object]
26
26
  # Next rule is an example of a left recursive rule
27
- rule 'member-list' => %w(member-list value-separator member)
27
+ rule 'member-list' => %w[member-list value-separator member]
28
28
  rule 'member-list' => 'member'
29
- rule 'member' => %w(string name-separator value)
30
- rule 'array' => %w(begin-array array-items end-array)
31
- rule 'array' => %w(begin-array end-array)
32
- rule 'array-items' => %w(array-items value-separator value)
33
- rule 'array-items' => %w(value)
29
+ rule 'member' => %w[string name-separator value]
30
+ rule 'array' => %w[begin-array array-items end-array]
31
+ rule 'array' => %w[begin-array end-array]
32
+ rule 'array-items' => %w[array-items value-separator value]
33
+ rule 'array-items' => %w[value]
34
34
  end
35
35
 
36
36
  # And now build the JSON grammar...
37
- GrammarJSON = builder.grammar
37
+ GrammarJSON = builder.grammar
@@ -1,6 +1,6 @@
1
1
  # File: JSON_lexer.rb
2
2
  # Lexer for the JSON data format
3
- require 'rley' # Load the gem
3
+ require 'rley' # Load the gem
4
4
  require 'strscan'
5
5
 
6
6
  # Lexer for JSON.
@@ -17,20 +17,19 @@ class JSONLexer
17
17
  ']' => 'end-array',
18
18
  ',' => 'value-separator',
19
19
  ':' => 'name-separator'
20
- }
20
+ }.freeze
21
21
 
22
- class ScanError < StandardError ; end
22
+ class ScanError < StandardError; end
23
23
 
24
- public
25
24
  def initialize(source, aGrammar)
26
25
  @scanner = StringScanner.new(source)
27
26
  @name2symbol = aGrammar.name2symbol
28
- @lineno = 1
27
+ @lineno = 1
29
28
  end
30
29
 
31
30
  def tokens()
32
31
  tok_sequence = []
33
- until @scanner.eos? do
32
+ until @scanner.eos?
34
33
  token = _next_token
35
34
  tok_sequence << token unless token.nil?
36
35
  end
@@ -38,13 +37,14 @@ public
38
37
  return tok_sequence
39
38
  end
40
39
 
41
- private
40
+ private
41
+
42
42
  def _next_token()
43
43
  token = nil
44
44
  skip_whitespaces
45
45
  curr_ch = scanner.getch # curr_ch is at start of token or eof reached...
46
46
 
47
- begin
47
+ loop do
48
48
  break if curr_ch.nil?
49
49
 
50
50
  case curr_ch
@@ -53,7 +53,7 @@ private
53
53
  token_type = name2symbol[type_name]
54
54
  token = Rley::Tokens::Token.new(curr_ch, token_type)
55
55
 
56
- when /[ftn]/ # First letter of keywords
56
+ when /[ftn]/ # First letter of keywords
57
57
  @scanner.pos = scanner.pos - 1 # Simulate putback
58
58
  keyw = scanner.scan(/false|true|null/)
59
59
  if keyw.nil?
@@ -65,10 +65,11 @@ private
65
65
  end
66
66
 
67
67
  # LITERALS
68
- when '"' # Start string delimiter found
68
+ when '"' # Start string delimiter found
69
69
  value = scanner.scan(/([^"\\]|\\.)*/)
70
- end_delimiter = scanner.getch()
71
- raise ScanError.new('No closing quotes (") found') if end_delimiter.nil?
70
+ end_delimiter = scanner.getch
71
+ err_msg = 'No closing quotes (") found'
72
+ raise ScanError.new(err_msg) if end_delimiter.nil?
72
73
  token_type = name2symbol['string']
73
74
  token = Rley::Tokens::Token.new(value, token_type)
74
75
 
@@ -83,15 +84,13 @@ private
83
84
  sequel = scanner.scan(/.{1,20}/)
84
85
  erroneous += sequel unless sequel.nil?
85
86
  raise ScanError.new("Unknown token #{erroneous}")
86
- end #case
87
-
88
-
89
- end while (token.nil? && curr_ch = scanner.getch())
87
+ end # case
88
+ break unless token.nil? && (curr_ch = scanner.getch)
89
+ end
90
90
 
91
91
  return token
92
92
  end
93
93
 
94
-
95
94
  def skip_whitespaces()
96
95
  matched = scanner.scan(/[ \t\f\n\r]+/)
97
96
  return if matched.nil?
@@ -101,12 +100,8 @@ private
101
100
  newline_detected(newline_count)
102
101
  end
103
102
 
104
-
105
103
  def newline_detected(count)
106
104
  @lineno += count
107
- @line_start = scanner.pos()
105
+ @line_start = scanner.pos
108
106
  end
109
-
110
107
  end # class
111
-
112
-
@@ -1,6 +1,6 @@
1
1
  # Purpose: to demonstrate how to build and render a parse tree for JSON
2
2
  # language
3
- require 'rley' # Load the Rley gem
3
+ require 'rley' # Load the Rley gem
4
4
  require_relative 'json_lexer'
5
5
 
6
6
  # Steps to render a parse tree (of a valid parsed input):
@@ -13,7 +13,7 @@ require_relative 'json_lexer'
13
13
 
14
14
  ########################################
15
15
  # Step 1. Load a grammar for JSON
16
- require_relative 'JSON_grammar'
16
+ require_relative 'json_grammar'
17
17
 
18
18
  # A JSON parser derived from our general Earley parser.
19
19
  class JSONParser < Rley::Parser::GFGEarleyParser
@@ -36,4 +36,4 @@ visitor = Rley::ParseTreeVisitor.new(ptree)
36
36
  # Now output formatted parse tree
37
37
  renderer = Rley::Formatter::Asciitree.new($stdout)
38
38
  renderer.render(visitor)
39
- # End of file
39
+ # End of file
@@ -1,5 +1,5 @@
1
1
  # Grammar for simple arithmetical expressions
2
- require 'rley' # Load the gem
2
+ require 'rley' # Load the gem
3
3
 
4
4
  ########################################
5
5
  # Define a grammar for basic arithmetical expressions
@@ -8,13 +8,13 @@ builder = Rley::Syntax::GrammarBuilder.new do
8
8
  add_terminals('LPAREN', 'RPAREN') # For '(', ')' delimiters
9
9
  add_terminals('PLUS', 'MINUS') # For '+', '-' operators or sign
10
10
  add_terminals('STAR', 'DIVIDE') # For '*', '/' operators
11
- rule 'expression' => %w(sign simple_expression)
11
+ rule 'expression' => %w[sign simple_expression]
12
12
  rule 'simple_expression' => 'term'
13
- rule 'simple_expression' => %w(simple_expression add_operator term)
13
+ rule 'simple_expression' => %w[simple_expression add_operator term]
14
14
  rule 'term' => 'factor'
15
- rule 'term' => %w(term mul_operator factor)
15
+ rule 'term' => %w[term mul_operator factor]
16
16
  rule 'factor' => 'NUMBER'
17
- rule 'factor' => %w(LPAREN expression RPAREN)
17
+ rule 'factor' => %w[LPAREN expression RPAREN]
18
18
  rule 'sign' => 'PLUS'
19
19
  rule 'sign' => 'MINUS'
20
20
  rule 'sign' => []