MCPcopy
hub / github.com/bazelbuild/bazel / linenums

Method linenums

src/test/java/net/starlark/java/syntax/LexerTest.java:88–99  ·  view source on GitHub ↗

Lexes the specified input string, and returns a string containing just the line numbers of each token.

(String input)

Source from the content-addressed store, hash-verified

86 * token.
87 */
88 private String linenums(String input) {
89 Lexer lexer = createLexer(input);
90 StringBuilder buf = new StringBuilder();
91 for (Token tok : allTokens(lexer)) {
92 if (buf.length() > 0) {
93 buf.append(' ');
94 }
95 int line = lexer.locs.getLocation(tok.start).line();
96 buf.append(line);
97 }
98 return buf.toString();
99 }
100
101 /**
102 * Returns a string containing the names of the tokens and their associated

Callers 1

testLineNumbersMethod · 0.95

Calls 7

createLexerMethod · 0.95
allTokensMethod · 0.95
lineMethod · 0.80
getLocationMethod · 0.65
lengthMethod · 0.45
appendMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected