V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
FlashEcho
V2EX  ›  程序员

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

  •  
  •   FlashEcho · Aug 26, 2025 · 1484 views
    This topic created in 244 days ago, the information mentioned may be changed or developed.

    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);
        }
      }
    }
    
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1829 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 16:22 · PVG 00:22 · LAX 09:22 · JFK 12:22
    ♥ Do have faith in what you're doing.