| 784 | } |
| 785 | |
| 786 | static bool constructor_annotation(TSLexer *lexer) { |
| 787 | advance(lexer); // @ |
| 788 | bool newline = false; |
| 789 | if (!constructor_trivia(lexer, &newline)) return false; |
| 790 | if (lexer->lookahead == '[') return constructor_balanced(lexer, ']'); |
| 791 | for (;;) { |
| 792 | if (!constructor_trivia(lexer, &newline)) return false; |
| 793 | if (lexer->lookahead == '`') { |
| 794 | advance(lexer); |
| 795 | while (!lexer->eof(lexer) && lexer->lookahead != '`') advance(lexer); |
| 796 | if (lexer->eof(lexer)) return false; |
| 797 | advance(lexer); |
| 798 | } else { |
| 799 | if (!constructor_word_char(lexer->lookahead)) return false; |
| 800 | char ignored[32]; constructor_word(lexer, ignored, sizeof(ignored)); |
| 801 | } |
| 802 | if (!constructor_trivia(lexer, &newline)) return false; |
| 803 | if (lexer->lookahead == ':') { |
| 804 | advance(lexer); // use-site target |
| 805 | if (!constructor_trivia(lexer, &newline)) return false; |
| 806 | if (lexer->lookahead == '[') return constructor_balanced(lexer, ']'); |
| 807 | continue; |
| 808 | } |
| 809 | if (lexer->lookahead == '.') { advance(lexer); continue; } |
| 810 | break; |
| 811 | } |
| 812 | if (!constructor_trivia(lexer, &newline)) return false; |
| 813 | if (lexer->lookahead == '<' && !constructor_balanced(lexer, '>')) return false; |
| 814 | if (!constructor_trivia(lexer, &newline)) return false; |
| 815 | if (lexer->lookahead == '(' && !constructor_balanced(lexer, ')')) return false; |
| 816 | return true; |
| 817 | } |
| 818 | |
| 819 | // Advance-only: every caller has already marked the token end. |
| 820 | static bool where_type_constraint_follows(TSLexer *lexer, bool *newline) { |
no test coverage detected