Data update
This commit is contained in:
parent
ed705008a8
commit
0df55f9f24
2196 changed files with 32999 additions and 3075 deletions
|
|
@ -97,7 +97,7 @@ singleton operatorState
|
|||
$40 { // (
|
||||
^ weak self.newBracket().gotoStarting()
|
||||
}
|
||||
: {
|
||||
! {
|
||||
^ weak self.newToken().append(ch).gotoToken()
|
||||
}
|
||||
}
|
||||
|
|
@ -123,8 +123,8 @@ singleton tokenState
|
|||
$47 { // /
|
||||
^ weak self.newFraction().gotoOperator()
|
||||
}
|
||||
: {
|
||||
^ weak self.append:ch
|
||||
! {
|
||||
^ weak self.append(ch)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -140,8 +140,8 @@ singleton startState
|
|||
$45 { // -
|
||||
^ weak self.newToken().append("0").newDifference().gotoOperator()
|
||||
}
|
||||
: {
|
||||
^ weak self.newToken().append:ch.gotoToken()
|
||||
! {
|
||||
^ weak self.newToken().append(ch).gotoToken()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -207,7 +207,7 @@ class Scope
|
|||
closeBracket()
|
||||
{
|
||||
if (_level < 10)
|
||||
{ InvalidArgumentException.new:"Invalid expression".raise() };
|
||||
{ InvalidArgumentException.new("Invalid expression").raise() };
|
||||
|
||||
_level := _level - 10
|
||||
}
|
||||
|
|
@ -216,17 +216,17 @@ class Scope
|
|||
{
|
||||
if(ch >= $48 && ch < $58)
|
||||
{
|
||||
_token.append:ch
|
||||
_token.append(ch)
|
||||
}
|
||||
else
|
||||
{
|
||||
InvalidArgumentException.new:"Invalid expression".raise()
|
||||
InvalidArgumentException.new("Invalid expression").raise()
|
||||
}
|
||||
}
|
||||
|
||||
append(string s)
|
||||
{
|
||||
s.forEach:(ch){ self.append:ch }
|
||||
s.forEach::(ch){ self.append(ch) }
|
||||
}
|
||||
|
||||
gotoStarting()
|
||||
|
|
@ -316,7 +316,7 @@ class Parser
|
|||
{
|
||||
var scope := Scope.new(self);
|
||||
|
||||
text.forEach:(ch){ scope.eval:ch };
|
||||
text.forEach::(ch){ scope.eval(ch) };
|
||||
|
||||
^ scope.Number
|
||||
}
|
||||
|
|
@ -331,11 +331,11 @@ public program()
|
|||
{
|
||||
try
|
||||
{
|
||||
console.printLine("=",parser.run:text)
|
||||
console.printLine("=",parser.run(text))
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
console.writeLine:"Invalid Expression"
|
||||
console.writeLine("Invalid Expression")
|
||||
};
|
||||
|
||||
text.clear()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue