-
Notifications
You must be signed in to change notification settings - Fork 591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Sublime Syntax Main Key Sort Order #2430
Comments
This commit... 1. updates XML/DTD syntax to sublime-syntax version 2. 2. sorts the main keys according to proposal sublimehq#2430 3. sorts hidden file extensions 4. removes some quotation marks from values.
This commit... 1. updates XML/DTD syntax to sublime-syntax version 2. 2. sorts the main keys according to proposal #2430 3. sorts hidden file extensions 4. removes some quotation marks from values.
Fixes sublimehq#2759 This commit... 1. sorts main header keys according to sublimehq#2430 2. adds or update `first_line_match` patterns to all appropriate syntax definitions in order to support emacs mode tags. Examples: // -*-c-*- // -*- c -*- // -*- mode: c -*- // -*- mode: c++; -*-
Fixes sublimehq#2759 This commit... 1. sorts main header keys according to sublimehq#2430 2. adds or update `first_line_match` patterns to all appropriate syntax definitions in order to support emacs mode tags. Examples: // -*-c-*- // -*- c -*- // -*- mode: c -*- // -*- mode: c++; -*-
Fixes sublimehq#2759 This commit... 1. sorts main header keys according to sublimehq#2430 2. adds or update `first_line_match` patterns to all appropriate syntax definitions in order to support emacs mode tags. Examples: // -*-c-*- // -*- c -*- // -*- mode: c -*- // -*- mode: c++; -*-
This commit... 1. updates to sublime-syntax "version 2" 2. re-orders header contexts sublimehq#2430 3. replaces `pop: true` by `pop: 1`
) * [Regular Expressions] Split into common syntax and boost syntax * [Regular Expressions] Move remaining anonymous contexts to named ones * [Regular Expressions] Update to sublime-syntax version 2 This commit... 1. updates to sublime-syntax "version 2" 2. re-orders header contexts #2430 3. replaces `pop: true` by `pop: 1` * [Regular Expression] Rename Regexp Common syntax file This commit renames "Regexp Common" to "Regexp (Basic)" to make it follow the naming scheme `<main name> (<derivative>)` which is already used by several syntaxes of this repo to express inheritance. * [Regular Expression] Remove unnecessary multi-set statement * [Regular Expression] Move group-start-common context * [Regular Expression] avoid unreached lookahead `base-group` and `group-body` of same content but distinguish by the way they pop, only. The latter consumes closing parens, while the former does not. Including the former into latter causes the lookahead `(?=\))` of the former being added into the latter one, which doesn't make sense. This commit therefore includes `base-literal` vs. `base-literal-extended` into `group-body` and its extended counterpart to exclude that unnecessary lookahead. * [Regular Expression] Tweak extended lien comment punctuation * [Regular Expression] Reorganize context names This commit... 1. renames all non-popping context names to plural 2. renames some `inside-...` contexts to `...-body` as some of them already used the latter nameing scheme. 3. adds a dedicated context for `line-comments` in case an inherited syntax wants to modify them. Notes: 1. This commit doesn't change behavior. 2. Goal is a common naming scheme, which is important if this package becomes a base for inheritance. * [Regular Expression] Rename unexpected-qualifier(s) contexts This commit applies plural/singular for (non-)popping unexpected-qualifier(s) contexts. As several qualifiers may be present in `unexpected-quantifier-pop` it feels more natural to name this context `maybe-unexpected-quantifiers`. * [Regular Expression] Use multi-push for charset ranges This commit creates a named context for `charset-ranges` and pushes both `charset-range-begin` and `charset-range-end` on stack at the same time. It slightly improves parsing performance. * [Regular Expression] Merge escaped-chars contexts * [Regular Expression] Add popping escaped-char contexts ... in case it needs to be addressed by an inherited syntax. * [Regular Expression] Move backslash child contexts This commit moves backslash related children below the `backslash` context. * [Regular Expression] Remove meta.literal This commit removes `meta.literal` as it causes each literal character to be tokenized separately, which slows down the syntax definition. Note: Clojure's and Perl's syntax tests are relaxed to not check for the removed meta scope anymore. * [Regular Expression] Reorganize backslashes context This commit splits `backslashes` context into anchors, backrefs, backslashes * [Regular Expression] Move group-start-common This commit moves the group-start-common context in Regexp.sublime-syntax to the same relative position as in the basic syntax and removes some unnecessary quotes. * [Regular Expression] Remove quotes * Update Regular Expressions/RegExp (Basic).sublime-syntax Co-authored-by: deathaxe <[email protected]> Co-authored-by: DeathAxe <[email protected]> Co-authored-by: deathaxe <[email protected]>
This commit... 1. updates all syntax definitions to version 2 syntax format 2. replaces pop: true by pop: 1 3: resorts main keys according to sublimehq#2430
This commit... 1. updates all syntax definitions to version 2 syntax format 2. replaces pop: true by pop: 1 3: resorts main keys according to #2430
As there has been no oppositions to this, I'd personally say that this is now the standard and perhaps should be written in our RFC repository https://github.com/SublimeText/ScopeNamingGuidelines :) |
Basically applies sublimehq/Packages#2430 Just another idea. Just drop it, if you don't like it.
Basically applies sublimehq/Packages#2430 Just another idea. Just drop it, if you don't like it.
- Split `JSON.sublime-syntax` into ... using inheritance: - `JSON (Basic).sublime-syntax` with `scope:source.json.basic` - `JSON.sublime-syntax` with `scope:source.json` - `JSONC.sublime-syntax` with `scope:source.json.jsonc` - `JSON5.sublime-syntax` with `scope:source.json.json5` - Although the base syntax does not define a `prototype`, we add `meta_include_prototype: false` to the base syntax, to prevent inheriting syntaxes from injecting rules. - make use of `variables` - Add many more file extensions for `JSON` and `JSONC` - Significantly extend tests to cover more parts of the syntaxes defined: - Split original test file into logical parts - Add indentation tests for: - `JSON`, `JSONC` - `mapping` (objects), `sequence` (arrays) - leave `JSON` headers in `Markdown` as json only, but split up fenced code blocks into `json` and `jsonc` to behave similarly to `GitHub Flavored Markdown` - fix tests for `meta.mapping meta.mapping.*` - make `mapping.*` contexts more modular - fix sublimehq#285 as requested by Jon - address sublimehq#757 and use tips to fix line comments for `JSONC` - address sublimehq#2430 and use sort-order as requested by deathaxe - address sublimehq#2852 and use tips to fix scopes of curly braces & square brackets in `JSON` Co-authored-by: Ashwin Shenoy <[email protected]> Co-authored-by: Jack Cherng <[email protected]> Co-authored-by: Janos Wortmann <[email protected]> Co-authored-by: Jon Skinner <[email protected]> Co-authored-by: FichteFoll <[email protected]> Co-authored-by: Keith Hall <[email protected]> Co-authored-by: Michael B. Lyons <[email protected]> Co-authored-by: Rafał Chłodnicki <[email protected]> Co-authored-by: deathaxe <[email protected]>
- Split `JSON.sublime-syntax` into ... using inheritance: - `JSON (Basic).sublime-syntax` with `scope:source.json.basic` - `JSON.sublime-syntax` with `scope:source.json` - `JSONC.sublime-syntax` with `scope:source.json.jsonc` - `JSON5.sublime-syntax` with `scope:source.json.json5` - Although the base syntax does not define a `prototype`, we add `meta_include_prototype: false` to the base syntax, to prevent inheriting syntaxes from injecting rules. - make use of `variables` - Add many more file extensions for `JSON` and `JSONC` - Significantly extend tests to cover more parts of the syntaxes defined: - Split original test file into logical parts - Add indentation tests for: - `JSON`, `JSONC` - `mapping` (objects), `sequence` (arrays) - leave `JSON` headers in `Markdown` as json only, but split up fenced code blocks into `json` and `jsonc` to behave similarly to `GitHub Flavored Markdown` - fix tests for `meta.mapping meta.mapping.*` - make `mapping.*` contexts more modular - fix sublimehq#285 as requested by Jon - address sublimehq#757 and use tips to fix line comments for `JSONC` - address sublimehq#2430 and use sort-order as requested by deathaxe - address sublimehq#2852 and use tips to fix scopes of curly braces & square brackets in `JSON` Co-authored-by: Ashwin Shenoy <[email protected]> Co-authored-by: Jack Cherng <[email protected]> Co-authored-by: Janos Wortmann <[email protected]> Co-authored-by: Jon Skinner <[email protected]> Co-authored-by: FichteFoll <[email protected]> Co-authored-by: Keith Hall <[email protected]> Co-authored-by: Michael B. Lyons <[email protected]> Co-authored-by: Rafał Chłodnicki <[email protected]> Co-authored-by: deathaxe <[email protected]>
- Split `JSON.sublime-syntax` into ... using inheritance: - `JSON (Basic).sublime-syntax` with `scope:source.json.basic` - `JSON.sublime-syntax` with `scope:source.json` - `JSONC.sublime-syntax` with `scope:source.json.jsonc` - `JSON5.sublime-syntax` with `scope:source.json.json5` - Although the base syntax does not define a `prototype`, we add `meta_include_prototype: false` to the base syntax, to prevent inheriting syntaxes from injecting rules. - make use of `variables` - Add many more file extensions for `JSON` and `JSONC` - Significantly extend tests to cover more parts of the syntaxes defined: - Split original test file into logical parts - Add indentation tests for: - `JSON`, `JSONC` - `mapping` (objects), `sequence` (arrays) - leave `JSON` headers in `Markdown` as json only, but split up fenced code blocks into `json` and `jsonc` to behave similarly to `GitHub Flavored Markdown` - fix tests for `meta.mapping meta.mapping.*` - make `mapping.*` contexts more modular - fix sublimehq#285 as requested by Jon - address sublimehq#757 and use tips to fix line comments for `JSONC` - address sublimehq#2430 and use sort-order as requested by deathaxe - address sublimehq#2852 and use tips to fix scopes of curly braces & square brackets in `JSON` Co-authored-by: Ashwin Shenoy <[email protected]> Co-authored-by: Jack Cherng <[email protected]> Co-authored-by: Janos Wortmann <[email protected]> Co-authored-by: Jon Skinner <[email protected]> Co-authored-by: FichteFoll <[email protected]> Co-authored-by: Keith Hall <[email protected]> Co-authored-by: Michael B. Lyons <[email protected]> Co-authored-by: Rafał Chłodnicki <[email protected]> Co-authored-by: deathaxe <[email protected]>
- Split `JSON.sublime-syntax` into ... using inheritance: - `JSON (Basic).sublime-syntax` with `scope:source.json.basic` - `JSON.sublime-syntax` with `scope:source.json` - `JSONC.sublime-syntax` with `scope:source.json.jsonc` - `JSON5.sublime-syntax` with `scope:source.json.json5` - Although the base syntax does not define a `prototype`, we add `meta_include_prototype: false` to the base syntax, to prevent inheriting syntaxes from injecting rules. - make use of `variables` - Add many more file extensions for `JSON` and `JSONC` - Significantly extend tests to cover more parts of the syntaxes defined: - Split original test file into logical parts - Add indentation tests for: - `JSON`, `JSONC` - `mapping` (objects), `sequence` (arrays) - leave `JSON` headers in `Markdown` as json only, but split up fenced code blocks into `json` and `jsonc` to behave similarly to `GitHub Flavored Markdown` - fix tests for `meta.mapping meta.mapping.*` - make `mapping.*` contexts more modular - fix sublimehq#285 as requested by Jon - address sublimehq#757 and use tips to fix line comments for `JSONC` - address sublimehq#2430 and use sort-order as requested by deathaxe - address sublimehq#2852 and use tips to fix scopes of curly braces & square brackets in `JSON` Co-authored-by: Ashwin Shenoy <[email protected]> Co-authored-by: Jack Cherng <[email protected]> Co-authored-by: Janos Wortmann <[email protected]> Co-authored-by: Jon Skinner <[email protected]> Co-authored-by: FichteFoll <[email protected]> Co-authored-by: Keith Hall <[email protected]> Co-authored-by: Michael B. Lyons <[email protected]> Co-authored-by: Rafał Chłodnicki <[email protected]> Co-authored-by: deathaxe <[email protected]>
* [Common] Add or update emacs mode patterns Fixes #2759 This commit... 1. sorts main header keys according to #2430 2. adds or update `first_line_match` patterns to all appropriate syntax definitions in order to support emacs mode tags. Examples: // -*-c-*- // -*- c -*- // -*- mode: c -*- // -*- mode: c++; -*- * [ActionScript] Fix first line pattern * [ASP] Fix first line pattern Moves `-*- asp -*-` to HTML (ASP).sublime-syntax * [JSP] Add missing first line pattern * [Java] Revert first line pattern JSP is html like syntax and probably doesn't need or never sees such mode comment. * [ASP] Revert first line pattern HTML (ASP) won't probably see any such comment, thus removing it. * [All] Allow anything in front of emacs mode tag comments Sync with PR #2862 * [Haskell] Add shebang to first_line_match * [Lua] Add shebang to first_line_match * [ShellScript] Add DASH shebang * [PHP] Add minor version support in shebang Syncs modification from #2915 to add support for php executables such as php php7 php71 php7.1 php7.1.3 to `first_line_match`'s shebang/editorconfig pattern. * [Batch File] Add "@echo on" to first_line_match
- Split `JSON.sublime-syntax` into ... using inheritance: - `JSON (Basic).sublime-syntax` with `scope:source.json.basic` - `JSON.sublime-syntax` with `scope:source.json` - `JSONC.sublime-syntax` with `scope:source.json.jsonc` - `JSON5.sublime-syntax` with `scope:source.json.json5` - Although the base syntax does not define a `prototype`, we add `meta_include_prototype: false` to the base syntax, to prevent inheriting syntaxes from injecting rules. - make use of `variables` - Add many more file extensions for `JSON` and `JSONC` - Significantly extend tests to cover more parts of the syntaxes defined: - Split original test file into logical parts - Add indentation tests for: - `JSON`, `JSONC` - `mapping` (objects), `sequence` (arrays) - leave `JSON` headers in `Markdown` as json only, but split up fenced code blocks into `json` and `jsonc` to behave similarly to `GitHub Flavored Markdown` - fix tests for `meta.mapping meta.mapping.*` - make `mapping.*` contexts more modular - fix sublimehq#285 as requested by Jon - address sublimehq#757 and use tips to fix line comments for `JSONC` - address sublimehq#2430 and use sort-order as requested by deathaxe - address sublimehq#2852 and use tips to fix scopes of curly braces & square brackets in `JSON` Co-authored-by: Ashwin Shenoy <[email protected]> Co-authored-by: Jack Cherng <[email protected]> Co-authored-by: Janos Wortmann <[email protected]> Co-authored-by: Jon Skinner <[email protected]> Co-authored-by: FichteFoll <[email protected]> Co-authored-by: Keith Hall <[email protected]> Co-authored-by: Michael B. Lyons <[email protected]> Co-authored-by: Rafał Chłodnicki <[email protected]> Co-authored-by: deathaxe <[email protected]>
- Using inheritance split up `JSON.sublime-syntax` into: - `JSON (Basic).sublime-syntax` with `scope:source.json.basic` - `JSON.sublime-syntax` with `scope:source.json` - `JSONC.sublime-syntax` with `scope:source.json.jsonc` - `JSON5.sublime-syntax` with `scope:source.json.json5` - Add many more file extensions for `JSON` & `JSONC`: - add doc links to exensions where applicable as a reference to be able to more quickly verify that they (still) use said syntax flavor - Add JSON5 with support for: - explicitly pos numbers, hexadecimal ints, Infinity and NaN - single quoted strings - more escape chars for strings - Only allow objects or arrays at the top level - add `meta.toc-list` scope to top level object keys to add them to the symbol list (also add tests, see below) - Make use of newer syntax features including those only available in `version: 2` syntaxes - Make use of `variables` - Highlighting speed improvements for empty objects and empty arrays - Significantly improve number highlighting - Correctly scope number signs with `constant.numeric.sign` instead of `keyword.operator.arithmetic` - Significantly extend tests to cover more parts of the syntaxes defined: - Split original test file into logical parts - Add indentation tests for: - `json`, `jsonc` & `json5` - `mapping` (objects), `sequence` (arrays) - Add symbols tests for: - scope: `meta.toc-list.json | meta.toc-list.json5` - languages: `json`, `jsonc` & `json5` - Fix tests for `meta.mapping meta.mapping.*` - Make `mapping.*` contexts more modular - Leave `JSON` headers in `Markdown` as `json` only, but split up fenced code blocks into `json`, `jsonc` & `json5` to behave similarly to `GitHub Flavored Markdown` BREAKING CHANGES: - scopes for number signs have changed from being `keyword.operator.arithmetic` to `constant.numeric.sign` - fix sublimehq#285 as requested by Jon - address sublimehq#757 using tips to fix line comments for `JSONC` - address sublimehq#2430 using sort-order as requested by deathaxe - address sublimehq#2852 using tips to fix scopes of curly braces & square brackets in `JSON` Co-authored-by: Ashwin Shenoy <[email protected]> Co-authored-by: Jack Cherng <[email protected]> Co-authored-by: Janos Wortmann <[email protected]> Co-authored-by: Jon Skinner <[email protected]> Co-authored-by: FichteFoll <[email protected]> Co-authored-by: Keith Hall <[email protected]> Co-authored-by: Michael B. Lyons <[email protected]> Co-authored-by: Rafał Chłodnicki <[email protected]> Co-authored-by: deathaxe <[email protected]>
- Using inheritance split up `JSON.sublime-syntax` into: - `JSON (Basic).sublime-syntax` with `scope:source.json.basic` - `JSON.sublime-syntax` with `scope:source.json` - `JSONC.sublime-syntax` with `scope:source.json.jsonc` - `JSON5.sublime-syntax` with `scope:source.json.json5` - Add many more file extensions for `JSON` & `JSONC`: - add doc links to exensions where applicable as a reference to be able to more quickly verify that they (still) use said syntax flavor - Add JSON5 with support for: - explicitly pos numbers, hexadecimal ints, Infinity and NaN - single quoted strings - more escape chars for strings - Only allow objects or arrays at the top level - add `meta.toc-list` scope to top level object keys to add them to the symbol list (also add tests, see below) - Make use of newer syntax features including those only available in `version: 2` syntaxes - Make use of `variables` - Highlighting speed improvements for empty objects and empty arrays - Significantly improve number highlighting - Correctly scope number signs with `constant.numeric.sign` instead of `keyword.operator.arithmetic` - Significantly extend tests to cover more parts of the syntaxes defined: - Split original test file into logical parts - Add indentation tests for: - `json`, `jsonc` & `json5` - `mapping` (objects), `sequence` (arrays) - Add symbols tests for: - scope: `meta.toc-list.json | meta.toc-list.json5` - languages: `json`, `jsonc` & `json5` - Fix tests for `meta.mapping meta.mapping.*` - Make `mapping.*` contexts more modular - Leave `JSON` headers in `Markdown` as `json` only, but split up fenced code blocks into `json`, `jsonc` & `json5` to behave similarly to `GitHub Flavored Markdown` BREAKING CHANGES: - scopes for number signs have changed from being `keyword.operator.arithmetic` to `constant.numeric.sign` - fix sublimehq#285 as requested by Jon - address sublimehq#757 using tips to fix line comments for `JSONC` - address sublimehq#2430 using sort-order as requested by deathaxe - address sublimehq#2852 using tips to fix scopes of curly braces & square brackets in `JSON` Co-authored-by: Ashwin Shenoy <[email protected]> Co-authored-by: Jack Cherng <[email protected]> Co-authored-by: Janos Wortmann <[email protected]> Co-authored-by: Jon Skinner <[email protected]> Co-authored-by: FichteFoll <[email protected]> Co-authored-by: Keith Hall <[email protected]> Co-authored-by: Michael B. Lyons <[email protected]> Co-authored-by: Rafał Chłodnicki <[email protected]> Co-authored-by: deathaxe <[email protected]>
Basically applies sublimehq/Packages#2430 Just another idea. Just drop it, if you don't like it.
- Using inheritance split up `JSON.sublime-syntax` into: - `JSON (Basic).sublime-syntax` with `scope:source.json.basic` - `JSON.sublime-syntax` with `scope:source.json` - `JSONC.sublime-syntax` with `scope:source.json.jsonc` - `JSON5.sublime-syntax` with `scope:source.json.json5` - Add many more file extensions for `JSON` & `JSONC`: - add doc links to extensions where applicable as a reference to be able to more quickly verify that they (still) use said syntax flavor - JSON: - (correctly formatted) JSON code can now be prettified or minified via the context menu or the command palette - highlight leading, trailing & multiple commas as invalid - only allow exactly one structure (object, array) or value (constant, number, string) at top level (thanks to Keith) - JSONC: - highlight some files by default as `JSONC` (as decided by Jon in sublimehq#285) - highlight leading & multiple commas as invalid, trailing as valid - JSON5: - explicitly pos numbers, hexadecimal ints, Infinity and NaN - single quoted strings - more escape chars for strings - ECMA identifierName as object keys (thanks to Thomas) - scoped as plain unquoted strings - line continuation in strings (with tests thanks to Keith) - Objects: - Add `meta.toc-list` scope to top level object keys to add them to the symbol list (also add tests, see below) - Highlighting speed improvements for empty objects (thanks to FichteFoll) - Make `mapping.*` contexts more modular - Arrays: - Highlighting speed improvements for empty arrays (thanks to FichteFoll) - Numbers: - Correctly scope number signs with `constant.numeric.sign` instead of `keyword.operator.arithmetic` - Significantly improve number highlighting (thanks to deathaxe) - Syntaxes: - Make use of newer syntax features including those only available in `version: 2` syntaxes - Make use of `variables` (with optimizations provided by deathaxe and regex patterns provided by Thomas) - Tests: - Significantly extend tests to cover more parts of the syntaxes defined. - Split original test file into logical parts - Add indentation tests for: - `json`, `jsonc` & `json5` - `mapping` (objects), `sequence` (arrays) - Add symbols tests for: - scope: `meta.toc-list.json | meta.toc-list.json5` - languages: `json`, `jsonc` & `json5` - Fix tests for `meta.mapping meta.mapping.*` - Leave `JSON` headers in `Markdown` as `json` only, but split up fenced code blocks into `json`, `jsonc` & `json5` to behave similarly to `GitHub Flavored Markdown` BREAKING CHANGES: - JSON does not have values that can be set via an inline calculation with the help of operators, but only simple number values. Scopes for number signs have changed from being `keyword.operator.arithmetic` to `constant.numeric.sign`. Color scheme authors should add this, should it be missing. - The `JSON.sublime-syntax` now marks comments as `invalid`, third party plugin authors should target `JSONC.sublime-syntax` instead to have the same user experience as before. - fix sublimehq#285 - address sublimehq#481 to remove incompatible regex patterns according to Will - address sublimehq#757 to fix line comments for `JSONC` (thanks to Keith) - address sublimehq#2430 using sort-order (as requested by deathaxe) - address sublimehq#2852 to fix scopes of curly braces & square brackets in `JSON` (thanks to Thomas) - address sublimehq/sublime_text#3154 and add symbol tests Co-authored-by: Ashwin Shenoy <[email protected]> Co-authored-by: Jack Cherng <[email protected]> Co-authored-by: Janos Wortmann <[email protected]> Co-authored-by: Jon Skinner <[email protected]> Co-authored-by: FichteFoll <[email protected]> Co-authored-by: Keith Hall <[email protected]> Co-authored-by: Michael B. Lyons <[email protected]> Co-authored-by: Rafał Chłodnicki <[email protected]> Co-authored-by: Thomas Smith <[email protected]> Co-authored-by: Will Bond <[email protected]> Co-authored-by: deathaxe <[email protected]>
This commit... 1. updates XML/DTD syntax to sublime-syntax version 2. 2. sorts the main keys according to proposal sublimehq#2430 3. sorts hidden file extensions 4. removes some quotation marks from values.
…blimehq#3034) * [Regular Expressions] Split into common syntax and boost syntax * [Regular Expressions] Move remaining anonymous contexts to named ones * [Regular Expressions] Update to sublime-syntax version 2 This commit... 1. updates to sublime-syntax "version 2" 2. re-orders header contexts sublimehq#2430 3. replaces `pop: true` by `pop: 1` * [Regular Expression] Rename Regexp Common syntax file This commit renames "Regexp Common" to "Regexp (Basic)" to make it follow the naming scheme `<main name> (<derivative>)` which is already used by several syntaxes of this repo to express inheritance. * [Regular Expression] Remove unnecessary multi-set statement * [Regular Expression] Move group-start-common context * [Regular Expression] avoid unreached lookahead `base-group` and `group-body` of same content but distinguish by the way they pop, only. The latter consumes closing parens, while the former does not. Including the former into latter causes the lookahead `(?=\))` of the former being added into the latter one, which doesn't make sense. This commit therefore includes `base-literal` vs. `base-literal-extended` into `group-body` and its extended counterpart to exclude that unnecessary lookahead. * [Regular Expression] Tweak extended lien comment punctuation * [Regular Expression] Reorganize context names This commit... 1. renames all non-popping context names to plural 2. renames some `inside-...` contexts to `...-body` as some of them already used the latter nameing scheme. 3. adds a dedicated context for `line-comments` in case an inherited syntax wants to modify them. Notes: 1. This commit doesn't change behavior. 2. Goal is a common naming scheme, which is important if this package becomes a base for inheritance. * [Regular Expression] Rename unexpected-qualifier(s) contexts This commit applies plural/singular for (non-)popping unexpected-qualifier(s) contexts. As several qualifiers may be present in `unexpected-quantifier-pop` it feels more natural to name this context `maybe-unexpected-quantifiers`. * [Regular Expression] Use multi-push for charset ranges This commit creates a named context for `charset-ranges` and pushes both `charset-range-begin` and `charset-range-end` on stack at the same time. It slightly improves parsing performance. * [Regular Expression] Merge escaped-chars contexts * [Regular Expression] Add popping escaped-char contexts ... in case it needs to be addressed by an inherited syntax. * [Regular Expression] Move backslash child contexts This commit moves backslash related children below the `backslash` context. * [Regular Expression] Remove meta.literal This commit removes `meta.literal` as it causes each literal character to be tokenized separately, which slows down the syntax definition. Note: Clojure's and Perl's syntax tests are relaxed to not check for the removed meta scope anymore. * [Regular Expression] Reorganize backslashes context This commit splits `backslashes` context into anchors, backrefs, backslashes * [Regular Expression] Move group-start-common This commit moves the group-start-common context in Regexp.sublime-syntax to the same relative position as in the basic syntax and removes some unnecessary quotes. * [Regular Expression] Remove quotes * Update Regular Expressions/RegExp (Basic).sublime-syntax Co-authored-by: deathaxe <[email protected]> Co-authored-by: DeathAxe <[email protected]> Co-authored-by: deathaxe <[email protected]>
This commit... 1. updates all syntax definitions to version 2 syntax format 2. replaces pop: true by pop: 1 3: resorts main keys according to sublimehq#2430
* [Common] Add or update emacs mode patterns Fixes sublimehq#2759 This commit... 1. sorts main header keys according to sublimehq#2430 2. adds or update `first_line_match` patterns to all appropriate syntax definitions in order to support emacs mode tags. Examples: // -*-c-*- // -*- c -*- // -*- mode: c -*- // -*- mode: c++; -*- * [ActionScript] Fix first line pattern * [ASP] Fix first line pattern Moves `-*- asp -*-` to HTML (ASP).sublime-syntax * [JSP] Add missing first line pattern * [Java] Revert first line pattern JSP is html like syntax and probably doesn't need or never sees such mode comment. * [ASP] Revert first line pattern HTML (ASP) won't probably see any such comment, thus removing it. * [All] Allow anything in front of emacs mode tag comments Sync with PR sublimehq#2862 * [Haskell] Add shebang to first_line_match * [Lua] Add shebang to first_line_match * [ShellScript] Add DASH shebang * [PHP] Add minor version support in shebang Syncs modification from sublimehq#2915 to add support for php executables such as php php7 php71 php7.1 php7.1.3 to `first_line_match`'s shebang/editorconfig pattern. * [Batch File] Add "@echo on" to first_line_match
- Using inheritance split up `JSON.sublime-syntax` into: - `JSON.sublime-syntax` with `scope:source.json` - `JSONC.sublime-syntax` with `scope:source.json.jsonc` - `JSON5.sublime-syntax` with `scope:source.json.json5` - `JSON_dotNET.sublime-syntax` with `scope:source.json.json-dotnet` - Add many more file extensions for `JSON` & `JSONC`: - add doc links to extensions where applicable as a reference to be able to more quickly verify that they (still) use said syntax flavor - JSON: - Make use of newer syntax features including those only available in `version: 2` syntaxes - Make use of `variables` (with optimizations provided by @deathaxe and regex patterns provided by @Thom1729) - Context names now more closely match the naming scheme of other (recently re-written) default syntaxes - (correctly formatted) JSON code can now be prettified or minified via the context menu or the command palette. JSON code can optionally be auto-prettified on pre save events. - highlight leading, trailing & multiple commas as invalid - only allow exactly one structure (object, array) or value (constant, number, string) at top level (thanks to @keith-hall) - links (`meta.link.inet`) and email addresses (`meta.link.email`) are scoped the same as in Markdown (thanks to @deathaxe) - JSONC: - highlight some files by default as `JSONC` (as decided by @jskinner in sublimehq#285) - highlight leading & multiple commas as invalid, trailing as valid - scope empty block comments as such - support syntax based folding of ST4131+, compare sublimehq#3291 - JSON5: - explicitly pos numbers, hexadecimal ints, Infinity and NaN - single quoted strings - more escape chars for strings - ECMA identifierName as object keys (regexes thanks to @Thom1729) - scoped as plain unquoted strings (thanks to @Thom1729) - support string interpolation (thanks to @deathaxe) - line continuation in strings (with tests thanks to @keith-hall) - JSON.NET: - support requested by @keith-hall, built with feedback from @michaelblyons - Objects: - Highlighting speed improvements for empty objects (thanks to @FichteFoll) - Make `mapping.*` contexts more modular - Arrays: - Highlighting speed improvements for empty arrays (thanks to @FichteFoll) - Numbers: - Correctly scope number signs with `constant.numeric.sign` instead of `keyword.operator.arithmetic` - Significantly improve number highlighting (thanks to @deathaxe) - Completions: - completions have been added for language constants, including kind info and details (with links to docs) - `null`, `false`, `true` for JSON - `Infinity` and `NaN` for JSON5 - Settings: - a `default_extension` is now set for all JSON flavors - Symbol index: - with an object structure at the top-level, only top-level keys within now show up in the index (including tests for symbols and syntax) - Tests: - test files now test the base scope - Significantly extend tests to cover more parts of the syntaxes - Split original test file into logical parts - Add indentation tests for: - `json`, `json5` & `jsonc` - `mapping` (objects), `sequence` (arrays) - Add symbols tests for: - top-level keys of object structures (thanks to deathaxe) - languages: `json`, `json5` & `jsonc` - Fix tests for `meta.mapping meta.mapping.*` - Leave `JSON` headers in `Markdown` as `json` only, but split up fenced code blocks into `json`, `json5` & `jsonc` to behave similarly to `GitHub Flavored Markdown` BREAKING CHANGES: - JSON does not have values that can be set via an inline calculation with the help of operators, but only simple number values. Scopes for number signs have changed from being `keyword.operator.arithmetic` to `constant.numeric.sign`. Color scheme authors should add this, should it be missing. - The `JSON.sublime-syntax` now marks comments as `invalid`, third party plugin authors should instead target `JSONC.sublime-syntax` to keep the user experience as-is. - Indexed symbols (i.e. top-level keys in JSON object structures) are scoped as `source.json meta.mapping.key - (meta.mapping.value meta.mapping.key | meta.sequence.list meta.mapping.key)`. Color scheme authors should add special highlighting to differentiate them from other keys. - fix sublimehq#285 - address sublimehq#421 (thanks to @FichteFoll) - address sublimehq#481 to remove incompatible regex patterns according to @wbond - address sublimehq#757 to fix line comments for `JSONC` (thanks to @keith-hall) - address sublimehq#2430 using sort-order (as requested by @deathaxe) - address sublimehq#2711 with regards to `constant.language.null` vs. `constant.language.empty` (thanks to @FichteFoll) - address sublimehq#2852 to fix scopes of curly braces & square brackets in `JSON` (thanks to @Thom1729) - address sublimehq#3228 to fix `punctuation.separator` scopes, compare sublimehq#3270 - address sublimehq/sublime_text#3154 and add symbol tests Co-authored-by: Ashwin Shenoy <[email protected]> Co-authored-by: Jack Cherng <[email protected]> Co-authored-by: Janos Wortmann <[email protected]> Co-authored-by: Jon Skinner <[email protected]> Co-authored-by: FichteFoll <[email protected]> Co-authored-by: Keith Hall <[email protected]> Co-authored-by: Michael B. Lyons <[email protected]> Co-authored-by: Rafał Chłodnicki <[email protected]> Co-authored-by: Thomas Smith <[email protected]> Co-authored-by: Will Bond <[email protected]> Co-authored-by: deathaxe <[email protected]>
- Using inheritance split up `JSON.sublime-syntax` into: - `JSON.sublime-syntax` with `scope:source.json` - `JSONC.sublime-syntax` with `scope:source.json.jsonc` - `JSON5.sublime-syntax` with `scope:source.json.json5` - `JSON_dotNET.sublime-syntax` with `scope:source.json.json-dotnet` - Add many more file extensions for `JSON` & `JSONC`: - add doc links to extensions where applicable as a reference to be able to more quickly verify that they (still) use said syntax flavor - JSON: - Make use of newer syntax features including those only available in `version: 2` syntaxes - Make use of `variables` (with optimizations provided by @deathaxe and regex patterns provided by @Thom1729) - Context names now more closely match the naming scheme of other (recently re-written) default syntaxes - (correctly formatted) JSON code can now be prettified or minified via the context menu or the command palette. JSON code can optionally be auto-prettified on pre save events. - highlight leading, trailing & multiple commas as invalid - only allow exactly one structure (object, array) or value (constant, number, string) at top level (thanks to @keith-hall) - links (`meta.link.inet`) and email addresses (`meta.link.email`) are scoped the same as in Markdown (thanks to @deathaxe) - JSONC: - highlight some files by default as `JSONC` (as decided by @jskinner in sublimehq#285) - highlight leading & multiple commas as invalid, trailing as valid - scope empty block comments as such - support syntax based folding of ST4131+, compare sublimehq#3291 - JSON5: - explicitly pos numbers, hexadecimal ints, Infinity and NaN - single quoted strings - more escape chars for strings - ECMA identifierName as object keys (regexes thanks to @Thom1729) - scoped as plain unquoted strings (thanks to @Thom1729) - support string interpolation (thanks to @deathaxe) - line continuation in strings (with tests thanks to @keith-hall) - JSON.NET: - support requested by @keith-hall, built with feedback from @michaelblyons - Objects: - Highlighting speed improvements for empty objects (thanks to @FichteFoll) - Make `mapping.*` contexts more modular - Arrays: - Highlighting speed improvements for empty arrays (thanks to @FichteFoll) - Numbers: - Correctly scope number signs with `constant.numeric.sign` instead of `keyword.operator.arithmetic` - Significantly improve number highlighting (thanks to @deathaxe) - Completions: - completions have been added for language constants, including kind info and details (with links to docs) - `null`, `false`, `true` for JSON - `Infinity` and `NaN` for JSON5 - Settings: - a `default_extension` is now set for all JSON flavors - Symbol index: - with an object structure at the top-level, only top-level keys within now show up in the index (including tests for symbols and syntax) - Tests: - test files now test the base scope - Significantly extend tests to cover more parts of the syntaxes - Split original test file into logical parts - Add indentation tests for: - `json`, `json5` & `jsonc` - `mapping` (objects), `sequence` (arrays) - Add symbols tests for: - top-level keys of object structures (thanks to deathaxe) - languages: `json`, `json5` & `jsonc` - Fix tests for `meta.mapping meta.mapping.*` - Leave `JSON` headers in `Markdown` as `json` only, but split up fenced code blocks into `json`, `json5` & `jsonc` to behave similarly to `GitHub Flavored Markdown` BREAKING CHANGES: - JSON does not have values that can be set via an inline calculation with the help of operators, but only simple number values. Scopes for number signs have changed from being `keyword.operator.arithmetic` to `constant.numeric.sign`. Color scheme authors should add this, should it be missing. - The `JSON.sublime-syntax` now marks comments as `invalid`, third party plugin authors should instead target `JSONC.sublime-syntax` to keep the user experience as-is. - Indexed symbols (i.e. top-level keys in JSON object structures) are scoped as `source.json meta.mapping.key - (meta.mapping.value meta.mapping.key | meta.sequence.list meta.mapping.key)`. Color scheme authors should add special highlighting to differentiate them from other keys. - fix sublimehq#285 - address sublimehq#421 (thanks to @FichteFoll) - address sublimehq#481 to remove incompatible regex patterns according to @wbond - address sublimehq#757 to fix line comments for `JSONC` (thanks to @keith-hall) - address sublimehq#2430 using sort-order (as requested by @deathaxe) - address sublimehq#2711 with regards to `constant.language.null` vs. `constant.language.empty` (thanks to @FichteFoll) - address sublimehq#2852 to fix scopes of curly braces & square brackets in `JSON` (thanks to @Thom1729) - address sublimehq#3228 to fix `punctuation.separator` scopes, compare sublimehq#3270 - address sublimehq/sublime_text#3154 and add symbol tests Co-authored-by: Ashwin Shenoy <[email protected]> Co-authored-by: Jack Cherng <[email protected]> Co-authored-by: Janos Wortmann <[email protected]> Co-authored-by: Jon Skinner <[email protected]> Co-authored-by: FichteFoll <[email protected]> Co-authored-by: Keith Hall <[email protected]> Co-authored-by: Michael B. Lyons <[email protected]> Co-authored-by: Rafał Chłodnicki <[email protected]> Co-authored-by: Thomas Smith <[email protected]> Co-authored-by: Will Bond <[email protected]> Co-authored-by: deathaxe <[email protected]>
- Using inheritance split up `JSON.sublime-syntax` into: - `JSON.sublime-syntax` with `scope:source.json` - `JSONC.sublime-syntax` with `scope:source.json.jsonc` - `JSON5.sublime-syntax` with `scope:source.json.json5` - `JSON_dotNET.sublime-syntax` with `scope:source.json.json-dotnet` - Add many more file extensions for `JSON` & `JSONC`: - add doc links to extensions where applicable as a reference to be able to more quickly verify that they (still) use said syntax flavor - JSON: - Make use of newer syntax features including those only available in `version: 2` syntaxes - Make use of `variables` (with optimizations provided by @deathaxe and regex patterns provided by @Thom1729) - Context names now more closely match the naming scheme of other (recently re-written) default syntaxes - (correctly formatted) JSON code can now be prettified or minified via the context menu or the command palette. JSON code can optionally be auto-prettified on pre save events. - highlight leading, trailing & multiple commas as invalid - only allow exactly one structure (object, array) or value (constant, number, string) at top level (thanks to @keith-hall) - links (`meta.link.inet`) and email addresses (`meta.link.email`) are scoped the same as in Markdown (thanks to @deathaxe) - JSONC: - highlight some files by default as `JSONC` (as decided by @jskinner in sublimehq#285) - highlight leading & multiple commas as invalid, trailing as valid - scope empty block comments as such - support syntax based folding of ST4131+, compare sublimehq#3291 - JSON5: - explicitly pos numbers, hexadecimal ints, Infinity and NaN - single quoted strings - more escape chars for strings - ECMA identifierName as object keys (regexes thanks to @Thom1729) - scoped as plain unquoted strings (thanks to @Thom1729) - support string interpolation (thanks to @deathaxe) - line continuation in strings (with tests thanks to @keith-hall) - JSON.NET: - support requested by @keith-hall, built with feedback from @michaelblyons - Objects: - Highlighting speed improvements for empty objects (thanks to @FichteFoll) - Make `mapping.*` contexts more modular - Arrays: - Highlighting speed improvements for empty arrays (thanks to @FichteFoll) - Numbers: - Correctly scope number signs with `constant.numeric.sign` instead of `keyword.operator.arithmetic` - Significantly improve number highlighting (thanks to @deathaxe) - Completions: - completions have been added for language constants, including kind info and details (with links to docs) - `null`, `false`, `true` for JSON - `Infinity` and `NaN` for JSON5 - Settings: - a `default_extension` is now set for all JSON flavors - Symbol index: - with an object structure at the top-level, only top-level keys within now show up in the index (including tests for symbols and syntax) - Tests: - test files now test the base scope - Significantly extend tests to cover more parts of the syntaxes - Split original test file into logical parts - Add indentation tests for: - `json`, `json5` & `jsonc` - `mapping` (objects), `sequence` (arrays) - Add symbols tests for: - top-level keys of object structures (thanks to deathaxe) - languages: `json`, `json5` & `jsonc` - Fix tests for `meta.mapping meta.mapping.*` - Leave `JSON` headers in `Markdown` as `json` only, but split up fenced code blocks into `json`, `json5` & `jsonc` to behave similarly to `GitHub Flavored Markdown` BREAKING CHANGES: - JSON does not have values that can be set via an inline calculation with the help of operators, but only simple number values. Scopes for number signs have changed from being `keyword.operator.arithmetic` to `constant.numeric.sign`. Color scheme authors should add this, should it be missing. - The `JSON.sublime-syntax` now marks comments as `invalid`, third party plugin authors should instead target `JSONC.sublime-syntax` to keep the user experience as-is. - Indexed symbols (i.e. top-level keys in JSON object structures) are scoped as `source.json meta.mapping.key - (meta.mapping.value meta.mapping.key | meta.sequence.list meta.mapping.key)`. Color scheme authors should add special highlighting to differentiate them from other keys. - fix sublimehq#285 - address sublimehq#421 (thanks to @FichteFoll) - address sublimehq#481 to remove incompatible regex patterns according to @wbond - address sublimehq#757 to fix line comments for `JSONC` (thanks to @keith-hall) - address sublimehq#2430 using sort-order (as requested by @deathaxe) - address sublimehq#2711 with regards to `constant.language.null` vs. `constant.language.empty` (thanks to @FichteFoll) - address sublimehq#2852 to fix scopes of curly braces & square brackets in `JSON` (thanks to @Thom1729) - address sublimehq#3228 to fix `punctuation.separator` scopes, compare sublimehq#3270 - address sublimehq/sublime_text#3154 and add symbol tests Co-authored-by: Ashwin Shenoy <[email protected]> Co-authored-by: Jack Cherng <[email protected]> Co-authored-by: Janos Wortmann <[email protected]> Co-authored-by: Jon Skinner <[email protected]> Co-authored-by: FichteFoll <[email protected]> Co-authored-by: Keith Hall <[email protected]> Co-authored-by: Michael B. Lyons <[email protected]> Co-authored-by: Rafał Chłodnicki <[email protected]> Co-authored-by: Thomas Smith <[email protected]> Co-authored-by: Will Bond <[email protected]> Co-authored-by: deathaxe <[email protected]>
- Using inheritance split up `JSON.sublime-syntax` into: - `JSON.sublime-syntax` with `scope:source.json` - `JSONC.sublime-syntax` with `scope:source.json.jsonc` - `JSON5.sublime-syntax` with `scope:source.json.json5` - `JSON_dotNET.sublime-syntax` with `scope:source.json.json-dotnet` - Add many more file extensions for `JSON` & `JSONC`: - add doc links to extensions where applicable as a reference to be able to more quickly verify that they (still) use said syntax flavor - JSON: - Make use of newer syntax features including those only available in `version: 2` syntaxes - Make use of `variables` (with optimizations provided by @deathaxe and regex patterns provided by @Thom1729) - Context names now more closely match the naming scheme of other (recently re-written) default syntaxes - (correctly formatted) JSON code can now be prettified or minified via the context menu or the command palette. JSON code can optionally be auto-prettified on pre save events. - highlight leading, trailing & multiple commas as invalid - only allow exactly one structure (object, array) or value (constant, number, string) at top level (thanks to @keith-hall) - links (`meta.link.inet`) and email addresses (`meta.link.email`) are scoped the same as in Markdown (thanks to @deathaxe) - JSONC: - highlight some files by default as `JSONC` (as decided by @jskinner in sublimehq#285) - highlight leading & multiple commas as invalid, trailing as valid - scope empty block comments as such - support syntax based folding of ST4131+, compare sublimehq#3291 - JSON5: - explicitly pos numbers, hexadecimal ints, Infinity and NaN - single quoted strings - more escape chars for strings - ECMA identifierName as object keys (regexes thanks to @Thom1729) - scoped as plain unquoted strings (thanks to @Thom1729) - support string interpolation (thanks to @deathaxe) - line continuation in strings (with tests thanks to @keith-hall) - JSON.NET: - support requested by @keith-hall, built with feedback from @michaelblyons - Objects: - Highlighting speed improvements for empty objects (thanks to @FichteFoll) - Make `mapping.*` contexts more modular - Arrays: - Highlighting speed improvements for empty arrays (thanks to @FichteFoll) - Numbers: - Correctly scope number signs with `constant.numeric.sign` instead of `keyword.operator.arithmetic` - Significantly improve number highlighting (thanks to @deathaxe) - Completions: - completions have been added for language constants, including kind info and details (with links to docs) - `null`, `false`, `true` for JSON - `Infinity` and `NaN` for JSON5 - Settings: - a `default_extension` is now set for all JSON flavors - Symbol index: - with an object structure at the top-level, only top-level keys within now show up in the index (including tests for symbols and syntax) - Tests: - test files now test the base scope - Significantly extend tests to cover more parts of the syntaxes - Split original test file into logical parts - Add indentation tests for: - `json`, `json5` & `jsonc` - `mapping` (objects), `sequence` (arrays) - Add symbols tests for: - top-level keys of object structures (thanks to deathaxe) - languages: `json`, `json5` & `jsonc` - Fix tests for `meta.mapping meta.mapping.*` - Leave `JSON` headers in `Markdown` as `json` only, but split up fenced code blocks into `json`, `json5` & `jsonc` to behave similarly to `GitHub Flavored Markdown` BREAKING CHANGES: - JSON does not have values that can be set via an inline calculation with the help of operators, but only simple number values. Scopes for number signs have changed from being `keyword.operator.arithmetic` to `constant.numeric.sign`. Color scheme authors should add this, should it be missing. - The `JSON.sublime-syntax` now marks comments as `invalid`, third party plugin authors should instead target `JSONC.sublime-syntax` to keep the user experience as-is. - Indexed symbols (i.e. top-level keys in JSON object structures) are scoped as `source.json meta.mapping.key - (meta.mapping.value meta.mapping.key | meta.sequence.list meta.mapping.key)`. Color scheme authors should add special highlighting to differentiate them from other keys. - fix sublimehq#285 - address sublimehq#421 (thanks to @FichteFoll) - address sublimehq#481 to remove incompatible regex patterns according to @wbond - address sublimehq#757 to fix line comments for `JSONC` (thanks to @keith-hall) - address sublimehq#2430 using sort-order (as requested by @deathaxe) - address sublimehq#2711 with regards to `constant.language.null` vs. `constant.language.empty` (thanks to @FichteFoll) - address sublimehq#2852 to fix scopes of curly braces & square brackets in `JSON` (thanks to @Thom1729) - address sublimehq#3228 to fix `punctuation.separator` scopes, compare sublimehq#3270 - address sublimehq/sublime_text#3154 and add symbol tests Co-authored-by: Ashwin Shenoy <[email protected]> Co-authored-by: Jack Cherng <[email protected]> Co-authored-by: Janos Wortmann <[email protected]> Co-authored-by: Jon Skinner <[email protected]> Co-authored-by: FichteFoll <[email protected]> Co-authored-by: Keith Hall <[email protected]> Co-authored-by: Michael B. Lyons <[email protected]> Co-authored-by: Rafał Chłodnicki <[email protected]> Co-authored-by: Thomas Smith <[email protected]> Co-authored-by: Will Bond <[email protected]> Co-authored-by: deathaxe <[email protected]>
In addition, it would be good to update the examples given in https://www.sublimetext.com/docs/syntax.html |
This commit applies main key sort order for syntax version 2 implements: sublimehq/Packages#2430
* Reorder main keys This commit applies main key sort order for syntax version 2 implements: sublimehq/Packages#2430 * Replace pop: true with pop: 1 This commit replaces pop: true to 1. avoid mixed styles if multiple levels of pop may be added. 2. as some statements use `pop: 1` already. 3. it makes it more clear to be a syntax version 2. * Distinguish interpolation and string interpolation This commit makes sure to clear `string` scopes where needed, so only meta.string meta.interpolation is left. * Add interpolation support for quoted strings
This commit rearranges header keys as per sublimehq/Packages#2430
The number of main keys in the sublime-syntax file format increases. While it seems common practise to have
variables
context beforecontexts
the header keys are sorted alphabetically only.I'd propose to group the name, scope and version keys as they describe the the syntax itself.
The file_extensions and first_line_match should follow and be separated by an empty line,
Here's an example of how it could look like:
The text was updated successfully, but these errors were encountered: