[antlr-interest] Submitting bug report?

Don Maier dMaier at genome.stanford.edu
Thu Apr 19 16:28:02 PDT 2007


Sure enough:

The grammar IDF.g is pasted below.  The recipe for failure is:

1)  Place grammar in ANTLRWorks 1.0b10.
2)  Check the grammar.   (ANTLRWorks reports "ok".)
3)  Generate the code, also using in ANTLRWorks.
4)  IDFLexer.java has two errors, at ll. 435, 509 due to a missing  
'}' in an 'if' statement.
5) IDFParser.java has an error at l. 227 because the variable  
'rowheader' is undefined.
7) Both generated java files have a first line comment indicating  
their antlr-3.0b7 provenance.   This makes me think that this problem  
is unlikely to be one in ANTLRWorks, and not in ANTLR proper.

My apologies, in advance, if this problem is the result of a  
beginner's fumble.

Also, I've not attached any files to avoid getting this message  
entangled in spam blockers.   But I'm happy to supply the grammar  
file, and the generated java files as attachments, if you wish.

Regards,
Don Maier

----------------------------------------------------

grammar IDF;
options { k=1; }

tokens {
	LSB = '[';
         RSB = ']';
         Q   = '"';
         SP  = ' ';
	TAB = '\t';
}

@lexer::header {

}	

@header {

}

@members {
public static int lineNumber = 1;
}

file    : record (RECORD_SEPARATOR record)* EOF
         { System.out.println("*** IDF Parse complete"); }
        	;
record  :
	{ System.out.print("*** Line " + lineNumber + ": "); }
	  header (cell_separator cell)*
	| empty_record
         { System.out.println("\n"); lineNumber++; }
        	;
header  : rowHeader = standard_header
	| rowHeader = comment_header
	{ System.out.print("Header = " + rowHeader); }
	;
standard_header
	: INVESTIGATION TITLE
	;		
comment_header
	: COMMENT LSB BRACKETED_CONTENT RSB
	;

empty_record
	: (SP|TAB)*
	;	
cell    : empty_cell
	| content = cell_content
    	| content = quoted_cell_content
	;
empty_cell
	: (SP)*
	;
cell_content
	: CONTENT
	;
quoted_cell_content
	: QUOTED_CONTENT
	;
cell_separator
	: TAB
	;
		
// Keyword terminals

INVESTIGATION
	: 'Investigation'
	;
TITLE	: 'Title'
	;
COMMENT : 'Comment'
	;
			
// Lexer

/* A sequence of one or more non-']' characters beginning and ending  
with a non-space
* character.
*/
BRACKETED_CONTENT
	: ((~(RSB|SP|TAB|'\r'|'\n')) (~(RSB|TAB|'\r'|'\n'))*)? (~(RSB|SP| 
TAB|'\r'|'\n'))
	;
/* A sequence of one or more characters starting with a non-quote,  
non-space character,
* and ending with a non-space character (which could be the first  
character).
*/
CONTENT
	: (~(Q|SP|TAB|'\r'|'\n')) ((~(TAB|'\r'|'\n'))* (~(SP|TAB|'\r'|'\n')))?
	;
/* A quote-bracketed sequence of non-quote characters, though  
permitting embedded
* escaped quotes in the forma of '\"'.
*/
QUOTED_CONTENT
	: Q! (~(Q|TAB|'\r'|'\n'))* (('\\'Q) (~(Q|TAB|'\r'|'\n'))*)* Q!
	;
RECORD_SEPARATOR
	: ( '\r''\n' ) => '\r''\n' // Windows
         | '\r'                     // Mac
         | '\n'                     // Unix
         ;
		
WS      : (SP)+
	{ $channel = HIDDEN; }
	;


----------------------------------------------------

On Apr 19, 2007, at 3:13 PM, Terence Parr wrote:

>
> On Apr 19, 2007, at 2:01 PM, Don Maier wrote:
>
>> Hi friends,
>>
>> Please forgive this note to the group from a newcomer.
>>
>> I'd like to submit a bug report describing a case where  
>> antlr-3.0b7 generates invalid Java code for the lexer (incorrectly  
>> constructed if-then-else statements),   I find myself unable to  
>> get the issue navigator to do anything but let me view existing  
>> defect reports -- which appear not to describe the problem I've  
>> encountered.   Can anyone supply me with a few hints?
>
> Hi Don,
>
> please post bugs to the list so we can decide if they really are ;)
>
> Thanks,
> Ter



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070419/26360248/attachment.html 


More information about the antlr-interest mailing list