MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / has_operand

Function has_operand

codegraph-kernel/grammars/scala/scanner.c:716–741  ·  view source on GitHub ↗

Whether a real operand follows the operator. Comments and line breaks are transparent, so scalac reads the next real token across them. A comment-only tail to EOF, a closing delimiter and a list separator are all no operand.

Source from the content-addressed store, hash-verified

714// transparent, so scalac reads the next real token across them. A comment-only
715// tail to EOF, a closing delimiter and a list separator are all no operand.
716static bool has_operand(TSLexer *lexer) {
717 for (;;) {
718 if (lexer->eof(lexer)) {
719 return false;
720 }
721 if (is_space(lexer->lookahead)) {
722 advance(lexer);
723 continue;
724 }
725 if (lexer->lookahead != '/') {
726 return !is_close_or_separator(lexer->lookahead);
727 }
728 advance(lexer);
729 if (lexer->lookahead == '/') {
730 while (!lexer->eof(lexer) && lexer->lookahead != '\n') {
731 advance(lexer);
732 }
733 continue;
734 }
735 if (lexer->lookahead != '*') {
736 return true; // a lone '/' is code
737 }
738 advance(lexer);
739 consume_block_comment_body(lexer);
740 }
741}
742
743// Blanks and then something that can be the right operand.
744static bool operand_follows(TSLexer *lexer) {

Callers 2

operand_followsFunction · 0.85
scan_implFunction · 0.85

Calls 4

is_spaceFunction · 0.85
is_close_or_separatorFunction · 0.85
advanceFunction · 0.70

Tested by

no test coverage detected