puppet 0.24.1 → 0.24.2

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

Potentially problematic release.


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

Files changed (266) hide show
  1. data/CHANGELOG +94 -0
  2. data/Rakefile +0 -4
  3. data/bin/puppet +18 -10
  4. data/bin/puppetd +1 -1
  5. data/bin/puppetdoc +14 -4
  6. data/bin/puppetmasterd +1 -1
  7. data/bin/puppetrun +3 -8
  8. data/bin/ralsh +12 -11
  9. data/conf/freebsd/puppetd +1 -1
  10. data/conf/freebsd/puppetmasterd +1 -1
  11. data/conf/gentoo/puppet/puppet.conf +29 -0
  12. data/conf/namespaceauth.conf +20 -0
  13. data/conf/redhat/puppet.spec +4 -1
  14. data/conf/solaris/smf/puppetd.xml +1 -1
  15. data/conf/solaris/smf/puppetmasterd.xml +1 -1
  16. data/conf/suse/puppet.spec +10 -8
  17. data/examples/root/etc/puppet/{puppetmasterd.conf → puppet.conf} +6 -3
  18. data/ext/logcheck/puppet +7 -0
  19. data/ext/puppet-test +28 -5
  20. data/lib/puppet.rb +2 -1
  21. data/lib/puppet/defaults.rb +12 -5
  22. data/lib/puppet/dsl.rb +43 -45
  23. data/lib/puppet/external/{gratr/rdot.rb → dot.rb} +0 -0
  24. data/lib/puppet/external/nagios.rb +50 -0
  25. data/lib/puppet/external/nagios/base.rb +421 -0
  26. data/lib/puppet/external/nagios/parser.rb +816 -0
  27. data/lib/puppet/file_serving/file_base.rb +16 -3
  28. data/lib/puppet/file_serving/metadata.rb +29 -11
  29. data/lib/puppet/indirector/terminus.rb +1 -0
  30. data/lib/puppet/metatype/closure.rb +4 -0
  31. data/lib/puppet/metatype/evaluation.rb +2 -17
  32. data/lib/puppet/metatype/metaparams.rb +1 -1
  33. data/lib/puppet/network.rb +3 -0
  34. data/lib/puppet/network/client.rb +4 -5
  35. data/lib/puppet/network/client/master.rb +10 -7
  36. data/lib/puppet/network/handler/fileserver.rb +22 -45
  37. data/lib/puppet/network/http_pool.rb +3 -0
  38. data/lib/puppet/network/http_server/mongrel.rb +7 -1
  39. data/lib/puppet/network/http_server/webrick.rb +4 -3
  40. data/lib/puppet/network/xmlrpc/client.rb +12 -1
  41. data/lib/puppet/node/catalog.rb +51 -40
  42. data/lib/puppet/parser/ast.rb +27 -49
  43. data/lib/puppet/parser/ast/astarray.rb +5 -24
  44. data/lib/puppet/parser/ast/caseopt.rb +4 -4
  45. data/lib/puppet/parser/ast/casestatement.rb +4 -5
  46. data/lib/puppet/parser/ast/collection.rb +3 -5
  47. data/lib/puppet/parser/ast/collexpr.rb +3 -5
  48. data/lib/puppet/parser/ast/definition.rb +148 -159
  49. data/lib/puppet/parser/ast/else.rb +2 -3
  50. data/lib/puppet/parser/ast/function.rb +3 -10
  51. data/lib/puppet/parser/ast/hostclass.rb +66 -59
  52. data/lib/puppet/parser/ast/ifstatement.rb +4 -5
  53. data/lib/puppet/parser/ast/leaf.rb +6 -6
  54. data/lib/puppet/parser/ast/node.rb +26 -58
  55. data/lib/puppet/parser/ast/resource.rb +5 -7
  56. data/lib/puppet/parser/ast/resource_defaults.rb +2 -4
  57. data/lib/puppet/parser/ast/resource_override.rb +4 -6
  58. data/lib/puppet/parser/ast/resource_reference.rb +2 -4
  59. data/lib/puppet/parser/ast/resourceparam.rb +2 -4
  60. data/lib/puppet/parser/ast/selector.rb +5 -6
  61. data/lib/puppet/parser/ast/tag.rb +2 -4
  62. data/lib/puppet/parser/ast/vardef.rb +3 -4
  63. data/lib/puppet/parser/collector.rb +5 -5
  64. data/lib/puppet/parser/{compile.rb → compiler.rb} +69 -107
  65. data/lib/puppet/parser/functions.rb +3 -3
  66. data/lib/puppet/parser/interpreter.rb +32 -23
  67. data/lib/puppet/parser/lexer.rb +391 -282
  68. data/lib/puppet/parser/parser.rb +5 -4
  69. data/lib/puppet/parser/parser_support.rb +3 -6
  70. data/lib/puppet/parser/resource.rb +24 -36
  71. data/lib/puppet/parser/resource/param.rb +1 -1
  72. data/lib/puppet/parser/resource/reference.rb +7 -3
  73. data/lib/puppet/parser/scope.rb +12 -7
  74. data/lib/puppet/parser/templatewrapper.rb +1 -1
  75. data/lib/puppet/pgraph.rb +9 -98
  76. data/lib/puppet/provider/interface/redhat.rb +65 -65
  77. data/lib/puppet/provider/mount/parsed.rb +1 -1
  78. data/lib/puppet/provider/naginator.rb +55 -0
  79. data/lib/puppet/provider/nameservice/directoryservice.rb +6 -7
  80. data/lib/puppet/provider/package/fink.rb +0 -2
  81. data/lib/puppet/provider/package/gem.rb +9 -5
  82. data/lib/puppet/provider/package/openbsd.rb +1 -1
  83. data/lib/puppet/provider/package/pkgdmg.rb +3 -8
  84. data/lib/puppet/provider/package/portage.rb +4 -4
  85. data/lib/puppet/provider/package/yumhelper.py +8 -6
  86. data/lib/puppet/provider/parsedfile.rb +7 -1
  87. data/lib/puppet/provider/service/debian.rb +2 -0
  88. data/lib/puppet/provider/service/gentoo.rb +4 -0
  89. data/lib/puppet/provider/service/init.rb +1 -1
  90. data/lib/puppet/provider/sshkey/parsed.rb +2 -0
  91. data/lib/puppet/provider/user/useradd.rb +1 -1
  92. data/lib/puppet/rails.rb +4 -0
  93. data/lib/puppet/rails/database/001_add_created_at_to_all_tables.rb +17 -0
  94. data/lib/puppet/rails/fact_value.rb +4 -0
  95. data/lib/puppet/rails/host.rb +1 -2
  96. data/lib/puppet/rails/param_value.rb +4 -0
  97. data/lib/puppet/rails/resource_tag.rb +4 -0
  98. data/lib/puppet/rails/source_file.rb +4 -1
  99. data/lib/puppet/relationship.rb +5 -1
  100. data/lib/puppet/reports/tagmail.rb +12 -1
  101. data/lib/puppet/resource_reference.rb +1 -1
  102. data/lib/puppet/simple_graph.rb +78 -11
  103. data/lib/puppet/sslcertificates.rb +1 -1
  104. data/lib/puppet/sslcertificates/ca.rb +3 -3
  105. data/lib/puppet/transaction.rb +7 -4
  106. data/lib/puppet/transportable.rb +1 -1
  107. data/lib/puppet/type.rb +3 -10
  108. data/lib/puppet/type/cron.rb +18 -0
  109. data/lib/puppet/type/exec.rb +18 -12
  110. data/lib/puppet/type/{pfile.rb → file.rb} +66 -84
  111. data/lib/puppet/type/file/checksum.rb +271 -0
  112. data/lib/puppet/type/{pfile → file}/content.rb +10 -15
  113. data/lib/puppet/type/{pfile → file}/ensure.rb +15 -8
  114. data/lib/puppet/type/{pfile → file}/group.rb +0 -0
  115. data/lib/puppet/type/{pfile → file}/mode.rb +0 -0
  116. data/lib/puppet/type/{pfile → file}/owner.rb +0 -0
  117. data/lib/puppet/type/{pfile → file}/source.rb +34 -48
  118. data/lib/puppet/type/{pfile → file}/target.rb +0 -0
  119. data/lib/puppet/type/{pfile → file}/type.rb +0 -0
  120. data/lib/puppet/type/{pfilebucket.rb → filebucket.rb} +0 -0
  121. data/lib/puppet/type/host.rb +13 -0
  122. data/lib/puppet/type/mailalias.rb +1 -1
  123. data/lib/puppet/type/nagios_command.rb +3 -0
  124. data/lib/puppet/type/nagios_contact.rb +3 -0
  125. data/lib/puppet/type/nagios_contactgroup.rb +3 -0
  126. data/lib/puppet/type/nagios_host.rb +3 -0
  127. data/lib/puppet/type/nagios_hostextinfo.rb +3 -0
  128. data/lib/puppet/type/nagios_hostgroup.rb +3 -0
  129. data/lib/puppet/type/nagios_hostgroupescalation.rb +3 -0
  130. data/lib/puppet/type/nagios_service.rb +3 -0
  131. data/lib/puppet/type/nagios_servicedependency.rb +3 -0
  132. data/lib/puppet/type/nagios_serviceescalation.rb +3 -0
  133. data/lib/puppet/type/nagios_serviceextinfo.rb +3 -0
  134. data/lib/puppet/type/nagios_timeperiod.rb +3 -0
  135. data/lib/puppet/type/package.rb +4 -12
  136. data/lib/puppet/type/service.rb +9 -0
  137. data/lib/puppet/type/sshkey.rb +3 -3
  138. data/lib/puppet/util/autoload.rb +5 -5
  139. data/lib/puppet/util/checksums.rb +51 -13
  140. data/lib/puppet/util/constant_inflector.rb +14 -0
  141. data/lib/puppet/util/filetype.rb +1 -1
  142. data/lib/puppet/util/graph.rb +3 -9
  143. data/lib/puppet/util/nagios_maker.rb +57 -0
  144. data/lib/puppet/util/settings.rb +19 -16
  145. data/lib/puppet/util/tagging.rb +39 -0
  146. data/test/executables/puppetbin.rb +17 -0
  147. data/test/language/ast.rb +8 -58
  148. data/test/language/ast/casestatement.rb +3 -3
  149. data/test/language/ast/resource.rb +6 -7
  150. data/test/language/ast/resource_reference.rb +12 -12
  151. data/test/language/ast/selector.rb +2 -2
  152. data/test/language/ast/variable.rb +2 -2
  153. data/test/language/functions.rb +24 -24
  154. data/test/language/parser.rb +20 -8
  155. data/test/language/resource.rb +5 -42
  156. data/test/language/scope.rb +21 -37
  157. data/test/language/snippets.rb +7 -0
  158. data/test/lib/puppettest.rb +28 -14
  159. data/test/lib/puppettest/parsertesting.rb +10 -10
  160. data/test/lib/puppettest/support/resources.rb +1 -1
  161. data/test/network/client/master.rb +10 -0
  162. data/test/network/handler/fileserver.rb +51 -49
  163. data/test/network/server/webrick.rb +1 -1
  164. data/test/other/dsl.rb +3 -4
  165. data/test/other/transactions.rb +6 -4
  166. data/test/rails/ast.rb +2 -2
  167. data/test/rails/configuration.rb +1 -1
  168. data/test/rails/railsparameter.rb +2 -0
  169. data/test/rails/railsresource.rb +1 -0
  170. data/test/ral/manager/type.rb +4 -4
  171. data/test/ral/providers/cron/crontab.rb +3 -1
  172. data/test/ral/providers/package.rb +1 -1
  173. data/test/ral/{types → type}/basic.rb +2 -2
  174. data/test/ral/{types → type}/cron.rb +0 -0
  175. data/test/ral/{types → type}/exec.rb +42 -2
  176. data/test/ral/{types → type}/file.rb +34 -79
  177. data/test/ral/{types → type}/file/target.rb +0 -0
  178. data/test/ral/{types → type}/filebucket.rb +0 -0
  179. data/test/ral/{types → type}/fileignoresource.rb +0 -0
  180. data/test/ral/{types → type}/filesources.rb +8 -27
  181. data/test/ral/{types → type}/group.rb +0 -0
  182. data/test/ral/{types → type}/host.rb +16 -0
  183. data/test/ral/{types → type}/mailalias.rb +0 -0
  184. data/test/ral/{types → type}/parameter.rb +0 -0
  185. data/test/ral/{types → type}/port.rb +0 -0
  186. data/test/ral/{types → type}/property.rb +0 -0
  187. data/test/ral/{types → type}/resources.rb +0 -0
  188. data/test/ral/{types → type}/service.rb +0 -0
  189. data/test/ral/{types → type}/sshkey.rb +0 -0
  190. data/test/ral/{types → type}/tidy.rb +1 -0
  191. data/test/ral/{types → type}/user.rb +0 -0
  192. data/test/ral/{types → type}/yumrepo.rb +0 -0
  193. data/test/ral/{types → type}/zone.rb +0 -0
  194. data/test/util/autoload.rb +24 -5
  195. metadata +60 -107
  196. data/conf/gentoo/puppet/puppetca.conf +0 -29
  197. data/conf/gentoo/puppet/puppetd.conf +0 -29
  198. data/conf/gentoo/puppet/puppetmasterd.conf +0 -29
  199. data/examples/root/etc/puppet/puppetd.conf +0 -4
  200. data/lib/puppet/external/gratr.rb +0 -33
  201. data/lib/puppet/external/gratr/adjacency_graph.rb +0 -257
  202. data/lib/puppet/external/gratr/base.rb +0 -34
  203. data/lib/puppet/external/gratr/biconnected.rb +0 -116
  204. data/lib/puppet/external/gratr/chinese_postman.rb +0 -123
  205. data/lib/puppet/external/gratr/common.rb +0 -73
  206. data/lib/puppet/external/gratr/comparability.rb +0 -92
  207. data/lib/puppet/external/gratr/digraph.rb +0 -116
  208. data/lib/puppet/external/gratr/digraph_distance.rb +0 -185
  209. data/lib/puppet/external/gratr/dot.rb +0 -90
  210. data/lib/puppet/external/gratr/edge.rb +0 -145
  211. data/lib/puppet/external/gratr/graph.rb +0 -303
  212. data/lib/puppet/external/gratr/graph_api.rb +0 -83
  213. data/lib/puppet/external/gratr/import.rb +0 -44
  214. data/lib/puppet/external/gratr/labels.rb +0 -90
  215. data/lib/puppet/external/gratr/maximum_flow.rb +0 -64
  216. data/lib/puppet/external/gratr/search.rb +0 -409
  217. data/lib/puppet/external/gratr/strong_components.rb +0 -127
  218. data/lib/puppet/external/gratr/undirected_graph.rb +0 -153
  219. data/lib/puppet/rails/external/tagging/acts_as_taggable.rb +0 -62
  220. data/lib/puppet/rails/external/tagging/init.rb +0 -5
  221. data/lib/puppet/rails/external/tagging/tag.rb +0 -50
  222. data/lib/puppet/rails/external/tagging/tagging.rb +0 -12
  223. data/lib/puppet/rails/puppet_class.rb +0 -6
  224. data/lib/puppet/reference/node_source.rb +0 -9
  225. data/lib/puppet/reference/report.rb +0 -21
  226. data/lib/puppet/type/pfile/checksum.rb +0 -326
  227. data/test/language/ast/definition.rb +0 -166
  228. data/test/language/ast/hostclass.rb +0 -184
  229. data/test/language/compile.rb +0 -569
  230. data/test/language/lexer.rb +0 -276
  231. data/test/lib/mocha.rb +0 -19
  232. data/test/lib/mocha/any_instance_method.rb +0 -35
  233. data/test/lib/mocha/auto_verify.rb +0 -113
  234. data/test/lib/mocha/central.rb +0 -35
  235. data/test/lib/mocha/class_method.rb +0 -62
  236. data/test/lib/mocha/deprecation.rb +0 -22
  237. data/test/lib/mocha/exception_raiser.rb +0 -17
  238. data/test/lib/mocha/expectation.rb +0 -378
  239. data/test/lib/mocha/expectation_error.rb +0 -6
  240. data/test/lib/mocha/infinite_range.rb +0 -25
  241. data/test/lib/mocha/inspect.rb +0 -39
  242. data/test/lib/mocha/instance_method.rb +0 -8
  243. data/test/lib/mocha/is_a.rb +0 -9
  244. data/test/lib/mocha/metaclass.rb +0 -7
  245. data/test/lib/mocha/missing_expectation.rb +0 -27
  246. data/test/lib/mocha/mock.rb +0 -207
  247. data/test/lib/mocha/multiple_yields.rb +0 -20
  248. data/test/lib/mocha/no_yields.rb +0 -11
  249. data/test/lib/mocha/object.rb +0 -110
  250. data/test/lib/mocha/parameter_matchers.rb +0 -9
  251. data/test/lib/mocha/parameter_matchers/all_of.rb +0 -39
  252. data/test/lib/mocha/parameter_matchers/any_of.rb +0 -44
  253. data/test/lib/mocha/parameter_matchers/anything.rb +0 -30
  254. data/test/lib/mocha/parameter_matchers/has_entry.rb +0 -39
  255. data/test/lib/mocha/parameter_matchers/has_key.rb +0 -39
  256. data/test/lib/mocha/parameter_matchers/has_value.rb +0 -39
  257. data/test/lib/mocha/parameter_matchers/includes.rb +0 -37
  258. data/test/lib/mocha/pretty_parameters.rb +0 -28
  259. data/test/lib/mocha/return_values.rb +0 -31
  260. data/test/lib/mocha/setup_and_teardown.rb +0 -23
  261. data/test/lib/mocha/single_return_value.rb +0 -24
  262. data/test/lib/mocha/single_yield.rb +0 -18
  263. data/test/lib/mocha/standalone.rb +0 -32
  264. data/test/lib/mocha/stub.rb +0 -18
  265. data/test/lib/mocha/test_case_adapter.rb +0 -49
  266. data/test/lib/mocha/yield_parameters.rb +0 -31
@@ -0,0 +1,816 @@
1
+ #
2
+ # DO NOT MODIFY!!!!
3
+ # This file is automatically generated by racc 1.4.4
4
+ # from racc grammer file "grammar.ry".
5
+ #
6
+ #
7
+ # parser.rb: generated by racc (runtime embedded)
8
+ #
9
+
10
+ ###### racc/parser.rb
11
+
12
+ unless $".index 'racc/parser.rb'
13
+ $".push 'racc/parser.rb'
14
+
15
+ self.class.module_eval <<'..end /usr/lib/ruby/1.8/racc/parser.rb modeval..id1306b79176', '/usr/lib/ruby/1.8/racc/parser.rb', 1
16
+ #
17
+ # parser.rb
18
+ #
19
+ # Copyright (c) 1999-2003 Minero Aoki <aamine@loveruby.net>
20
+ #
21
+ # This program is free software.
22
+ # You can distribute/modify this program under the same terms of ruby.
23
+ #
24
+ # As a special exception, when this code is copied by Racc
25
+ # into a Racc output file, you may use that output file
26
+ # without restriction.
27
+ #
28
+ # $raccId: parser.rb,v 1.4 2003/11/03 13:41:47 aamine Exp $
29
+ #
30
+
31
+ unless defined?(NotImplementedError)
32
+ NotImplementedError = NotImplementError
33
+ end
34
+
35
+ module Racc
36
+ class ParseError < StandardError; end
37
+ end
38
+ unless defined?(::ParseError)
39
+ ParseError = Racc::ParseError
40
+ end
41
+
42
+
43
+ module Racc
44
+
45
+ unless defined?(Racc_No_Extentions)
46
+ Racc_No_Extentions = false
47
+ end
48
+
49
+ class Parser
50
+
51
+ Racc_Runtime_Version = '1.4.4'
52
+ Racc_Runtime_Revision = '$raccRevision: 1.4 $'.split[1]
53
+
54
+ Racc_Runtime_Core_Version_R = '1.4.4'
55
+ Racc_Runtime_Core_Revision_R = '$raccRevision: 1.4 $'.split[1]
56
+ begin
57
+ require 'racc/cparse'
58
+ # Racc_Runtime_Core_Version_C = (defined in extension)
59
+ Racc_Runtime_Core_Revision_C = Racc_Runtime_Core_Id_C.split[2]
60
+ unless new.respond_to?(:_racc_do_parse_c, true)
61
+ raise LoadError, 'old cparse.so'
62
+ end
63
+ if Racc_No_Extentions
64
+ raise LoadError, 'selecting ruby version of racc runtime core'
65
+ end
66
+
67
+ Racc_Main_Parsing_Routine = :_racc_do_parse_c
68
+ Racc_YY_Parse_Method = :_racc_yyparse_c
69
+ Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_C
70
+ Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_C
71
+ Racc_Runtime_Type = 'c'
72
+ rescue LoadError
73
+ Racc_Main_Parsing_Routine = :_racc_do_parse_rb
74
+ Racc_YY_Parse_Method = :_racc_yyparse_rb
75
+ Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_R
76
+ Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_R
77
+ Racc_Runtime_Type = 'ruby'
78
+ end
79
+
80
+ def Parser.racc_runtime_type
81
+ Racc_Runtime_Type
82
+ end
83
+
84
+ private
85
+
86
+ def _racc_setup
87
+ @yydebug = false unless self.class::Racc_debug_parser
88
+ @yydebug = false unless defined?(@yydebug)
89
+ if @yydebug
90
+ @racc_debug_out = $stderr unless defined?(@racc_debug_out)
91
+ @racc_debug_out ||= $stderr
92
+ end
93
+ arg = self.class::Racc_arg
94
+ arg[13] = true if arg.size < 14
95
+ arg
96
+ end
97
+
98
+ def _racc_init_sysvars
99
+ @racc_state = [0]
100
+ @racc_tstack = []
101
+ @racc_vstack = []
102
+
103
+ @racc_t = nil
104
+ @racc_val = nil
105
+
106
+ @racc_read_next = true
107
+
108
+ @racc_user_yyerror = false
109
+ @racc_error_status = 0
110
+ end
111
+
112
+ ###
113
+ ### do_parse
114
+ ###
115
+
116
+ def do_parse
117
+ __send__(Racc_Main_Parsing_Routine, _racc_setup(), false)
118
+ end
119
+
120
+ def next_token
121
+ raise NotImplementedError, "#{self.class}\#next_token is not defined"
122
+ end
123
+
124
+ def _racc_do_parse_rb( arg, in_debug )
125
+ action_table, action_check, action_default, action_pointer,
126
+ goto_table, goto_check, goto_default, goto_pointer,
127
+ nt_base, reduce_table, token_table, shift_n,
128
+ reduce_n, use_result, * = arg
129
+
130
+ _racc_init_sysvars
131
+ tok = act = i = nil
132
+ nerr = 0
133
+
134
+ catch(:racc_end_parse) {
135
+ while true
136
+ if i = action_pointer[@racc_state[-1]]
137
+ if @racc_read_next
138
+ if @racc_t != 0 # not EOF
139
+ tok, @racc_val = next_token()
140
+ unless tok # EOF
141
+ @racc_t = 0
142
+ else
143
+ @racc_t = (token_table[tok] or 1) # error token
144
+ end
145
+ racc_read_token(@racc_t, tok, @racc_val) if @yydebug
146
+ @racc_read_next = false
147
+ end
148
+ end
149
+ i += @racc_t
150
+ unless i >= 0 and
151
+ act = action_table[i] and
152
+ action_check[i] == @racc_state[-1]
153
+ act = action_default[@racc_state[-1]]
154
+ end
155
+ else
156
+ act = action_default[@racc_state[-1]]
157
+ end
158
+ while act = _racc_evalact(act, arg)
159
+ ;
160
+ end
161
+ end
162
+ }
163
+ end
164
+
165
+ ###
166
+ ### yyparse
167
+ ###
168
+
169
+ def yyparse( recv, mid )
170
+ __send__(Racc_YY_Parse_Method, recv, mid, _racc_setup(), true)
171
+ end
172
+
173
+ def _racc_yyparse_rb( recv, mid, arg, c_debug )
174
+ action_table, action_check, action_default, action_pointer,
175
+ goto_table, goto_check, goto_default, goto_pointer,
176
+ nt_base, reduce_table, token_table, shift_n,
177
+ reduce_n, use_result, * = arg
178
+
179
+ _racc_init_sysvars
180
+ tok = nil
181
+ act = nil
182
+ i = nil
183
+ nerr = 0
184
+
185
+ catch(:racc_end_parse) {
186
+ until i = action_pointer[@racc_state[-1]]
187
+ while act = _racc_evalact(action_default[@racc_state[-1]], arg)
188
+ ;
189
+ end
190
+ end
191
+ recv.__send__(mid) do |tok, val|
192
+ # $stderr.puts "rd: tok=#{tok}, val=#{val}"
193
+ unless tok
194
+ @racc_t = 0
195
+ else
196
+ @racc_t = (token_table[tok] or 1) # error token
197
+ end
198
+ @racc_val = val
199
+ @racc_read_next = false
200
+
201
+ i += @racc_t
202
+ unless i >= 0 and
203
+ act = action_table[i] and
204
+ action_check[i] == @racc_state[-1]
205
+ act = action_default[@racc_state[-1]]
206
+ # $stderr.puts "02: act=#{act}"
207
+ # $stderr.puts "curstate=#{@racc_state[-1]}"
208
+ else
209
+ # $stderr.puts "01: act=#{act}"
210
+ end
211
+
212
+ while act = _racc_evalact(act, arg)
213
+ ;
214
+ end
215
+
216
+ while not (i = action_pointer[@racc_state[-1]]) or
217
+ not @racc_read_next or
218
+ @racc_t == 0 # $
219
+ unless i and i += @racc_t and
220
+ i >= 0 and
221
+ act = action_table[i] and
222
+ action_check[i] == @racc_state[-1]
223
+ act = action_default[@racc_state[-1]]
224
+ # $stderr.puts "04: act=#{act}"
225
+ else
226
+ # $stderr.puts "03: act=#{act}"
227
+ end
228
+ while act = _racc_evalact(act, arg)
229
+ ;
230
+ end
231
+ end
232
+ end
233
+ }
234
+ end
235
+
236
+ ###
237
+ ### common
238
+ ###
239
+
240
+ def _racc_evalact( act, arg )
241
+ # $stderr.puts "ea: act=#{act}"
242
+ action_table, action_check, action_default, action_pointer,
243
+ goto_table, goto_check, goto_default, goto_pointer,
244
+ nt_base, reduce_table, token_table, shift_n,
245
+ reduce_n, use_result, * = arg
246
+ nerr = 0 # tmp
247
+
248
+ if act > 0 and act < shift_n
249
+ #
250
+ # shift
251
+ #
252
+ if @racc_error_status > 0
253
+ @racc_error_status -= 1 unless @racc_t == 1 # error token
254
+ end
255
+ @racc_vstack.push @racc_val
256
+ @racc_state.push act
257
+ @racc_read_next = true
258
+ if @yydebug
259
+ @racc_tstack.push @racc_t
260
+ racc_shift @racc_t, @racc_tstack, @racc_vstack
261
+ end
262
+
263
+ elsif act < 0 and act > -reduce_n
264
+ #
265
+ # reduce
266
+ #
267
+ code = catch(:racc_jump) {
268
+ @racc_state.push _racc_do_reduce(arg, act)
269
+ false
270
+ }
271
+ if code
272
+ case code
273
+ when 1 # yyerror
274
+ @racc_user_yyerror = true # user_yyerror
275
+ return -reduce_n
276
+ when 2 # yyaccept
277
+ return shift_n
278
+ else
279
+ raise RuntimeError, '[Racc Bug] unknown jump code'
280
+ end
281
+ end
282
+
283
+ elsif act == shift_n
284
+ #
285
+ # accept
286
+ #
287
+ racc_accept if @yydebug
288
+ throw :racc_end_parse, @racc_vstack[0]
289
+
290
+ elsif act == -reduce_n
291
+ #
292
+ # error
293
+ #
294
+ case @racc_error_status
295
+ when 0
296
+ unless arg[21] # user_yyerror
297
+ nerr += 1
298
+ on_error @racc_t, @racc_val, @racc_vstack
299
+ end
300
+ when 3
301
+ if @racc_t == 0 # is $
302
+ throw :racc_end_parse, nil
303
+ end
304
+ @racc_read_next = true
305
+ end
306
+ @racc_user_yyerror = false
307
+ @racc_error_status = 3
308
+ while true
309
+ if i = action_pointer[@racc_state[-1]]
310
+ i += 1 # error token
311
+ if i >= 0 and
312
+ (act = action_table[i]) and
313
+ action_check[i] == @racc_state[-1]
314
+ break
315
+ end
316
+ end
317
+
318
+ throw :racc_end_parse, nil if @racc_state.size <= 1
319
+ @racc_state.pop
320
+ @racc_vstack.pop
321
+ if @yydebug
322
+ @racc_tstack.pop
323
+ racc_e_pop @racc_state, @racc_tstack, @racc_vstack
324
+ end
325
+ end
326
+ return act
327
+
328
+ else
329
+ raise RuntimeError, "[Racc Bug] unknown action #{act.inspect}"
330
+ end
331
+
332
+ racc_next_state(@racc_state[-1], @racc_state) if @yydebug
333
+
334
+ nil
335
+ end
336
+
337
+ def _racc_do_reduce( arg, act )
338
+ action_table, action_check, action_default, action_pointer,
339
+ goto_table, goto_check, goto_default, goto_pointer,
340
+ nt_base, reduce_table, token_table, shift_n,
341
+ reduce_n, use_result, * = arg
342
+ state = @racc_state
343
+ vstack = @racc_vstack
344
+ tstack = @racc_tstack
345
+
346
+ i = act * -3
347
+ len = reduce_table[i]
348
+ reduce_to = reduce_table[i+1]
349
+ method_id = reduce_table[i+2]
350
+ void_array = []
351
+
352
+ tmp_t = tstack[-len, len] if @yydebug
353
+ tmp_v = vstack[-len, len]
354
+ tstack[-len, len] = void_array if @yydebug
355
+ vstack[-len, len] = void_array
356
+ state[-len, len] = void_array
357
+
358
+ # tstack must be updated AFTER method call
359
+ if use_result
360
+ vstack.push __send__(method_id, tmp_v, vstack, tmp_v[0])
361
+ else
362
+ vstack.push __send__(method_id, tmp_v, vstack)
363
+ end
364
+ tstack.push reduce_to
365
+
366
+ racc_reduce(tmp_t, reduce_to, tstack, vstack) if @yydebug
367
+
368
+ k1 = reduce_to - nt_base
369
+ if i = goto_pointer[k1]
370
+ i += state[-1]
371
+ if i >= 0 and (curstate = goto_table[i]) and goto_check[i] == k1
372
+ return curstate
373
+ end
374
+ end
375
+ goto_default[k1]
376
+ end
377
+
378
+ def on_error( t, val, vstack )
379
+ raise ParseError, sprintf("\nparse error on value %s (%s)",
380
+ val.inspect, token_to_str(t) || '?')
381
+ end
382
+
383
+ def yyerror
384
+ throw :racc_jump, 1
385
+ end
386
+
387
+ def yyaccept
388
+ throw :racc_jump, 2
389
+ end
390
+
391
+ def yyerrok
392
+ @racc_error_status = 0
393
+ end
394
+
395
+ #
396
+ # for debugging output
397
+ #
398
+
399
+ def racc_read_token( t, tok, val )
400
+ @racc_debug_out.print 'read '
401
+ @racc_debug_out.print tok.inspect, '(', racc_token2str(t), ') '
402
+ @racc_debug_out.puts val.inspect
403
+ @racc_debug_out.puts
404
+ end
405
+
406
+ def racc_shift( tok, tstack, vstack )
407
+ @racc_debug_out.puts "shift #{racc_token2str tok}"
408
+ racc_print_stacks tstack, vstack
409
+ @racc_debug_out.puts
410
+ end
411
+
412
+ def racc_reduce( toks, sim, tstack, vstack )
413
+ out = @racc_debug_out
414
+ out.print 'reduce '
415
+ if toks.empty?
416
+ out.print ' <none>'
417
+ else
418
+ toks.each {|t| out.print ' ', racc_token2str(t) }
419
+ end
420
+ out.puts " --> #{racc_token2str(sim)}"
421
+
422
+ racc_print_stacks tstack, vstack
423
+ @racc_debug_out.puts
424
+ end
425
+
426
+ def racc_accept
427
+ @racc_debug_out.puts 'accept'
428
+ @racc_debug_out.puts
429
+ end
430
+
431
+ def racc_e_pop( state, tstack, vstack )
432
+ @racc_debug_out.puts 'error recovering mode: pop token'
433
+ racc_print_states state
434
+ racc_print_stacks tstack, vstack
435
+ @racc_debug_out.puts
436
+ end
437
+
438
+ def racc_next_state( curstate, state )
439
+ @racc_debug_out.puts "goto #{curstate}"
440
+ racc_print_states state
441
+ @racc_debug_out.puts
442
+ end
443
+
444
+ def racc_print_stacks( t, v )
445
+ out = @racc_debug_out
446
+ out.print ' ['
447
+ t.each_index do |i|
448
+ out.print ' (', racc_token2str(t[i]), ' ', v[i].inspect, ')'
449
+ end
450
+ out.puts ' ]'
451
+ end
452
+
453
+ def racc_print_states( s )
454
+ out = @racc_debug_out
455
+ out.print ' ['
456
+ s.each {|st| out.print ' ', st }
457
+ out.puts ' ]'
458
+ end
459
+
460
+ def racc_token2str( tok )
461
+ self.class::Racc_token_to_s_table[tok] or
462
+ raise RuntimeError, "[Racc Bug] can't convert token #{tok} to string"
463
+ end
464
+
465
+ def token_to_str( t )
466
+ self.class::Racc_token_to_s_table[t]
467
+ end
468
+
469
+ end
470
+
471
+ end
472
+ ..end /usr/lib/ruby/1.8/racc/parser.rb modeval..id1306b79176
473
+ end # end of racc/parser.rb
474
+
475
+
476
+ module Nagios
477
+
478
+ class Parser < Racc::Parser
479
+
480
+ module_eval <<'..end grammar.ry modeval..id458299781d', 'grammar.ry', 57
481
+
482
+ def parse(src)
483
+ @src = src
484
+
485
+ # state variables
486
+ @invar = false
487
+ @inobject = false
488
+ @done = false
489
+
490
+ @line = 0
491
+ @yydebug = true
492
+
493
+ begin
494
+ do_parse
495
+ rescue SyntaxError
496
+ $stderr.print "#{$!}\n"
497
+ exit
498
+ end
499
+ end
500
+
501
+ # The lexer. Very simple.
502
+ def token
503
+ @src.sub!(/\A\n/,'')
504
+ if $&
505
+ @line += 1
506
+ return [ :RETURN, "\n" ]
507
+ end
508
+
509
+ if @done
510
+ return nil
511
+ end
512
+ yytext = String.new
513
+
514
+
515
+ # remove comments from this line
516
+ @src.sub!(/\A[ \t]*;.*\n/,"\n")
517
+ if $&
518
+ return [:INLINECOMMENT, ""]
519
+ end
520
+
521
+ @src.sub!(/\A#.*\n/,"\n")
522
+ if $&
523
+ return [:COMMENT, ""]
524
+ end
525
+
526
+ @src.sub!(/#.*/,'')
527
+
528
+ if @src.length == 0
529
+ @done = true
530
+ return [false, '$']
531
+ end
532
+
533
+ if @invar
534
+ @src.sub!(/\A[ \t]+/,'')
535
+ @src.sub!(/\A([^;\n]+)(\n|;)/,'\2')
536
+ if $1
537
+ yytext += $1
538
+ end
539
+ @invar = false
540
+ return [:VALUE, yytext]
541
+ else
542
+ @src.sub!(/\A[\t ]*(\S+)([\t ]*|$)/,'')
543
+ if $1
544
+ yytext = $1
545
+ case yytext
546
+ when 'define'
547
+ #puts "got define"
548
+ return [:DEFINE, yytext]
549
+ when '{'
550
+ #puts "got {"
551
+ @inobject = true
552
+ return [:LCURLY, yytext]
553
+ else
554
+ unless @inobject
555
+ #puts "got type: #{yytext}"
556
+ if yytext =~ /\W/
557
+ giveback = yytext.dup
558
+ giveback.sub!(/^\w+/,'')
559
+ #puts "giveback " + giveback
560
+ #puts "yytext " + yytext
561
+ yytext.sub!(/\W.*$/,'')
562
+ #puts "yytext " + yytext
563
+ #puts "all [#{giveback} #{yytext} #{orig}]"
564
+ @src = giveback + @src
565
+ end
566
+ return [:NAME, yytext]
567
+ else
568
+ if yytext == '}'
569
+ #puts "got closure: #{yytext}"
570
+ @inobject = false
571
+ return [:RCURLY, '}']
572
+ end
573
+
574
+ unless @invar
575
+ @invar = true
576
+ return [:PARAM, $1]
577
+ else
578
+ end
579
+ end
580
+ end
581
+ end
582
+ end
583
+ end
584
+
585
+ def next_token
586
+ token
587
+ end
588
+
589
+ def yydebug
590
+ 1
591
+ end
592
+
593
+ def yywrap
594
+ 0
595
+ end
596
+
597
+ def on_error(token, value, vstack )
598
+ msg = ""
599
+ unless value.nil?
600
+ msg = "line #{@line}: syntax error at '#{value}'"
601
+ else
602
+ msg = "line #{@line}: syntax error at '#{token}'"
603
+ end
604
+ unless @src.size > 0
605
+ msg = "line #{@line}: Unexpected end of file"
606
+ end
607
+ if token == '$end'.intern
608
+ puts "okay, this is silly"
609
+ else
610
+ raise SyntaxError, msg
611
+ end
612
+ end
613
+ ..end grammar.ry modeval..id458299781d
614
+
615
+ ##### racc 1.4.4 generates ###
616
+
617
+ racc_reduce_table = [
618
+ 0, 0, :racc_error,
619
+ 1, 13, :_reduce_1,
620
+ 2, 13, :_reduce_2,
621
+ 1, 14, :_reduce_3,
622
+ 1, 14, :_reduce_4,
623
+ 1, 14, :_reduce_none,
624
+ 2, 16, :_reduce_6,
625
+ 6, 15, :_reduce_7,
626
+ 1, 17, :_reduce_none,
627
+ 2, 17, :_reduce_9,
628
+ 4, 18, :_reduce_10,
629
+ 1, 20, :_reduce_none,
630
+ 2, 20, :_reduce_none,
631
+ 0, 19, :_reduce_none,
632
+ 1, 19, :_reduce_none ]
633
+
634
+ racc_reduce_n = 15
635
+
636
+ racc_shift_n = 26
637
+
638
+ racc_action_table = [
639
+ 9, 15, 1, 20, 1, 14, 12, 13, 11, 6,
640
+ 7, 6, 7, 15, 18, 8, 21, 23, 25 ]
641
+
642
+ racc_action_check = [
643
+ 2, 16, 2, 16, 0, 12, 8, 9, 7, 2,
644
+ 2, 0, 0, 14, 15, 1, 18, 22, 24 ]
645
+
646
+ racc_action_pointer = [
647
+ 2, 12, 0, nil, nil, nil, nil, -1, 0, 7,
648
+ nil, nil, -4, nil, 8, 6, -4, nil, 5, nil,
649
+ nil, nil, 8, nil, 9, nil ]
650
+
651
+ racc_action_default = [
652
+ -15, -15, -15, -1, -3, -5, -4, -15, -15, -15,
653
+ -2, -6, -15, 26, -15, -15, -15, -8, -13, -9,
654
+ -7, -14, -15, -11, -10, -12 ]
655
+
656
+ racc_goto_table = [
657
+ 17, 3, 19, 10, 2, 16, 22, 24 ]
658
+
659
+ racc_goto_check = [
660
+ 6, 2, 6, 2, 1, 5, 7, 8 ]
661
+
662
+ racc_goto_pointer = [
663
+ nil, 4, 1, nil, nil, -9, -14, -12, -15 ]
664
+
665
+ racc_goto_default = [
666
+ nil, nil, nil, 4, 5, nil, nil, nil, nil ]
667
+
668
+ racc_token_table = {
669
+ false => 0,
670
+ Object.new => 1,
671
+ :DEFINE => 2,
672
+ :NAME => 3,
673
+ :STRING => 4,
674
+ :PARAM => 5,
675
+ :LCURLY => 6,
676
+ :RCURLY => 7,
677
+ :VALUE => 8,
678
+ :RETURN => 9,
679
+ :COMMENT => 10,
680
+ :INLINECOMMENT => 11 }
681
+
682
+ racc_use_result_var = true
683
+
684
+ racc_nt_base = 12
685
+
686
+ Racc_arg = [
687
+ racc_action_table,
688
+ racc_action_check,
689
+ racc_action_default,
690
+ racc_action_pointer,
691
+ racc_goto_table,
692
+ racc_goto_check,
693
+ racc_goto_default,
694
+ racc_goto_pointer,
695
+ racc_nt_base,
696
+ racc_reduce_table,
697
+ racc_token_table,
698
+ racc_shift_n,
699
+ racc_reduce_n,
700
+ racc_use_result_var ]
701
+
702
+ Racc_token_to_s_table = [
703
+ '$end',
704
+ 'error',
705
+ 'DEFINE',
706
+ 'NAME',
707
+ 'STRING',
708
+ 'PARAM',
709
+ 'LCURLY',
710
+ 'RCURLY',
711
+ 'VALUE',
712
+ 'RETURN',
713
+ 'COMMENT',
714
+ 'INLINECOMMENT',
715
+ '$start',
716
+ 'decls',
717
+ 'decl',
718
+ 'object',
719
+ 'comment',
720
+ 'vars',
721
+ 'var',
722
+ 'icomment',
723
+ 'returns']
724
+
725
+ Racc_debug_parser = false
726
+
727
+ ##### racc system variables end #####
728
+
729
+ # reduce 0 omitted
730
+
731
+ module_eval <<'.,.,', 'grammar.ry', 6
732
+ def _reduce_1( val, _values, result )
733
+ return val[0] if val[0]
734
+ result
735
+ end
736
+ .,.,
737
+
738
+ module_eval <<'.,.,', 'grammar.ry', 18
739
+ def _reduce_2( val, _values, result )
740
+ if val[1].nil?
741
+ result = val[0]
742
+ else
743
+ if val[0].nil?
744
+ result = val[1]
745
+ else
746
+ result = [ val[0], val[1] ].flatten
747
+ end
748
+ end
749
+ result
750
+ end
751
+ .,.,
752
+
753
+ module_eval <<'.,.,', 'grammar.ry', 20
754
+ def _reduce_3( val, _values, result )
755
+ result = [val[0]]
756
+ result
757
+ end
758
+ .,.,
759
+
760
+ module_eval <<'.,.,', 'grammar.ry', 21
761
+ def _reduce_4( val, _values, result )
762
+ result = nil
763
+ result
764
+ end
765
+ .,.,
766
+
767
+ # reduce 5 omitted
768
+
769
+ module_eval <<'.,.,', 'grammar.ry', 25
770
+ def _reduce_6( val, _values, result )
771
+ result = nil
772
+ result
773
+ end
774
+ .,.,
775
+
776
+ module_eval <<'.,.,', 'grammar.ry', 31
777
+ def _reduce_7( val, _values, result )
778
+ result = Nagios::Base.create(val[1],val[4])
779
+ result
780
+ end
781
+ .,.,
782
+
783
+ # reduce 8 omitted
784
+
785
+ module_eval <<'.,.,', 'grammar.ry', 40
786
+ def _reduce_9( val, _values, result )
787
+ val[1].each {|p,v|
788
+ val[0][p] = v
789
+ }
790
+ result = val[0]
791
+ result
792
+ end
793
+ .,.,
794
+
795
+ module_eval <<'.,.,', 'grammar.ry', 42
796
+ def _reduce_10( val, _values, result )
797
+ result = {val[0],val[1]}
798
+ result
799
+ end
800
+ .,.,
801
+
802
+ # reduce 11 omitted
803
+
804
+ # reduce 12 omitted
805
+
806
+ # reduce 13 omitted
807
+
808
+ # reduce 14 omitted
809
+
810
+ def _reduce_none( val, _values, result )
811
+ result
812
+ end
813
+
814
+ end # class Parser
815
+
816
+ end # module Nagios