proto2.TextFormatSerializer.Parser Extends
Helper class for parsing the text format.

Inheritance

Constructor

goog.proto2.TextFormatSerializer.Parser()

Instance Methods

Public Protected Private
consumeFieldValue_(messagefield) boolean
Attempts to consume the value of the given field.
Arguments:
message : goog.proto2.Message
The parent message.
field : goog.proto2.FieldDescriptor
The field.
Returns: boolean  True on success, false otherwise.
code »
consumeField_(message) boolean
Attempts to consume a field under a message.
Arguments:
message : goog.proto2.Message
The parent message. If null, then the field value will be consumed without being assigned to anything.
Returns: boolean  True on success, false otherwise.
code »
consumeIdentifier_() ?string
Consumes an IDENTIFIER token.
Returns: ?string  The string value or null on error.
code »
consumeMessage_(messagedelimiter) boolean
Attempts to consume the given message.
Arguments:
message : goog.proto2.Message
The message to consume and fill. If null, then the message contents will be consumed without ever being set to anything.
delimiter : string
The delimiter expected at the end of the message.
Returns: boolean  True on success, false otherwise.
code »
consumeNestedMessage_(messagefield) boolean
Attempts to consume a nested message.
Arguments:
message : goog.proto2.Message
The parent message.
field : goog.proto2.FieldDescriptor
The field.
Returns: boolean  True on success, false otherwise.
code »
consumeNumber_() ?string
Consumes a NUMBER token.
Returns: ?string  The string value or null on error.
code »
consumeString_() ?string
Consumes a STRING token.
Returns: ?string  The *deescaped* string value or null on error.
code »
consumeToken_(type) ?string
Consumes a token of the given type.
Arguments:
type : goog.proto2.TextFormatSerializer.Tokenizer_.TokenTypes
The type of the token to consume.
Returns: ?string  The string value of the token or null on error.
code »
consumeUnknownFieldValue_() boolean
Attempts to consume the value of an unknown field. This method uses heuristics to try to consume just the right tokens.
Returns: boolean  True on success, false otherwise.
code »
consume_(value) boolean
Consumes a token with the given value. If not found, reports an error.
Arguments:
value : string
The string value expected for the token.
Returns: boolean  True on success, false otherwise.
code »
getError() ?string
No description.
Returns: ?string  The parse error, if any.
code »
getFieldValue_(field) *
Attempts to parse the given field's value from the stream.
Arguments:
field : goog.proto2.FieldDescriptor
The field.
Returns: *  The field's value or null if none.
code »
lookingAtType_(type) boolean
No description.
Arguments:
type : goog.proto2.TextFormatSerializer.Tokenizer_.TokenTypes
The token type.
Returns: boolean  True if the current token has the given type.
code »
lookingAt_(value) boolean
No description.
Arguments:
value : string
The value to check against.
Returns: boolean  True if the current token has the given string value.
code »
parse(messagedataopt_ignoreMissingFields) boolean
Parses the given data, filling the message as it goes.
Arguments:
message : goog.proto2.Message
The message to fill.
data : string
The text format data.
opt_ignoreMissingFields : boolean=
If true, fields missing in the proto will be ignored.
Returns: boolean  True on success, false on failure. On failure, the getError method can be called to get the reason for failure.
code »
reportError_(msg)
Reports a parse error.
Arguments:
msg : string
The error message.
code »
tryConsume_(value) boolean
Attempts to consume a token with the given string value.
Arguments:
value : string
The string value for the token.
Returns: boolean  True if the token matches and was consumed, false otherwise.
code »

Instance Properties

error_ :
The error during parsing, if any.
Code »
ignoreMissingFields_ :
Whether to ignore missing fields in the proto when parsing.
Code »
The current tokenizer.
Code »

Static Methods

goog.proto2.TextFormatSerializer.Parser.getNumberFromString_(num) !number
Attempts to convert a string to a number.
Arguments:
num : string
in hexadecimal or float format.
Returns: !number  The converted number or null on error.
code »
goog.proto2.TextFormatSerializer.Parser.parseNumericalConstant_(identifier) ?number
Parse NaN, positive infinity, or negative infinity from a string.
Arguments:
identifier : string
An identifier string to check.
Returns: ?number  Infinity, negative infinity, NaN, or null if none of the constants could be parsed.
code »

Package proto2.TextFormatSerializer

Package Reference