lib/nagios_parser/object/parser.rb in nagios_parser-1.2.2 vs lib/nagios_parser/object/parser.rb in nagios_parser-1.3.0
- old
+ new
@@ -1,8 +1,8 @@
#
# DO NOT MODIFY!!!!
-# This file is automatically generated by Racc 1.4.6
+# This file is automatically generated by Racc 1.4.9
# from Racc grammer file "".
#
require 'racc/parser.rb'
@@ -10,21 +10,22 @@
module NagiosParser
module Object
class Parser < Racc::Parser
-module_eval(<<'...end parser.y/module_eval...', 'parser.y', 34)
+module_eval(<<'...end parser.y/module_eval...', 'parser.y', 35)
private
def last_is_key?(list)
list.last[0] == :KEY
end
public
def create_token(string)
result = []
inside = false
+ inside_squigglies = false
scanner = StringScanner.new(string)
until scanner.empty?
case
when scanner.scan(/\s+/)
@@ -38,20 +39,22 @@
scanner.reset
when scanner.scan(/define/)
result << [:DEFINE, nil]
when (!inside and match = scanner.scan(/\w+/))
result << [:TYPE, match]
- when match = scanner.scan(/\{/)
+ when (!inside and match = scanner.scan(/\{/))
inside = true
result << [:OPEN, nil]
- when match = scanner.scan(/\}/)
+ when (match = scanner.scan(/\}/))
inside = false
result << [:CLOSE, nil]
when (!last_is_key?(result) and match = scanner.scan(/\w+/))
result << [:KEY, match.chomp.gsub(/\s+$/, '')]
when (inside and match = scanner.scan(/\d+$/))
result << [:VALUE, match.to_i]
+ when (inside and match = scanner.scan(/.*\{.+\}.*/))
+ result << [:VALUE, match.gsub(/\s+$/, '')]
when (inside and match = scanner.scan(/[^\n\}]+/))
# Make sure to ignore inline comments starting with ';'.
result << [:VALUE, match.gsub(/\s+$/, '')]
else
raise "Can't tokenize <#{scanner.peek(10)}>"
@@ -79,31 +82,31 @@
end
...end parser.y/module_eval...
##### State transition tables begin ###
racc_action_table = [
- 5, 8, 1, 13, 11, 7, 1, 11, 4, 14 ]
+ 4, 8, 3, 12, 11, 7, 6, 11, 3, 14 ]
racc_action_check = [
- 2, 5, 2, 9, 9, 4, 0, 7, 1, 11 ]
+ 1, 6, 1, 9, 9, 4, 3, 8, 0, 11 ]
racc_action_pointer = [
- 4, 5, 0, nil, 1, 1, nil, 1, nil, -2,
+ 6, 0, nil, 3, 5, nil, -3, nil, 1, -2,
nil, 2, nil, nil, nil ]
racc_action_default = [
- -7, -7, -7, -1, -7, -7, -2, -7, 15, -7,
- -4, -7, -5, -3, -6 ]
+ -8, -8, -1, -8, -8, -2, -8, 15, -8, -8,
+ -4, -7, -3, -5, -6 ]
racc_goto_table = [
- 10, 3, 12, 6, 9, 2 ]
+ 10, 13, 2, 5, 9, 1 ]
racc_goto_check = [
- 4, 2, 4, 2, 3, 1 ]
+ 4, 4, 2, 2, 3, 1 ]
racc_goto_pointer = [
- nil, 5, 1, -3, -7 ]
+ nil, 5, 2, -4, -8 ]
racc_goto_default = [
nil, nil, nil, nil, nil ]
racc_reduce_table = [
@@ -111,13 +114,14 @@
1, 9, :_reduce_none,
2, 9, :_reduce_none,
5, 10, :_reduce_3,
1, 11, :_reduce_none,
2, 11, :_reduce_5,
- 2, 12, :_reduce_6 ]
+ 2, 12, :_reduce_6,
+ 1, 12, :_reduce_7 ]
-racc_reduce_n = 7
+racc_reduce_n = 8
racc_shift_n = 15
racc_token_table = {
false => 0,
@@ -197,9 +201,16 @@
.,.,
module_eval(<<'.,.,', 'parser.y', 25)
def _reduce_6(val, _values, result)
result = {val[0] => val[1]}
+ result
+ end
+.,.,
+
+module_eval(<<'.,.,', 'parser.y', 26)
+ def _reduce_7(val, _values, result)
+ result = {val[0] => nil }
result
end
.,.,
def _reduce_none(val, _values, result)