Skip to content

Commit 0a2ddf1

Browse files
authored
Update README.md
1 parent 0c396a5 commit 0a2ddf1

File tree

1 file changed

+49
-17
lines changed

1 file changed

+49
-17
lines changed

README.md

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,53 @@ Step 4: Evaluate the expression
5252
```
5353
### Simple assignment expressions - overwriting variable value
5454
```
55-
"a++" //Assign value of post increment expression
56-
"a--" //Assign value of post decrement expression
57-
"--a" //Assign value of pre decrement expression
58-
"++a" //Assign value of pre increment expression
59-
"a+=1" //Assign value of add expression
60-
"a-=1" //Assign value of substract expression
61-
"a*=2" //Assign value of multiply expression
62-
"a/=2" //Assign value of divide expression
63-
"a%=2" //Assign value of modulo expression
64-
"a<<=1" //Assign value of left-shift expression
65-
"a>>=1" //Assign value of right-shift expression
66-
"a&=7" //Assign value of bitwise-and expression
67-
"a|=7" //Assign value of bitwise-or expression
68-
"a^=7" //Assign value of bitwise-xor expression
69-
"a=(a+7)". //Assign value of a simple expression
70-
"a=(a+(Int16)7)" //Assign value of a complex expression
71-
"a=Int32.MaxValue" //Assign a constant value
55+
"a++" //Assign value of variable 'a' with post increment expression
56+
"a--" //Assign value of variable 'a' with post decrement expression
57+
"--a" //Assign value of variable 'a' with pre decrement expression
58+
"++a" //Assign value of variable 'a' with pre increment expression
59+
"a+=1" //Assign value of variable 'a' with add expression
60+
"a-=1" //Assign value of variable 'a' with substract expression
61+
"a*=2" //Assign value of variable 'a' with multiply expression
62+
"a/=2" //Assign value of variable 'a' with divide expression
63+
"a%=2" //Assign value of variable 'a' with modulo expression
64+
"a<<=1" //Assign value of variable 'a' with left-shift expression
65+
"a>>=1" //Assign value of variable 'a' with right-shift expression
66+
"a&=7" //Assign value of variable 'a' with bitwise-and expression
67+
"a|=7" //Assign value of variable 'a' with bitwise-or expression
68+
"a^=7" //Assign value of variable 'a' with bitwise-xor expression
69+
"a=(a+7)". //Assign value of variable 'a' with a simple expression
70+
"a=(a+(Int16)7)" //Assign value of variable 'a' with a complex expression
71+
"a=Int32.MaxValue" //Assign a constant value to variable 'a'. Is also an example of Field or property access on exported type. Requires Int32 to be added to exported type
7272
```
73+
### Simple logical expressions
74+
```
75+
"a < 7" //Compare < between variable 'a' and int constant
76+
"a <= 7" //Compare <= between variable 'a' and int constant
77+
"a == 6" //Compare for equality between variable 'a' and int constant
78+
"a != 6" //Compare for not equal between variable 'a' and int constant
79+
"a > 7" //Compare > between variable 'a' and int constant
80+
"a >= 7" //Compare >= between variable 'a' and int constant
81+
"a && 7" //Logical and between variable 'a' and int constant
82+
"a || 0" //Logical or between variable 'a' and int constant
83+
"true && true". //Logical and between boolean constants
84+
"true || false". //Logical or between boolean constants
85+
"a >= 7000000000" //Compare variable 'a' (int) with long constant
86+
```
87+
### Object creation expression
88+
```
89+
"new DateTime(50000000000)" //Create a new instance of DateTime based on Ticks (long). Requires DateTime to be added to ExportedTypes in Context
90+
"a=new DateTime(50000000000)" //Create a new instance of DateTime and assign to variable 'a'. Requires DateTime to be added to ExportedTypes in Context
91+
```
92+
### Method invocation expression
93+
```
94+
"a.AddTicks((Int64)100)". //Invokes method of variable (or on Exported Type)
95+
"a=a.AddTicks((Int64)100)" //Invokes method of variable and assign value to variable 'a'
96+
"Int32.Parse(\"100\")". //Invokes method on exported type. Requires Int32 to be added to ExportedTypes in Context
97+
```
98+
### Other complex example expression
99+
```
100+
"String.Concat(obj[\"channel\"][\"item\"][0][\"title\"].ToString().Substring(0,8), suffix)" //Operates on variable 'obj' of type JObject and 'suffix' of type String
101+
"Int32.Parse(((Int32)Math.Sqrt(a * a * 1.0)).ToString()) == 5" //Operates on variable 'a' of type int
102+
```
103+
### Reference - Test Cases
104+
[Functional Tests](https://github.com/sriksun/ExpressionEvaluator/blob/main/ExpressionEvaulatorTests/FunctionalTests.cs)

0 commit comments

Comments
 (0)