[antlr-interest] Spaces as separators

Simone Tripodi simone.tripodi at gmail.com
Fri Oct 19 09:32:02 PDT 2007


Hi All,
I've been developing a SPARQL grammar in ANTRL3, and it's complete at 90%.
I have a problem: I'm not able separate the end of a variable from the
begin of a subsequent one that starts without special symbols; these
variables are separated by a space, that I skip with the typical rule

 WS
	: (' '
	| '\t'
	| '\n'
	| '\r')+ { $channel=HIDDEN; }

 For example, a sequence of variables like:

?titole   cd:author

in the parse tree is grouped as

|
+ titolocd
|
+ autore

and it's totally wrong.

I attach the grammar and the testcase is:

PREFIX cd: <http://example.org/cd/>
SELECT ?title ?author ?year
FROM  <http://cd.com/listacd.ttl>
WHERE {?title cd:author ?author.
	    ?title cd:year ?year .
}

Could someone help me please? Any help is very appreciated.
Cheers,
Simone
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Sparql.g
Type: application/octet-stream
Size: 8295 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20071019/6552825e/attachment.obj 


More information about the antlr-interest mailing list