I created myself a parser that has quite some rules. Now I discovered that in the format there are comments possible. The type of comments is quite common. One format for single line comment and one for multiline comments.
The comments are not described as part of the format. So now I'm trying to get a solution how to parse the comments. Basically the can appear anywhere in the text. I could do it by first removing the comments and then parsinf the format. But hopefully there is something more smart.
thanks,
Norbert
Am 13.05.2011 um 11:40 schrieb Norbert Hartl:
I created myself a parser that has quite some rules. Now I discovered that in the format there are comments possible. The type of comments is quite common. One format for single line comment and one for multiline comments.
The comments are not described as part of the format. So now I'm trying to get a solution how to parse the comments. Basically the can appear anywhere in the text. I could do it by first removing the comments and then parsinf the format. But hopefully there is something more smart.
Ah, looking at the java parser I see that implementing a custom token parser is the way to go. Perfect fit I would say
Norbert
Hi,
On 13 May 2011, at 15:54, Norbert Hartl wrote:
Am 13.05.2011 um 11:40 schrieb Norbert Hartl:
I created myself a parser that has quite some rules. Now I discovered that in the format there are comments possible. The type of comments is quite common. One format for single line comment and one for multiline comments.
The comments are not described as part of the format. So now I'm trying to get a solution how to parse the comments. Basically the can appear anywhere in the text. I could do it by first removing the comments and then parsinf the format. But hopefully there is something more smart.
Ah, looking at the java parser I see that implementing a custom token parser is the way to go. Perfect fit I would say
Yes, this is also what Smalltalk parser is doing. Another option is to explicitly add the comments to all possible parsers.
Cheers, Doru
Norbert
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com
"The coherence of a trip is given by the clearness of the goal."
Am 14.05.2011 um 00:44 schrieb Tudor Girba:
Hi,
On 13 May 2011, at 15:54, Norbert Hartl wrote:
Am 13.05.2011 um 11:40 schrieb Norbert Hartl:
I created myself a parser that has quite some rules. Now I discovered that in the format there are comments possible. The type of comments is quite common. One format for single line comment and one for multiline comments.
The comments are not described as part of the format. So now I'm trying to get a solution how to parse the comments. Basically the can appear anywhere in the text. I could do it by first removing the comments and then parsinf the format. But hopefully there is something more smart.
Ah, looking at the java parser I see that implementing a custom token parser is the way to go. Perfect fit I would say
Yes, this is also what Smalltalk parser is doing. Another option is to explicitly add the comments to all possible parsers.
I thought at first I want to avoid adding comments to all parsers. But now as I think again this might be as feasible as having a custom token parser. I think as an exercise I try to build it with the parsers.
thanks,
Norbert