ruby_protobuf 0.4.5 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,7 +1,14 @@
1
- === 0.4.5 / 2010-07-17
1
+ === 0.4.6 / 2010-09-12
2
2
 
3
+ * 0.4.6
4
+ * Implement Message#to_hash method.
5
+ * Accept String value for enum fields.
6
+ * Optimizations.
7
+ * Bug fixes.
8
+ * Ignore "syntax = ...." in .proto.
9
+ * Empty packed field.
3
10
  * 0.4.5
4
- * Bug fix. (enum value)
11
+ * Bug fixes. (enum value, frozen string)
5
12
  * 0.4.4
6
13
  * Bug fix. (rprotoc)
7
14
  * 0.4.3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.5
1
+ 0.4.6
@@ -6,5 +6,7 @@ module Protobuf
6
6
  START_GROUP = 3
7
7
  END_GROUP = 4
8
8
  FIXED32 = 5
9
+
10
+ PACKABLE_TYPES = [VARINT, FIXED64, FIXED32]
9
11
  end
10
12
  end
@@ -317,5 +317,11 @@ require 'protobuf/message/extend'
317
317
  end
318
318
  end
319
319
  end
320
+
321
+ class SyntaxNode < Base
322
+ def initialize(syntax)
323
+ # do nothing
324
+ end
325
+ end
320
326
  end
321
327
  end
@@ -12,6 +12,7 @@ rule
12
12
  | package
13
13
  | option
14
14
  | service
15
+ | syntax
15
16
  | ';' { result = nil }
16
17
 
17
18
  import : 'import' STRING_LITERAL ';'
@@ -73,6 +74,8 @@ rule
73
74
  | rpc
74
75
  | ';' { result = nil}
75
76
 
77
+ syntax : 'syntax' '=' STRING_LITERAL ';' { result = Protobuf::Node::SyntaxNode.new(val[2]) }
78
+
76
79
  rpc : 'rpc' IDENT '(' rpc_arg ')' 'returns' '(' rpc_arg ')' ';'
77
80
  { result = Protobuf::Node::RpcNode.new(val[1], val[3], val[7]) }
78
81
 
@@ -104,7 +107,7 @@ rule
104
107
  | label type field_name '=' integer_literal '[' field_option_list ']' ';'
105
108
  { result = Protobuf::Node::FieldNode.new(val[0], val[1], val[2], val[4], val[6]) }
106
109
 
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"
110
+ field_name : IDENT | "required" | "optional" | "repeated" | "import" | "package" | "option" | "message" | "extend" | "enum" | "service" | "syntax" | "rpc" | "returns" | "group" | "default" | "extensions" | "to" | "max" | "double" | "float" | "int32" | "int64" | "uint32" | "uint64" | "sint32" | "sint64" | "fixed32" | "fixed64" | "sfixed32" | "sfixed64" | "bool" | "string" | "bytes"
108
111
 
109
112
  field_option_list : field_option
110
113
  { result = val }
@@ -178,7 +181,7 @@ end
178
181
  when match(/\/\*/)
179
182
  # C-like comment
180
183
  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/)
184
+ when match(/(?:required|optional|repeated|import|package|option|message|extend|enum|service|syntax|rpc|returns|group|default|extensions|to|max|double|float|int32|int64|uint32|uint64|sint32|sint64|fixed32|fixed64|sfixed32|sfixed64|bool|string|bytes)\b/)
182
185
  yield [@token, @token.to_sym]
183
186
  when match(/[+-]?\d*\.\d+([Ee][\+-]?\d+)?/)
184
187
  yield [:FLOAT_LITERAL, @token.to_f]