2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#define system.
|
||||
#define system'routines.
|
||||
#define extensions.
|
||||
#import system.
|
||||
#import system'routines.
|
||||
#import extensions.
|
||||
#import extensions'text.
|
||||
|
||||
#class Token
|
||||
{
|
||||
|
|
@ -9,7 +10,7 @@
|
|||
|
||||
#constructor new &level:aLevel
|
||||
[
|
||||
theValue := String new.
|
||||
theValue := StringWriter new.
|
||||
theLevel := aLevel + 9.
|
||||
]
|
||||
|
||||
|
|
@ -17,10 +18,10 @@
|
|||
|
||||
#method append : aChar
|
||||
[
|
||||
theValue += aChar.
|
||||
theValue << aChar.
|
||||
]
|
||||
|
||||
#method number = theValue value toReal.
|
||||
#method number = theValue get toReal.
|
||||
}
|
||||
|
||||
#class Node
|
||||
|
|
@ -100,8 +101,6 @@
|
|||
#method number => theTop.
|
||||
}
|
||||
|
||||
// --- States ---
|
||||
|
||||
#symbol operatorState = (:ch)
|
||||
[
|
||||
ch =>
|
||||
|
|
@ -219,7 +218,7 @@
|
|||
|
||||
#method append:ch
|
||||
[
|
||||
((ch >= 48) and:(ch < 58))
|
||||
((ch >= #48) and:(ch < #58))
|
||||
? [ theToken append:ch. ]
|
||||
! [ #throw InvalidArgumentException new &message:"Invalid expression". ].
|
||||
]
|
||||
|
|
@ -320,11 +319,13 @@
|
|||
#var aText := String new.
|
||||
#var aParser := Parser new.
|
||||
|
||||
[ (aText << console readLine) length > 0] doWhile:
|
||||
[ console readLine save &to:aText length > 0] doWhile:
|
||||
[
|
||||
console writeLine:"=" :(aParser run:aText)
|
||||
| if &Error:e [
|
||||
console writeLine:"Invalid Expression".
|
||||
].
|
||||
|
||||
aText clear.
|
||||
].
|
||||
].
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue