diff --git a/langkit/langkit_lexer.cpp b/langkit/langkit_lexer.cpp index 62815a6..20400b7 100644 --- a/langkit/langkit_lexer.cpp +++ b/langkit/langkit_lexer.cpp @@ -67,7 +67,7 @@ std::vector Lexer::lex(const std::string &input, const char *filename) } if ((!found_eoc) && (input_iter != input_end)) { ++input_iter; - current_col += 1; + ++current_col; } } diff --git a/langkit/langkit_parser.hpp b/langkit/langkit_parser.hpp index 0767c05..6acdcf8 100644 --- a/langkit/langkit_parser.hpp +++ b/langkit/langkit_parser.hpp @@ -77,7 +77,7 @@ struct Rule { return Rule(boost::bind(Or_Rule, _1, _2, _3, _4, _5, *this, rhs)); } - Rule operator<<(const Rule &rhs) { + Rule operator>>(const Rule &rhs) { return Rule(boost::bind(And_Rule, _1, _2, _3, _4, _5, *this, rhs)); } diff --git a/langkit/main.cpp b/langkit/main.cpp index 8c40dc8..75baf6f 100644 --- a/langkit/main.cpp +++ b/langkit/main.cpp @@ -53,14 +53,14 @@ void parse(std::vector &tokens, const char *filename) { /* Rule lhs; Rule rhs; - Rule rule = lhs << rhs; + Rule rule = lhs >> rhs; lhs = Str("def", true); rhs = Id(TokenType::Identifier, true); //Rule rule(TokenType::Function_Def); //rule = Str("def") | Str("int"); - //Rule rule = Str("def", false) << Id(TokenType::Identifier); + //Rule rule = Str("def", false) >> Id(TokenType::Identifier); */ @@ -73,11 +73,11 @@ void parse(std::vector &tokens, const char *filename) { Rule return_statement(TokenType::Return); Rule add(TokenType::Add); - rule = Ign(Str("def")) << Id(TokenType::Identifier) << ~(Ign(Str("(")) << ~params << Ign(Str(")"))) << block; - params = Id(TokenType::Identifier) << *(Ign(Str(",")) << Id(TokenType::Identifier)); - block = Ign(Str("{")) << ~return_statement << Ign(Str("}")); - return_statement = Ign(Str("return")) << add; - add = Id(TokenType::Identifier) << Ign(Str("+")) << Id(TokenType::Identifier); + rule = Ign(Str("def")) >> Id(TokenType::Identifier) >> ~(Ign(Str("(")) >> ~params >> Ign(Str(")"))) >> block; + params = Id(TokenType::Identifier) >> *(Ign(Str(",")) >> Id(TokenType::Identifier)); + block = Ign(Str("{")) >> ~return_statement >> Ign(Str("}")); + return_statement = Ign(Str("return")) >> add; + add = Id(TokenType::Identifier) >> Ign(Str("+")) >> Id(TokenType::Identifier); /* @@ -93,12 +93,12 @@ void parse(std::vector &tokens, const char *filename) { /* Rule rule(3); - rule = Ign(Str("Bob")) << Str("Fred"); + rule = Ign(Str("Bob")) >> Str("Fred"); */ /* statement = equation; - equation = Id(TokenType::Identifier) << Str("+") << Id(TokenType::Identifier); + equation = Id(TokenType::Identifier) >> Str("+") >> Id(TokenType::Identifier); */ /*