v8 使用的 torque 语言,使用 cpp, javascript, typescript 作为代码块的语言,高亮显示得都不好,有什么办法吗?
举个例子,下面是用 typescript ,就会高亮过多内容
transitioning macro RegExpPrototypeExecBodyWithoutResultFast(
implicit context: Context)(regexp: JSRegExp,
string: String): RegExpMatchInfo labels IfDidNotMatch {
const lastIndex = LoadLastIndexAsLength(regexp, true);
return RegExpPrototypeExecBodyWithoutResult(regexp, string, lastIndex, true)
otherwise IfDidNotMatch;
}
下面是用 cpp ,最后一段不知道怎么识别错误了,全高亮成某一个东西了
transitioning macro RegExpExectransitioning macro RegExpExec(
implicit context: Context)(receiver: JSReceiver, string: String): JSAny {
// Take the slow path of fetching the exec property, calling it, and
// verifying its return value.
const exec = GetProperty(receiver, 'exec');
// Is {exec} callable?
typeswitch (exec) {
case (execCallable: Callable): {
const result = Call(context, execCallable, receiver, string);
if (result != Null) {
ThrowIfNotJSReceiver(
result, MessageTemplate::kInvalidRegExpExecResult, '');
}
return result;
}
case (Object): {
const regexp = Cast<JSRegExp>(receiver) otherwise ThrowTypeError(
MessageTemplate::kIncompatibleMethodReceiver, 'RegExp.prototype.exec',
receiver);
return RegExpPrototypeExecSlow(regexp, string);
}
}
}