From 15ea5dc7eb6d617f7686e17ab3179c192ad03d38 Mon Sep 17 00:00:00 2001 From: thom Date: Tue, 20 Mar 2018 13:05:24 -0400 Subject: [PATCH] Fuly integrated upstream changes. --- extensions/es_decorators.yaml | 33 ++-------------- extensions/flow_types.yaml | 22 +++++------ extensions/jsx.yaml | 4 +- extensions/string_object_keys.yaml | 62 +++++------------------------- extensions/styled_components.yaml | 4 +- 5 files changed, 29 insertions(+), 96 deletions(-) diff --git a/extensions/es_decorators.yaml b/extensions/es_decorators.yaml index 9f5e412..125c967 100644 --- a/extensions/es_decorators.yaml +++ b/extensions/es_decorators.yaml @@ -6,36 +6,9 @@ contexts: !merge statements: !prepend - include: decorator - class-body: - - match: '\{' - scope: punctuation.section.block.js - set: - - meta_scope: meta.block.js - - - include: decorator - - - match: '\}' - scope: punctuation.section.block.js - pop: true - - - match: \; - scope: punctuation.terminator.statement.js - - - match: \bconstructor\b - scope: entity.name.function.constructor.js - push: - - function-declaration-expect-body - - function-declaration-meta - - function-declaration-expect-parameters - - - match: \bstatic\b - scope: storage.modifier.js - push: class-field - - - match: (?={{class_element_name}}) - push: class-field - - - include: else-pop + class-body-contents: !prepend + - meta_scope: meta.block.js + - include: decorator decorator: - match: '@' diff --git a/extensions/flow_types.yaml b/extensions/flow_types.yaml index b53a812..803c411 100644 --- a/extensions/flow_types.yaml +++ b/extensions/flow_types.yaml @@ -17,10 +17,10 @@ contexts: !merge - include: flow-type-alias-declaration flow-type-declare: - - match: \bdeclare\b(?=\s*(?:type|class|opaque|export)\b) + - match: declare{{identifier_break}}(?=\s*(?:type|class|opaque|export){{identifier_break}}) scope: storage.type.js set: - - match: \bopaque\b + - match: opaque{{identifier_break}} scope: storage.modifier.js pop: true - include: else-pop @@ -104,7 +104,7 @@ contexts: !merge - include: else-pop class-extends: - - match: \bextends\b + - match: extends{{identifier_break}} scope: storage.modifier.extends.js set: - - include: flow-type-generic-arguments @@ -223,15 +223,15 @@ contexts: !merge push: flow-type flow-type-literal: - - match: \btrue\b + - match: true{{identifier_break}} scope: constant.language.boolean.true.js pop: true - - match: \bfalse\b + - match: false{{identifier_break}} scope: constant.language.boolean.false.js pop: true - match: (?=\d) set: - - - match: \w+ + - - match: '{{identifier_part}}+' scope: invalid.illegal.js - include: immediately-pop - literal-number @@ -241,14 +241,14 @@ contexts: !merge flow-type-special: !foreach in: [ any, mixed ] value: - match: !argument value + match: !format '{value}{{{{identifier_break}}}}' scope: !format 'support.type.{value}.js' pop: true flow-type-primitive: !foreach in: [ boolean, number, string, 'null', void ] value: - match: !argument value + match: !format '{value}{{{{identifier_break}}}}' scope: !format 'support.type.primitive.{value}.js' pop: true @@ -278,7 +278,7 @@ contexts: !merge - include: flow-type-list flow-type-typeof: - - match: \btypeof\b + - match: typeof{{identifier_break}} scope: keyword.operator.js set: expression @@ -388,11 +388,11 @@ contexts: !merge - include: else-pop flow-type-alias-declaration: - - match: (?=\btype\b) + - match: (?=type{{identifier_break}}) push: flow-type-alias flow-type-alias: - - match: \btype\b + - match: type{{identifier_break}} scope: storage.type.js set: - !meta meta.declaration.type.js diff --git a/extensions/jsx.yaml b/extensions/jsx.yaml index 5fcc53c..7a68060 100644 --- a/extensions/jsx.yaml +++ b/extensions/jsx.yaml @@ -3,7 +3,9 @@ --- !merge variables: !merge - jsx_identifier: '[_$[:alpha:]][-_$[:alnum:]]*' + jsx_identifier_part: (?:{{identifier_part}}|-) + jsx_identifier_break: (?!{{jsx_identifier_part}}) + jsx_identifier: '{{identifier_start}}{{jsx_identifier_part}}*{{jsx_identifier_break}}' contexts: !merge expression-begin: !prepend diff --git a/extensions/string_object_keys.yaml b/extensions/string_object_keys.yaml index f825e07..8184995 100644 --- a/extensions/string_object_keys.yaml +++ b/extensions/string_object_keys.yaml @@ -1,56 +1,14 @@ %YAML 1.2 -%TAG ! tag:yaml-macros:yamlmacros.lib.extend,yamlmacros.lib.arguments: +%TAG ! tag:yaml-macros:yamlmacros.lib.extend: --- !merge contexts: !merge - object-literal: - - match: '\{' - scope: punctuation.section.block.js - set: - - meta_scope: meta.object-literal.js - - match: '\}' - scope: punctuation.section.block.js - pop: true - - - match: \.\.\. - scope: keyword.operator.spread.js - push: expression-no-comma - - - match: >- - (?x)(?= - {{property_name}}\s*: - (?: {{either_func_lookahead}} ) - ) - push: - - either-function-declaration - - function-declaration-meta - - object-literal-expect-colon - - object-literal-meta-key - - method-name - - - match: '{{method_lookahead}}' - push: method-declaration - - - match: '{{identifier}}(?=\s*(?:[},]|$|//|/\*))' - scope: variable.other.readwrite.js - - match: (?=\[) - push: computed-property-name - - match: "(?=\"|')" - push: - - object-literal-meta-key - - literal-string - - match: '{{dollar_identifier}}' - scope: string.unquoted.js meta.object-literal.key.dollar.js - captures: - 1: punctuation.dollar.js - - match: '{{identifier}}' - scope: string.unquoted.js meta.object-literal.key.js - - match: (?=[-+]?(?:\.[0-9]|0[bxo]|\d)) - push: - - meta_scope: meta.object-literal.key.js - - include: literal-number - - - include: comma-separator - - match: ':' - scope: punctuation.separator.key-value.js - push: expression-no-comma + bare-property-name: + - match: '{{dollar_only_identifier}}' + scope: string.unquoted.js meta.object-literal.key.dollar.only.js punctuation.dollar.js + - match: '{{dollar_identifier}}' + scope: string.unquoted.js meta.object-literal.key.dollar.js + captures: + 1: punctuation.dollar.js + - match: '{{identifier}}' + scope: string.unquoted.js meta.object-literal.key.js diff --git a/extensions/styled_components.yaml b/extensions/styled_components.yaml index 6f865b3..316627e 100644 --- a/extensions/styled_components.yaml +++ b/extensions/styled_components.yaml @@ -4,7 +4,7 @@ !merge contexts: !merge expression-begin: !prepend - - match: (?=(?:styled|injectGlobal|keyframes)\b) + - match: (?=(?:styled|injectGlobal|keyframes){{identifier_break}}) set: - styled-component-end - styled-component-begin @@ -61,4 +61,4 @@ contexts: !merge scope: variable.other.readwrite.js pop: true - - include: else-pop \ No newline at end of file + - include: else-pop