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

How to identify chineese tags such as (where...
srikanth
Wed Jun 27, 2012 10:37 PM

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


srikanth

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

franz
Thu Jun 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