[antlr-interest] (no subject)

Mikael Petterson mikael.petterson at ericsson.com
Sat Aug 2 04:46:05 PDT 2008


Hi,

Thanks for replying. Well AFAIK ( I am annoyed that I accepted the code
, not given by me, generated by antlr without knowing it complex
implications) the grammar file defined is for recognizing clearcase
output. Depending on what clearcase returns the generated code will an
array of information that the rest of the plugin can interpret. The
problem I have is that I want to see why the parser rule 'error' does
not return anything.

Eg when clearcase returns the following:

cleartool: Error: By default won't create a version identical to
predecessor.

I supposed that the grammar file ( attatached) defined ( I don't know if
it is 2.x or 3.x grammar ? Anyone?) to return an ClearcaseElementState
object containing values:

	$elem.text, ClearCase.IS_ELEMENT |
ClearCase.ERROR_IDENTICAL_TO_PREDECESSOR

I have used the regular debugger in eclipse and foud that elements ( see
code below ) does not contain these.

So that is why I wanted to debug antlr generated code.

How can I do that?

cheers,

//mikael




protected ClearCaseElementState[] parserOutput(final String[] result) {
		final StringBuffer display = new StringBuffer();
		for (int i = 0; i < result.length; i++) {
			if (i != 0) {
				display.append("\n");
			}
			display.append(result[i]);
		}
		LOG.finest("parsing:" + display.toString());
		ClearCaseElementState[] res = null;
		try {
			final Reader reader = new
StringReader(display.toString());
			final CleartoolOutputLexer lexer = new
CleartoolOutputLexer(
					new ANTLRReaderStream(reader));
			final CommonTokenStream cts = new
CommonTokenStream(lexer);
			final CleartoolOutputParser parser = new
CleartoolOutputParser(cts);
			final List elements = parser.main();
			res = (ClearCaseElementState[]) elements
					.toArray(new
ClearCaseElementState[elements.size()]);
		} catch (final IOException e) {
			// TODO handle catch block
			e.printStackTrace();
		} catch (final RecognitionException e) {
			// TODO handle catch block
			e.printStackTrace();
		} catch (final Exception e) {
			// TODO handle catch block
			e.printStackTrace();
		}
		
		return res;
	}
-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Raphael Reitzig
Sent: den 2 augusti 2008 13:17
To: antlr-interest at antlr.org
Subject: Re: [antlr-interest] (no subject)

Hi!

Given a gramar this big, you should take the time and explain what does
not work if you want anyone to have a closer look.

Are those code blocks (class definition?!) really ok with ANTLR 3?

Regards

Raphael

"faraz ahmed" <passionist_81 at yahoo.co.uk> wrote (Sat Aug  2 03:07:29
2008):

> If somebody can plz look at this grammer file and help me finding 
> errors from this file.
>
> I am new to antlr and have to use this grammer file to build a parser 
> using new versio of antlr tool.
>
> many thanx
>
> faraz .
>
>
>       __________________________________________________________
> Not happy with your email address?.
> Get the one you really want - millions of new email addresses 
> available now at Yahoo! http://uk.docs.yahoo.com/ymail/new.html



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: CleartoolOutput.g
Type: application/octet-stream
Size: 5662 bytes
Desc: CleartoolOutput.g
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20080802/a802b725/attachment-0001.obj 


More information about the antlr-interest mailing list