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 <[email protected]> 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:
> <code>
> package ExamplePackage;
> message ExampleMessage
> {
>     required string first = 1;
>     required string second = 2;
> }
> </code>
> and a message of type ExampleMessage containing data:
> <code>
> first: "FirstData"
> second: "SecondData"
> </code>
> 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++):
> <code>
> ExamplePackage::ExampleMessage MyMessage;
> google::protobuf::TextFormat::ParseFromString(fileStream, &MyMessage);
> lineOfFirst = MyMessage.first().*getLine*();
> lineOfSecond = MyMessage.second().*getLine*();
> </code>
> ->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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to