V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
chesha1
V2EX  ›  程序员

小众语言 torque 如何使用 markdown 代码块高亮

  •  
  •   chesha1 · 8 天前 · 948 次点击

    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);
        }
      }
    }
    
    目前尚无回复
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5877 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 06:16 · PVG 14:16 · LAX 23:16 · JFK 02:16
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.