mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-07 04:26:32 +08:00
This change makes it easier to run the script from directly `roll_py.deps` without having to fetch the dependencies first. This also makes it easier to track which dependencies our tooling have. Change-Id: I1ce55074ee6a1fffa6f2a2f05a56d0d74b4aca90 Bug: 1255619 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3431346 Reviewed-by: Mathias Bynens <mathias@chromium.org> Commit-Queue: Johan Bay <jobay@chromium.org>
51 lines
1.0 KiB
JavaScript
51 lines
1.0 KiB
JavaScript
// @ts-check
|
|
|
|
import { Base } from "./base.js";
|
|
import { unescape } from "./helpers.js";
|
|
|
|
export class WrappedToken extends Base {
|
|
/**
|
|
* @param {import("../tokeniser").Tokeniser} tokeniser
|
|
* @param {string} type
|
|
*/
|
|
static parser(tokeniser, type) {
|
|
return () => {
|
|
const value = tokeniser.consumeKind(type);
|
|
if (value) {
|
|
return new WrappedToken({
|
|
source: tokeniser.source,
|
|
tokens: { value },
|
|
});
|
|
}
|
|
};
|
|
}
|
|
|
|
get value() {
|
|
return unescape(this.tokens.value.value);
|
|
}
|
|
|
|
/** @param {import("../writer").Writer} w */
|
|
write(w) {
|
|
return w.ts.wrap([
|
|
w.token(this.tokens.value),
|
|
w.token(this.tokens.separator),
|
|
]);
|
|
}
|
|
}
|
|
|
|
export class Eof extends WrappedToken {
|
|
/**
|
|
* @param {import("../tokeniser").Tokeniser} tokeniser
|
|
*/
|
|
static parse(tokeniser) {
|
|
const value = tokeniser.consumeKind("eof");
|
|
if (value) {
|
|
return new Eof({ source: tokeniser.source, tokens: { value } });
|
|
}
|
|
}
|
|
|
|
get type() {
|
|
return "eof";
|
|
}
|
|
}
|