summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustyna Att Ilczuk <justyna.ilczuk@gmail.com>2012-12-09 21:46:29 +0100
committerJustyna Att Ilczuk <justyna.ilczuk@gmail.com>2012-12-09 21:46:29 +0100
commitc862bad33f7faf05482dae04ac000adf5550e2a6 (patch)
tree2a68f3d792445b29072ab37eb2c220d041ae8576
parent2042c35d8502ecd66c7cdb49fff3a3a8887b01c9 (diff)
downloadsencha-lang-c862bad33f7faf05482dae04ac000adf5550e2a6.tar.gz
sencha-lang-c862bad33f7faf05482dae04ac000adf5550e2a6.tar.bz2
sencha-lang-c862bad33f7faf05482dae04ac000adf5550e2a6.tar.xz
sencha-lang-c862bad33f7faf05482dae04ac000adf5550e2a6.zip
Somethings wrong with assignments in "repeat".
-rw-r--r--Sencha-lang/AST/AllTypesOfASTNodes.h1
-rw-r--r--Sencha-lang/AST/RepeatStatement.cpp6
-rw-r--r--Sencha-lang/Parser.cpp10
3 files changed, 13 insertions, 4 deletions
diff --git a/Sencha-lang/AST/AllTypesOfASTNodes.h b/Sencha-lang/AST/AllTypesOfASTNodes.h
index 32dd53c..bb22126 100644
--- a/Sencha-lang/AST/AllTypesOfASTNodes.h
+++ b/Sencha-lang/AST/AllTypesOfASTNodes.h
@@ -21,6 +21,7 @@
#include "Assignment.h"
#include "DeclarationStatement.h"
#include "IfNode.h"
+#include "RepeatStatement.h"
//And probably more
//TODO actualize it
diff --git a/Sencha-lang/AST/RepeatStatement.cpp b/Sencha-lang/AST/RepeatStatement.cpp
index 18f7ca9..45e08c7 100644
--- a/Sencha-lang/AST/RepeatStatement.cpp
+++ b/Sencha-lang/AST/RepeatStatement.cpp
@@ -45,14 +45,12 @@ std::string RepeatStatement::debug()
void RepeatStatement::add_iteration_number(SenchaObject so)
{
-
- /*if(so.type == SenchaObject::integer_number)
+ if(so.type == SenchaObject::integer_number)
{
how_many_times = so.integer;
}
else
{
how_many_times = 0;
- }*/
- how_many_times = 3;
+ }
}
diff --git a/Sencha-lang/Parser.cpp b/Sencha-lang/Parser.cpp
index 7ac8fc6..5182793 100644
--- a/Sencha-lang/Parser.cpp
+++ b/Sencha-lang/Parser.cpp
@@ -220,6 +220,16 @@ ASTStatement * Parser::statement(ASTNode * parent)
delete stat;
return ifStatement;
+ }
+ else if(accept("repeat"))
+ {
+ RepeatStatement * repeat = new RepeatStatement(parent);
+ repeat->add_iteration_number(expr(repeat)->evaluate());
+ repeat->add_body(statement(repeat));
+
+ //similar stuff
+ delete stat;
+ return repeat;
}
else if(accept("while"))
{