JavaScript: Show character code when reporting unexpected character.

This commit is contained in:
Max Schaefer
2019-03-21 10:41:29 +00:00
parent 8a693699fc
commit 1835028b93
7 changed files with 35 additions and 9 deletions

View File

@@ -721,7 +721,8 @@ public class Parser {
return this.finishOp(TokenType.prefix, 1);
}
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
String msg = String.format("Unexpected character '%s' (U+%04X)", codePointToString(code), code);
this.raise(this.pos, msg);
return null;
}

View File

@@ -163,9 +163,9 @@ import java.util.stream.Stream;
* following environment variables are available:
*
* <ul>
* <li><code>LGTM_THREADS</code> determines how many threads are used for parallel
* extraction of JavaScript files (TypeScript files cannot currently be extracted in
* parallel). If left unspecified, the extractor uses a single thread.
* <li><code>LGTM_THREADS</code> determines how many threads are used for parallel extraction of
* JavaScript files (TypeScript files cannot currently be extracted in parallel). If left
* unspecified, the extractor uses a single thread.
* <li><code>LGTM_TRAP_CACHE</code> and <code>LGTM_TRAP_CACHE_BOUND</code> can be used to specify
* the location and size of a trap cache to be used during extraction.
* </ul>

View File

@@ -37,7 +37,7 @@ public class Main {
* A version identifier that should be updated every time the extractor changes in such a way that
* it may produce different tuples for the same file under the same {@link ExtractorConfig}.
*/
public static final String EXTRACTOR_VERSION = "2019-03-13";
public static final String EXTRACTOR_VERSION = "2019-03-21";
public static final Pattern NEWLINE = Pattern.compile("\n");

View File

@@ -84,9 +84,7 @@ public class AutoBuildTests {
return f;
}
/**
* Add a file with default file type.
*/
/** Add a file with default file type. */
private Path addFile(boolean extracted, Path root, String... components) throws IOException {
return addFile(extracted, null, root, components);
}