dcsimg
Problems with regexp expressions in a ordered syntax
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Mario_Toffia
Posted On:   Monday, January 3, 2005 04:52 AM

Problems with regexp expressions in a ordered syntax Hi I've probles with distingwishing literals and scope in expressions. An expression could look like this: (execution(private override w{5,6} $instanceof{ns.next_ns*.*.ext_next.*kalle*}->*kalle(int iVal1,kalle.ho*.Stringa csVal2)) AND !execution(* void ¤pelle->new(..))) I'm generating C# code and the lexer grammar is in the end of the letter (not functional). How do i e.g. distingwish between $instanceof{regexp} and the contained regexp since both are allowed to use {} etc. If I'm not allowing {,( this lexer grammar seems to be ok, but if I do it cannot distingwish litterals and identifiers. Many regards, Mario Toffia   More>>

Problems with regexp expressions in a ordered syntax


Hi I've probles with distingwishing literals and scope in expressions. An expression could look like this:



(execution(private override w{5,6} $instanceof{ns.next_ns*.*.ext_next.*kalle*}->*kalle(int iVal1,kalle.ho*.Stringa csVal2)) AND !execution(* void ¤pelle->new(..)))



I'm generating C# code and the lexer grammar is in the end of the letter (not functional). How do i e.g. distingwish between $instanceof{regexp} and the contained regexp since both are allowed to use {} etc. If I'm not allowing {,( this lexer grammar seems to be ok, but if I do it cannot distingwish litterals and identifiers.

Many regards,
Mario Toffia




Lexer


------------------------------------------------------------------


			





Grammar ExpressionLexer

ANTLR -generated HTML file from grammar.g


Terence Parr, MageLang Institute

ANTLR Version 2.7.4; 1989-1999


				

Definition of lexer ExpressionLexer, which is a subclass of CharScanner.

/** Lexer nextToken rule:
* The lexer nextToken rule is synthesized from all of the user-defined
* lexer rules. It logically consists of one big alternative block with
* each user-defined rule being an alternative.
*/
mOPEN_PAREN
| mCLOSE_PAREN
| mWILDCARD_PARAM_ARGS
| mCOMMA
| mMEMBER_ACESS_TOKEN
| mLCURLY
| mRCURLY
| mSTAR
| mNOT_SYM
| mOR_SYM
| mAND_SYM
| mATTRIBUTE
| mIDENT
| mWS
mOPEN_PAREN
: '('
;

mCLOSE_PAREN
: ')'
;

mWILDCARD_PARAM_ARGS
: "(..)"
;

mCOMMA
: ','
;

mMEMBER_ACESS_TOKEN
: "->"
;

mLCURLY
: '{'
;

mRCURLY
: '}'
;

mSTAR
: '*'
;

mNOT_SYM
: '!'
;

mOR_SYM
: '|'
;

mAND_SYM
: '&'
;

mATTRIBUTE
: ( '¤' mIDENT )
;

mIDENT
: ( 'a'..'z'
| 'A'..'Z'
| '_'
| '$'
| '@'
| '^'
| ''
)
( 'a'..'z'
| 'A'..'Z'
| '_'
| '0'..'9'
| '$'
| '.'
| '^'
| ''
| '['
| ']'
| '='
| '?'
| ' <'
| '>'
| '*'
| '!'
| '|'
| '&'
| '/'
)*
;

mWS
: ( ' '
| ' '
| 'f'
| ( "
"
| '
'
| '
'
)

)+

;
   <<Less
About | Sitemap | Contact