BenjaminSchaaf / sbnf

A BNF-style language for writing sublime-syntax files
MIT License
58 stars 6 forks source link

(~<expr>)* results in duplicate meta scopes #19

Closed AmjadHD closed 1 year ago

AmjadHD commented 3 years ago
main = (~string)*;

string{meta.string string.quoted.double} =
  '"'{punctuation.definition.string.begin}
    (~`\t`{constant.character.escape})*
    ~'"'{punctuation.definition.string.end};
%YAML 1.2
---
# http://www.sublimetext.com/docs/syntax.html
version: 2
name: xmpl
scope: source.xmpl
contexts:
  # Rule: main
  main:
    - match: '"'
      scope: meta.string.xmpl string.quoted.double.xmpl punctuation.definition.string.begin.xmpl
      push: string|0
  # Rule: string
  string|0:
    - meta_content_scope: meta.string.xmpl string.quoted.double.xmpl
    - match: '\\t'
      scope: meta.string.xmpl string.quoted.double.xmpl constant.character.escape.xmpl
    - match: '"'
      scope: meta.string.xmpl string.quoted.double.xmpl punctuation.definition.string.end.xmpl
      pop: true

since - match: '\\t' doesn't pop the context its scope should not include the meta scope.

mitranim commented 3 years ago

Possible duplicate of #13.