Bugfixes for multiline comments to properly preserve column and to span multiple lines
This commit is contained in:
@@ -56,7 +56,6 @@ std::vector<TokenPtr> Lexer::lex(const std::string &input, const char *filename)
|
|||||||
input_iter += comment_end.size();
|
input_iter += comment_end.size();
|
||||||
++current_line;
|
++current_line;
|
||||||
current_col = 0;
|
current_col = 0;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
boost::match_results<std::string::const_iterator> eoc_delim;
|
boost::match_results<std::string::const_iterator> eoc_delim;
|
||||||
if (regex_search(input_iter, input_end, eoc_delim, multiline_comment_end_pattern.regex, boost::match_continuous)) {
|
if (regex_search(input_iter, input_end, eoc_delim, multiline_comment_end_pattern.regex, boost::match_continuous)) {
|
||||||
@@ -68,6 +67,7 @@ std::vector<TokenPtr> Lexer::lex(const std::string &input, const char *filename)
|
|||||||
}
|
}
|
||||||
if ((!found_eoc) && (input_iter != input_end)) {
|
if ((!found_eoc) && (input_iter != input_end)) {
|
||||||
++input_iter;
|
++input_iter;
|
||||||
|
current_col += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -118,7 +118,6 @@ void parse(std::vector<TokenPtr> &tokens, const char *filename) {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
if (results.second) {
|
if (results.second) {
|
||||||
std::cout << "Parse successful: " << std::endl;
|
std::cout << "Parse successful: " << std::endl;
|
||||||
debug_print(parent, "");
|
debug_print(parent, "");
|
||||||
@@ -127,7 +126,6 @@ void parse(std::vector<TokenPtr> &tokens, const char *filename) {
|
|||||||
std::cout << "Parse failed: " << std::endl;
|
std::cout << "Parse failed: " << std::endl;
|
||||||
debug_print(parent, "");
|
debug_print(parent, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -168,7 +166,7 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::vector<TokenPtr> tokens = lexer.lex(load_file(argv[1]), argv[1]);
|
std::vector<TokenPtr> tokens = lexer.lex(load_file(argv[1]), argv[1]);
|
||||||
|
debug_print(tokens);
|
||||||
parse(tokens, argv[1]);
|
parse(tokens, argv[1]);
|
||||||
//debug_print(tokens);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user