Exclamation Mark

May 17, 2009 at 7:01 PM

Hi,

i played with Irony and come to the two following problem:

a) Start a ExpressionLine only by using an assignment or by using only '="

a = 5 + 3

= 5 + 3

should be parsed the same or nearly the same.

b) Create a Statement or what else that looks like:

aaa!bbb like 'User!UserId' in the SqlReportingServer - Expression Language

so i can use it as

a = aaa!bbb 

what else i try, i always get an SyntaxError with the "!" sign.

 

Thanks very much in advance

Peter

 

 

Coordinator
May 18, 2009 at 8:12 AM

well, remember it's just a sample expression evaluator. Before I introduce "!" or "." operators, there must be an object reference implementation, ability to use external objects (not just numbers), .NET interop and so on. Too much for simple demo I think. Although, once all this functionality is supported by core Irony functionality, it won't be a big deal to extend the example into real "embeddable evaluation engine".

thank you for you suggestions

Roman 

May 18, 2009 at 12:11 PM

Hi Roman

i think you missed me.

If i build a statement or Function like "User" all works as expected.

As soon as i use "User!" i get an error  (EOF,LF) pointing to the "!".

So, what i'm looking for is a chance to use the "!" Character only as a String representation.

No need for special operators or stuff like this.

Peter

 

 

Coordinator
May 18, 2009 at 4:42 PM

I don't quite understand what are you trying to do. Are you building a new grammar? or just trying to feed some input expression with "User!UserId" term into sample expression evaluator?

May 18, 2009 at 5:42 PM

Hi Roman,

i'm the developer of SharpReport, the reporting tool for SharpDevelop.

To be as similar as possible to SqlServer ReportingServices i try to implement nearly the same grammer for expressions as SQlServer does.

So for a quick look:

http://msdn.microsoft.com/en-us/library/ms157274.aspx

In a big way i have to parse

User!UserId and some more

Globals!.PageNumber  and some more

Parameters!ParamName

Fields!FieldsInDataSet

Variables!Variablename

That's why i need the ExclamationMark

Thanks

Peter

 

 

Coordinator
May 19, 2009 at 6:37 AM

ok, what you need is define another non-terminal FieldRef, as kind of Term:

Term.Rule = number | ParExpr | Variable | FieldRef;

FieldRef.Rule = Variable + "!" + Variable;

 

Roman

May 20, 2009 at 6:41 AM
Edited May 20, 2009 at 6:48 AM

Hi Roman,

hopefully i did it correct.

After a long trail and error phase i found a solution by myself:

var exclamationMark = Symbol("!");

var UserSection = Symbol("User" );

 

var userSectionStmt = new NonTerminal("userStmt");

userSectionStmt.Rule = UserSection + exclamationMark + Symbol("UserId")

 | UserSection + exclamationMark + Symbol("test1")

| UserSection + exclamationMark + Symbol("test2");

The same go's for "Globals!xxx"

Statement.Rule = AssignmentStmt | Expr | Empty | userSectionStmt |globalSectionStmt ;

Did you see some disadvantages in this solution.

I will do some UnitTests in my Realworld application to see what solution fit's best.

By the way, did you have any idea about my first question:

Assignment without variable like

= Expression or what else

Thanks a lot for your help

Peter