Fwd: petit question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Fwd: petit question

Fabrizio Perin
Hi,
I'm not sure how to answer the forwarded email. At list i have an idea but without using PPExpressionParser. Someone has an answer that rely on PPExpressionParser?

Cheers,
Fabrizio

Begin forwarded message:

Hi Fabrizio,
How are you? Its Friday, its me again :D.
I realized some stuff but still don't really get the Expressions. Let me give you an example:

exp := PPExpressionParser new.
exp term: (($$ asParser trim , #letter asParser star) flatten / ($" asParser trim, $" asParser negate star, $" asParser trim) flatten);
group: [ :g |
g right: '=' asParser trim do: [:a :op :b | {a. op. b.}].
].

exp parse: '$var = "dings"'. "this is valid code"
exp parse: '"dings" = $var'. "this is invalid code"

How do i tell the expression parser to make a constrain on one side? Or a better question could be: How do i combine expression parsers to achieve a similar behavior? Do i even have to? Or am I to assume that the programmer just knows the order...? I could do something like:

group: [ :g |
g right: '=' asParser trim do: [:a :op :b | 
{ (LeftAssignmentSideExpressionParser new parse: a.) op. (RightAssignmentSideExpressionParser new parse: b.) }
].
].

Do you see my Problem?

Cheers Michael


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev