[antlr-interest] Failed predicate problem [v3]

Alexandre Porcelli porcelli at uol.com.br
Sun Nov 5 16:25:41 PST 2006


Hi People,

  I'm getting problems with semantic predicate. I constructed the folowing :

pictureClause
	:	PIC PIC_VALUE
	;

PIC_VALUE
	:{ultPic}? ('+'|'-'|'$'|'A'|'B'|','|'E'|('0'..'9')|'X'|'S'|'V'|'Z'|'*'|'('|')'|
{ input.LA(2) != ' ' && input.LA(2) != '\n' && input.LA(2) != '\r' }?
'.')+
	{
		ultPic = false;
	}
	;

PIC	:	'PIC' 'TURE'?
{
ultPic = true;
}
	;

  It works almost time, but when I have a situation that should escape
(by semantic predicate) I got an failed predicate error:

mTokens, mPIC_VALUE]: line 6:53 rule PIC_VALUE failed predicate: {
input.LA(2) != ' ' && input.LA(2) != '\n' && input.LA(2) != '\r' }?

  I appreciate any help - I´m getting this problem and I can´t advance
in my job :(

ps: Attached the sample grammar and a text that generates the problem.


Thanks in Advance,
Alexandre Porcelli
-------------- next part --------------
       DATA DIVISION.
       WORKING-STORAGE SECTION.

       01  WH-VRSOMPRO1                PIC S9(008)V99 COMP-3.
       01  WH-VRSOMPRO2                PIC S9(008)V99.
       01  WH-VRSOMPRO3                PIC S9(008)V99 .

       PROCEDURE DIVISION.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Cobol.g
Type: application/octet-stream
Size: 4390 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20061105/3461dfee/attachment.obj 


More information about the antlr-interest mailing list