Added break and return statements. Fixed inner block parsing

This commit is contained in:
Jonathan Turner
2009-06-09 13:16:11 +00:00
parent dba0f3ed7a
commit 53c3e2ee25
3 changed files with 171 additions and 83 deletions

View File

@@ -95,6 +95,12 @@ void parse(std::vector<TokenPtr> &tokens, const char *filename) {
block = Ign(Str("{")) >> ~return_statement >> Ign(Str("}"));
return_statement = Ign(Str("return")) >> expression;
*/
Rule rule(TokenType::Equation);
rule = Str("break");
std::cout << "Check: " << rule.impl->new_id << std::endl;
/*
Rule rule = *(expression >> *Ign(Id(TokenType::Semicolon)));
expression = term >> *((Str("+") >> term) | (Str("-") >> term));
term = factor >> *((Str("*") >> factor) | (Str("/") >> factor));
@@ -103,7 +109,7 @@ void parse(std::vector<TokenPtr> &tokens, const char *filename) {
negate = Ign(Str("-")) >> factor;
value = funcall | Id(TokenType::Identifier) | Id(TokenType::Number) | Id(TokenType::Quoted_String) | Id(TokenType::Single_Quoted_String);
*/
/*
Rule rule = Str("x") << Id(TokenType::Semicolon);
*/