Returns a string containing the names of the tokens and their associated values. (String-literals are printed without escaping.)
(Token[] tokens)
| 103 | * values. (String-literals are printed without escaping.) |
| 104 | */ |
| 105 | private static String values(Token[] tokens) { |
| 106 | StringBuilder buffer = new StringBuilder(); |
| 107 | for (Token token : tokens) { |
| 108 | if (buffer.length() > 0) { |
| 109 | buffer.append(' '); |
| 110 | } |
| 111 | buffer.append(token.kind.name()); |
| 112 | if (token.value != null) { |
| 113 | buffer.append('(').append(token.value).append(')'); |
| 114 | } |
| 115 | } |
| 116 | return buffer.toString(); |
| 117 | } |
| 118 | |
| 119 | // Scans src, and asserts that the tokens match wantTokens |
| 120 | // and that there are no errors. |
no test coverage detected