首页 > 解决方案 > 用 tmLanguage 匹配 begin 和 pattern without end

问题描述

我正在尝试使用 tmLanguage 定义一种语言,以便在 vscode 中突出显示语法。我有以下规则。

"sexp": {
  "name": "entity.sexp",
  "patterns": [
    {"include": "#list_of_sexp"},
    {"include": "#atom"}
  ]
}

是否有可能有一个与带有“;”前缀的sexp匹配的评论规则?我不确定在“结束”中添加什么。

"comment": {
  "name": "comment.sexp",
  "begin": ";",
  "end": ??,
  "patterns": [{ "include": "#sexp" }]
}

标签: visual-studio-codesyntax-highlighting

解决方案


我最终在“结束”中用一个积极的前瞻正则表达式解决了这个问题。


推荐阅读