Add support for comments after section headers (closes #1259)

There's no canonical definition of what's the INI syntax, but Python's `ConfigParser` supports comments after section headers:

```ini
[section] ; comment
```
This commit is contained in:
Niklas Sombert 2020-10-05 17:52:40 +02:00 committed by David Peter
parent aa205c6a9f
commit 5e0b7f013a
2 changed files with 3 additions and 2 deletions

2
assets/README.md vendored
View File

@ -33,7 +33,7 @@ The following files have been manually modified after converting from a `.tmLang
* `Apache.sublime_syntax`=> removed `.conf` and `.CONF` file types.
* `Dart.sublime-syntax` => removed `#regex.dart` include.
* `INI.sublime-syntax` => added `.hgrc`, `hgrc`, and `desktop` file types.
* `INI.sublime-syntax` => added `.hgrc`, `hgrc`, and `desktop` file types and support for comments after section headers
* `Org mode.sublime-syntax` => removed `task` file type.
* `SML.sublime_syntax` => removed `ml` file type.

View File

@ -25,12 +25,13 @@ contexts:
scope: comment.line.semicolon.ini
captures:
1: punctuation.definition.comment.ini
- match: '^\s*(\[)(.*?)(\])'
- match: '^\s*(\[)(.*?)(\])\s*(;.*)?$\n?'
scope: meta.tag.section.ini
captures:
1: punctuation.definition.section.ini
2: entity.section.ini
3: punctuation.definition.section.ini
4: comment.definition.section.ini
- match: '^(\s*(["'']?)(.+?)(\2)\s*(=))?\s*((["'']?)(.*?)(\7))\s*(;.*)?$\n?'
scope: meta.declaration.ini
captures: