RewriteCardinalityExceptionってなんなんだぜ?

ツリーは、ちゃんと出来ている。ASTに変換しようとしてコケている。
パーサが構築しうるツリーと、変換されうるASTにズレ的な何かがある…と言っている気がするが、
どう対応したら良いのかサパーリ分からない。誰かボスケテ

grammar TwoWaySQL;

options {
	language = Java;
	output = AST;
	ASTLabelType = CommonTree;
}

tokens {
	BEGINNODE;
	IFNODE;
	EXPRESSIONNODE;
	ELSENODE;
	ELSEIFNODE;
}

@header {
package twowaysql.grammar;
}

@lexer::header {
package twowaysql.grammar;
}

@lexer::members {
boolean inComment = false;
boolean inLineComment = false;
}

twowaySQL : txt EOF;

txt 	:
	(comment | charactors)+
	;

charactors :
	(IDENT| SYMBOLS | QUOTED)+
	;

// $<comment

comment :
	begincomment
	| ifcomment
	| blockcomment
	| linecomment
	;


blockcomment :
	C_ST charactors C_ED ;

linecomment :
	C_LN_ST charactors C_LN_ED ;

ifcomment :
	(C_ST IF expression C_ED txt
		(elseifcomment txt)* (elsecomment txt)? endcomment)
	-> ^(IFNODE ^(EXPRESSIONNODE expression) txt
			^(ELSEIFNODE elseifcomment txt)*
			^(ELSENODE txt)?
		)
	;

elseifcomment :
	(C_ST ELSEIF expression C_ED | C_LN_ST ELSEIF expression C_LN_ED)
		-> ^(EXPRESSIONNODE expression);

elsecomment :
	(C_ST ELSE C_ED | C_LN_ST ELSE C_LN_ED) ;

expression :
	charactors ;
	
begincomment :
	((C_ST BEGIN C_ED | C_LN_ST BEGIN C_LN_ED) txt endcomment) -> ^(BEGINNODE txt);

endcomment :
	C_ST END C_ED | C_LN_ST END C_LN_ED;

// $>
QUOTED	: SYM_Q ~(SYM_Q)+ SYM_Q;
SYMBOLS	: '*' | '/' | '-';
fragment SYM_Q	:	'\u0027' | '"';

C_ST	:
	{!inComment}? '/*' { inComment = true; };

C_ED	:
	{inComment}? '*/' { inComment = false; };
	
C_LN_ST	:
	{!inComment}? '--' { inLineComment = true; inComment = true; };

C_LN_ED	:
	{inLineComment}? ( LN_R LN_N | LN_R | LN_N | EOF ) { inLineComment = false; inComment = false; };

// $<Keywords

BEGIN 	: ('b'|'B')('e'|'E')('g'|'G')('i'|'I')('n'|'N');
IF		: ('i'|'I')('f'|'F');
ELSE	: ('e'|'E')('l'|'L')('s'|'S')('e'|'E');
ELSEIF	: ('e'|'E')('l'|'L')('s'|'S')('e'|'E')('i'|'I')('f'|'F');
END		: ('e'|'E')('n'|'N')('d'|'D');

// $>

IDENT	: CHAR+;

fragment WS	: '\t' | '\v' | '\f' | ' ' | '\u00A0';
fragment LN_R :	'\r';
fragment LN_N : '\n';
fragment CHAR	: ~(SYMBOLS | SYM_Q | LN_R | LN_N | WS);

LT : {!inLineComment}? (LN_R | LN_N)+ { $channel = HIDDEN; };
WHITE_SPACES	: (WS)+ { $channel = HIDDEN; };

このgrammarに、

ada.cec のしのし / 3 d/*aa hoge
 piro*/  ぎゃぼー
-- BeGiN
 /* If aa - bb
 dd*/moge piro /*eLsEIF ccc + 44 '*/' */cccd
	-- elSEif fuga < '0'
		dfdze
	-- ElSe 
	 zzz "-- fugafuga"
 -- eNd
	-- moge うぼぁ zz
/* EnD*/

を食わせると、

-- eNd

の辺りまでパースした所で、RewriteCrdinalityExceptionと言うのがすっ飛んできてパーサが死ぬ。
ELSEIFなんつーキーワードがいかんのか…いやいや、CommonTreeは構築出来ているのだから、ASTにできる筈。