[antlr-interest] How a rule can containt characters that match other rule

pepone pepone pepone.onrez at gmail.com
Mon Apr 24 15:37:02 PDT 2006


Hi all

I trying to build a Wiki Lexer parser and i don't know how to solve
this situation

Here is a sample document

---
<p>Hello world UTF-8</p>
---

---  Match document begin and document end

<p> parraf begin
</p> parraf end


I have this rules in my parser:

document
	:DOCUMENT^(parraf)+DOCUMENT
	;

parraf
	:
	(PARRAF_TAG_BEGIN^
		(~(OTAG|CTAG))+
	PARRAF_TAG_END)
	;

Lexer rules:

DOCUMENT:
	'-''-''-'
	;

PARRAF_TAG_BEGIN:
	OTAG P CTAG
	;
	
PARRAF_TAG_END:
	OTAG SLASH P CTAG
	;

protected OTAG:'<';
protected CTAG:'>';

The problem is that when parser found '8' it expect '-'

how make the parser work in this scenario?

Thanks
--
play tetris http://pepone.on-rez.com/tetris
run gentoo http://gentoo-notes.blogspot.com/


More information about the antlr-interest mailing list