cybrid_api_organization_ruby 0.73.0 → 0.73.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +4 -2
  3. data/README.md +5 -5
  4. data/cybrid_api_organization_ruby.gemspec +1 -1
  5. data/lib/cybrid_api_organization_ruby/api/organizations_organization_api.rb +1 -1
  6. data/lib/cybrid_api_organization_ruby/api_client.rb +1 -1
  7. data/lib/cybrid_api_organization_ruby/api_error.rb +1 -1
  8. data/lib/cybrid_api_organization_ruby/configuration.rb +1 -1
  9. data/lib/cybrid_api_organization_ruby/models/error_response_organization_model.rb +1 -1
  10. data/lib/cybrid_api_organization_ruby/models/organization_organization_model.rb +1 -1
  11. data/lib/cybrid_api_organization_ruby/models/patch_organization_organization_model.rb +1 -1
  12. data/lib/cybrid_api_organization_ruby/version.rb +2 -2
  13. data/lib/cybrid_api_organization_ruby.rb +1 -1
  14. data/spec/api/organizations_organization_api_spec.rb +1 -1
  15. data/spec/api_client_spec.rb +1 -1
  16. data/spec/configuration_spec.rb +1 -1
  17. data/spec/models/error_response_organization_model_spec.rb +1 -1
  18. data/spec/models/organization_organization_model_spec.rb +1 -1
  19. data/spec/models/patch_organization_organization_model_spec.rb +1 -1
  20. data/spec/spec_helper.rb +1 -1
  21. data/vendor/bundle/ruby/3.2.0/bin/racc +29 -0
  22. data/vendor/bundle/ruby/3.2.0/cache/parser-3.2.2.3.gem +0 -0
  23. data/vendor/bundle/ruby/3.2.0/cache/racc-1.7.0.gem +0 -0
  24. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/gem_make.out +5 -5
  25. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/ffi-1.15.5/gem_make.out +5 -5
  26. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +5 -5
  27. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.1.0/gem_make.out +5 -5
  28. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.7.0/gem.build_complete +0 -0
  29. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.7.0/gem_make.out +28 -0
  30. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.7.0/mkmf.log +57 -0
  31. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.7.0/racc/cparse.so +0 -0
  32. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.0.7/gem_make.out +5 -5
  33. data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/macruby.rb +3 -1
  34. data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/ruby18.rb +3 -1
  35. data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/ruby19.rb +3 -1
  36. data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/ruby20.rb +3 -1
  37. data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/ruby21.rb +3 -1
  38. data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/ruby22.rb +3 -1
  39. data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/ruby23.rb +3 -1
  40. data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/ruby24.rb +3 -1
  41. data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/ruby25.rb +3 -1
  42. data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/ruby26.rb +3 -1
  43. data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/ruby27.rb +3 -1
  44. data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/ruby30.rb +3 -1
  45. data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/ruby31.rb +3 -1
  46. data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/ruby32.rb +3 -1
  47. data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/ruby33.rb +3 -1
  48. data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/rubymotion.rb +3 -1
  49. data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/version.rb +1 -1
  50. data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/parser.gemspec +1 -1
  51. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/COPYING +22 -0
  52. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/ChangeLog +846 -0
  53. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/README.ja.rdoc +94 -0
  54. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/README.rdoc +79 -0
  55. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/TODO +5 -0
  56. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/bin/racc +320 -0
  57. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/doc/en/NEWS.en.rdoc +282 -0
  58. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/doc/en/grammar.en.rdoc +226 -0
  59. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/doc/en/grammar2.en.rdoc +219 -0
  60. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/doc/ja/NEWS.ja.rdoc +307 -0
  61. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/doc/ja/command.ja.html +94 -0
  62. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/doc/ja/debug.ja.rdoc +36 -0
  63. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/doc/ja/grammar.ja.rdoc +348 -0
  64. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/doc/ja/index.ja.html +10 -0
  65. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/doc/ja/parser.ja.rdoc +125 -0
  66. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/doc/ja/usage.ja.html +414 -0
  67. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/ext/racc/MANIFEST +4 -0
  68. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/ext/racc/cparse/Makefile +269 -0
  69. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/ext/racc/cparse/cparse.c +861 -0
  70. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/ext/racc/cparse/extconf.rb +9 -0
  71. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/lib/racc/compat.rb +33 -0
  72. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/lib/racc/cparse.so +0 -0
  73. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/lib/racc/debugflags.rb +60 -0
  74. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/lib/racc/exception.rb +16 -0
  75. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/lib/racc/grammar.rb +1114 -0
  76. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/lib/racc/grammarfileparser.rb +561 -0
  77. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/lib/racc/info.rb +17 -0
  78. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/lib/racc/iset.rb +92 -0
  79. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/lib/racc/logfilegenerator.rb +212 -0
  80. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/lib/racc/parser-text.rb +658 -0
  81. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/lib/racc/parser.rb +632 -0
  82. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/lib/racc/parserfilegenerator.rb +470 -0
  83. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/lib/racc/sourcetext.rb +35 -0
  84. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/lib/racc/state.rb +972 -0
  85. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/lib/racc/statetransitiontable.rb +311 -0
  86. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/lib/racc/static.rb +5 -0
  87. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.0/lib/racc.rb +6 -0
  88. data/vendor/bundle/ruby/3.2.0/specifications/{parser-3.2.2.1.gemspec → parser-3.2.2.3.gemspec} +5 -5
  89. data/vendor/bundle/ruby/3.2.0/specifications/racc-1.7.0.gemspec +27 -0
  90. metadata +127 -83
  91. data/vendor/bundle/ruby/3.2.0/cache/parser-3.2.2.1.gem +0 -0
  92. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/LICENSE.txt +0 -0
  93. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/bin/ruby-parse +0 -0
  94. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/bin/ruby-rewrite +0 -0
  95. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/gauntlet_parser.rb +0 -0
  96. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/all.rb +0 -0
  97. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/ast/node.rb +0 -0
  98. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/ast/processor.rb +0 -0
  99. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/base.rb +0 -0
  100. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/builders/default.rb +0 -0
  101. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/clobbering_error.rb +0 -0
  102. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/color.rb +0 -0
  103. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/context.rb +0 -0
  104. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/current.rb +0 -0
  105. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/current_arg_stack.rb +0 -0
  106. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/deprecation.rb +0 -0
  107. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/diagnostic/engine.rb +0 -0
  108. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/diagnostic.rb +0 -0
  109. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/lexer/dedenter.rb +0 -0
  110. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/lexer/explanation.rb +0 -0
  111. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/lexer/literal.rb +0 -0
  112. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/lexer/stack_state.rb +0 -0
  113. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/lexer-F0.rb +0 -0
  114. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/lexer-F1.rb +0 -0
  115. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/lexer-strings.rb +0 -0
  116. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/max_numparam_stack.rb +0 -0
  117. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/messages.rb +0 -0
  118. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/meta.rb +0 -0
  119. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/rewriter.rb +0 -0
  120. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/ruby28.rb +0 -0
  121. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/runner/ruby_parse.rb +0 -0
  122. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/runner/ruby_rewrite.rb +0 -0
  123. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/runner.rb +0 -0
  124. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/buffer.rb +0 -0
  125. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/comment/associator.rb +0 -0
  126. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/comment.rb +0 -0
  127. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/map/collection.rb +0 -0
  128. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/map/condition.rb +0 -0
  129. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/map/constant.rb +0 -0
  130. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/map/definition.rb +0 -0
  131. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/map/for.rb +0 -0
  132. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/map/heredoc.rb +0 -0
  133. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/map/index.rb +0 -0
  134. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/map/keyword.rb +0 -0
  135. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/map/method_definition.rb +0 -0
  136. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/map/objc_kwarg.rb +0 -0
  137. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/map/operator.rb +0 -0
  138. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/map/rescue_body.rb +0 -0
  139. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/map/send.rb +0 -0
  140. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/map/ternary.rb +0 -0
  141. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/map/variable.rb +0 -0
  142. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/map.rb +0 -0
  143. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/range.rb +0 -0
  144. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/rewriter/action.rb +0 -0
  145. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/rewriter.rb +0 -0
  146. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/tree_rewriter/action.rb +0 -0
  147. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/source/tree_rewriter.rb +0 -0
  148. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/static_environment.rb +0 -0
  149. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/syntax_error.rb +0 -0
  150. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/tree_rewriter.rb +0 -0
  151. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser/variables_stack.rb +0 -0
  152. /data/vendor/bundle/ruby/3.2.0/gems/{parser-3.2.2.1 → parser-3.2.2.3}/lib/parser.rb +0 -0
@@ -0,0 +1,470 @@
1
+ #--
2
+ #
3
+ #
4
+ #
5
+ # Copyright (c) 1999-2006 Minero Aoki
6
+ #
7
+ # This program is free software.
8
+ # You can distribute/modify this program under the same terms of ruby.
9
+ # see the file "COPYING".
10
+ #
11
+ #++
12
+
13
+ require 'racc/compat'
14
+ require 'racc/sourcetext'
15
+ require 'racc/parser-text'
16
+ require 'rbconfig'
17
+
18
+ module Racc
19
+
20
+ class ParserFileGenerator
21
+
22
+ class Params
23
+ def self.bool_attr(name)
24
+ module_eval(<<-End)
25
+ def #{name}?
26
+ @#{name}
27
+ end
28
+
29
+ def #{name}=(b)
30
+ @#{name} = b
31
+ end
32
+ End
33
+ end
34
+
35
+ attr_accessor :filename
36
+ attr_accessor :classname
37
+ attr_accessor :superclass
38
+ bool_attr :omit_action_call
39
+ bool_attr :result_var
40
+ attr_accessor :header
41
+ attr_accessor :inner
42
+ attr_accessor :footer
43
+
44
+ bool_attr :debug_parser
45
+ bool_attr :convert_line
46
+ bool_attr :convert_line_all
47
+ bool_attr :embed_runtime
48
+ bool_attr :make_executable
49
+ attr_accessor :interpreter
50
+
51
+ def initialize
52
+ # Parameters derived from parser
53
+ self.filename = nil
54
+ self.classname = nil
55
+ self.superclass = 'Racc::Parser'
56
+ self.omit_action_call = true
57
+ self.result_var = true
58
+ self.header = []
59
+ self.inner = []
60
+ self.footer = []
61
+
62
+ # Parameters derived from command line options
63
+ self.debug_parser = false
64
+ self.convert_line = true
65
+ self.convert_line_all = false
66
+ self.embed_runtime = false
67
+ self.make_executable = false
68
+ self.interpreter = nil
69
+ end
70
+ end
71
+
72
+ def initialize(states, params)
73
+ @states = states
74
+ @grammar = states.grammar
75
+ @params = params
76
+ end
77
+
78
+ def generate_parser
79
+ string_io = StringIO.new
80
+
81
+ init_line_conversion_system
82
+ @f = string_io
83
+ parser_file
84
+
85
+ string_io.rewind
86
+ string_io.read
87
+ end
88
+
89
+ def generate_parser_file(destpath)
90
+ init_line_conversion_system
91
+ File.open(destpath, 'w') {|f|
92
+ @f = f
93
+ parser_file
94
+ }
95
+ File.chmod 0755, destpath if @params.make_executable?
96
+ end
97
+
98
+ private
99
+
100
+ def parser_file
101
+ shebang @params.interpreter if @params.make_executable?
102
+ notice
103
+ line
104
+ if @params.embed_runtime?
105
+ embed_library runtime_source()
106
+ else
107
+ require 'racc/parser.rb'
108
+ end
109
+ header
110
+ parser_class(@params.classname, @params.superclass) {
111
+ inner
112
+ state_transition_table
113
+ }
114
+ footer
115
+ end
116
+
117
+ c = ::RbConfig::CONFIG
118
+ RUBY_PATH = "#{c['bindir']}/#{c['ruby_install_name']}#{c['EXEEXT']}"
119
+
120
+ def shebang(path)
121
+ line '#!' + (path == 'ruby' ? RUBY_PATH : path)
122
+ end
123
+
124
+ def notice
125
+ line %q[#]
126
+ line %q[# DO NOT MODIFY!!!!]
127
+ line %Q[# This file is automatically generated by Racc #{Racc::Version}]
128
+ line %Q[# from Racc grammar file "#{@params.filename}".]
129
+ line %q[#]
130
+ end
131
+
132
+ def runtime_source
133
+ SourceText.new(::Racc::PARSER_TEXT, 'racc/parser.rb', 1)
134
+ end
135
+
136
+ def embed_library(src)
137
+ line %[###### #{src.filename} begin]
138
+ line %[unless $".index '#{src.filename}']
139
+ line %[$".push '#{src.filename}']
140
+ put src, @params.convert_line?
141
+ line %[end]
142
+ line %[###### #{src.filename} end]
143
+ end
144
+
145
+ def require(feature)
146
+ line "require '#{feature}'"
147
+ end
148
+
149
+ def parser_class(classname, superclass)
150
+ mods = classname.split('::')
151
+ classid = mods.pop
152
+ mods.each do |mod|
153
+ indent; line "module #{mod}"
154
+ cref_push mod
155
+ end
156
+ indent; line "class #{classid} < #{superclass}"
157
+ cref_push classid
158
+ yield
159
+ cref_pop
160
+ indent; line "end \# class #{classid}"
161
+ mods.reverse_each do |mod|
162
+ cref_pop
163
+ indent; line "end \# module #{mod}"
164
+ end
165
+ end
166
+
167
+ def header
168
+ @params.header.each do |src|
169
+ line
170
+ put src, @params.convert_line_all?
171
+ end
172
+ end
173
+
174
+ def inner
175
+ @params.inner.each do |src|
176
+ line
177
+ put src, @params.convert_line?
178
+ end
179
+ end
180
+
181
+ def footer
182
+ @params.footer.each do |src|
183
+ line
184
+ put src, @params.convert_line_all?
185
+ end
186
+ end
187
+
188
+ # Low Level Routines
189
+
190
+ def put(src, convert_line = false)
191
+ if convert_line
192
+ replace_location(src) {
193
+ @f.puts src.text
194
+ }
195
+ else
196
+ @f.puts src.text
197
+ end
198
+ end
199
+
200
+ def line(str = '')
201
+ @f.puts str
202
+ end
203
+
204
+ def init_line_conversion_system
205
+ @cref = []
206
+ @used_separator = {}
207
+ end
208
+
209
+ def cref_push(name)
210
+ @cref.push name
211
+ end
212
+
213
+ def cref_pop
214
+ @cref.pop
215
+ end
216
+
217
+ def indent
218
+ @f.print ' ' * @cref.size
219
+ end
220
+
221
+ def toplevel?
222
+ @cref.empty?
223
+ end
224
+
225
+ def replace_location(src)
226
+ sep = make_separator(src)
227
+ @f.print 'self.class.' if toplevel?
228
+ @f.puts "module_eval(<<'#{sep}', '#{src.filename}', #{src.lineno})"
229
+ yield
230
+ @f.puts sep
231
+ end
232
+
233
+ def make_separator(src)
234
+ sep = unique_separator(src.filename)
235
+ sep *= 2 while src.text.index(sep)
236
+ sep
237
+ end
238
+
239
+ def unique_separator(id)
240
+ sep = String.new "...end #{id}/module_eval..."
241
+ while @used_separator.key?(sep)
242
+ sep.concat sprintf('%02x', rand(255))
243
+ end
244
+ @used_separator[sep] = true
245
+ sep
246
+ end
247
+
248
+ #
249
+ # State Transition Table Serialization
250
+ #
251
+
252
+ public
253
+
254
+ def put_state_transition_table(f)
255
+ @f = f
256
+ state_transition_table
257
+ end
258
+
259
+ private
260
+
261
+ def state_transition_table
262
+ table = @states.state_transition_table
263
+ table.use_result_var = @params.result_var?
264
+ table.debug_parser = @params.debug_parser?
265
+
266
+ line "##### State transition tables begin ###"
267
+ line
268
+ integer_list 'racc_action_table', table.action_table
269
+ line
270
+ integer_list 'racc_action_check', table.action_check
271
+ line
272
+ integer_list 'racc_action_pointer', table.action_pointer
273
+ line
274
+ integer_list 'racc_action_default', table.action_default
275
+ line
276
+ integer_list 'racc_goto_table', table.goto_table
277
+ line
278
+ integer_list 'racc_goto_check', table.goto_check
279
+ line
280
+ integer_list 'racc_goto_pointer', table.goto_pointer
281
+ line
282
+ integer_list 'racc_goto_default', table.goto_default
283
+ line
284
+ i_i_sym_list 'racc_reduce_table', table.reduce_table
285
+ line
286
+ line "racc_reduce_n = #{table.reduce_n}"
287
+ line
288
+ line "racc_shift_n = #{table.shift_n}"
289
+ line
290
+ sym_int_hash 'racc_token_table', table.token_table
291
+ line
292
+ line "racc_nt_base = #{table.nt_base}"
293
+ line
294
+ line "racc_use_result_var = #{table.use_result_var}"
295
+ line
296
+ @f.print(unindent_auto(<<-End))
297
+ Racc_arg = [
298
+ racc_action_table,
299
+ racc_action_check,
300
+ racc_action_default,
301
+ racc_action_pointer,
302
+ racc_goto_table,
303
+ racc_goto_check,
304
+ racc_goto_default,
305
+ racc_goto_pointer,
306
+ racc_nt_base,
307
+ racc_reduce_table,
308
+ racc_token_table,
309
+ racc_shift_n,
310
+ racc_reduce_n,
311
+ racc_use_result_var ]
312
+ End
313
+ line "Ractor.make_shareable(Racc_arg) if defined?(Ractor)"
314
+ line
315
+ string_list 'Racc_token_to_s_table', table.token_to_s_table
316
+ line "Ractor.make_shareable(Racc_token_to_s_table) if defined?(Ractor)"
317
+ line
318
+ line "Racc_debug_parser = #{table.debug_parser}"
319
+ line
320
+ line '##### State transition tables end #####'
321
+ actions
322
+ end
323
+
324
+ def integer_list(name, table)
325
+ sep = ''
326
+ line "#{name} = ["
327
+ table.each_slice(10) do |ns|
328
+ @f.print sep; sep = ",\n"
329
+ @f.print ns.map {|n| sprintf('%6s', n ? n.to_s : 'nil') }.join(',')
330
+ end
331
+ line ' ]'
332
+ end
333
+
334
+ def i_i_sym_list(name, table)
335
+ sep = ''
336
+ line "#{name} = ["
337
+ table.each_slice(3) do |len, target, mid|
338
+ @f.print sep; sep = ",\n"
339
+ @f.printf ' %d, %d, %s', len, target, mid.inspect
340
+ end
341
+ line " ]"
342
+ end
343
+
344
+ def sym_int_hash(name, h)
345
+ sep = "\n"
346
+ @f.print "#{name} = {"
347
+ h.to_a.sort_by {|sym, i| i }.each do |sym, i|
348
+ @f.print sep; sep = ",\n"
349
+ @f.printf " %s => %d", sym.serialize, i
350
+ end
351
+ line " }"
352
+ end
353
+
354
+ def string_list(name, list)
355
+ sep = " "
356
+ line "#{name} = ["
357
+ list.each do |s|
358
+ @f.print sep; sep = ",\n "
359
+ @f.print s.dump
360
+ end
361
+ line ' ]'
362
+ end
363
+
364
+ def actions
365
+ @grammar.each do |rule|
366
+ unless rule.action.source?
367
+ raise "racc: fatal: cannot generate parser file when any action is a Proc"
368
+ end
369
+ end
370
+
371
+ if @params.result_var?
372
+ decl = ', result'
373
+ retval = "\n result"
374
+ default_body = ''
375
+ else
376
+ decl = ''
377
+ retval = ''
378
+ default_body = 'val[0]'
379
+ end
380
+ @grammar.each do |rule|
381
+ line
382
+ if rule.action.empty? and @params.omit_action_call?
383
+ line "# reduce #{rule.ident} omitted"
384
+ else
385
+ src0 = rule.action.source || SourceText.new(default_body, __FILE__, 0)
386
+ if @params.convert_line?
387
+ src = remove_blank_lines(src0)
388
+ delim = make_delimiter(src.text)
389
+ @f.printf unindent_auto(<<-End),
390
+ module_eval(<<'%s', '%s', %d)
391
+ def _reduce_%d(val, _values%s)
392
+ %s%s
393
+ end
394
+ %s
395
+ End
396
+ delim, src.filename, src.lineno - 1,
397
+ rule.ident, decl,
398
+ src.text, retval,
399
+ delim
400
+ else
401
+ src = remove_blank_lines(src0)
402
+ @f.printf unindent_auto(<<-End),
403
+ def _reduce_%d(val, _values%s)
404
+ %s%s
405
+ end
406
+ End
407
+ rule.ident, decl,
408
+ src.text, retval
409
+ end
410
+ end
411
+ end
412
+ line
413
+ @f.printf unindent_auto(<<-'End'), decl
414
+ def _reduce_none(val, _values%s)
415
+ val[0]
416
+ end
417
+ End
418
+ line
419
+ end
420
+
421
+ def remove_blank_lines(src)
422
+ body = src.text.dup
423
+ line = src.lineno
424
+ while body.slice!(/\A[ \t\f]*(?:\n|\r\n|\r)/)
425
+ line += 1
426
+ end
427
+ SourceText.new(body, src.filename, line)
428
+ end
429
+
430
+ def make_delimiter(body)
431
+ delim = '.,.,'
432
+ while body.index(delim)
433
+ delim *= 2
434
+ end
435
+ delim
436
+ end
437
+
438
+ def unindent_auto(str)
439
+ lines = str.lines.to_a
440
+ n = minimum_indent(lines)
441
+ lines.map {|line| detab(line).sub(indent_re(n), '').rstrip + "\n" }.join('')
442
+ end
443
+
444
+ def minimum_indent(lines)
445
+ lines.map {|line| n_indent(line) }.min
446
+ end
447
+
448
+ def n_indent(line)
449
+ line.slice(/\A\s+/).size
450
+ end
451
+
452
+ RE_CACHE = {}
453
+
454
+ def indent_re(n)
455
+ RE_CACHE[n] ||= /\A {#{n}}/
456
+ end
457
+
458
+ def detab(str, ts = 8)
459
+ add = 0
460
+ len = nil
461
+ str.gsub(/\t/) {
462
+ len = ts - ($`.size + add) % ts
463
+ add += len - 1
464
+ ' ' * len
465
+ }
466
+ end
467
+
468
+ end
469
+
470
+ end
@@ -0,0 +1,35 @@
1
+ #--
2
+ #
3
+ #
4
+ #
5
+ # Copyright (c) 1999-2006 Minero Aoki
6
+ #
7
+ # This program is free software.
8
+ # You can distribute/modify this program under the same terms of ruby.
9
+ # see the file "COPYING".
10
+ #
11
+ #++
12
+
13
+ module Racc
14
+
15
+ class SourceText
16
+ def initialize(text, filename, lineno)
17
+ @text = text
18
+ @filename = filename
19
+ @lineno = lineno
20
+ end
21
+
22
+ attr_reader :text
23
+ attr_reader :filename
24
+ attr_reader :lineno
25
+
26
+ def to_s
27
+ "#<SourceText #{location()}>"
28
+ end
29
+
30
+ def location
31
+ "#{@filename}:#{@lineno}"
32
+ end
33
+ end
34
+
35
+ end