Permalink
Browse files

[examples/algebra] updated

- ShowContents is now GGE::ShowContents
- $match<expr> is $match.hash-access('expr') until hash stuff is fixed
- changed a 'say' to a 'warn'
  • Loading branch information...
1 parent c48c45b commit c4fb5b3384bf05c92a70df5bc527cbd454db1ae2 @masak committed Feb 24, 2010
Showing with 4 additions and 4 deletions.
  1. +4 −4 examples/algebra
View
@@ -2,13 +2,13 @@ use v6;
use GGE::Exp;
use GGE::OPTable;
-class Algebra::Literal is GGE::Exp does ShowContents {
+class Algebra::Literal is GGE::Exp does GGE::ShowContents {
method evaluate() {
+$.ast;
}
}
-class Algebra::BinOp is GGE::Exp does ShowContents {
+class Algebra::BinOp is GGE::Exp does GGE::ShowContents {
}
class Algebra::Addition is Algebra::BinOp {
@@ -35,10 +35,10 @@ given GGE::OPTable.new() -> $optable {
while prompt('> ') -> $input {
my $match = $optable.parse($input);
if $match.to < $input.chars {
- say 'Could not parse the arithmetic expression';
+ warn 'Could not parse the arithmetic expression';
next;
}
- my $expr = $match<expr>;
+ my $expr = $match.hash-access('expr');
say $expr.evaluate;
}
say '';

0 comments on commit c4fb5b3

Please sign in to comment.