diff --git a/crates/erg_parser/lex.rs b/crates/erg_parser/lex.rs index d5c10d4cf..421a062b8 100644 --- a/crates/erg_parser/lex.rs +++ b/crates/erg_parser/lex.rs @@ -526,16 +526,6 @@ impl Lexer /*<'a>*/ { ), ))); } - // ignore indents if the current line is a comment - if let Some('#') = self.peek_cur_ch() { - if let Some('[') = self.peek_next_ch() { - if let Err(e) = self.lex_multi_line_comment() { - return Some(Err(e)); - } - } else if let Err(e) = self.lex_comment() { - return Some(Err(e)); - } - } let mut is_valid_dedent = false; let calc_indent_and_validate = |sum: usize, x: &usize| { if sum + *x == spaces_len || spaces_len == 0 { diff --git a/crates/erg_parser/tests/comment.er b/crates/erg_parser/tests/comment.er index d795f412b..5210a45b3 100644 --- a/crates/erg_parser/tests/comment.er +++ b/crates/erg_parser/tests/comment.er @@ -5,3 +5,20 @@ aa ]# a = 1 + +func() = + if True, do: + # aaa + log "hello" + # aaa + 1 + +C = Class() +C. + # new + new() = + C::__new__() + norm self = None + +# create a new instance of C +_ = C.new()