protobuf 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +28 -0
- data/README.md +216 -0
- data/Rakefile +1 -0
- data/bin/rpc_server +117 -0
- data/bin/rprotoc +46 -0
- data/examples/addressbook.pb.rb +55 -0
- data/examples/addressbook.proto +24 -0
- data/examples/reading_a_message.rb +32 -0
- data/examples/writing_a_message.rb +46 -0
- data/lib/protobuf.rb +6 -0
- data/lib/protobuf/common/exceptions.rb +11 -0
- data/lib/protobuf/common/logger.rb +64 -0
- data/lib/protobuf/common/util.rb +59 -0
- data/lib/protobuf/common/wire_type.rb +10 -0
- data/lib/protobuf/compiler/compiler.rb +52 -0
- data/lib/protobuf/compiler/nodes.rb +323 -0
- data/lib/protobuf/compiler/proto.y +216 -0
- data/lib/protobuf/compiler/proto2.ebnf +79 -0
- data/lib/protobuf/compiler/proto_parser.rb +1425 -0
- data/lib/protobuf/compiler/template/rpc_bin.erb +4 -0
- data/lib/protobuf/compiler/template/rpc_client.erb +18 -0
- data/lib/protobuf/compiler/template/rpc_service.erb +25 -0
- data/lib/protobuf/compiler/template/rpc_service_implementation.erb +42 -0
- data/lib/protobuf/compiler/visitors.rb +302 -0
- data/lib/protobuf/descriptor/descriptor.proto +286 -0
- data/lib/protobuf/descriptor/descriptor.rb +55 -0
- data/lib/protobuf/descriptor/descriptor_builder.rb +143 -0
- data/lib/protobuf/descriptor/descriptor_proto.rb +138 -0
- data/lib/protobuf/descriptor/enum_descriptor.rb +33 -0
- data/lib/protobuf/descriptor/field_descriptor.rb +49 -0
- data/lib/protobuf/descriptor/file_descriptor.rb +37 -0
- data/lib/protobuf/message/decoder.rb +83 -0
- data/lib/protobuf/message/encoder.rb +46 -0
- data/lib/protobuf/message/enum.rb +62 -0
- data/lib/protobuf/message/extend.rb +8 -0
- data/lib/protobuf/message/field.rb +701 -0
- data/lib/protobuf/message/message.rb +402 -0
- data/lib/protobuf/message/protoable.rb +38 -0
- data/lib/protobuf/rpc/buffer.rb +74 -0
- data/lib/protobuf/rpc/client.rb +268 -0
- data/lib/protobuf/rpc/client_connection.rb +225 -0
- data/lib/protobuf/rpc/error.rb +34 -0
- data/lib/protobuf/rpc/error/client_error.rb +31 -0
- data/lib/protobuf/rpc/error/server_error.rb +43 -0
- data/lib/protobuf/rpc/rpc.pb.rb +107 -0
- data/lib/protobuf/rpc/server.rb +183 -0
- data/lib/protobuf/rpc/service.rb +244 -0
- data/lib/protobuf/rpc/stat.rb +70 -0
- data/lib/protobuf/version.rb +3 -0
- data/proto/rpc.proto +73 -0
- data/protobuf.gemspec +25 -0
- data/script/mk_parser +2 -0
- data/spec/functional/embedded_service_spec.rb +7 -0
- data/spec/proto/test.pb.rb +31 -0
- data/spec/proto/test.proto +31 -0
- data/spec/proto/test_service.rb +30 -0
- data/spec/proto/test_service_impl.rb +17 -0
- data/spec/spec_helper.rb +26 -0
- data/spec/unit/client_spec.rb +128 -0
- data/spec/unit/common/logger_spec.rb +121 -0
- data/spec/unit/enum_spec.rb +13 -0
- data/spec/unit/message_spec.rb +67 -0
- data/spec/unit/server_spec.rb +27 -0
- data/spec/unit/service_spec.rb +75 -0
- data/test/check_unbuild.rb +30 -0
- data/test/data/data.bin +3 -0
- data/test/data/data_source.py +14 -0
- data/test/data/types.bin +0 -0
- data/test/data/types_source.py +22 -0
- data/test/data/unk.png +0 -0
- data/test/proto/addressbook.pb.rb +66 -0
- data/test/proto/addressbook.proto +33 -0
- data/test/proto/addressbook_base.pb.rb +58 -0
- data/test/proto/addressbook_base.proto +26 -0
- data/test/proto/addressbook_ext.pb.rb +20 -0
- data/test/proto/addressbook_ext.proto +6 -0
- data/test/proto/collision.pb.rb +17 -0
- data/test/proto/collision.proto +5 -0
- data/test/proto/ext_collision.pb.rb +24 -0
- data/test/proto/ext_collision.proto +8 -0
- data/test/proto/ext_range.pb.rb +22 -0
- data/test/proto/ext_range.proto +7 -0
- data/test/proto/float_default.proto +10 -0
- data/test/proto/lowercase.pb.rb +30 -0
- data/test/proto/lowercase.proto +9 -0
- data/test/proto/merge.pb.rb +39 -0
- data/test/proto/merge.proto +15 -0
- data/test/proto/nested.pb.rb +30 -0
- data/test/proto/nested.proto +9 -0
- data/test/proto/optional_field.pb.rb +35 -0
- data/test/proto/optional_field.proto +12 -0
- data/test/proto/packed.pb.rb +22 -0
- data/test/proto/packed.proto +6 -0
- data/test/proto/rpc.proto +6 -0
- data/test/proto/types.pb.rb +84 -0
- data/test/proto/types.proto +37 -0
- data/test/test_addressbook.rb +56 -0
- data/test/test_compiler.rb +325 -0
- data/test/test_descriptor.rb +122 -0
- data/test/test_enum_value.rb +41 -0
- data/test/test_extension.rb +36 -0
- data/test/test_lowercase.rb +11 -0
- data/test/test_message.rb +128 -0
- data/test/test_optional_field.rb +103 -0
- data/test/test_packed_field.rb +40 -0
- data/test/test_parse.rb +15 -0
- data/test/test_repeated_types.rb +132 -0
- data/test/test_serialize.rb +61 -0
- data/test/test_standard_message.rb +96 -0
- data/test/test_types.rb +226 -0
- metadata +261 -0
@@ -0,0 +1,216 @@
|
|
1
|
+
class Protobuf::ProtoParser
|
2
|
+
rule
|
3
|
+
proto : proto_item
|
4
|
+
{ result = Protobuf::Node::ProtoNode.new(val) }
|
5
|
+
| proto proto_item
|
6
|
+
{ result.children << val[1] if val[1]}
|
7
|
+
|
8
|
+
proto_item : message
|
9
|
+
| extend
|
10
|
+
| enum
|
11
|
+
| import
|
12
|
+
| package
|
13
|
+
| option
|
14
|
+
| service
|
15
|
+
| ';' { result = nil }
|
16
|
+
|
17
|
+
import : 'import' STRING_LITERAL ';'
|
18
|
+
{ result = Protobuf::Node::ImportNode.new(val[1]) }
|
19
|
+
|
20
|
+
package : 'package' IDENT dot_ident_list ';'
|
21
|
+
{ result = Protobuf::Node::PackageNode.new(val[2].unshift(val[1])) }
|
22
|
+
|
23
|
+
dot_ident_list :
|
24
|
+
{ result = [] }
|
25
|
+
| dot_ident_list '.' IDENT
|
26
|
+
{ result << val[2] }
|
27
|
+
|
28
|
+
option : 'option' option_body ';'
|
29
|
+
{ result = Protobuf::Node::OptionNode.new(*val[1]) }
|
30
|
+
|
31
|
+
option_body : IDENT dot_ident_list '=' constant
|
32
|
+
{ result = [val[1].unshift(val[0]), val[3]] }
|
33
|
+
|
34
|
+
message : 'message' IDENT message_body
|
35
|
+
{ result = Protobuf::Node::MessageNode.new(val[1], val[2]) }
|
36
|
+
|
37
|
+
extend : 'extend' user_type '{' extend_body_list '}'
|
38
|
+
{ result = Protobuf::Node::ExtendNode.new(val[1], val[3]) }
|
39
|
+
|
40
|
+
extend_body_list :
|
41
|
+
{ result = [] }
|
42
|
+
| extend_body_list extend_body
|
43
|
+
{ result << val[1] if val[1] }
|
44
|
+
|
45
|
+
extend_body : field
|
46
|
+
| group
|
47
|
+
| ';' { result = nil }
|
48
|
+
|
49
|
+
enum : 'enum' IDENT '{' enum_body_list '}'
|
50
|
+
{ result = Protobuf::Node::EnumNode.new(val[1], val[3]) }
|
51
|
+
|
52
|
+
enum_body_list :
|
53
|
+
{ result = [] }
|
54
|
+
| enum_body_list enum_body
|
55
|
+
{ result << val[1] if val[1] }
|
56
|
+
|
57
|
+
enum_body : option
|
58
|
+
| enum_field
|
59
|
+
| ';' { result = nil }
|
60
|
+
|
61
|
+
enum_field : IDENT '=' integer_literal ';'
|
62
|
+
{ result = Protobuf::Node::EnumFieldNode.new(val[0], val[2]) }
|
63
|
+
|
64
|
+
service : 'service' IDENT '{' service_body_list '}'
|
65
|
+
{ result = Protobuf::Node::ServiceNode.new(val[1], val[3]) }
|
66
|
+
|
67
|
+
service_body_list :
|
68
|
+
{ result = [] }
|
69
|
+
| service_body_list service_body
|
70
|
+
{ result << val[1] if val[1] }
|
71
|
+
|
72
|
+
service_body : option
|
73
|
+
| rpc
|
74
|
+
| ';' { result = nil}
|
75
|
+
|
76
|
+
rpc : 'rpc' IDENT '(' rpc_arg ')' 'returns' '(' rpc_arg ')' ';'
|
77
|
+
{ result = Protobuf::Node::RpcNode.new(val[1], val[3], val[7]) }
|
78
|
+
|
79
|
+
rpc_arg :
|
80
|
+
| user_type
|
81
|
+
|
82
|
+
message_body : '{' message_body_body_list '}'
|
83
|
+
{ result = val[1] }
|
84
|
+
|
85
|
+
message_body_body_list :
|
86
|
+
{ result = [] }
|
87
|
+
| message_body_body_list message_body_body
|
88
|
+
{ result << val[1] if val[1] }
|
89
|
+
|
90
|
+
message_body_body : field
|
91
|
+
| enum
|
92
|
+
| message
|
93
|
+
| extend
|
94
|
+
| extensions
|
95
|
+
| group
|
96
|
+
| option
|
97
|
+
| ';' { result = nil }
|
98
|
+
|
99
|
+
group : label 'group' CAMEL_IDENT '=' integer_literal message_body
|
100
|
+
{ result = Protobuf::Node::GroupNode.new(val[0], val[2], val[4], val[5]) }
|
101
|
+
|
102
|
+
field : label type field_name '=' integer_literal ';'
|
103
|
+
{ result = Protobuf::Node::FieldNode.new(val[0], val[1], val[2], val[4]) }
|
104
|
+
| label type field_name '=' integer_literal '[' field_option_list ']' ';'
|
105
|
+
{ result = Protobuf::Node::FieldNode.new(val[0], val[1], val[2], val[4], val[6]) }
|
106
|
+
|
107
|
+
field_name : IDENT | "required" | "optional" | "repeated" | "import" | "package" | "option" | "message" | "extend" | "enum" | "service" | "rpc" | "returns" | "group" | "default" | "extensions" | "to" | "max" | "double" | "float" | "int32" | "int64" | "uint32" | "uint64" | "sint32" | "sint64" | "fixed32" | "fixed64" | "sfixed32" | "sfixed64" | "bool" | "string" | "bytes"
|
108
|
+
|
109
|
+
field_option_list : field_option
|
110
|
+
{ result = val }
|
111
|
+
| field_option_list ',' field_option
|
112
|
+
{ result << val[2] }
|
113
|
+
|
114
|
+
field_option : option_body
|
115
|
+
| 'default' '=' constant
|
116
|
+
{ result = [:default, val[2]] }
|
117
|
+
|
118
|
+
extensions : 'extensions' extension comma_extension_list ';'
|
119
|
+
{ result = Protobuf::Node::ExtensionsNode.new(val[2].unshift(val[1])) }
|
120
|
+
|
121
|
+
comma_extension_list :
|
122
|
+
{ result = [] }
|
123
|
+
| ',' extension
|
124
|
+
{ result << val[1] }
|
125
|
+
|
126
|
+
extension : integer_literal
|
127
|
+
{ result = Protobuf::Node::ExtensionRangeNode.new(val[0]) }
|
128
|
+
| integer_literal 'to' integer_literal
|
129
|
+
{ result = Protobuf::Node::ExtensionRangeNode.new(val[0], val[2]) }
|
130
|
+
| integer_literal 'to' 'max'
|
131
|
+
{ result = Protobuf::Node::ExtensionRangeNode.new(val[0], :max) }
|
132
|
+
|
133
|
+
label : 'required'
|
134
|
+
| 'optional'
|
135
|
+
| 'repeated'
|
136
|
+
|
137
|
+
type : 'double' | 'float' | 'int32' | 'int64' | 'uint32' | 'uint64'
|
138
|
+
| 'sint32' | 'sint64' | 'fixed32' | 'fixed64' | 'sfixed32' | 'sfixed64'
|
139
|
+
| 'bool' | 'string' | 'bytes' | user_type
|
140
|
+
|
141
|
+
user_type : IDENT dot_ident_list
|
142
|
+
{ result = val[1].unshift(val[0]) }
|
143
|
+
| '.' IDENT dot_ident_list
|
144
|
+
{ result = val[1].unshift(val[0]) }
|
145
|
+
|
146
|
+
constant : IDENT
|
147
|
+
| integer_literal
|
148
|
+
| FLOAT_LITERAL
|
149
|
+
| STRING_LITERAL
|
150
|
+
| BOOLEAN_LITERAL
|
151
|
+
|
152
|
+
integer_literal : DEC_INTEGER
|
153
|
+
| HEX_INTEGER
|
154
|
+
| OCT_INTEGER
|
155
|
+
end
|
156
|
+
|
157
|
+
---- inner
|
158
|
+
|
159
|
+
require 'strscan'
|
160
|
+
|
161
|
+
def parse(f)
|
162
|
+
@scanner = StringScanner.new(f.read)
|
163
|
+
yyparse(self, :scan)
|
164
|
+
end
|
165
|
+
|
166
|
+
def scan_debug
|
167
|
+
scan do |token, value|
|
168
|
+
p [token, value]
|
169
|
+
yield [token, value]
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
def scan
|
174
|
+
until @scanner.eos?
|
175
|
+
case
|
176
|
+
when match(/\s+/, /\/\/.*/)
|
177
|
+
# skip
|
178
|
+
when match(/\/\*/)
|
179
|
+
# C-like comment
|
180
|
+
raise 'EOF inside block comment' until @scanner.scan_until(/\*\//)
|
181
|
+
when match(/(?:required|optional|repeated|import|package|option|message|extend|enum|service|rpc|returns|group|default|extensions|to|max|double|float|int32|int64|uint32|uint64|sint32|sint64|fixed32|fixed64|sfixed32|sfixed64|bool|string|bytes)\b/)
|
182
|
+
yield [@token, @token.to_sym]
|
183
|
+
when match(/[+-]?\d*\.\d+([Ee][\+-]?\d+)?/)
|
184
|
+
yield [:FLOAT_LITERAL, @token.to_f]
|
185
|
+
when match(/[+-]?[1-9]\d*(?!\.)/, /0(?![.xX0-9])/)
|
186
|
+
yield [:DEC_INTEGER, @token.to_i]
|
187
|
+
when match(/0[xX]([A-Fa-f0-9])+/)
|
188
|
+
yield [:HEX_INTEGER, @token.to_i(0)]
|
189
|
+
when match(/0[0-7]+/)
|
190
|
+
yield [:OCT_INTEGER, @token.to_i(0)]
|
191
|
+
when match(/(true|false)\b/)
|
192
|
+
yield [:BOOLEAN_LITERAL, @token == 'true']
|
193
|
+
when match(/"(?:[^"\\]+|\\.)*"/, /'(?:[^'\\]+|\\.)*'/)
|
194
|
+
yield [:STRING_LITERAL, eval(@token)]
|
195
|
+
when match(/[a-zA-Z_]\w*/)
|
196
|
+
yield [:IDENT, @token.to_sym]
|
197
|
+
when match(/[A-Z]\w*/)
|
198
|
+
yield [:CAMEL_IDENT, @token.to_sym]
|
199
|
+
when match(/./)
|
200
|
+
yield [@token, @token]
|
201
|
+
else
|
202
|
+
raise "parse error around #{@scanner.string[@scanner.pos, 32].inspect}"
|
203
|
+
end
|
204
|
+
end
|
205
|
+
yield [false, nil]
|
206
|
+
end
|
207
|
+
|
208
|
+
def match(*regular_expressions)
|
209
|
+
regular_expressions.each do |re|
|
210
|
+
if @scanner.scan(re)
|
211
|
+
@token = @scanner[0]
|
212
|
+
return true
|
213
|
+
end
|
214
|
+
end
|
215
|
+
false
|
216
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# See: http://groups.google.com/group/protobuf/browse_thread/thread/1cccfc624cd612da
|
2
|
+
|
3
|
+
proto ::= ( message | extend | enum | import | package | option | ";" )*
|
4
|
+
|
5
|
+
import ::= "import" strLit ";"
|
6
|
+
|
7
|
+
package ::= "package" ident ( "." ident )* ";"
|
8
|
+
|
9
|
+
option ::= "option" optionBody ";"
|
10
|
+
|
11
|
+
optionBody ::= ident ( "." ident )* "=" constant
|
12
|
+
|
13
|
+
message ::= "message" ident messageBody
|
14
|
+
|
15
|
+
extend ::= "extend" userType "{" ( field | group | ";" )* "}"
|
16
|
+
|
17
|
+
enum ::= "enum" ident "{" ( option | enumField | ";" )* "}"
|
18
|
+
|
19
|
+
enumField ::= ident "=" intLit ";"
|
20
|
+
|
21
|
+
service ::= "service" ident "{" ( option | rpc | ";" )* "}"
|
22
|
+
|
23
|
+
rpc ::= "rpc" ident "(" userType ")" "returns" "(" userType ")" ";"
|
24
|
+
|
25
|
+
messageBody ::= "{" ( field | enum | message | extend | extensions | group | option | ":" )* "}"
|
26
|
+
|
27
|
+
group ::= label "group" camelIdent "=" intLit messageBody
|
28
|
+
|
29
|
+
field ::= label type ident "=" intLit ( "[" fieldOption ( "," fieldOption )* "]" )? ";"
|
30
|
+
# tag number must be 2^29-1 or lower, not 0, and not 19000-19999 (reserved)
|
31
|
+
|
32
|
+
fieldOption ::= optionBody | "default" "=" constant
|
33
|
+
|
34
|
+
# extension numbers must not overlap with field or other extension numbers
|
35
|
+
extensions ::= "extensions" extension ( "," extension )* ";"
|
36
|
+
|
37
|
+
extension ::= intLit ( "to" ( intLit | "max" ) )?
|
38
|
+
|
39
|
+
label ::= "required" | "optional" | "repeated"
|
40
|
+
|
41
|
+
type ::= "double" | "float" | "int32" | "int64" | "uint32" | "uint64"
|
42
|
+
| "sint32" | "sint64" | "fixed32" | "fixed64" | "sfixed32" | "sfixed64"
|
43
|
+
| "bool" | "string" | "bytes" | userType
|
44
|
+
|
45
|
+
# leading dot for identifiers means they're fully qualified
|
46
|
+
userType ::= "."? ident ( "." ident )*
|
47
|
+
|
48
|
+
constant ::= ident | intLit | floatLit | strLit | boolLit
|
49
|
+
|
50
|
+
ident ::= /[A-Za-z_][\w_]*/
|
51
|
+
|
52
|
+
# according to parser.cc, group names must start with a capital letter as a
|
53
|
+
# hack for backwards-compatibility
|
54
|
+
camelIdent ::= /[A-Z][\w_]*/
|
55
|
+
|
56
|
+
intLit ::= decInt | hexInt | octInt
|
57
|
+
|
58
|
+
decInt ::= /[1-9]\d*/
|
59
|
+
|
60
|
+
hexInt ::= /0[xX]([A-Fa-f0-9])+/
|
61
|
+
|
62
|
+
octInt ::= /0[0-7]+/
|
63
|
+
|
64
|
+
# allow_f_after_float_ is disabled by default in tokenizer.cc
|
65
|
+
floatLit ::= /\d+(\.\d+)?([Ee][\+-]?\d+)?/
|
66
|
+
|
67
|
+
boolLit ::= "true" | "false"
|
68
|
+
|
69
|
+
# contents must not contain unescaped quote character
|
70
|
+
strLit ::= quote ( hexEscape | octEscape | charEscape | /[^\0\n]/ )* quote
|
71
|
+
|
72
|
+
quote ::= /["']/
|
73
|
+
|
74
|
+
hexEscape ::= /\\[Xx][A-Fa-f0-9]{1,2}/
|
75
|
+
|
76
|
+
octEscape ::= /\\0?[0-7]{1,3}/
|
77
|
+
|
78
|
+
charEscape ::= /\\[abfnrtv\\\?'"]/
|
79
|
+
|
@@ -0,0 +1,1425 @@
|
|
1
|
+
#
|
2
|
+
# DO NOT MODIFY!!!!
|
3
|
+
# This file is automatically generated by racc 1.4.5
|
4
|
+
# from racc grammer file "lib/protobuf/compiler/proto.y".
|
5
|
+
#
|
6
|
+
#
|
7
|
+
# lib/protobuf/compiler/proto_parser.rb: generated by racc (runtime embedded)
|
8
|
+
#
|
9
|
+
###### racc/parser.rb begin
|
10
|
+
unless $".index 'racc/parser.rb'
|
11
|
+
$".push 'racc/parser.rb'
|
12
|
+
|
13
|
+
self.class.module_eval <<'..end racc/parser.rb modeval..id24fd9e97a6', 'racc/parser.rb', 1
|
14
|
+
#
|
15
|
+
# $Id: parser.rb,v 1.7 2005/11/20 17:31:32 aamine Exp $
|
16
|
+
#
|
17
|
+
# Copyright (c) 1999-2005 Minero Aoki
|
18
|
+
#
|
19
|
+
# This program is free software.
|
20
|
+
# You can distribute/modify this program under the same terms of ruby.
|
21
|
+
#
|
22
|
+
# As a special exception, when this code is copied by Racc
|
23
|
+
# into a Racc output file, you may use that output file
|
24
|
+
# without restriction.
|
25
|
+
#
|
26
|
+
|
27
|
+
unless defined?(NotImplementedError)
|
28
|
+
NotImplementedError = NotImplementError
|
29
|
+
end
|
30
|
+
|
31
|
+
module Racc
|
32
|
+
class ParseError < StandardError; end
|
33
|
+
end
|
34
|
+
unless defined?(::ParseError)
|
35
|
+
ParseError = Racc::ParseError
|
36
|
+
end
|
37
|
+
|
38
|
+
module Racc
|
39
|
+
|
40
|
+
unless defined?(Racc_No_Extentions)
|
41
|
+
Racc_No_Extentions = false
|
42
|
+
end
|
43
|
+
|
44
|
+
class Parser
|
45
|
+
|
46
|
+
Racc_Runtime_Version = '1.4.5'
|
47
|
+
Racc_Runtime_Revision = '$Revision: 1.7 $'.split[1]
|
48
|
+
|
49
|
+
Racc_Runtime_Core_Version_R = '1.4.5'
|
50
|
+
Racc_Runtime_Core_Revision_R = '$Revision: 1.7 $'.split[1]
|
51
|
+
begin
|
52
|
+
require 'racc/cparse'
|
53
|
+
# Racc_Runtime_Core_Version_C = (defined in extention)
|
54
|
+
Racc_Runtime_Core_Revision_C = Racc_Runtime_Core_Id_C.split[2]
|
55
|
+
unless new.respond_to?(:_racc_do_parse_c, true)
|
56
|
+
raise LoadError, 'old cparse.so'
|
57
|
+
end
|
58
|
+
if Racc_No_Extentions
|
59
|
+
raise LoadError, 'selecting ruby version of racc runtime core'
|
60
|
+
end
|
61
|
+
|
62
|
+
Racc_Main_Parsing_Routine = :_racc_do_parse_c
|
63
|
+
Racc_YY_Parse_Method = :_racc_yyparse_c
|
64
|
+
Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_C
|
65
|
+
Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_C
|
66
|
+
Racc_Runtime_Type = 'c'
|
67
|
+
rescue LoadError
|
68
|
+
$stderr.puts $!
|
69
|
+
Racc_Main_Parsing_Routine = :_racc_do_parse_rb
|
70
|
+
Racc_YY_Parse_Method = :_racc_yyparse_rb
|
71
|
+
Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_R
|
72
|
+
Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_R
|
73
|
+
Racc_Runtime_Type = 'ruby'
|
74
|
+
end
|
75
|
+
|
76
|
+
def Parser.racc_runtime_type
|
77
|
+
Racc_Runtime_Type
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def _racc_setup
|
83
|
+
@yydebug = false unless self.class::Racc_debug_parser
|
84
|
+
@yydebug = false unless defined?(@yydebug)
|
85
|
+
if @yydebug
|
86
|
+
@racc_debug_out = $stderr unless defined?(@racc_debug_out)
|
87
|
+
@racc_debug_out ||= $stderr
|
88
|
+
end
|
89
|
+
arg = self.class::Racc_arg
|
90
|
+
arg[13] = true if arg.size < 14
|
91
|
+
arg
|
92
|
+
end
|
93
|
+
|
94
|
+
def _racc_init_sysvars
|
95
|
+
@racc_state = [0]
|
96
|
+
@racc_tstack = []
|
97
|
+
@racc_vstack = []
|
98
|
+
|
99
|
+
@racc_t = nil
|
100
|
+
@racc_val = nil
|
101
|
+
|
102
|
+
@racc_read_next = true
|
103
|
+
|
104
|
+
@racc_user_yyerror = false
|
105
|
+
@racc_error_status = 0
|
106
|
+
end
|
107
|
+
|
108
|
+
###
|
109
|
+
### do_parse
|
110
|
+
###
|
111
|
+
|
112
|
+
def do_parse
|
113
|
+
__send__(Racc_Main_Parsing_Routine, _racc_setup(), false)
|
114
|
+
end
|
115
|
+
|
116
|
+
def next_token
|
117
|
+
raise NotImplementedError, "#{self.class}\#next_token is not defined"
|
118
|
+
end
|
119
|
+
|
120
|
+
def _racc_do_parse_rb(arg, in_debug)
|
121
|
+
action_table, action_check, action_default, action_pointer,
|
122
|
+
goto_table, goto_check, goto_default, goto_pointer,
|
123
|
+
nt_base, reduce_table, token_table, shift_n,
|
124
|
+
reduce_n, use_result, * = arg
|
125
|
+
|
126
|
+
_racc_init_sysvars
|
127
|
+
tok = act = i = nil
|
128
|
+
nerr = 0
|
129
|
+
|
130
|
+
catch(:racc_end_parse) {
|
131
|
+
while true
|
132
|
+
if i = action_pointer[@racc_state[-1]]
|
133
|
+
if @racc_read_next
|
134
|
+
if @racc_t != 0 # not EOF
|
135
|
+
tok, @racc_val = next_token()
|
136
|
+
unless tok # EOF
|
137
|
+
@racc_t = 0
|
138
|
+
else
|
139
|
+
@racc_t = (token_table[tok] or 1) # error token
|
140
|
+
end
|
141
|
+
racc_read_token(@racc_t, tok, @racc_val) if @yydebug
|
142
|
+
@racc_read_next = false
|
143
|
+
end
|
144
|
+
end
|
145
|
+
i += @racc_t
|
146
|
+
unless i >= 0 and
|
147
|
+
act = action_table[i] and
|
148
|
+
action_check[i] == @racc_state[-1]
|
149
|
+
act = action_default[@racc_state[-1]]
|
150
|
+
end
|
151
|
+
else
|
152
|
+
act = action_default[@racc_state[-1]]
|
153
|
+
end
|
154
|
+
while act = _racc_evalact(act, arg)
|
155
|
+
;
|
156
|
+
end
|
157
|
+
end
|
158
|
+
}
|
159
|
+
end
|
160
|
+
|
161
|
+
###
|
162
|
+
### yyparse
|
163
|
+
###
|
164
|
+
|
165
|
+
def yyparse(recv, mid)
|
166
|
+
__send__(Racc_YY_Parse_Method, recv, mid, _racc_setup(), true)
|
167
|
+
end
|
168
|
+
|
169
|
+
def _racc_yyparse_rb(recv, mid, arg, c_debug)
|
170
|
+
action_table, action_check, action_default, action_pointer,
|
171
|
+
goto_table, goto_check, goto_default, goto_pointer,
|
172
|
+
nt_base, reduce_table, token_table, shift_n,
|
173
|
+
reduce_n, use_result, * = arg
|
174
|
+
|
175
|
+
_racc_init_sysvars
|
176
|
+
tok = nil
|
177
|
+
act = nil
|
178
|
+
i = nil
|
179
|
+
nerr = 0
|
180
|
+
|
181
|
+
catch(:racc_end_parse) {
|
182
|
+
until i = action_pointer[@racc_state[-1]]
|
183
|
+
while act = _racc_evalact(action_default[@racc_state[-1]], arg)
|
184
|
+
;
|
185
|
+
end
|
186
|
+
end
|
187
|
+
recv.__send__(mid) do |tok, val|
|
188
|
+
unless tok
|
189
|
+
@racc_t = 0
|
190
|
+
else
|
191
|
+
@racc_t = (token_table[tok] or 1) # error token
|
192
|
+
end
|
193
|
+
@racc_val = val
|
194
|
+
@racc_read_next = false
|
195
|
+
|
196
|
+
i += @racc_t
|
197
|
+
unless i >= 0 and
|
198
|
+
act = action_table[i] and
|
199
|
+
action_check[i] == @racc_state[-1]
|
200
|
+
act = action_default[@racc_state[-1]]
|
201
|
+
end
|
202
|
+
while act = _racc_evalact(act, arg)
|
203
|
+
;
|
204
|
+
end
|
205
|
+
|
206
|
+
while not (i = action_pointer[@racc_state[-1]]) or
|
207
|
+
not @racc_read_next or
|
208
|
+
@racc_t == 0 # $
|
209
|
+
unless i and i += @racc_t and
|
210
|
+
i >= 0 and
|
211
|
+
act = action_table[i] and
|
212
|
+
action_check[i] == @racc_state[-1]
|
213
|
+
act = action_default[@racc_state[-1]]
|
214
|
+
end
|
215
|
+
while act = _racc_evalact(act, arg)
|
216
|
+
;
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
}
|
221
|
+
end
|
222
|
+
|
223
|
+
###
|
224
|
+
### common
|
225
|
+
###
|
226
|
+
|
227
|
+
def _racc_evalact(act, arg)
|
228
|
+
action_table, action_check, action_default, action_pointer,
|
229
|
+
goto_table, goto_check, goto_default, goto_pointer,
|
230
|
+
nt_base, reduce_table, token_table, shift_n,
|
231
|
+
reduce_n, use_result, * = arg
|
232
|
+
nerr = 0 # tmp
|
233
|
+
|
234
|
+
if act > 0 and act < shift_n
|
235
|
+
#
|
236
|
+
# shift
|
237
|
+
#
|
238
|
+
if @racc_error_status > 0
|
239
|
+
@racc_error_status -= 1 unless @racc_t == 1 # error token
|
240
|
+
end
|
241
|
+
@racc_vstack.push @racc_val
|
242
|
+
@racc_state.push act
|
243
|
+
@racc_read_next = true
|
244
|
+
if @yydebug
|
245
|
+
@racc_tstack.push @racc_t
|
246
|
+
racc_shift @racc_t, @racc_tstack, @racc_vstack
|
247
|
+
end
|
248
|
+
|
249
|
+
elsif act < 0 and act > -reduce_n
|
250
|
+
#
|
251
|
+
# reduce
|
252
|
+
#
|
253
|
+
code = catch(:racc_jump) {
|
254
|
+
@racc_state.push _racc_do_reduce(arg, act)
|
255
|
+
false
|
256
|
+
}
|
257
|
+
if code
|
258
|
+
case code
|
259
|
+
when 1 # yyerror
|
260
|
+
@racc_user_yyerror = true # user_yyerror
|
261
|
+
return -reduce_n
|
262
|
+
when 2 # yyaccept
|
263
|
+
return shift_n
|
264
|
+
else
|
265
|
+
raise '[Racc Bug] unknown jump code'
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
elsif act == shift_n
|
270
|
+
#
|
271
|
+
# accept
|
272
|
+
#
|
273
|
+
racc_accept if @yydebug
|
274
|
+
throw :racc_end_parse, @racc_vstack[0]
|
275
|
+
|
276
|
+
elsif act == -reduce_n
|
277
|
+
#
|
278
|
+
# error
|
279
|
+
#
|
280
|
+
case @racc_error_status
|
281
|
+
when 0
|
282
|
+
unless arg[21] # user_yyerror
|
283
|
+
nerr += 1
|
284
|
+
on_error @racc_t, @racc_val, @racc_vstack
|
285
|
+
end
|
286
|
+
when 3
|
287
|
+
if @racc_t == 0 # is $
|
288
|
+
throw :racc_end_parse, nil
|
289
|
+
end
|
290
|
+
@racc_read_next = true
|
291
|
+
end
|
292
|
+
@racc_user_yyerror = false
|
293
|
+
@racc_error_status = 3
|
294
|
+
while true
|
295
|
+
if i = action_pointer[@racc_state[-1]]
|
296
|
+
i += 1 # error token
|
297
|
+
if i >= 0 and
|
298
|
+
(act = action_table[i]) and
|
299
|
+
action_check[i] == @racc_state[-1]
|
300
|
+
break
|
301
|
+
end
|
302
|
+
end
|
303
|
+
throw :racc_end_parse, nil if @racc_state.size <= 1
|
304
|
+
@racc_state.pop
|
305
|
+
@racc_vstack.pop
|
306
|
+
if @yydebug
|
307
|
+
@racc_tstack.pop
|
308
|
+
racc_e_pop @racc_state, @racc_tstack, @racc_vstack
|
309
|
+
end
|
310
|
+
end
|
311
|
+
return act
|
312
|
+
|
313
|
+
else
|
314
|
+
raise "[Racc Bug] unknown action #{act.inspect}"
|
315
|
+
end
|
316
|
+
|
317
|
+
racc_next_state(@racc_state[-1], @racc_state) if @yydebug
|
318
|
+
|
319
|
+
nil
|
320
|
+
end
|
321
|
+
|
322
|
+
def _racc_do_reduce(arg, act)
|
323
|
+
action_table, action_check, action_default, action_pointer,
|
324
|
+
goto_table, goto_check, goto_default, goto_pointer,
|
325
|
+
nt_base, reduce_table, token_table, shift_n,
|
326
|
+
reduce_n, use_result, * = arg
|
327
|
+
state = @racc_state
|
328
|
+
vstack = @racc_vstack
|
329
|
+
tstack = @racc_tstack
|
330
|
+
|
331
|
+
i = act * -3
|
332
|
+
len = reduce_table[i]
|
333
|
+
reduce_to = reduce_table[i+1]
|
334
|
+
method_id = reduce_table[i+2]
|
335
|
+
void_array = []
|
336
|
+
|
337
|
+
tmp_t = tstack[-len, len] if @yydebug
|
338
|
+
tmp_v = vstack[-len, len]
|
339
|
+
tstack[-len, len] = void_array if @yydebug
|
340
|
+
vstack[-len, len] = void_array
|
341
|
+
state[-len, len] = void_array
|
342
|
+
|
343
|
+
# tstack must be updated AFTER method call
|
344
|
+
if use_result
|
345
|
+
vstack.push __send__(method_id, tmp_v, vstack, tmp_v[0])
|
346
|
+
else
|
347
|
+
vstack.push __send__(method_id, tmp_v, vstack)
|
348
|
+
end
|
349
|
+
tstack.push reduce_to
|
350
|
+
|
351
|
+
racc_reduce(tmp_t, reduce_to, tstack, vstack) if @yydebug
|
352
|
+
|
353
|
+
k1 = reduce_to - nt_base
|
354
|
+
if i = goto_pointer[k1]
|
355
|
+
i += state[-1]
|
356
|
+
if i >= 0 and (curstate = goto_table[i]) and goto_check[i] == k1
|
357
|
+
return curstate
|
358
|
+
end
|
359
|
+
end
|
360
|
+
goto_default[k1]
|
361
|
+
end
|
362
|
+
|
363
|
+
def on_error(t, val, vstack)
|
364
|
+
raise ParseError, sprintf("\nparse error on value %s (%s)",
|
365
|
+
val.inspect, token_to_str(t) || '?')
|
366
|
+
end
|
367
|
+
|
368
|
+
def yyerror
|
369
|
+
throw :racc_jump, 1
|
370
|
+
end
|
371
|
+
|
372
|
+
def yyaccept
|
373
|
+
throw :racc_jump, 2
|
374
|
+
end
|
375
|
+
|
376
|
+
def yyerrok
|
377
|
+
@racc_error_status = 0
|
378
|
+
end
|
379
|
+
|
380
|
+
#
|
381
|
+
# for debugging output
|
382
|
+
#
|
383
|
+
|
384
|
+
def racc_read_token(t, tok, val)
|
385
|
+
@racc_debug_out.print 'read '
|
386
|
+
@racc_debug_out.print tok.inspect, '(', racc_token2str(t), ') '
|
387
|
+
@racc_debug_out.puts val.inspect
|
388
|
+
@racc_debug_out.puts
|
389
|
+
end
|
390
|
+
|
391
|
+
def racc_shift(tok, tstack, vstack)
|
392
|
+
@racc_debug_out.puts "shift #{racc_token2str tok}"
|
393
|
+
racc_print_stacks tstack, vstack
|
394
|
+
@racc_debug_out.puts
|
395
|
+
end
|
396
|
+
|
397
|
+
def racc_reduce(toks, sim, tstack, vstack)
|
398
|
+
out = @racc_debug_out
|
399
|
+
out.print 'reduce '
|
400
|
+
if toks.empty?
|
401
|
+
out.print ' <none>'
|
402
|
+
else
|
403
|
+
toks.each {|t| out.print ' ', racc_token2str(t) }
|
404
|
+
end
|
405
|
+
out.puts " --> #{racc_token2str(sim)}"
|
406
|
+
|
407
|
+
racc_print_stacks tstack, vstack
|
408
|
+
@racc_debug_out.puts
|
409
|
+
end
|
410
|
+
|
411
|
+
def racc_accept
|
412
|
+
@racc_debug_out.puts 'accept'
|
413
|
+
@racc_debug_out.puts
|
414
|
+
end
|
415
|
+
|
416
|
+
def racc_e_pop(state, tstack, vstack)
|
417
|
+
@racc_debug_out.puts 'error recovering mode: pop token'
|
418
|
+
racc_print_states state
|
419
|
+
racc_print_stacks tstack, vstack
|
420
|
+
@racc_debug_out.puts
|
421
|
+
end
|
422
|
+
|
423
|
+
def racc_next_state(curstate, state)
|
424
|
+
@racc_debug_out.puts "goto #{curstate}"
|
425
|
+
racc_print_states state
|
426
|
+
@racc_debug_out.puts
|
427
|
+
end
|
428
|
+
|
429
|
+
def racc_print_stacks(t, v)
|
430
|
+
out = @racc_debug_out
|
431
|
+
out.print ' ['
|
432
|
+
t.each_index do |i|
|
433
|
+
out.print ' (', racc_token2str(t[i]), ' ', v[i].inspect, ')'
|
434
|
+
end
|
435
|
+
out.puts ' ]'
|
436
|
+
end
|
437
|
+
|
438
|
+
def racc_print_states(s)
|
439
|
+
out = @racc_debug_out
|
440
|
+
out.print ' ['
|
441
|
+
s.each {|st| out.print ' ', st }
|
442
|
+
out.puts ' ]'
|
443
|
+
end
|
444
|
+
|
445
|
+
def racc_token2str(tok)
|
446
|
+
self.class::Racc_token_to_s_table[tok] or
|
447
|
+
raise "[Racc Bug] can't convert token #{tok} to string"
|
448
|
+
end
|
449
|
+
|
450
|
+
def token_to_str(t)
|
451
|
+
self.class::Racc_token_to_s_table[t]
|
452
|
+
end
|
453
|
+
|
454
|
+
end
|
455
|
+
|
456
|
+
end
|
457
|
+
..end racc/parser.rb modeval..id24fd9e97a6
|
458
|
+
end
|
459
|
+
###### racc/parser.rb end
|
460
|
+
|
461
|
+
|
462
|
+
module Protobuf
|
463
|
+
|
464
|
+
class ProtoParser < Racc::Parser
|
465
|
+
|
466
|
+
module_eval <<'..end lib/protobuf/compiler/proto.y modeval..id110d2bf917', 'lib/protobuf/compiler/proto.y', 158
|
467
|
+
|
468
|
+
require 'strscan'
|
469
|
+
|
470
|
+
def parse(f)
|
471
|
+
@scanner = StringScanner.new(f.read)
|
472
|
+
yyparse(self, :scan)
|
473
|
+
end
|
474
|
+
|
475
|
+
def scan_debug
|
476
|
+
scan do |token, value|
|
477
|
+
p [token, value]
|
478
|
+
yield [token, value]
|
479
|
+
end
|
480
|
+
end
|
481
|
+
|
482
|
+
def scan
|
483
|
+
until @scanner.eos?
|
484
|
+
case
|
485
|
+
when match(/\s+/, /\/\/.*/)
|
486
|
+
# skip
|
487
|
+
when match(/\/\*/)
|
488
|
+
# C-like comment
|
489
|
+
raise 'EOF inside block comment' until @scanner.scan_until(/\*\//)
|
490
|
+
when match(/(?:required|optional|repeated|import|package|option|message|extend|enum|service|rpc|returns|group|default|extensions|to|max|double|float|int32|int64|uint32|uint64|sint32|sint64|fixed32|fixed64|sfixed32|sfixed64|bool|string|bytes)\b/)
|
491
|
+
yield [@token, @token.to_sym]
|
492
|
+
when match(/[+-]?\d*\.\d+([Ee][\+-]?\d+)?/)
|
493
|
+
yield [:FLOAT_LITERAL, @token.to_f]
|
494
|
+
when match(/[+-]?[1-9]\d*(?!\.)/, /0(?![.xX0-9])/)
|
495
|
+
yield [:DEC_INTEGER, @token.to_i]
|
496
|
+
when match(/0[xX]([A-Fa-f0-9])+/)
|
497
|
+
yield [:HEX_INTEGER, @token.to_i(0)]
|
498
|
+
when match(/0[0-7]+/)
|
499
|
+
yield [:OCT_INTEGER, @token.to_i(0)]
|
500
|
+
when match(/(true|false)\b/)
|
501
|
+
yield [:BOOLEAN_LITERAL, @token == 'true']
|
502
|
+
when match(/"(?:[^"\\]+|\\.)*"/, /'(?:[^'\\]+|\\.)*'/)
|
503
|
+
yield [:STRING_LITERAL, eval(@token)]
|
504
|
+
when match(/[a-zA-Z_]\w*/)
|
505
|
+
yield [:IDENT, @token.to_sym]
|
506
|
+
when match(/[A-Z]\w*/)
|
507
|
+
yield [:CAMEL_IDENT, @token.to_sym]
|
508
|
+
when match(/./)
|
509
|
+
yield [@token, @token]
|
510
|
+
else
|
511
|
+
raise "parse error around #{@scanner.string[@scanner.pos, 32].inspect}"
|
512
|
+
end
|
513
|
+
end
|
514
|
+
yield [false, nil]
|
515
|
+
end
|
516
|
+
|
517
|
+
def match(*regular_expressions)
|
518
|
+
regular_expressions.each do |re|
|
519
|
+
if @scanner.scan(re)
|
520
|
+
@token = @scanner[0]
|
521
|
+
return true
|
522
|
+
end
|
523
|
+
end
|
524
|
+
false
|
525
|
+
end
|
526
|
+
..end lib/protobuf/compiler/proto.y modeval..id110d2bf917
|
527
|
+
|
528
|
+
##### racc 1.4.5 generates ###
|
529
|
+
|
530
|
+
racc_reduce_table = [
|
531
|
+
0, 0, :racc_error,
|
532
|
+
1, 53, :_reduce_1,
|
533
|
+
2, 53, :_reduce_2,
|
534
|
+
1, 54, :_reduce_none,
|
535
|
+
1, 54, :_reduce_none,
|
536
|
+
1, 54, :_reduce_none,
|
537
|
+
1, 54, :_reduce_none,
|
538
|
+
1, 54, :_reduce_none,
|
539
|
+
1, 54, :_reduce_none,
|
540
|
+
1, 54, :_reduce_none,
|
541
|
+
1, 54, :_reduce_10,
|
542
|
+
3, 58, :_reduce_11,
|
543
|
+
4, 59, :_reduce_12,
|
544
|
+
0, 62, :_reduce_13,
|
545
|
+
3, 62, :_reduce_14,
|
546
|
+
3, 60, :_reduce_15,
|
547
|
+
4, 63, :_reduce_16,
|
548
|
+
3, 55, :_reduce_17,
|
549
|
+
5, 56, :_reduce_18,
|
550
|
+
0, 67, :_reduce_19,
|
551
|
+
2, 67, :_reduce_20,
|
552
|
+
1, 68, :_reduce_none,
|
553
|
+
1, 68, :_reduce_none,
|
554
|
+
1, 68, :_reduce_23,
|
555
|
+
5, 57, :_reduce_24,
|
556
|
+
0, 71, :_reduce_25,
|
557
|
+
2, 71, :_reduce_26,
|
558
|
+
1, 72, :_reduce_none,
|
559
|
+
1, 72, :_reduce_none,
|
560
|
+
1, 72, :_reduce_29,
|
561
|
+
4, 73, :_reduce_30,
|
562
|
+
5, 61, :_reduce_31,
|
563
|
+
0, 75, :_reduce_32,
|
564
|
+
2, 75, :_reduce_33,
|
565
|
+
1, 76, :_reduce_none,
|
566
|
+
1, 76, :_reduce_none,
|
567
|
+
1, 76, :_reduce_36,
|
568
|
+
10, 77, :_reduce_37,
|
569
|
+
0, 78, :_reduce_none,
|
570
|
+
1, 78, :_reduce_none,
|
571
|
+
3, 65, :_reduce_40,
|
572
|
+
0, 79, :_reduce_41,
|
573
|
+
2, 79, :_reduce_42,
|
574
|
+
1, 80, :_reduce_none,
|
575
|
+
1, 80, :_reduce_none,
|
576
|
+
1, 80, :_reduce_none,
|
577
|
+
1, 80, :_reduce_none,
|
578
|
+
1, 80, :_reduce_none,
|
579
|
+
1, 80, :_reduce_none,
|
580
|
+
1, 80, :_reduce_none,
|
581
|
+
1, 80, :_reduce_50,
|
582
|
+
6, 70, :_reduce_51,
|
583
|
+
6, 69, :_reduce_52,
|
584
|
+
9, 69, :_reduce_53,
|
585
|
+
1, 84, :_reduce_none,
|
586
|
+
1, 84, :_reduce_none,
|
587
|
+
1, 84, :_reduce_none,
|
588
|
+
1, 84, :_reduce_none,
|
589
|
+
1, 84, :_reduce_none,
|
590
|
+
1, 84, :_reduce_none,
|
591
|
+
1, 84, :_reduce_none,
|
592
|
+
1, 84, :_reduce_none,
|
593
|
+
1, 84, :_reduce_none,
|
594
|
+
1, 84, :_reduce_none,
|
595
|
+
1, 84, :_reduce_none,
|
596
|
+
1, 84, :_reduce_none,
|
597
|
+
1, 84, :_reduce_none,
|
598
|
+
1, 84, :_reduce_none,
|
599
|
+
1, 84, :_reduce_none,
|
600
|
+
1, 84, :_reduce_none,
|
601
|
+
1, 84, :_reduce_none,
|
602
|
+
1, 84, :_reduce_none,
|
603
|
+
1, 84, :_reduce_none,
|
604
|
+
1, 84, :_reduce_none,
|
605
|
+
1, 84, :_reduce_none,
|
606
|
+
1, 84, :_reduce_none,
|
607
|
+
1, 84, :_reduce_none,
|
608
|
+
1, 84, :_reduce_none,
|
609
|
+
1, 84, :_reduce_none,
|
610
|
+
1, 84, :_reduce_none,
|
611
|
+
1, 84, :_reduce_none,
|
612
|
+
1, 84, :_reduce_none,
|
613
|
+
1, 84, :_reduce_none,
|
614
|
+
1, 84, :_reduce_none,
|
615
|
+
1, 84, :_reduce_none,
|
616
|
+
1, 84, :_reduce_none,
|
617
|
+
1, 84, :_reduce_none,
|
618
|
+
1, 85, :_reduce_87,
|
619
|
+
3, 85, :_reduce_88,
|
620
|
+
1, 86, :_reduce_none,
|
621
|
+
3, 86, :_reduce_90,
|
622
|
+
4, 81, :_reduce_91,
|
623
|
+
0, 88, :_reduce_92,
|
624
|
+
2, 88, :_reduce_93,
|
625
|
+
1, 87, :_reduce_94,
|
626
|
+
3, 87, :_reduce_95,
|
627
|
+
3, 87, :_reduce_96,
|
628
|
+
1, 82, :_reduce_none,
|
629
|
+
1, 82, :_reduce_none,
|
630
|
+
1, 82, :_reduce_none,
|
631
|
+
1, 83, :_reduce_none,
|
632
|
+
1, 83, :_reduce_none,
|
633
|
+
1, 83, :_reduce_none,
|
634
|
+
1, 83, :_reduce_none,
|
635
|
+
1, 83, :_reduce_none,
|
636
|
+
1, 83, :_reduce_none,
|
637
|
+
1, 83, :_reduce_none,
|
638
|
+
1, 83, :_reduce_none,
|
639
|
+
1, 83, :_reduce_none,
|
640
|
+
1, 83, :_reduce_none,
|
641
|
+
1, 83, :_reduce_none,
|
642
|
+
1, 83, :_reduce_none,
|
643
|
+
1, 83, :_reduce_none,
|
644
|
+
1, 83, :_reduce_none,
|
645
|
+
1, 83, :_reduce_none,
|
646
|
+
1, 83, :_reduce_none,
|
647
|
+
2, 66, :_reduce_116,
|
648
|
+
3, 66, :_reduce_117,
|
649
|
+
1, 64, :_reduce_none,
|
650
|
+
1, 64, :_reduce_none,
|
651
|
+
1, 64, :_reduce_none,
|
652
|
+
1, 64, :_reduce_none,
|
653
|
+
1, 64, :_reduce_none,
|
654
|
+
1, 74, :_reduce_none,
|
655
|
+
1, 74, :_reduce_none,
|
656
|
+
1, 74, :_reduce_none ]
|
657
|
+
|
658
|
+
racc_reduce_n = 126
|
659
|
+
|
660
|
+
racc_shift_n = 184
|
661
|
+
|
662
|
+
racc_action_table = [
|
663
|
+
74, 51, 77, 19, 20, 74, 25, 77, 67, 60,
|
664
|
+
32, 47, 53, 63, 14, 14, 43, 107, 39, 68,
|
665
|
+
61, 38, 69, 50, 54, 56, 110, 170, 106, 109,
|
666
|
+
94, 96, 97, 98, 99, 100, 101, 103, 104, 105,
|
667
|
+
108, 93, 95, 72, 73, 75, 76, 78, 72, 73,
|
668
|
+
75, 76, 78, 123, 111, 131, 134, 43, 141, 48,
|
669
|
+
147, 116, 19, 20, 122, 126, 130, 19, 20, 140,
|
670
|
+
144, 75, 76, 78, 120, 124, 127, 129, 133, 136,
|
671
|
+
139, 143, 146, 115, 118, 119, 121, 125, 128, 132,
|
672
|
+
135, 138, 142, 145, 114, 117, 83, 167, 176, 75,
|
673
|
+
76, 78, 14, 25, 16, 1, 159, 85, 6, 75,
|
674
|
+
76, 78, 75, 76, 78, 19, 20, 166, 50, 54,
|
675
|
+
56, 177, 91, 35, 170, 75, 76, 78, 27, 34,
|
676
|
+
4, 7, 148, 11, 33, 150, 14, 151, 16, 1,
|
677
|
+
153, 154, 6, 9, 4, 7, 155, 11, 156, 43,
|
678
|
+
14, 40, 16, 1, 161, 30, 6, 9, 75, 76,
|
679
|
+
78, 29, 25, 165, 24, 40, 169, 23, 174, 175,
|
680
|
+
22, 43, 21, 180, 59, 182, 183 ]
|
681
|
+
|
682
|
+
racc_action_check = [
|
683
|
+
48, 42, 48, 58, 58, 175, 177, 175, 46, 45,
|
684
|
+
20, 36, 42, 45, 46, 45, 36, 58, 27, 46,
|
685
|
+
45, 26, 46, 42, 42, 42, 63, 177, 58, 58,
|
686
|
+
58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
|
687
|
+
58, 58, 58, 48, 48, 48, 48, 48, 175, 175,
|
688
|
+
175, 175, 175, 102, 69, 102, 102, 37, 102, 37,
|
689
|
+
102, 102, 150, 150, 102, 102, 102, 1, 1, 102,
|
690
|
+
102, 91, 91, 91, 102, 102, 102, 102, 102, 102,
|
691
|
+
102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
|
692
|
+
102, 102, 102, 102, 102, 102, 49, 163, 172, 110,
|
693
|
+
110, 110, 49, 166, 49, 49, 151, 49, 49, 154,
|
694
|
+
154, 154, 153, 153, 153, 174, 174, 163, 49, 49,
|
695
|
+
49, 172, 49, 23, 166, 151, 151, 151, 15, 22,
|
696
|
+
15, 15, 107, 15, 21, 111, 15, 112, 15, 15,
|
697
|
+
113, 137, 15, 15, 0, 0, 148, 0, 149, 44,
|
698
|
+
0, 29, 0, 0, 152, 18, 0, 0, 155, 155,
|
699
|
+
155, 16, 14, 158, 11, 164, 165, 9, 169, 170,
|
700
|
+
7, 31, 6, 176, 43, 178, 182 ]
|
701
|
+
|
702
|
+
racc_action_pointer = [
|
703
|
+
142, 61, nil, nil, nil, nil, 166, 166, nil, 161,
|
704
|
+
nil, 158, nil, nil, 156, 128, 155, nil, 143, nil,
|
705
|
+
4, 122, 127, 111, nil, nil, 19, 18, nil, 139,
|
706
|
+
nil, 164, nil, nil, nil, nil, 9, 50, nil, nil,
|
707
|
+
nil, nil, -1, 168, 142, 7, 6, nil, -4, 94,
|
708
|
+
nil, nil, nil, nil, nil, nil, nil, nil, -3, nil,
|
709
|
+
nil, nil, nil, 17, nil, nil, nil, nil, nil, 48,
|
710
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
711
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
712
|
+
nil, 22, nil, nil, nil, nil, nil, nil, nil, nil,
|
713
|
+
nil, nil, 50, nil, nil, nil, nil, 111, nil, nil,
|
714
|
+
50, 118, 108, 94, nil, nil, nil, nil, nil, nil,
|
715
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
716
|
+
nil, nil, nil, nil, nil, nil, nil, 132, nil, nil,
|
717
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 137, 146,
|
718
|
+
56, 76, 152, 63, 60, 109, nil, nil, 145, nil,
|
719
|
+
nil, nil, nil, 95, 153, 147, 97, nil, nil, 151,
|
720
|
+
160, nil, 75, nil, 109, 1, 171, 0, 157, nil,
|
721
|
+
nil, nil, 174, nil ]
|
722
|
+
|
723
|
+
racc_action_default = [
|
724
|
+
-126, -126, -3, -4, -10, -5, -126, -126, -6, -126,
|
725
|
+
-7, -126, -8, -9, -126, -126, -126, -1, -126, -13,
|
726
|
+
-126, -126, -126, -126, -13, -13, -126, -126, -2, -126,
|
727
|
+
-19, -116, -13, -25, -11, -32, -126, -126, -15, 184,
|
728
|
+
-41, -17, -126, -126, -117, -126, -126, -12, -126, -126,
|
729
|
+
-97, -23, -20, -18, -98, -21, -99, -22, -126, -14,
|
730
|
+
-29, -24, -27, -126, -26, -28, -35, -36, -31, -126,
|
731
|
+
-34, -33, -120, -122, -121, -123, -124, -118, -125, -119,
|
732
|
+
-16, -45, -46, -50, -44, -40, -43, -42, -48, -47,
|
733
|
+
-49, -126, -115, -113, -102, -114, -103, -104, -105, -106,
|
734
|
+
-107, -108, -126, -109, -110, -111, -100, -126, -112, -101,
|
735
|
+
-126, -126, -94, -92, -85, -74, -62, -86, -75, -76,
|
736
|
+
-55, -77, -63, -58, -56, -78, -64, -57, -79, -68,
|
737
|
+
-65, -59, -80, -69, -54, -81, -70, -126, -82, -71,
|
738
|
+
-66, -60, -83, -72, -67, -84, -73, -61, -126, -126,
|
739
|
+
-38, -126, -126, -126, -126, -126, -30, -39, -126, -96,
|
740
|
+
-95, -91, -93, -126, -126, -126, -126, -52, -51, -126,
|
741
|
+
-126, -89, -126, -87, -38, -126, -126, -126, -126, -90,
|
742
|
+
-53, -88, -126, -37 ]
|
743
|
+
|
744
|
+
racc_goto_table = [
|
745
|
+
41, 80, 112, 18, 158, 113, 31, 17, 57, 173,
|
746
|
+
55, 36, 37, 64, 42, 88, 26, 86, 45, 44,
|
747
|
+
181, 149, 28, 62, 70, 52, 65, 90, 178, 84,
|
748
|
+
46, 71, 66, 82, 49, 87, 89, 102, 137, 172,
|
749
|
+
81, 15, 152, nil, nil, nil, nil, nil, nil, nil,
|
750
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
751
|
+
92, nil, 160, nil, 112, 163, 164, 162, nil, nil,
|
752
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
753
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
754
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
755
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
756
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
757
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 179, nil,
|
758
|
+
nil, nil, nil, nil, nil, 168 ]
|
759
|
+
|
760
|
+
racc_goto_check = [
|
761
|
+
13, 12, 22, 14, 26, 35, 10, 2, 18, 34,
|
762
|
+
17, 10, 10, 20, 15, 18, 11, 17, 19, 10,
|
763
|
+
34, 22, 2, 8, 8, 16, 21, 8, 26, 5,
|
764
|
+
23, 24, 25, 4, 27, 28, 29, 31, 32, 33,
|
765
|
+
3, 1, 36, nil, nil, nil, nil, nil, nil, nil,
|
766
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
767
|
+
14, nil, 22, nil, 22, 22, 22, 35, nil, nil,
|
768
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
769
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
770
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
771
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
772
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
773
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 12, nil,
|
774
|
+
nil, nil, nil, nil, nil, 13 ]
|
775
|
+
|
776
|
+
racc_goto_pointer = [
|
777
|
+
nil, 41, 7, -9, -16, -20, nil, nil, -22, nil,
|
778
|
+
-13, 2, -47, -29, 2, -16, -17, -32, -34, -15,
|
779
|
+
-32, -19, -89, -5, -15, -14, -146, -6, -14, -13,
|
780
|
+
nil, -21, -64, -127, -157, -86, -71 ]
|
781
|
+
|
782
|
+
racc_goto_default = [
|
783
|
+
nil, nil, nil, 2, 3, 5, 8, 10, 12, 13,
|
784
|
+
nil, 171, nil, nil, 157, nil, nil, nil, nil, nil,
|
785
|
+
nil, nil, 79, nil, nil, nil, nil, nil, nil, nil,
|
786
|
+
58, nil, nil, nil, nil, nil, nil ]
|
787
|
+
|
788
|
+
racc_token_table = {
|
789
|
+
false => 0,
|
790
|
+
Object.new => 1,
|
791
|
+
";" => 2,
|
792
|
+
"import" => 3,
|
793
|
+
:STRING_LITERAL => 4,
|
794
|
+
"package" => 5,
|
795
|
+
:IDENT => 6,
|
796
|
+
"." => 7,
|
797
|
+
"option" => 8,
|
798
|
+
"=" => 9,
|
799
|
+
"message" => 10,
|
800
|
+
"extend" => 11,
|
801
|
+
"{" => 12,
|
802
|
+
"}" => 13,
|
803
|
+
"enum" => 14,
|
804
|
+
"service" => 15,
|
805
|
+
"rpc" => 16,
|
806
|
+
"(" => 17,
|
807
|
+
")" => 18,
|
808
|
+
"returns" => 19,
|
809
|
+
"group" => 20,
|
810
|
+
:CAMEL_IDENT => 21,
|
811
|
+
"[" => 22,
|
812
|
+
"]" => 23,
|
813
|
+
"required" => 24,
|
814
|
+
"optional" => 25,
|
815
|
+
"repeated" => 26,
|
816
|
+
"default" => 27,
|
817
|
+
"extensions" => 28,
|
818
|
+
"to" => 29,
|
819
|
+
"max" => 30,
|
820
|
+
"double" => 31,
|
821
|
+
"float" => 32,
|
822
|
+
"int32" => 33,
|
823
|
+
"int64" => 34,
|
824
|
+
"uint32" => 35,
|
825
|
+
"uint64" => 36,
|
826
|
+
"sint32" => 37,
|
827
|
+
"sint64" => 38,
|
828
|
+
"fixed32" => 39,
|
829
|
+
"fixed64" => 40,
|
830
|
+
"sfixed32" => 41,
|
831
|
+
"sfixed64" => 42,
|
832
|
+
"bool" => 43,
|
833
|
+
"string" => 44,
|
834
|
+
"bytes" => 45,
|
835
|
+
"," => 46,
|
836
|
+
:FLOAT_LITERAL => 47,
|
837
|
+
:BOOLEAN_LITERAL => 48,
|
838
|
+
:DEC_INTEGER => 49,
|
839
|
+
:HEX_INTEGER => 50,
|
840
|
+
:OCT_INTEGER => 51 }
|
841
|
+
|
842
|
+
racc_use_result_var = true
|
843
|
+
|
844
|
+
racc_nt_base = 52
|
845
|
+
|
846
|
+
Racc_arg = [
|
847
|
+
racc_action_table,
|
848
|
+
racc_action_check,
|
849
|
+
racc_action_default,
|
850
|
+
racc_action_pointer,
|
851
|
+
racc_goto_table,
|
852
|
+
racc_goto_check,
|
853
|
+
racc_goto_default,
|
854
|
+
racc_goto_pointer,
|
855
|
+
racc_nt_base,
|
856
|
+
racc_reduce_table,
|
857
|
+
racc_token_table,
|
858
|
+
racc_shift_n,
|
859
|
+
racc_reduce_n,
|
860
|
+
racc_use_result_var ]
|
861
|
+
|
862
|
+
Racc_token_to_s_table = [
|
863
|
+
'$end',
|
864
|
+
'error',
|
865
|
+
'";"',
|
866
|
+
'"import"',
|
867
|
+
'STRING_LITERAL',
|
868
|
+
'"package"',
|
869
|
+
'IDENT',
|
870
|
+
'"."',
|
871
|
+
'"option"',
|
872
|
+
'"="',
|
873
|
+
'"message"',
|
874
|
+
'"extend"',
|
875
|
+
'"{"',
|
876
|
+
'"}"',
|
877
|
+
'"enum"',
|
878
|
+
'"service"',
|
879
|
+
'"rpc"',
|
880
|
+
'"("',
|
881
|
+
'")"',
|
882
|
+
'"returns"',
|
883
|
+
'"group"',
|
884
|
+
'CAMEL_IDENT',
|
885
|
+
'"["',
|
886
|
+
'"]"',
|
887
|
+
'"required"',
|
888
|
+
'"optional"',
|
889
|
+
'"repeated"',
|
890
|
+
'"default"',
|
891
|
+
'"extensions"',
|
892
|
+
'"to"',
|
893
|
+
'"max"',
|
894
|
+
'"double"',
|
895
|
+
'"float"',
|
896
|
+
'"int32"',
|
897
|
+
'"int64"',
|
898
|
+
'"uint32"',
|
899
|
+
'"uint64"',
|
900
|
+
'"sint32"',
|
901
|
+
'"sint64"',
|
902
|
+
'"fixed32"',
|
903
|
+
'"fixed64"',
|
904
|
+
'"sfixed32"',
|
905
|
+
'"sfixed64"',
|
906
|
+
'"bool"',
|
907
|
+
'"string"',
|
908
|
+
'"bytes"',
|
909
|
+
'","',
|
910
|
+
'FLOAT_LITERAL',
|
911
|
+
'BOOLEAN_LITERAL',
|
912
|
+
'DEC_INTEGER',
|
913
|
+
'HEX_INTEGER',
|
914
|
+
'OCT_INTEGER',
|
915
|
+
'$start',
|
916
|
+
'proto',
|
917
|
+
'proto_item',
|
918
|
+
'message',
|
919
|
+
'extend',
|
920
|
+
'enum',
|
921
|
+
'import',
|
922
|
+
'package',
|
923
|
+
'option',
|
924
|
+
'service',
|
925
|
+
'dot_ident_list',
|
926
|
+
'option_body',
|
927
|
+
'constant',
|
928
|
+
'message_body',
|
929
|
+
'user_type',
|
930
|
+
'extend_body_list',
|
931
|
+
'extend_body',
|
932
|
+
'field',
|
933
|
+
'group',
|
934
|
+
'enum_body_list',
|
935
|
+
'enum_body',
|
936
|
+
'enum_field',
|
937
|
+
'integer_literal',
|
938
|
+
'service_body_list',
|
939
|
+
'service_body',
|
940
|
+
'rpc',
|
941
|
+
'rpc_arg',
|
942
|
+
'message_body_body_list',
|
943
|
+
'message_body_body',
|
944
|
+
'extensions',
|
945
|
+
'label',
|
946
|
+
'type',
|
947
|
+
'field_name',
|
948
|
+
'field_option_list',
|
949
|
+
'field_option',
|
950
|
+
'extension',
|
951
|
+
'comma_extension_list']
|
952
|
+
|
953
|
+
Racc_debug_parser = false
|
954
|
+
|
955
|
+
##### racc system variables end #####
|
956
|
+
|
957
|
+
# reduce 0 omitted
|
958
|
+
|
959
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 3
|
960
|
+
def _reduce_1( val, _values, result )
|
961
|
+
result = Protobuf::Node::ProtoNode.new(val)
|
962
|
+
result
|
963
|
+
end
|
964
|
+
.,.,
|
965
|
+
|
966
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 5
|
967
|
+
def _reduce_2( val, _values, result )
|
968
|
+
result.children << val[1] if val[1]
|
969
|
+
result
|
970
|
+
end
|
971
|
+
.,.,
|
972
|
+
|
973
|
+
# reduce 3 omitted
|
974
|
+
|
975
|
+
# reduce 4 omitted
|
976
|
+
|
977
|
+
# reduce 5 omitted
|
978
|
+
|
979
|
+
# reduce 6 omitted
|
980
|
+
|
981
|
+
# reduce 7 omitted
|
982
|
+
|
983
|
+
# reduce 8 omitted
|
984
|
+
|
985
|
+
# reduce 9 omitted
|
986
|
+
|
987
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 14
|
988
|
+
def _reduce_10( val, _values, result )
|
989
|
+
result = nil
|
990
|
+
result
|
991
|
+
end
|
992
|
+
.,.,
|
993
|
+
|
994
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 17
|
995
|
+
def _reduce_11( val, _values, result )
|
996
|
+
result = Protobuf::Node::ImportNode.new(val[1])
|
997
|
+
result
|
998
|
+
end
|
999
|
+
.,.,
|
1000
|
+
|
1001
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 20
|
1002
|
+
def _reduce_12( val, _values, result )
|
1003
|
+
result = Protobuf::Node::PackageNode.new(val[2].unshift(val[1]))
|
1004
|
+
result
|
1005
|
+
end
|
1006
|
+
.,.,
|
1007
|
+
|
1008
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 23
|
1009
|
+
def _reduce_13( val, _values, result )
|
1010
|
+
result = []
|
1011
|
+
result
|
1012
|
+
end
|
1013
|
+
.,.,
|
1014
|
+
|
1015
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 25
|
1016
|
+
def _reduce_14( val, _values, result )
|
1017
|
+
result << val[2]
|
1018
|
+
result
|
1019
|
+
end
|
1020
|
+
.,.,
|
1021
|
+
|
1022
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 28
|
1023
|
+
def _reduce_15( val, _values, result )
|
1024
|
+
result = Protobuf::Node::OptionNode.new(*val[1])
|
1025
|
+
result
|
1026
|
+
end
|
1027
|
+
.,.,
|
1028
|
+
|
1029
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 31
|
1030
|
+
def _reduce_16( val, _values, result )
|
1031
|
+
result = [val[1].unshift(val[0]), val[3]]
|
1032
|
+
result
|
1033
|
+
end
|
1034
|
+
.,.,
|
1035
|
+
|
1036
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 34
|
1037
|
+
def _reduce_17( val, _values, result )
|
1038
|
+
result = Protobuf::Node::MessageNode.new(val[1], val[2])
|
1039
|
+
result
|
1040
|
+
end
|
1041
|
+
.,.,
|
1042
|
+
|
1043
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 37
|
1044
|
+
def _reduce_18( val, _values, result )
|
1045
|
+
result = Protobuf::Node::ExtendNode.new(val[1], val[3])
|
1046
|
+
result
|
1047
|
+
end
|
1048
|
+
.,.,
|
1049
|
+
|
1050
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 40
|
1051
|
+
def _reduce_19( val, _values, result )
|
1052
|
+
result = []
|
1053
|
+
result
|
1054
|
+
end
|
1055
|
+
.,.,
|
1056
|
+
|
1057
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 42
|
1058
|
+
def _reduce_20( val, _values, result )
|
1059
|
+
result << val[1] if val[1]
|
1060
|
+
result
|
1061
|
+
end
|
1062
|
+
.,.,
|
1063
|
+
|
1064
|
+
# reduce 21 omitted
|
1065
|
+
|
1066
|
+
# reduce 22 omitted
|
1067
|
+
|
1068
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 46
|
1069
|
+
def _reduce_23( val, _values, result )
|
1070
|
+
result = nil
|
1071
|
+
result
|
1072
|
+
end
|
1073
|
+
.,.,
|
1074
|
+
|
1075
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 49
|
1076
|
+
def _reduce_24( val, _values, result )
|
1077
|
+
result = Protobuf::Node::EnumNode.new(val[1], val[3])
|
1078
|
+
result
|
1079
|
+
end
|
1080
|
+
.,.,
|
1081
|
+
|
1082
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 52
|
1083
|
+
def _reduce_25( val, _values, result )
|
1084
|
+
result = []
|
1085
|
+
result
|
1086
|
+
end
|
1087
|
+
.,.,
|
1088
|
+
|
1089
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 54
|
1090
|
+
def _reduce_26( val, _values, result )
|
1091
|
+
result << val[1] if val[1]
|
1092
|
+
result
|
1093
|
+
end
|
1094
|
+
.,.,
|
1095
|
+
|
1096
|
+
# reduce 27 omitted
|
1097
|
+
|
1098
|
+
# reduce 28 omitted
|
1099
|
+
|
1100
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 58
|
1101
|
+
def _reduce_29( val, _values, result )
|
1102
|
+
result = nil
|
1103
|
+
result
|
1104
|
+
end
|
1105
|
+
.,.,
|
1106
|
+
|
1107
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 61
|
1108
|
+
def _reduce_30( val, _values, result )
|
1109
|
+
result = Protobuf::Node::EnumFieldNode.new(val[0], val[2])
|
1110
|
+
result
|
1111
|
+
end
|
1112
|
+
.,.,
|
1113
|
+
|
1114
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 64
|
1115
|
+
def _reduce_31( val, _values, result )
|
1116
|
+
result = Protobuf::Node::ServiceNode.new(val[1], val[3])
|
1117
|
+
result
|
1118
|
+
end
|
1119
|
+
.,.,
|
1120
|
+
|
1121
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 67
|
1122
|
+
def _reduce_32( val, _values, result )
|
1123
|
+
result = []
|
1124
|
+
result
|
1125
|
+
end
|
1126
|
+
.,.,
|
1127
|
+
|
1128
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 69
|
1129
|
+
def _reduce_33( val, _values, result )
|
1130
|
+
result << val[1] if val[1]
|
1131
|
+
result
|
1132
|
+
end
|
1133
|
+
.,.,
|
1134
|
+
|
1135
|
+
# reduce 34 omitted
|
1136
|
+
|
1137
|
+
# reduce 35 omitted
|
1138
|
+
|
1139
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 73
|
1140
|
+
def _reduce_36( val, _values, result )
|
1141
|
+
result = nil
|
1142
|
+
result
|
1143
|
+
end
|
1144
|
+
.,.,
|
1145
|
+
|
1146
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 76
|
1147
|
+
def _reduce_37( val, _values, result )
|
1148
|
+
result = Protobuf::Node::RpcNode.new(val[1], val[3], val[7])
|
1149
|
+
result
|
1150
|
+
end
|
1151
|
+
.,.,
|
1152
|
+
|
1153
|
+
# reduce 38 omitted
|
1154
|
+
|
1155
|
+
# reduce 39 omitted
|
1156
|
+
|
1157
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 82
|
1158
|
+
def _reduce_40( val, _values, result )
|
1159
|
+
result = val[1]
|
1160
|
+
result
|
1161
|
+
end
|
1162
|
+
.,.,
|
1163
|
+
|
1164
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 85
|
1165
|
+
def _reduce_41( val, _values, result )
|
1166
|
+
result = []
|
1167
|
+
result
|
1168
|
+
end
|
1169
|
+
.,.,
|
1170
|
+
|
1171
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 87
|
1172
|
+
def _reduce_42( val, _values, result )
|
1173
|
+
result << val[1] if val[1]
|
1174
|
+
result
|
1175
|
+
end
|
1176
|
+
.,.,
|
1177
|
+
|
1178
|
+
# reduce 43 omitted
|
1179
|
+
|
1180
|
+
# reduce 44 omitted
|
1181
|
+
|
1182
|
+
# reduce 45 omitted
|
1183
|
+
|
1184
|
+
# reduce 46 omitted
|
1185
|
+
|
1186
|
+
# reduce 47 omitted
|
1187
|
+
|
1188
|
+
# reduce 48 omitted
|
1189
|
+
|
1190
|
+
# reduce 49 omitted
|
1191
|
+
|
1192
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 96
|
1193
|
+
def _reduce_50( val, _values, result )
|
1194
|
+
result = nil
|
1195
|
+
result
|
1196
|
+
end
|
1197
|
+
.,.,
|
1198
|
+
|
1199
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 99
|
1200
|
+
def _reduce_51( val, _values, result )
|
1201
|
+
result = Protobuf::Node::GroupNode.new(val[0], val[2], val[4], val[5])
|
1202
|
+
result
|
1203
|
+
end
|
1204
|
+
.,.,
|
1205
|
+
|
1206
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 102
|
1207
|
+
def _reduce_52( val, _values, result )
|
1208
|
+
result = Protobuf::Node::FieldNode.new(val[0], val[1], val[2], val[4])
|
1209
|
+
result
|
1210
|
+
end
|
1211
|
+
.,.,
|
1212
|
+
|
1213
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 104
|
1214
|
+
def _reduce_53( val, _values, result )
|
1215
|
+
result = Protobuf::Node::FieldNode.new(val[0], val[1], val[2], val[4], val[6])
|
1216
|
+
result
|
1217
|
+
end
|
1218
|
+
.,.,
|
1219
|
+
|
1220
|
+
# reduce 54 omitted
|
1221
|
+
|
1222
|
+
# reduce 55 omitted
|
1223
|
+
|
1224
|
+
# reduce 56 omitted
|
1225
|
+
|
1226
|
+
# reduce 57 omitted
|
1227
|
+
|
1228
|
+
# reduce 58 omitted
|
1229
|
+
|
1230
|
+
# reduce 59 omitted
|
1231
|
+
|
1232
|
+
# reduce 60 omitted
|
1233
|
+
|
1234
|
+
# reduce 61 omitted
|
1235
|
+
|
1236
|
+
# reduce 62 omitted
|
1237
|
+
|
1238
|
+
# reduce 63 omitted
|
1239
|
+
|
1240
|
+
# reduce 64 omitted
|
1241
|
+
|
1242
|
+
# reduce 65 omitted
|
1243
|
+
|
1244
|
+
# reduce 66 omitted
|
1245
|
+
|
1246
|
+
# reduce 67 omitted
|
1247
|
+
|
1248
|
+
# reduce 68 omitted
|
1249
|
+
|
1250
|
+
# reduce 69 omitted
|
1251
|
+
|
1252
|
+
# reduce 70 omitted
|
1253
|
+
|
1254
|
+
# reduce 71 omitted
|
1255
|
+
|
1256
|
+
# reduce 72 omitted
|
1257
|
+
|
1258
|
+
# reduce 73 omitted
|
1259
|
+
|
1260
|
+
# reduce 74 omitted
|
1261
|
+
|
1262
|
+
# reduce 75 omitted
|
1263
|
+
|
1264
|
+
# reduce 76 omitted
|
1265
|
+
|
1266
|
+
# reduce 77 omitted
|
1267
|
+
|
1268
|
+
# reduce 78 omitted
|
1269
|
+
|
1270
|
+
# reduce 79 omitted
|
1271
|
+
|
1272
|
+
# reduce 80 omitted
|
1273
|
+
|
1274
|
+
# reduce 81 omitted
|
1275
|
+
|
1276
|
+
# reduce 82 omitted
|
1277
|
+
|
1278
|
+
# reduce 83 omitted
|
1279
|
+
|
1280
|
+
# reduce 84 omitted
|
1281
|
+
|
1282
|
+
# reduce 85 omitted
|
1283
|
+
|
1284
|
+
# reduce 86 omitted
|
1285
|
+
|
1286
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 109
|
1287
|
+
def _reduce_87( val, _values, result )
|
1288
|
+
result = val
|
1289
|
+
result
|
1290
|
+
end
|
1291
|
+
.,.,
|
1292
|
+
|
1293
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 111
|
1294
|
+
def _reduce_88( val, _values, result )
|
1295
|
+
result << val[2]
|
1296
|
+
result
|
1297
|
+
end
|
1298
|
+
.,.,
|
1299
|
+
|
1300
|
+
# reduce 89 omitted
|
1301
|
+
|
1302
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 115
|
1303
|
+
def _reduce_90( val, _values, result )
|
1304
|
+
result = [:default, val[2]]
|
1305
|
+
result
|
1306
|
+
end
|
1307
|
+
.,.,
|
1308
|
+
|
1309
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 118
|
1310
|
+
def _reduce_91( val, _values, result )
|
1311
|
+
result = Protobuf::Node::ExtensionsNode.new(val[2].unshift(val[1]))
|
1312
|
+
result
|
1313
|
+
end
|
1314
|
+
.,.,
|
1315
|
+
|
1316
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 121
|
1317
|
+
def _reduce_92( val, _values, result )
|
1318
|
+
result = []
|
1319
|
+
result
|
1320
|
+
end
|
1321
|
+
.,.,
|
1322
|
+
|
1323
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 123
|
1324
|
+
def _reduce_93( val, _values, result )
|
1325
|
+
result << val[1]
|
1326
|
+
result
|
1327
|
+
end
|
1328
|
+
.,.,
|
1329
|
+
|
1330
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 126
|
1331
|
+
def _reduce_94( val, _values, result )
|
1332
|
+
result = Protobuf::Node::ExtensionRangeNode.new(val[0])
|
1333
|
+
result
|
1334
|
+
end
|
1335
|
+
.,.,
|
1336
|
+
|
1337
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 128
|
1338
|
+
def _reduce_95( val, _values, result )
|
1339
|
+
result = Protobuf::Node::ExtensionRangeNode.new(val[0], val[2])
|
1340
|
+
result
|
1341
|
+
end
|
1342
|
+
.,.,
|
1343
|
+
|
1344
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 130
|
1345
|
+
def _reduce_96( val, _values, result )
|
1346
|
+
result = Protobuf::Node::ExtensionRangeNode.new(val[0], :max)
|
1347
|
+
result
|
1348
|
+
end
|
1349
|
+
.,.,
|
1350
|
+
|
1351
|
+
# reduce 97 omitted
|
1352
|
+
|
1353
|
+
# reduce 98 omitted
|
1354
|
+
|
1355
|
+
# reduce 99 omitted
|
1356
|
+
|
1357
|
+
# reduce 100 omitted
|
1358
|
+
|
1359
|
+
# reduce 101 omitted
|
1360
|
+
|
1361
|
+
# reduce 102 omitted
|
1362
|
+
|
1363
|
+
# reduce 103 omitted
|
1364
|
+
|
1365
|
+
# reduce 104 omitted
|
1366
|
+
|
1367
|
+
# reduce 105 omitted
|
1368
|
+
|
1369
|
+
# reduce 106 omitted
|
1370
|
+
|
1371
|
+
# reduce 107 omitted
|
1372
|
+
|
1373
|
+
# reduce 108 omitted
|
1374
|
+
|
1375
|
+
# reduce 109 omitted
|
1376
|
+
|
1377
|
+
# reduce 110 omitted
|
1378
|
+
|
1379
|
+
# reduce 111 omitted
|
1380
|
+
|
1381
|
+
# reduce 112 omitted
|
1382
|
+
|
1383
|
+
# reduce 113 omitted
|
1384
|
+
|
1385
|
+
# reduce 114 omitted
|
1386
|
+
|
1387
|
+
# reduce 115 omitted
|
1388
|
+
|
1389
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 141
|
1390
|
+
def _reduce_116( val, _values, result )
|
1391
|
+
result = val[1].unshift(val[0])
|
1392
|
+
result
|
1393
|
+
end
|
1394
|
+
.,.,
|
1395
|
+
|
1396
|
+
module_eval <<'.,.,', 'lib/protobuf/compiler/proto.y', 143
|
1397
|
+
def _reduce_117( val, _values, result )
|
1398
|
+
result = val[1].unshift(val[0])
|
1399
|
+
result
|
1400
|
+
end
|
1401
|
+
.,.,
|
1402
|
+
|
1403
|
+
# reduce 118 omitted
|
1404
|
+
|
1405
|
+
# reduce 119 omitted
|
1406
|
+
|
1407
|
+
# reduce 120 omitted
|
1408
|
+
|
1409
|
+
# reduce 121 omitted
|
1410
|
+
|
1411
|
+
# reduce 122 omitted
|
1412
|
+
|
1413
|
+
# reduce 123 omitted
|
1414
|
+
|
1415
|
+
# reduce 124 omitted
|
1416
|
+
|
1417
|
+
# reduce 125 omitted
|
1418
|
+
|
1419
|
+
def _reduce_none( val, _values, result )
|
1420
|
+
result
|
1421
|
+
end
|
1422
|
+
|
1423
|
+
end # class ProtoParser
|
1424
|
+
|
1425
|
+
end # module Protobuf
|