dcsimg
How to identify chineese tags such as <xxxx>(where xxxx is chineese) using antlr rules?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   srikanth
Posted On:   Wednesday, June 27, 2012 10:37 PM

we have to read the contents between the chineese tags such as these <签发人 />  using antlr. Need help


srikanth

Re: How to identify chineese tags such as <xxxx>(where xxxx is chineese) using antlr rules?

Posted By:   franz  
Posted On:   Thursday, June 28, 2012 10:02 AM

It's not perfect, but you can give it a try:

grammar Test;
 
options {
  language = Java;
  output = AST;
}
 
rule: OPEN_TAG ANY_CONTENT CLOSE_TAG;
 
 
//WS :
//  (' ' | '\t' | '\f')+ {$channel=HIDDEN;};
  
OPEN_TAG:
'<' (options{greedy=false;}: ~'/')* '>';
CLOSE_TAG:
'<' (options{greedy=flase;}:  ~'>')* '/>';
 
ANY_CONTENT:
(~'<')*;

Would be nice to get feedback.

Regards,
Franz
About | Sitemap | Contact