File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -55,18 +55,23 @@ Tok Lexer::lex() {
5555 if (accept (' .' )) return {loc_, Tok::Tag::T_dot};
5656 if (accept (' ;' )) return {loc_, Tok::Tag::T_semicolon};
5757 if (accept (' +' )) return {loc_, Tok::Tag::T_add};
58- if (accept (' -' )) return {loc_, Tok::Tag::T_sub};
5958 if (accept (' *' )) return {loc_, Tok::Tag::T_mul};
59+
60+ // sub or single-line comment
61+ if (accept (' -' )) {
62+ if (accept (' -' )) {
63+ while (ahead () != utf8::EoF && ahead () != ' \n ' ) next ();
64+ continue ;
65+ }
66+ return {loc_, Tok::Tag::T_sub};
67+ }
68+
69+ // div or multi-line comment
6070 if (accept (' /' )) {
6171 if (accept (' *' )) {
6272 eat_comments ();
6373 continue ;
6474 }
65- if (accept (' /' )) {
66- while (ahead () != utf8::EoF && ahead () != ' \n ' ) next ();
67- continue ;
68- }
69-
7075 return {loc_, Tok::Tag::T_div};
7176 }
7277
You can’t perform that action at this time.
0 commit comments