summaryrefslogtreecommitdiffstats
path: root/sencha/Parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sencha/Parser.cpp')
-rw-r--r--sencha/Parser.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/sencha/Parser.cpp b/sencha/Parser.cpp
index d19d8e3..9fab40d 100644
--- a/sencha/Parser.cpp
+++ b/sencha/Parser.cpp
@@ -18,12 +18,12 @@ Parser::~Parser()
void Parser::report(string s)
{
- report_message += s + "\n";
+ report_message += s ;
}
void Parser::error(string s)
{
- error_message += s + "\n";
+ error_message += s ;
}
bool Parser::read_next()
@@ -55,7 +55,7 @@ void Parser::interpret()
if(accept("="))
{
expr();
- report(" := ");
+ report(" :=\n");
}
if(accept(";"))
{
@@ -140,6 +140,7 @@ void Parser::statement()
{
if(accept("{"))
{
+ report("GO Deeper\n");
while(!accept("}"))
{
statement();
@@ -152,7 +153,7 @@ void Parser::statement()
if(accept("="))
{
expr();
- report(" := ");
+ report(" :=\n");
}
expect(";");
}
@@ -165,8 +166,9 @@ void Parser::statement()
{
//similar stuff
}
- else if(tok_value == "return")
+ else if(accept("return"))
{
+
if(!peek(";"))
{
expr();
@@ -178,7 +180,8 @@ void Parser::statement()
else
{
expr();
- expect(";");
+ while(!expect(";")) read_next();
+
}
}
@@ -244,11 +247,11 @@ void Parser::add_expr()
if(accept("+"))
{
postfix_expr();
- report(" + ");
+ report(" +\n");
} else if(accept("-"))
{
postfix_expr();
- report(" - ");
+ report(" -\n");
}
}
}
@@ -260,7 +263,7 @@ void Parser::rel_expr()
{
accept("<");
add_expr();
- report(" < ");
+ report(" <\n");
}
}
@@ -272,12 +275,12 @@ void Parser::eq_expr()
if(accept("=="))
{
rel_expr();
- report("==");
+ report("==\n");
}
else if(accept("!="))
{
rel_expr();
- report("!=");
+ report("!=\n");
}
}
}