Re: How to express a math expression in a single regular expression?
- From: "Oliver Wong" <owong@xxxxxxxxxxxxxx>
- Date: Thu, 01 Dec 2005 15:51:23 GMT
<sueyic@xxxxxxxxx> wrote in message
news:1133446268.153785.161120@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> >So can I described my
>>idea in a regular expression and get a string rather than a tree back?
>
> I don't really understand your math expressions, but you can get a
> string rather than a tree ..
>
> For instance if you have defined
> <SQ_BRACKET_L: "[">
> <SQ_BRACKET_R: "R">
> <NOT_SQ_BRACKET: ~[ "[" , "]" ]>
>
> <SQ_BRACKET_WCONTENTS: <SQ_BRACKET_L> (<NOT_SQ_BRACKET>)*
> <SQ_BRACKET_R>>
>
> If inside your production you did this:
>
> void production() :
> {Token tok;}
> {
> tok = <SQ_BRACKET_WCONTENTS>
> {System.out.println(tok.image);}
> }
>
> Then tok.image should be the string of the bracket w contents instead
> of a tree .. is this what you wanted?
What if part of the expression inside the array index dereferencing
contains another array dereferencing?
I think regular expressions are not powerful enough to capture arbitrary
mathematical expressions.
- Oliver
.
- Follow-Ups:
- Re: How to express a math expression in a single regular expression?
- From: Oliver Wong
- Re: How to express a math expression in a single regular expression?
- References:
- How to express a math expression in a single regular expression?
- From: moop?
- Re: How to express a math expression in a single regular expression?
- From: sueyic@xxxxxxxxx
- How to express a math expression in a single regular expression?
- Prev by Date: Re: How to express a math expression in a single regular expression?
- Next by Date: Re: How to express a math expression in a single regular expression?
- Previous by thread: Re: How to express a math expression in a single regular expression?
- Next by thread: Re: How to express a math expression in a single regular expression?
- Index(es):
Relevant Pages
|
|