diff --git a/krakenGrammer.kgm b/krakenGrammer.kgm index d421a6b..60dd92c 100644 --- a/krakenGrammer.kgm +++ b/krakenGrammer.kgm @@ -27,8 +27,9 @@ actual_white = line_white | line_break | line_break actual_white | line_white ac WS = actual_white | WS comment WS | WS comment | ; # cpp_comment lets us do stuff like ending a statement with a cpp comment - c comments already work as they don't eat the return -maybe_line_white = "( | )+" | ; -line_end = maybe_line_white ";" | maybe_line_white line_break | maybe_line_white cpp_comment | WS c_comment line_end ; +maybe_line_white = "( | )+" | c_comment | maybe_line_white c_comment | maybe_line_white "( | )+" | ; +line_end = maybe_line_white ";" | maybe_line_white line_break | maybe_line_white cpp_comment ; +#line_end = maybe_line_white ";" | maybe_line_white line_break | maybe_line_white cpp_comment | WS c_comment line_end ; # line_end = "( | )+" ";" | "( | )+" line_break | "( | )+" cpp_comment | ";" | line_break | cpp_comment ; # line_end = WS ";" | WS line_break | WS cpp_comment ; @@ -99,7 +100,7 @@ statement = if_statement | while_loop | for_loop | return_statement line_end | b break_statement = "break" ; continue_statement = "continue" ; defer_statement = "defer" WS statement ; -function_call = unarad "\(" WS opt_parameter_list WS "\)" ; +function_call = unarad WS "\(" WS opt_parameter_list WS "\)" ; boolean_expression = boolean_expression WS "\|\|" WS and_boolean_expression | and_boolean_expression ; and_boolean_expression = and_boolean_expression WS "&&" WS bool_exp | bool_exp ; diff --git a/tests/test_c_comments.expected_results b/tests/test_c_comments.expected_results new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/tests/test_c_comments.expected_results @@ -0,0 +1 @@ +1 diff --git a/tests/test_c_comments.krak b/tests/test_c_comments.krak new file mode 100644 index 0000000..660dcbe --- /dev/null +++ b/tests/test_c_comments.krak @@ -0,0 +1,8 @@ +/*here*/ +/*here*/import /*here*/io/*here*/:/*here*/*/*here*/ +/*here*/ +/*here*/fun/*here*/ main/*here*/(/*here*/)/*here*/:/*here*/ int/*here*/ {/*here*/ + /*here*/ println/*here*/( /*here*/1 /*here*/ )/*here*/ + /*here*/ return /*here*/0/*here*/ + /*here*/}/*here*/ +/*here*/