This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 116873 - *ANTLR* rules with "returns" attribute are incorrectly handled by generator
Summary: *ANTLR* rules with "returns" attribute are incorrectly handled by generator
Status: CLOSED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Egor Ushakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-26 20:52 UTC by _ andrey_gubichev
Modified: 2007-11-16 13:10 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ andrey_gubichev 2007-09-26 20:52:13 UTC
ANTLR in C/C++ Pack doesn't generate correct Java classes for this grammar:


/*Sample grammar*/

header {
package org.netbeans.modules.fortran.generated;
import antlr.CommonToken;
import antlr.CharStreamException;
}

class Fortran77Parser extends Parser;
options {
    k = 2;
}

program :
	"";


class Fortran77Lexer extends Lexer;

protected NUM  : ('0'..'9') ;

protected INTVAL returns [int val=0]: (NUM)+ {val=Integer.parseInt($getText);} ;
Comment 1 Egor Ushakov 2007-10-30 14:26:46 UTC
The problem is that current ANTLR does not generate correct return statements
in case of matching errors.
Comment 2 Egor Ushakov 2007-10-30 14:27:05 UTC
The problem is that current ANTLR does not generate correct return statements
in case of matching errors.
Comment 3 Egor Ushakov 2007-10-31 13:04:32 UTC
Fixed:
Checking in Context.java;
/shared/data/ccvs/repository/cnd/antlr/src/antlr/Context.java,v  <--  Context.java
new revision: 1.3; previous revision: 1.2
done
Checking in JavaCodeGenerator.java;
/shared/data/ccvs/repository/cnd/antlr/src/antlr/JavaCodeGenerator.java,v  <--  JavaCodeGenerator.java
new revision: 1.10; previous revision: 1.9