equal
deleted
inserted
replaced
1 "{ Package: 'squeak:petitparser' }" |
1 "{ Package: 'stx:goodies/petitparser' }" |
2 |
2 |
3 PPCompositeParser subclass:#PPArithmeticParser |
3 PPCompositeParser subclass:#PPArithmeticParser |
4 instanceVariableNames:'terms addition factors multiplication power primary parentheses |
4 instanceVariableNames:'terms addition factors multiplication power primary parentheses |
5 number' |
5 number' |
6 classVariableNames:'' |
6 classVariableNames:'' |
16 ! ! |
16 ! ! |
17 |
17 |
18 !PPArithmeticParser methodsFor:'grammar'! |
18 !PPArithmeticParser methodsFor:'grammar'! |
19 |
19 |
20 addition |
20 addition |
21 ^ (factors separatedBy: ($+ asParser / $- asParser) token trim) |
21 ^ (factors separatedBy: ($+ asParser / $- asParser) token trim) |
22 foldLeft: [ :a :op :b | a perform: op value asSymbol with: b ] |
22 foldLeft: [ :a :op :b | a perform: op value asSymbol with: b ] |
23 ! |
23 ! |
24 |
24 |
25 factors |
25 factors |
26 ^ multiplication / power |
26 ^ multiplication / power |
52 ! ! |
52 ! ! |
53 |
53 |
54 !PPArithmeticParser class methodsFor:'documentation'! |
54 !PPArithmeticParser class methodsFor:'documentation'! |
55 |
55 |
56 version_SVN |
56 version_SVN |
57 ^ '$Id: PPArithmeticParser.st,v 1.1 2011-08-18 18:56:17 cg Exp $' |
57 ^ '$Id: PPArithmeticParser.st,v 1.2 2012-01-13 11:22:50 cg Exp $' |
58 ! ! |
58 ! ! |