Filtering certain parts of a grammar and ignore the rest. Howto?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Monday, July 26, 2004 04:26 AM

I am trying to apply XSD xchema in a weblogic6.1 env. I keep getting the error: "General Schema Error: Grammar with uri 2: http://www.w3schools.com , can not found." When I promote some other parser like the apache parser.jar up the classpath order above weblogic.jar, then it all works fine. Does this mean than weblogic6.1 does not support XSD? In the actual env, it is not possible for me to promote the other parsers above the order in the classpath over weblogic.jar. Can anyone suggest a way out? Is there a way to access the Impl classes within the apacheXML.jar in the non-JAXP way? Hi, I'm interested in parsing only certain parts of a program file (i.e. structures in C),   More>>

Hi,

I'm interested in parsing only
certain parts of a program file (i.e. structures in C),
and I don't want to
specify the complete grammar (and use the filter option in Lexer).
But how can I tell antlr to ignore everything untila struct
variable is found, process it, and than ignore the rest.



The description in the ANTLR user guide is too short and
it is not easy to guess how this would be done from
the HTML filtering example given there. Therefore any help
is appreciated.



I've tried something like following, but it didn't work. This
is for some other Pascal like language:




			
class RecordParser extends Parser;

record :
"RECORD" ID SEMICOLON
(variable | COMMENT )+
"END" "RECORD" SEMICOLON
;

variable:
... //rules and actions here


class RecordLexer extends Lexer;
options {
charVocabulary = 'u0000'..'u00FF';
filter=true;
}

COMMENT : '!'
('
' {newline();} |
~('!' | '
'))*
'!'
{$setType(Token.SKIP);}
;

ID : ('A'..'Z')('A'..'Z' | NUM)* ;
INDEX :'(' NUM ')' ;
NUM : ('0'..'9')+ ;

SEMICOLON : ';' ;

WS :
( ' ' | ' ' | '
' {newline();} )
{_ttype = Token.SKIP;}
;




thanks in advance...
BR,
hba    <<Less

Re: Filtering certain parts of a grammar and ignore the rest. Howto?

Posted By:   Anonymous  
Posted On:   Tuesday, August 10, 2004 03:43 AM

I think I got it. This is not possible :)
So I had to specify the complete grammar for the declaration
sector. But I only wrote actions for the
rules matching a record.


BR,

Hasan B.A.

About | Sitemap | Contact