Re: [protobuf] Get line and column number of parsed protocol buffer text format message

2012-08-22 Thread Jason Hsueh
The next release (in progress) will contain a feature of TextFormat to
record the parse tree during by customizing calls to the
TextFormat::Parser. Sit tight...


On Thu, Aug 16, 2012 at 2:34 AM, lolle  wrote:

> Hi
>
> I am using the protocol buffer text format. I need information about the
> line and column number of a message that was already parsed. For example, I
> have a protocol buffer message definition in the .proto file:
> 
> package ExamplePackage;
> message ExampleMessage
> {
> required string first = 1;
> required string second = 2;
> }
> 
> and a message of type ExampleMessage containing data:
> 
> first: "FirstData"
> second: "SecondData"
> 
> The data is stored in a protocol buffer text format file, so the text
> format parser can get information about the line/column of the data
> ("first" -> (line = 1/ column = 1) and "second" -> (line = 2/ column = 1)
> during parsing.
> Now I am wondering if I can access the information on line/column after
> parsing. Something like (C++):
> 
> ExamplePackage::ExampleMessage MyMessage;
> google::protobuf::TextFormat::ParseFromString(fileStream, &MyMessage);
> lineOfFirst = MyMessage.first().*getLine*();
> lineOfSecond = MyMessage.second().*getLine*();
> 
> ->lineOfFirst should be 1 now and lineOfSecond should be 2.
> As the methods "getLine"/"getColumn" do not exist, I am wondering if there
> any possibility to get line/column after parsing a text format file?
>
> Thanks for your help in advance.
>
> Lolle
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/protobuf/-/uqzkAz1XNbAJ.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



[protobuf] Get line and column number of parsed protocol buffer text format message

2012-08-22 Thread lolle
Hi

I am using the protocol buffer text format. I need information about the 
line and column number of a message that was already parsed. For example, I 
have a protocol buffer message definition in the .proto file:

package ExamplePackage;
message ExampleMessage
{
required string first = 1;
required string second = 2;
}

and a message of type ExampleMessage containing data:

first: "FirstData"
second: "SecondData"

The data is stored in a protocol buffer text format file, so the text 
format parser can get information about the line/column of the data 
("first" -> (line = 1/ column = 1) and "second" -> (line = 2/ column = 1) 
during parsing.
Now I am wondering if I can access the information on line/column after 
parsing. Something like (C++):

ExamplePackage::ExampleMessage MyMessage;
google::protobuf::TextFormat::ParseFromString(fileStream, &MyMessage);
lineOfFirst = MyMessage.first().*getLine*();
lineOfSecond = MyMessage.second().*getLine*();

->lineOfFirst should be 1 now and lineOfSecond should be 2.
As the methods "getLine"/"getColumn" do not exist, I am wondering if there 
any possibility to get line/column after parsing a text format file?

Thanks for your help in advance.

Lolle



-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/protobuf/-/uqzkAz1XNbAJ.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.