Match last string in Lexer
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Kreso_Tkalec
Posted On:   Friday, February 4, 2005 05:25 AM

My problem is to match last string. I have code writen in lex, and would like to translate it to antlr. Lex code: B [a-zA-Z_] C [0-9a-zA-Z\'^.:_`] {B}{C}*(" "*{C}+)*" "*DA {some code...} So far I wrote this: protected B : 'a'..'z'|'A'..'Z'|'_'; protected C : '0'..'9'|'a'..'z'|'A'..'Z'|'\''|'^'|'.'|':'|'_'|'`'; MyToken: (B)(C)*((" ")*(C)+)*(" ")*"DA"; The problem is that definition of C allows to math string "DA" , so lexer never comes to last string. Any sugestions?    More>>

My problem is to match last string. I have code writen in lex, and would like to translate it to antlr.

Lex code:

B [a-zA-Z_]

C [0-9a-zA-Z\'^.:_`]

{B}{C}*(" "*{C}+)*" "*DA {some code...}


So far I wrote this:

protected B : 'a'..'z'|'A'..'Z'|'_';

protected C : '0'..'9'|'a'..'z'|'A'..'Z'|'\''|'^'|'.'|':'|'_'|'`';

MyToken: (B)(C)*((" ")*(C)+)*(" ")*"DA";


The problem is that definition of C allows to math string "DA" , so lexer never comes to last string. Any sugestions?

   <<Less
About | Sitemap | Contact