From 5b5f388fc46e45dff7e48edc90242c7f578d8705 Mon Sep 17 00:00:00 2001 From: Victor Petrovykh Date: Fri, 31 Jul 2020 06:22:53 -0400 Subject: [PATCH] Make raw f-strings consistent. Any f-string allows variable interpolation, that includes a raw f-string. Make all raw prefixes (`r` or `R`) behave the same way in combination with `f` prefix. Fixes #186 --- grammars/MagicPython.cson | 910 +----------- grammars/MagicPython.tmLanguage | 1788 +----------------------- grammars/src/MagicPython.syntax.yaml | 80 -- grammars/src/pyfstring.inc.syntax.yaml | 2 +- misc/example.py | 2 + test/atom-spec/python-spec.js | 744 +++++----- test/fstrings/empty2.py | 36 +- test/fstrings/fraw1.py | 40 + test/fstrings/fraw2.py | 36 + test/fstrings/fraw3.py | 36 + test/fstrings/fraw4.py | 45 + test/fstrings/prefixes2.py | 24 +- test/fstrings/prefixes3.py | 24 +- test/regexp/fregexp1.py | 56 - test/regexp/fregexp2.py | 28 - test/regexp/fregexp3.py | 28 - test/regexp/fregexp4.py | 36 - test/regexp/fregexp5.py | 26 - test/regexp/fregexp6.py | 39 - 19 files changed, 546 insertions(+), 3434 deletions(-) create mode 100644 test/fstrings/fraw1.py create mode 100644 test/fstrings/fraw2.py create mode 100644 test/fstrings/fraw3.py create mode 100644 test/fstrings/fraw4.py delete mode 100644 test/regexp/fregexp1.py delete mode 100644 test/regexp/fregexp2.py delete mode 100644 test/regexp/fregexp3.py delete mode 100644 test/regexp/fregexp4.py delete mode 100644 test/regexp/fregexp5.py delete mode 100644 test/regexp/fregexp6.py diff --git a/grammars/MagicPython.cson b/grammars/MagicPython.cson index b137f776..afb32a6d 100644 --- a/grammars/MagicPython.cson +++ b/grammars/MagicPython.cson @@ -785,18 +785,6 @@ repository: { include: "#regexp-double-one-line" } - { - include: "#fregexp-single-three-line" - } - { - include: "#fregexp-double-three-line" - } - { - include: "#fregexp-single-one-line" - } - { - include: "#fregexp-double-one-line" - } ] string: patterns: [ @@ -3334,900 +3322,6 @@ repository: include: "#double-three-regexp-expression" } ] - "single-one-fregexp-expression": - patterns: [ - { - include: "#fregexp-base-expression" - } - { - include: "#single-one-regexp-character-set" - } - { - include: "#single-one-regexp-comments" - } - { - include: "#regexp-flags" - } - { - include: "#single-one-regexp-named-group" - } - { - include: "#regexp-backreference" - } - { - include: "#single-one-fregexp-lookahead" - } - { - include: "#single-one-fregexp-lookahead-negative" - } - { - include: "#single-one-fregexp-lookbehind" - } - { - include: "#single-one-fregexp-lookbehind-negative" - } - { - include: "#single-one-fregexp-conditional" - } - { - include: "#single-one-fregexp-parentheses-non-capturing" - } - { - include: "#single-one-fregexp-parentheses" - } - ] - "single-one-fregexp-named-group": - name: "meta.named.regexp" - begin: ''' - (?x) - (\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>) - - ''' - end: "(\\)|(?=\\'))|((?=(?) - - ''' - end: "(\\)|(?=\\'\\'\\'))" - beginCaptures: - "1": - name: "punctuation.parenthesis.named.begin.regexp support.other.parenthesis.regexp" - "2": - name: "entity.name.tag.named.group.regexp" - endCaptures: - "1": - name: "punctuation.parenthesis.named.end.regexp support.other.parenthesis.regexp" - "2": - name: "invalid.illegal.newline.python" - patterns: [ - { - include: "#single-three-fregexp-expression" - } - { - include: "#comments-string-single-three" - } - ] - "single-three-fregexp-lookahead": - begin: "(\\()\\?=" - end: "(\\)|(?=\\'\\'\\'))" - beginCaptures: - "0": - name: "keyword.operator.lookahead.regexp" - "1": - name: "punctuation.parenthesis.lookahead.begin.regexp" - endCaptures: - "1": - name: "punctuation.parenthesis.lookahead.end.regexp keyword.operator.lookahead.regexp" - "2": - name: "invalid.illegal.newline.python" - patterns: [ - { - include: "#single-three-fregexp-expression" - } - { - include: "#comments-string-single-three" - } - ] - "single-three-fregexp-lookahead-negative": - begin: "(\\()\\?!" - end: "(\\)|(?=\\'\\'\\'))" - beginCaptures: - "0": - name: "keyword.operator.lookahead.negative.regexp" - "1": - name: "punctuation.parenthesis.lookahead.begin.regexp" - endCaptures: - "1": - name: "punctuation.parenthesis.lookahead.end.regexp keyword.operator.lookahead.negative.regexp" - "2": - name: "invalid.illegal.newline.python" - patterns: [ - { - include: "#single-three-fregexp-expression" - } - { - include: "#comments-string-single-three" - } - ] - "single-three-fregexp-lookbehind": - begin: "(\\()\\?<=" - end: "(\\)|(?=\\'\\'\\'))" - beginCaptures: - "0": - name: "keyword.operator.lookbehind.regexp" - "1": - name: "punctuation.parenthesis.lookbehind.begin.regexp" - endCaptures: - "1": - name: "punctuation.parenthesis.lookbehind.end.regexp keyword.operator.lookbehind.regexp" - "2": - name: "invalid.illegal.newline.python" - patterns: [ - { - include: "#single-three-fregexp-expression" - } - { - include: "#comments-string-single-three" - } - ] - "single-three-fregexp-lookbehind-negative": - begin: "(\\()\\?) - - ''' - end: "(\\)|(?=\"))|((?=(?) - - ''' - end: "(\\)|(?=\"\"\"))" - beginCaptures: - "1": - name: "punctuation.parenthesis.named.begin.regexp support.other.parenthesis.regexp" - "2": - name: "entity.name.tag.named.group.regexp" - endCaptures: - "1": - name: "punctuation.parenthesis.named.end.regexp support.other.parenthesis.regexp" - "2": - name: "invalid.illegal.newline.python" - patterns: [ - { - include: "#double-three-fregexp-expression" - } - { - include: "#comments-string-double-three" - } - ] - "double-three-fregexp-lookahead": - begin: "(\\()\\?=" - end: "(\\)|(?=\"\"\"))" - beginCaptures: - "0": - name: "keyword.operator.lookahead.regexp" - "1": - name: "punctuation.parenthesis.lookahead.begin.regexp" - endCaptures: - "1": - name: "punctuation.parenthesis.lookahead.end.regexp keyword.operator.lookahead.regexp" - "2": - name: "invalid.illegal.newline.python" - patterns: [ - { - include: "#double-three-fregexp-expression" - } - { - include: "#comments-string-double-three" - } - ] - "double-three-fregexp-lookahead-negative": - begin: "(\\()\\?!" - end: "(\\)|(?=\"\"\"))" - beginCaptures: - "0": - name: "keyword.operator.lookahead.negative.regexp" - "1": - name: "punctuation.parenthesis.lookahead.begin.regexp" - endCaptures: - "1": - name: "punctuation.parenthesis.lookahead.end.regexp keyword.operator.lookahead.negative.regexp" - "2": - name: "invalid.illegal.newline.python" - patterns: [ - { - include: "#double-three-fregexp-expression" - } - { - include: "#comments-string-double-three" - } - ] - "double-three-fregexp-lookbehind": - begin: "(\\()\\?<=" - end: "(\\)|(?=\"\"\"))" - beginCaptures: - "0": - name: "keyword.operator.lookbehind.regexp" - "1": - name: "punctuation.parenthesis.lookbehind.begin.regexp" - endCaptures: - "1": - name: "punctuation.parenthesis.lookbehind.end.regexp keyword.operator.lookbehind.regexp" - "2": - name: "invalid.illegal.newline.python" - patterns: [ - { - include: "#double-three-fregexp-expression" - } - { - include: "#comments-string-double-three" - } - ] - "double-three-fregexp-lookbehind-negative": - begin: "(\\()\\?include #regexp-double-one-line - - include - #fregexp-single-three-line - - - include - #fregexp-double-three-line - - - include - #fregexp-single-one-line - - - include - #fregexp-double-one-line - string @@ -5646,1774 +5630,6 @@ indirectly through syntactic constructs - single-one-fregexp-expression - - patterns - - - include - #fregexp-base-expression - - - include - #single-one-regexp-character-set - - - include - #single-one-regexp-comments - - - include - #regexp-flags - - - include - #single-one-regexp-named-group - - - include - #regexp-backreference - - - include - #single-one-fregexp-lookahead - - - include - #single-one-fregexp-lookahead-negative - - - include - #single-one-fregexp-lookbehind - - - include - #single-one-fregexp-lookbehind-negative - - - include - #single-one-fregexp-conditional - - - include - #single-one-fregexp-parentheses-non-capturing - - - include - #single-one-fregexp-parentheses - - - - single-one-fregexp-named-group - - name - meta.named.regexp - begin - (?x) - (\() (\?P <\w+(?:\s+[[:alnum:]]+)?>) - - end - (\)|(?=\'))|((?=(?<!\\)\n)) - beginCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp - - 2 - - name - entity.name.tag.named.group.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-one-fregexp-expression - - - - single-one-fregexp-lookahead - - begin - (\()\?= - end - (\)|(?=\'))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - keyword.operator.lookahead.regexp - - 1 - - name - punctuation.parenthesis.lookahead.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-one-fregexp-expression - - - - single-one-fregexp-lookahead-negative - - begin - (\()\?! - end - (\)|(?=\'))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - keyword.operator.lookahead.negative.regexp - - 1 - - name - punctuation.parenthesis.lookahead.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-one-fregexp-expression - - - - single-one-fregexp-lookbehind - - begin - (\()\?<= - end - (\)|(?=\'))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - keyword.operator.lookbehind.regexp - - 1 - - name - punctuation.parenthesis.lookbehind.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-one-fregexp-expression - - - - single-one-fregexp-lookbehind-negative - - begin - (\()\?<! - end - (\)|(?=\'))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - keyword.operator.lookbehind.negative.regexp - - 1 - - name - punctuation.parenthesis.lookbehind.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-one-fregexp-expression - - - - single-one-fregexp-conditional - - begin - (\()\?\((\w+(?:\s+[[:alnum:]]+)?|\d+)\) - end - (\)|(?=\'))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - keyword.operator.conditional.regexp - - 1 - - name - punctuation.parenthesis.conditional.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-one-fregexp-expression - - - - single-one-fregexp-parentheses-non-capturing - - begin - \(\?: - end - (\)|(?=\'))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-one-fregexp-expression - - - - single-one-fregexp-parentheses - - begin - \( - end - (\)|(?=\'))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-one-fregexp-expression - - - - single-three-fregexp-expression - - patterns - - - include - #fregexp-base-expression - - - include - #single-three-regexp-character-set - - - include - #single-three-regexp-comments - - - include - #regexp-flags - - - include - #single-three-regexp-named-group - - - include - #regexp-backreference - - - include - #single-three-fregexp-lookahead - - - include - #single-three-fregexp-lookahead-negative - - - include - #single-three-fregexp-lookbehind - - - include - #single-three-fregexp-lookbehind-negative - - - include - #single-three-fregexp-conditional - - - include - #single-three-fregexp-parentheses-non-capturing - - - include - #single-three-fregexp-parentheses - - - include - #comments-string-single-three - - - - single-three-fregexp-named-group - - name - meta.named.regexp - begin - (?x) - (\() (\?P <\w+(?:\s+[[:alnum:]]+)?>) - - end - (\)|(?=\'\'\')) - beginCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp - - 2 - - name - entity.name.tag.named.group.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-three-fregexp-expression - - - include - #comments-string-single-three - - - - single-three-fregexp-lookahead - - begin - (\()\?= - end - (\)|(?=\'\'\')) - beginCaptures - - 0 - - name - keyword.operator.lookahead.regexp - - 1 - - name - punctuation.parenthesis.lookahead.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-three-fregexp-expression - - - include - #comments-string-single-three - - - - single-three-fregexp-lookahead-negative - - begin - (\()\?! - end - (\)|(?=\'\'\')) - beginCaptures - - 0 - - name - keyword.operator.lookahead.negative.regexp - - 1 - - name - punctuation.parenthesis.lookahead.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-three-fregexp-expression - - - include - #comments-string-single-three - - - - single-three-fregexp-lookbehind - - begin - (\()\?<= - end - (\)|(?=\'\'\')) - beginCaptures - - 0 - - name - keyword.operator.lookbehind.regexp - - 1 - - name - punctuation.parenthesis.lookbehind.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-three-fregexp-expression - - - include - #comments-string-single-three - - - - single-three-fregexp-lookbehind-negative - - begin - (\()\?<! - end - (\)|(?=\'\'\')) - beginCaptures - - 0 - - name - keyword.operator.lookbehind.negative.regexp - - 1 - - name - punctuation.parenthesis.lookbehind.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-three-fregexp-expression - - - include - #comments-string-single-three - - - - single-three-fregexp-conditional - - begin - (\()\?\((\w+(?:\s+[[:alnum:]]+)?|\d+)\) - end - (\)|(?=\'\'\')) - beginCaptures - - 0 - - name - keyword.operator.conditional.regexp - - 1 - - name - punctuation.parenthesis.conditional.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-three-fregexp-expression - - - include - #comments-string-single-three - - - - single-three-fregexp-parentheses-non-capturing - - begin - \(\?: - end - (\)|(?=\'\'\')) - beginCaptures - - 0 - - name - support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-three-fregexp-expression - - - include - #comments-string-single-three - - - - single-three-fregexp-parentheses - - begin - \( - end - (\)|(?=\'\'\')) - beginCaptures - - 0 - - name - support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-three-fregexp-expression - - - include - #comments-string-single-three - - - - double-one-fregexp-expression - - patterns - - - include - #fregexp-base-expression - - - include - #double-one-regexp-character-set - - - include - #double-one-regexp-comments - - - include - #regexp-flags - - - include - #double-one-regexp-named-group - - - include - #regexp-backreference - - - include - #double-one-fregexp-lookahead - - - include - #double-one-fregexp-lookahead-negative - - - include - #double-one-fregexp-lookbehind - - - include - #double-one-fregexp-lookbehind-negative - - - include - #double-one-fregexp-conditional - - - include - #double-one-fregexp-parentheses-non-capturing - - - include - #double-one-fregexp-parentheses - - - - double-one-fregexp-named-group - - name - meta.named.regexp - begin - (?x) - (\() (\?P <\w+(?:\s+[[:alnum:]]+)?>) - - end - (\)|(?="))|((?=(?<!\\)\n)) - beginCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp - - 2 - - name - entity.name.tag.named.group.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-one-fregexp-expression - - - - double-one-fregexp-lookahead - - begin - (\()\?= - end - (\)|(?="))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - keyword.operator.lookahead.regexp - - 1 - - name - punctuation.parenthesis.lookahead.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-one-fregexp-expression - - - - double-one-fregexp-lookahead-negative - - begin - (\()\?! - end - (\)|(?="))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - keyword.operator.lookahead.negative.regexp - - 1 - - name - punctuation.parenthesis.lookahead.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-one-fregexp-expression - - - - double-one-fregexp-lookbehind - - begin - (\()\?<= - end - (\)|(?="))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - keyword.operator.lookbehind.regexp - - 1 - - name - punctuation.parenthesis.lookbehind.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-one-fregexp-expression - - - - double-one-fregexp-lookbehind-negative - - begin - (\()\?<! - end - (\)|(?="))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - keyword.operator.lookbehind.negative.regexp - - 1 - - name - punctuation.parenthesis.lookbehind.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-one-fregexp-expression - - - - double-one-fregexp-conditional - - begin - (\()\?\((\w+(?:\s+[[:alnum:]]+)?|\d+)\) - end - (\)|(?="))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - keyword.operator.conditional.regexp - - 1 - - name - punctuation.parenthesis.conditional.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-one-fregexp-expression - - - - double-one-fregexp-parentheses-non-capturing - - begin - \(\?: - end - (\)|(?="))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-one-fregexp-expression - - - - double-one-fregexp-parentheses - - begin - \( - end - (\)|(?="))|((?=(?<!\\)\n)) - beginCaptures - - 0 - - name - support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-one-fregexp-expression - - - - double-three-fregexp-expression - - patterns - - - include - #fregexp-base-expression - - - include - #double-three-regexp-character-set - - - include - #double-three-regexp-comments - - - include - #regexp-flags - - - include - #double-three-regexp-named-group - - - include - #regexp-backreference - - - include - #double-three-fregexp-lookahead - - - include - #double-three-fregexp-lookahead-negative - - - include - #double-three-fregexp-lookbehind - - - include - #double-three-fregexp-lookbehind-negative - - - include - #double-three-fregexp-conditional - - - include - #double-three-fregexp-parentheses-non-capturing - - - include - #double-three-fregexp-parentheses - - - include - #comments-string-double-three - - - - double-three-fregexp-named-group - - name - meta.named.regexp - begin - (?x) - (\() (\?P <\w+(?:\s+[[:alnum:]]+)?>) - - end - (\)|(?=""")) - beginCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp - - 2 - - name - entity.name.tag.named.group.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-three-fregexp-expression - - - include - #comments-string-double-three - - - - double-three-fregexp-lookahead - - begin - (\()\?= - end - (\)|(?=""")) - beginCaptures - - 0 - - name - keyword.operator.lookahead.regexp - - 1 - - name - punctuation.parenthesis.lookahead.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-three-fregexp-expression - - - include - #comments-string-double-three - - - - double-three-fregexp-lookahead-negative - - begin - (\()\?! - end - (\)|(?=""")) - beginCaptures - - 0 - - name - keyword.operator.lookahead.negative.regexp - - 1 - - name - punctuation.parenthesis.lookahead.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-three-fregexp-expression - - - include - #comments-string-double-three - - - - double-three-fregexp-lookbehind - - begin - (\()\?<= - end - (\)|(?=""")) - beginCaptures - - 0 - - name - keyword.operator.lookbehind.regexp - - 1 - - name - punctuation.parenthesis.lookbehind.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-three-fregexp-expression - - - include - #comments-string-double-three - - - - double-three-fregexp-lookbehind-negative - - begin - (\()\?<! - end - (\)|(?=""")) - beginCaptures - - 0 - - name - keyword.operator.lookbehind.negative.regexp - - 1 - - name - punctuation.parenthesis.lookbehind.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-three-fregexp-expression - - - include - #comments-string-double-three - - - - double-three-fregexp-conditional - - begin - (\()\?\((\w+(?:\s+[[:alnum:]]+)?|\d+)\) - end - (\)|(?=""")) - beginCaptures - - 0 - - name - keyword.operator.conditional.regexp - - 1 - - name - punctuation.parenthesis.conditional.begin.regexp - - - endCaptures - - 1 - - name - keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-three-fregexp-expression - - - include - #comments-string-double-three - - - - double-three-fregexp-parentheses-non-capturing - - begin - \(\?: - end - (\)|(?=""")) - beginCaptures - - 0 - - name - support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-three-fregexp-expression - - - include - #comments-string-double-three - - - - double-three-fregexp-parentheses - - begin - \( - end - (\)|(?=""")) - beginCaptures - - 0 - - name - support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp - - - endCaptures - - 1 - - name - support.other.parenthesis.regexp punctuation.parenthesis.end.regexp - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-three-fregexp-expression - - - include - #comments-string-double-three - - - - fregexp-single-one-line - - name - string.interpolated.python string.regexp.quoted.single.python - begin - \b(([uU]r)|([fF]r)|(r[fF]?))(\') - end - (\')|(?<!\\)(\n) - beginCaptures - - 2 - - name - invalid.deprecated.prefix.python - - 3 - - name - storage.type.string.python - - 4 - - name - storage.type.string.python - - 5 - - name - punctuation.definition.string.begin.python - - - endCaptures - - 1 - - name - punctuation.definition.string.end.python - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-one-fregexp-expression - - - - fregexp-single-three-line - - name - string.interpolated.python string.regexp.quoted.multi.python - begin - \b(([uU]r)|([fF]r)|(r[fF]?))(\'\'\') - end - (\'\'\') - beginCaptures - - 2 - - name - invalid.deprecated.prefix.python - - 3 - - name - storage.type.string.python - - 4 - - name - storage.type.string.python - - 5 - - name - punctuation.definition.string.begin.python - - - endCaptures - - 1 - - name - punctuation.definition.string.end.python - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #single-three-fregexp-expression - - - - fregexp-double-one-line - - name - string.interpolated.python string.regexp.quoted.single.python - begin - \b(([uU]r)|([fF]r)|(r[fF]?))(") - end - (")|(?<!\\)(\n) - beginCaptures - - 2 - - name - invalid.deprecated.prefix.python - - 3 - - name - storage.type.string.python - - 4 - - name - storage.type.string.python - - 5 - - name - punctuation.definition.string.begin.python - - - endCaptures - - 1 - - name - punctuation.definition.string.end.python - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-one-fregexp-expression - - - - fregexp-double-three-line - - name - string.interpolated.python string.regexp.quoted.multi.python - begin - \b(([uU]r)|([fF]r)|(r[fF]?))(""") - end - (""") - beginCaptures - - 2 - - name - invalid.deprecated.prefix.python - - 3 - - name - storage.type.string.python - - 4 - - name - storage.type.string.python - - 5 - - name - punctuation.definition.string.begin.python - - - endCaptures - - 1 - - name - punctuation.definition.string.end.python - - 2 - - name - invalid.illegal.newline.python - - - patterns - - - include - #double-three-fregexp-expression - - - string-raw-quoted-single-line name @@ -8137,7 +6353,7 @@ indirectly through syntactic constructs name meta.fstring.python begin - (\b(?:[R][fF]|[fF][R]))((['"])) + (\b(?:[rR][fF]|[fF][rR]))((['"])) end (\2)|((?<!\\)\n) beginCaptures @@ -8515,7 +6731,7 @@ indirectly through syntactic constructs name meta.fstring.python begin - (\b(?:[R][fF]|[fF][R]))('''|""") + (\b(?:[rR][fF]|[fF][rR]))('''|""") end (\2) beginCaptures diff --git a/grammars/src/MagicPython.syntax.yaml b/grammars/src/MagicPython.syntax.yaml index 83948dc1..bd740829 100644 --- a/grammars/src/MagicPython.syntax.yaml +++ b/grammars/src/MagicPython.syntax.yaml @@ -103,82 +103,6 @@ repository: bquote: '(""")' equote: '(""")' - - file: 'regexp.inc.syntax.yaml' - vars: - prefix: 'single-one-' - basename: 'fregexp' - marker: "|(?=\\')" - nested: '' - guard: "|((?=(? List[str]: async with db.transaction(): result = await db.query(...) print(f'Result: {result!r} {a=} {b=!r}') + print(Rf'data: {c=}') + print(rf'data: {c=}') mapping = None # type: Dict[int, Any] # PEP 484 diff --git a/test/atom-spec/python-spec.js b/test/atom-spec/python-spec.js index da7d08c1..cf00b257 100644 --- a/test/atom-spec/python-spec.js +++ b/test/atom-spec/python-spec.js @@ -6610,39 +6610,313 @@ describe("Grammar Tests", function() { function() { tokens = grammar.tokenizeLines("rf\"{} { }\"\nrf\"\"\"{}\n{ }\n\"\"\"") expect(tokens[0][0].value).toBe("rf"); - expect(tokens[0][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); + expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); expect(tokens[0][1].value).toBe("\""); - expect(tokens[0][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); + expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); expect(tokens[0][2].value).toBe("{"); - expect(tokens[0][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][3].value).toBe("}"); - expect(tokens[0][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][4].value).toBe(" "); - expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); expect(tokens[0][5].value).toBe("{"); - expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][6].value).toBe(" "); - expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","invalid.illegal.brace.python"]); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.brace.python"]); expect(tokens[0][7].value).toBe("}"); - expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][7].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); expect(tokens[0][8].value).toBe("\""); - expect(tokens[0][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); + expect(tokens[0][8].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); expect(tokens[1][0].value).toBe("rf"); - expect(tokens[1][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","storage.type.string.python"]); + expect(tokens[1][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.multi.python string.interpolated.python"]); expect(tokens[1][1].value).toBe("\"\"\""); - expect(tokens[1][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.begin.python"]); + expect(tokens[1][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python punctuation.definition.string.begin.python"]); expect(tokens[1][2].value).toBe("{"); - expect(tokens[1][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); expect(tokens[1][3].value).toBe("}"); - expect(tokens[1][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][4].value).toBe(""); + expect(tokens[1][4].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python"]); expect(tokens[2][0].value).toBe("{"); - expect(tokens[2][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][0].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); expect(tokens[2][1].value).toBe(" "); - expect(tokens[2][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","invalid.illegal.brace.python"]); + expect(tokens[2][1].scopes).toEqual(["source.python","meta.fstring.python","invalid.illegal.brace.python"]); expect(tokens[2][2].value).toBe("}"); - expect(tokens[2][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][2].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][3].value).toBe(""); + expect(tokens[2][3].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python"]); expect(tokens[3][0].value).toBe("\"\"\""); - expect(tokens[3][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.end.python"]); + expect(tokens[3][0].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python punctuation.definition.string.end.python"]); + }); + + it("test/fstrings/fraw1.py", + function() { + tokens = grammar.tokenizeLines("a = fr'[a-z]'\na = Fr'[a-z]'\na = rf'[a-z]'\na = rF'[a-z]'") + expect(tokens[0][0].value).toBe("a"); + expect(tokens[0][0].scopes).toEqual(["source.python"]); + expect(tokens[0][1].value).toBe(" "); + expect(tokens[0][1].scopes).toEqual(["source.python"]); + expect(tokens[0][2].value).toBe("="); + expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[0][3].value).toBe(" "); + expect(tokens[0][3].scopes).toEqual(["source.python"]); + expect(tokens[0][4].value).toBe("fr"); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[0][5].value).toBe("'"); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); + expect(tokens[0][6].value).toBe("[a-z]"); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[0][7].value).toBe("'"); + expect(tokens[0][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[1][0].value).toBe("a"); + expect(tokens[1][0].scopes).toEqual(["source.python"]); + expect(tokens[1][1].value).toBe(" "); + expect(tokens[1][1].scopes).toEqual(["source.python"]); + expect(tokens[1][2].value).toBe("="); + expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[1][3].value).toBe(" "); + expect(tokens[1][3].scopes).toEqual(["source.python"]); + expect(tokens[1][4].value).toBe("Fr"); + expect(tokens[1][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[1][5].value).toBe("'"); + expect(tokens[1][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); + expect(tokens[1][6].value).toBe("[a-z]"); + expect(tokens[1][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[1][7].value).toBe("'"); + expect(tokens[1][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[2][0].value).toBe("a"); + expect(tokens[2][0].scopes).toEqual(["source.python"]); + expect(tokens[2][1].value).toBe(" "); + expect(tokens[2][1].scopes).toEqual(["source.python"]); + expect(tokens[2][2].value).toBe("="); + expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[2][3].value).toBe(" "); + expect(tokens[2][3].scopes).toEqual(["source.python"]); + expect(tokens[2][4].value).toBe("rf"); + expect(tokens[2][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[2][5].value).toBe("'"); + expect(tokens[2][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); + expect(tokens[2][6].value).toBe("[a-z]"); + expect(tokens[2][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[2][7].value).toBe("'"); + expect(tokens[2][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[3][0].value).toBe("a"); + expect(tokens[3][0].scopes).toEqual(["source.python"]); + expect(tokens[3][1].value).toBe(" "); + expect(tokens[3][1].scopes).toEqual(["source.python"]); + expect(tokens[3][2].value).toBe("="); + expect(tokens[3][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[3][3].value).toBe(" "); + expect(tokens[3][3].scopes).toEqual(["source.python"]); + expect(tokens[3][4].value).toBe("rF"); + expect(tokens[3][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[3][5].value).toBe("'"); + expect(tokens[3][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); + expect(tokens[3][6].value).toBe("[a-z]"); + expect(tokens[3][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[3][7].value).toBe("'"); + expect(tokens[3][7].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); + }); + + it("test/fstrings/fraw2.py", + function() { + tokens = grammar.tokenizeLines("rf'fo{{2}}'\nrf\"fo{{2}}\"\nrf'''fo{{2}}'''\nrf\"\"\"fo{{2}}\"\"\"") + expect(tokens[0][0].value).toBe("rf"); + expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[0][1].value).toBe("'"); + expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); + expect(tokens[0][2].value).toBe("fo"); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[0][3].value).toBe("{{"); + expect(tokens[0][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[0][4].value).toBe("2"); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[0][5].value).toBe("}}"); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[0][6].value).toBe("'"); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[1][0].value).toBe("rf"); + expect(tokens[1][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[1][1].value).toBe("\""); + expect(tokens[1][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); + expect(tokens[1][2].value).toBe("fo"); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[1][3].value).toBe("{{"); + expect(tokens[1][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[1][4].value).toBe("2"); + expect(tokens[1][4].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[1][5].value).toBe("}}"); + expect(tokens[1][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[1][6].value).toBe("\""); + expect(tokens[1][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[2][0].value).toBe("rf"); + expect(tokens[2][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.multi.python string.interpolated.python"]); + expect(tokens[2][1].value).toBe("'''"); + expect(tokens[2][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python punctuation.definition.string.begin.python"]); + expect(tokens[2][2].value).toBe("fo"); + expect(tokens[2][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python"]); + expect(tokens[2][3].value).toBe("{{"); + expect(tokens[2][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[2][4].value).toBe("2"); + expect(tokens[2][4].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python"]); + expect(tokens[2][5].value).toBe("}}"); + expect(tokens[2][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[2][6].value).toBe("'''"); + expect(tokens[2][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[3][0].value).toBe("rf"); + expect(tokens[3][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.multi.python string.interpolated.python"]); + expect(tokens[3][1].value).toBe("\"\"\""); + expect(tokens[3][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python punctuation.definition.string.begin.python"]); + expect(tokens[3][2].value).toBe("fo"); + expect(tokens[3][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python"]); + expect(tokens[3][3].value).toBe("{{"); + expect(tokens[3][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[3][4].value).toBe("2"); + expect(tokens[3][4].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python"]); + expect(tokens[3][5].value).toBe("}}"); + expect(tokens[3][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[3][6].value).toBe("\"\"\""); + expect(tokens[3][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python punctuation.definition.string.end.python"]); + }); + + it("test/fstrings/fraw3.py", + function() { + tokens = grammar.tokenizeLines("rf'fo{2}'\nrf\"fo{2}\"\nrf'''fo{2}'''\nrf\"\"\"fo{2}\"\"\"") + expect(tokens[0][0].value).toBe("rf"); + expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[0][1].value).toBe("'"); + expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); + expect(tokens[0][2].value).toBe("fo"); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[0][3].value).toBe("{"); + expect(tokens[0][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][4].value).toBe("2"); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]); + expect(tokens[0][5].value).toBe("}"); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][6].value).toBe("'"); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[1][0].value).toBe("rf"); + expect(tokens[1][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[1][1].value).toBe("\""); + expect(tokens[1][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); + expect(tokens[1][2].value).toBe("fo"); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[1][3].value).toBe("{"); + expect(tokens[1][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][4].value).toBe("2"); + expect(tokens[1][4].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]); + expect(tokens[1][5].value).toBe("}"); + expect(tokens[1][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][6].value).toBe("\""); + expect(tokens[1][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[2][0].value).toBe("rf"); + expect(tokens[2][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.multi.python string.interpolated.python"]); + expect(tokens[2][1].value).toBe("'''"); + expect(tokens[2][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python punctuation.definition.string.begin.python"]); + expect(tokens[2][2].value).toBe("fo"); + expect(tokens[2][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python"]); + expect(tokens[2][3].value).toBe("{"); + expect(tokens[2][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][4].value).toBe("2"); + expect(tokens[2][4].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]); + expect(tokens[2][5].value).toBe("}"); + expect(tokens[2][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][6].value).toBe("'''"); + expect(tokens[2][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[3][0].value).toBe("rf"); + expect(tokens[3][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.multi.python string.interpolated.python"]); + expect(tokens[3][1].value).toBe("\"\"\""); + expect(tokens[3][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python punctuation.definition.string.begin.python"]); + expect(tokens[3][2].value).toBe("fo"); + expect(tokens[3][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python"]); + expect(tokens[3][3].value).toBe("{"); + expect(tokens[3][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[3][4].value).toBe("2"); + expect(tokens[3][4].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]); + expect(tokens[3][5].value).toBe("}"); + expect(tokens[3][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[3][6].value).toBe("\"\"\""); + expect(tokens[3][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.multi.python string.interpolated.python punctuation.definition.string.end.python"]); + }); + + it("test/fstrings/fraw4.py", + function() { + tokens = grammar.tokenizeLines("a = rf'fo{{{2}}}'\na = rf'fo{{{bar}}}'\na = rf'fo{{2}}'") + expect(tokens[0][0].value).toBe("a"); + expect(tokens[0][0].scopes).toEqual(["source.python"]); + expect(tokens[0][1].value).toBe(" "); + expect(tokens[0][1].scopes).toEqual(["source.python"]); + expect(tokens[0][2].value).toBe("="); + expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[0][3].value).toBe(" "); + expect(tokens[0][3].scopes).toEqual(["source.python"]); + expect(tokens[0][4].value).toBe("rf"); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[0][5].value).toBe("'"); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); + expect(tokens[0][6].value).toBe("fo"); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[0][7].value).toBe("{{"); + expect(tokens[0][7].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[0][8].value).toBe("{"); + expect(tokens[0][8].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][9].value).toBe("2"); + expect(tokens[0][9].scopes).toEqual(["source.python","meta.fstring.python","constant.numeric.dec.python"]); + expect(tokens[0][10].value).toBe("}"); + expect(tokens[0][10].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][11].value).toBe("}}"); + expect(tokens[0][11].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[0][12].value).toBe("'"); + expect(tokens[0][12].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[1][0].value).toBe("a"); + expect(tokens[1][0].scopes).toEqual(["source.python"]); + expect(tokens[1][1].value).toBe(" "); + expect(tokens[1][1].scopes).toEqual(["source.python"]); + expect(tokens[1][2].value).toBe("="); + expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[1][3].value).toBe(" "); + expect(tokens[1][3].scopes).toEqual(["source.python"]); + expect(tokens[1][4].value).toBe("rf"); + expect(tokens[1][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[1][5].value).toBe("'"); + expect(tokens[1][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); + expect(tokens[1][6].value).toBe("fo"); + expect(tokens[1][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[1][7].value).toBe("{{"); + expect(tokens[1][7].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[1][8].value).toBe("{"); + expect(tokens[1][8].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][9].value).toBe("bar"); + expect(tokens[1][9].scopes).toEqual(["source.python","meta.fstring.python"]); + expect(tokens[1][10].value).toBe("}"); + expect(tokens[1][10].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][11].value).toBe("}}"); + expect(tokens[1][11].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[1][12].value).toBe("'"); + expect(tokens[1][12].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); + expect(tokens[2][0].value).toBe("a"); + expect(tokens[2][0].scopes).toEqual(["source.python"]); + expect(tokens[2][1].value).toBe(" "); + expect(tokens[2][1].scopes).toEqual(["source.python"]); + expect(tokens[2][2].value).toBe("="); + expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); + expect(tokens[2][3].value).toBe(" "); + expect(tokens[2][3].scopes).toEqual(["source.python"]); + expect(tokens[2][4].value).toBe("rf"); + expect(tokens[2][4].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[2][5].value).toBe("'"); + expect(tokens[2][5].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); + expect(tokens[2][6].value).toBe("fo"); + expect(tokens[2][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[2][7].value).toBe("{{"); + expect(tokens[2][7].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[2][8].value).toBe("2"); + expect(tokens[2][8].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[2][9].value).toBe("}}"); + expect(tokens[2][9].scopes).toEqual(["source.python","meta.fstring.python","constant.character.escape.python"]); + expect(tokens[2][10].value).toBe("'"); + expect(tokens[2][10].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); }); it("test/fstrings/nested1.py", @@ -7084,25 +7358,33 @@ describe("Grammar Tests", function() { expect(tokens[1][6].value).toBe("'"); expect(tokens[1][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.single.python string.interpolated.python punctuation.definition.string.end.python"]); expect(tokens[2][0].value).toBe("rf"); - expect(tokens[2][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); + expect(tokens[2][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); expect(tokens[2][1].value).toBe("'"); - expect(tokens[2][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); + expect(tokens[2][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); expect(tokens[2][2].value).toBe("some "); - expect(tokens[2][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[2][3].value).toBe("{obj}"); - expect(tokens[2][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[2][4].value).toBe("'"); - expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); + expect(tokens[2][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[2][3].value).toBe("{"); + expect(tokens[2][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][4].value).toBe("obj"); + expect(tokens[2][4].scopes).toEqual(["source.python","meta.fstring.python"]); + expect(tokens[2][5].value).toBe("}"); + expect(tokens[2][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[2][6].value).toBe("'"); + expect(tokens[2][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); expect(tokens[3][0].value).toBe("rF"); - expect(tokens[3][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); + expect(tokens[3][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); expect(tokens[3][1].value).toBe("'"); - expect(tokens[3][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); + expect(tokens[3][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); expect(tokens[3][2].value).toBe("some "); - expect(tokens[3][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[3][3].value).toBe("{obj}"); - expect(tokens[3][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[3][4].value).toBe("'"); - expect(tokens[3][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); + expect(tokens[3][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[3][3].value).toBe("{"); + expect(tokens[3][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[3][4].value).toBe("obj"); + expect(tokens[3][4].scopes).toEqual(["source.python","meta.fstring.python"]); + expect(tokens[3][5].value).toBe("}"); + expect(tokens[3][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[3][6].value).toBe("'"); + expect(tokens[3][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); expect(tokens[4][0].value).toBe("Rf"); expect(tokens[4][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); expect(tokens[4][1].value).toBe("'"); @@ -7137,25 +7419,33 @@ describe("Grammar Tests", function() { function() { tokens = grammar.tokenizeLines("fr'some {obj}'\nFr'some {obj}'\nfR'some {obj}'\nFR'some {obj}'") expect(tokens[0][0].value).toBe("fr"); - expect(tokens[0][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); + expect(tokens[0][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); expect(tokens[0][1].value).toBe("'"); - expect(tokens[0][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); + expect(tokens[0][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); expect(tokens[0][2].value).toBe("some "); - expect(tokens[0][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[0][3].value).toBe("{obj}"); - expect(tokens[0][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[0][4].value).toBe("'"); - expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); + expect(tokens[0][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[0][3].value).toBe("{"); + expect(tokens[0][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][4].value).toBe("obj"); + expect(tokens[0][4].scopes).toEqual(["source.python","meta.fstring.python"]); + expect(tokens[0][5].value).toBe("}"); + expect(tokens[0][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[0][6].value).toBe("'"); + expect(tokens[0][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); expect(tokens[1][0].value).toBe("Fr"); - expect(tokens[1][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); + expect(tokens[1][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); expect(tokens[1][1].value).toBe("'"); - expect(tokens[1][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); + expect(tokens[1][1].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python punctuation.definition.string.begin.python"]); expect(tokens[1][2].value).toBe("some "); - expect(tokens[1][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[1][3].value).toBe("{obj}"); - expect(tokens[1][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[1][4].value).toBe("'"); - expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); + expect(tokens[1][2].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python"]); + expect(tokens[1][3].value).toBe("{"); + expect(tokens[1][3].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][4].value).toBe("obj"); + expect(tokens[1][4].scopes).toEqual(["source.python","meta.fstring.python"]); + expect(tokens[1][5].value).toBe("}"); + expect(tokens[1][5].scopes).toEqual(["source.python","meta.fstring.python","constant.character.format.placeholder.other.python"]); + expect(tokens[1][6].value).toBe("'"); + expect(tokens[1][6].scopes).toEqual(["source.python","meta.fstring.python","string.quoted.raw.single.python string.interpolated.python punctuation.definition.string.end.python"]); expect(tokens[2][0].value).toBe("fR"); expect(tokens[2][0].scopes).toEqual(["source.python","meta.fstring.python","storage.type.string.python string.quoted.raw.single.python string.interpolated.python"]); expect(tokens[2][1].value).toBe("'"); @@ -10724,370 +11014,6 @@ describe("Grammar Tests", function() { expect(tokens[0][15].scopes).toEqual(["source.python","string.regexp.quoted.multi.python","punctuation.definition.string.end.python"]); }); - it("test/regexp/fregexp1.py", - function() { - tokens = grammar.tokenizeLines("a = fr'[a-z]'\na = Fr'[a-z]'\na = rf'[a-z]'\na = rF'[a-z]'") - expect(tokens[0][0].value).toBe("a"); - expect(tokens[0][0].scopes).toEqual(["source.python"]); - expect(tokens[0][1].value).toBe(" "); - expect(tokens[0][1].scopes).toEqual(["source.python"]); - expect(tokens[0][2].value).toBe("="); - expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[0][3].value).toBe(" "); - expect(tokens[0][3].scopes).toEqual(["source.python"]); - expect(tokens[0][4].value).toBe("fr"); - expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[0][5].value).toBe("'"); - expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[0][6].value).toBe("["); - expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]); - expect(tokens[0][7].value).toBe("a"); - expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[0][8].value).toBe("-"); - expect(tokens[0][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[0][9].value).toBe("z"); - expect(tokens[0][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[0][10].value).toBe("]"); - expect(tokens[0][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]); - expect(tokens[0][11].value).toBe("'"); - expect(tokens[0][11].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[1][0].value).toBe("a"); - expect(tokens[1][0].scopes).toEqual(["source.python"]); - expect(tokens[1][1].value).toBe(" "); - expect(tokens[1][1].scopes).toEqual(["source.python"]); - expect(tokens[1][2].value).toBe("="); - expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[1][3].value).toBe(" "); - expect(tokens[1][3].scopes).toEqual(["source.python"]); - expect(tokens[1][4].value).toBe("Fr"); - expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[1][5].value).toBe("'"); - expect(tokens[1][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[1][6].value).toBe("["); - expect(tokens[1][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]); - expect(tokens[1][7].value).toBe("a"); - expect(tokens[1][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[1][8].value).toBe("-"); - expect(tokens[1][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[1][9].value).toBe("z"); - expect(tokens[1][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[1][10].value).toBe("]"); - expect(tokens[1][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]); - expect(tokens[1][11].value).toBe("'"); - expect(tokens[1][11].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[2][0].value).toBe("a"); - expect(tokens[2][0].scopes).toEqual(["source.python"]); - expect(tokens[2][1].value).toBe(" "); - expect(tokens[2][1].scopes).toEqual(["source.python"]); - expect(tokens[2][2].value).toBe("="); - expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[2][3].value).toBe(" "); - expect(tokens[2][3].scopes).toEqual(["source.python"]); - expect(tokens[2][4].value).toBe("rf"); - expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[2][5].value).toBe("'"); - expect(tokens[2][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[2][6].value).toBe("["); - expect(tokens[2][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]); - expect(tokens[2][7].value).toBe("a"); - expect(tokens[2][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[2][8].value).toBe("-"); - expect(tokens[2][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[2][9].value).toBe("z"); - expect(tokens[2][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[2][10].value).toBe("]"); - expect(tokens[2][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]); - expect(tokens[2][11].value).toBe("'"); - expect(tokens[2][11].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[3][0].value).toBe("a"); - expect(tokens[3][0].scopes).toEqual(["source.python"]); - expect(tokens[3][1].value).toBe(" "); - expect(tokens[3][1].scopes).toEqual(["source.python"]); - expect(tokens[3][2].value).toBe("="); - expect(tokens[3][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[3][3].value).toBe(" "); - expect(tokens[3][3].scopes).toEqual(["source.python"]); - expect(tokens[3][4].value).toBe("rF"); - expect(tokens[3][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[3][5].value).toBe("'"); - expect(tokens[3][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[3][6].value).toBe("["); - expect(tokens[3][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.begin.regexp"]); - expect(tokens[3][7].value).toBe("a"); - expect(tokens[3][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[3][8].value).toBe("-"); - expect(tokens[3][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[3][9].value).toBe("z"); - expect(tokens[3][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.character.set.regexp"]); - expect(tokens[3][10].value).toBe("]"); - expect(tokens[3][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","meta.character.set.regexp","constant.other.set.regexp punctuation.character.set.end.regexp"]); - expect(tokens[3][11].value).toBe("'"); - expect(tokens[3][11].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - }); - - it("test/regexp/fregexp2.py", - function() { - tokens = grammar.tokenizeLines("rf'fo{{2}}'\nrf\"fo{{2}}\"\nrf'''fo{{2}}'''\nrf\"\"\"fo{{2}}\"\"\"") - expect(tokens[0][0].value).toBe("rf"); - expect(tokens[0][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[0][1].value).toBe("'"); - expect(tokens[0][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[0][2].value).toBe("fo"); - expect(tokens[0][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[0][3].value).toBe("{{2}}"); - expect(tokens[0][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","keyword.operator.quantifier.regexp"]); - expect(tokens[0][4].value).toBe("'"); - expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[1][0].value).toBe("rf"); - expect(tokens[1][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[1][1].value).toBe("\""); - expect(tokens[1][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[1][2].value).toBe("fo"); - expect(tokens[1][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[1][3].value).toBe("{{2}}"); - expect(tokens[1][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","keyword.operator.quantifier.regexp"]); - expect(tokens[1][4].value).toBe("\""); - expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[2][0].value).toBe("rf"); - expect(tokens[2][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[2][1].value).toBe("'''"); - expect(tokens[2][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[2][2].value).toBe("fo"); - expect(tokens[2][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python"]); - expect(tokens[2][3].value).toBe("{{2}}"); - expect(tokens[2][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","keyword.operator.quantifier.regexp"]); - expect(tokens[2][4].value).toBe("'''"); - expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[3][0].value).toBe("rf"); - expect(tokens[3][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[3][1].value).toBe("\"\"\""); - expect(tokens[3][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[3][2].value).toBe("fo"); - expect(tokens[3][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python"]); - expect(tokens[3][3].value).toBe("{{2}}"); - expect(tokens[3][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","keyword.operator.quantifier.regexp"]); - expect(tokens[3][4].value).toBe("\"\"\""); - expect(tokens[3][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.end.python"]); - }); - - it("test/regexp/fregexp3.py", - function() { - tokens = grammar.tokenizeLines("rf'fo{2}'\nrf\"fo{2}\"\nrf'''fo{2}'''\nrf\"\"\"fo{2}\"\"\"") - expect(tokens[0][0].value).toBe("rf"); - expect(tokens[0][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[0][1].value).toBe("'"); - expect(tokens[0][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[0][2].value).toBe("fo"); - expect(tokens[0][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[0][3].value).toBe("{2}"); - expect(tokens[0][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[0][4].value).toBe("'"); - expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[1][0].value).toBe("rf"); - expect(tokens[1][0].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[1][1].value).toBe("\""); - expect(tokens[1][1].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[1][2].value).toBe("fo"); - expect(tokens[1][2].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[1][3].value).toBe("{2}"); - expect(tokens[1][3].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[1][4].value).toBe("\""); - expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[2][0].value).toBe("rf"); - expect(tokens[2][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[2][1].value).toBe("'''"); - expect(tokens[2][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[2][2].value).toBe("fo"); - expect(tokens[2][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python"]); - expect(tokens[2][3].value).toBe("{2}"); - expect(tokens[2][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python"]); - expect(tokens[2][4].value).toBe("'''"); - expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[3][0].value).toBe("rf"); - expect(tokens[3][0].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[3][1].value).toBe("\"\"\""); - expect(tokens[3][1].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[3][2].value).toBe("fo"); - expect(tokens[3][2].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python"]); - expect(tokens[3][3].value).toBe("{2}"); - expect(tokens[3][3].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python"]); - expect(tokens[3][4].value).toBe("\"\"\""); - expect(tokens[3][4].scopes).toEqual(["source.python","string.regexp.quoted.multi.python string.interpolated.python","punctuation.definition.string.end.python"]); - }); - - it("test/regexp/fregexp4.py", - function() { - tokens = grammar.tokenizeLines("a = rf'fo{{2}}'\na = r'fo{{2}}'\na = r'fo{2}'") - expect(tokens[0][0].value).toBe("a"); - expect(tokens[0][0].scopes).toEqual(["source.python"]); - expect(tokens[0][1].value).toBe(" "); - expect(tokens[0][1].scopes).toEqual(["source.python"]); - expect(tokens[0][2].value).toBe("="); - expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[0][3].value).toBe(" "); - expect(tokens[0][3].scopes).toEqual(["source.python"]); - expect(tokens[0][4].value).toBe("rf"); - expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[0][5].value).toBe("'"); - expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[0][6].value).toBe("fo"); - expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[0][7].value).toBe("{{2}}"); - expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","keyword.operator.quantifier.regexp"]); - expect(tokens[0][8].value).toBe("'"); - expect(tokens[0][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[1][0].value).toBe("a"); - expect(tokens[1][0].scopes).toEqual(["source.python"]); - expect(tokens[1][1].value).toBe(" "); - expect(tokens[1][1].scopes).toEqual(["source.python"]); - expect(tokens[1][2].value).toBe("="); - expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[1][3].value).toBe(" "); - expect(tokens[1][3].scopes).toEqual(["source.python"]); - expect(tokens[1][4].value).toBe("r"); - expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]); - expect(tokens[1][5].value).toBe("'"); - expect(tokens[1][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]); - expect(tokens[1][6].value).toBe("fo{"); - expect(tokens[1][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]); - expect(tokens[1][7].value).toBe("{2}"); - expect(tokens[1][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","keyword.operator.quantifier.regexp"]); - expect(tokens[1][8].value).toBe("}"); - expect(tokens[1][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]); - expect(tokens[1][9].value).toBe("'"); - expect(tokens[1][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.end.python"]); - expect(tokens[2][0].value).toBe("a"); - expect(tokens[2][0].scopes).toEqual(["source.python"]); - expect(tokens[2][1].value).toBe(" "); - expect(tokens[2][1].scopes).toEqual(["source.python"]); - expect(tokens[2][2].value).toBe("="); - expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[2][3].value).toBe(" "); - expect(tokens[2][3].scopes).toEqual(["source.python"]); - expect(tokens[2][4].value).toBe("r"); - expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]); - expect(tokens[2][5].value).toBe("'"); - expect(tokens[2][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]); - expect(tokens[2][6].value).toBe("fo"); - expect(tokens[2][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]); - expect(tokens[2][7].value).toBe("{2}"); - expect(tokens[2][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python","keyword.operator.quantifier.regexp"]); - expect(tokens[2][8].value).toBe("'"); - expect(tokens[2][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.end.python"]); - }); - - it("test/regexp/fregexp5.py", - function() { - tokens = grammar.tokenizeLines("a = rf'{{foo}}'\na = r'\\{foo\\}'") - expect(tokens[0][0].value).toBe("a"); - expect(tokens[0][0].scopes).toEqual(["source.python"]); - expect(tokens[0][1].value).toBe(" "); - expect(tokens[0][1].scopes).toEqual(["source.python"]); - expect(tokens[0][2].value).toBe("="); - expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[0][3].value).toBe(" "); - expect(tokens[0][3].scopes).toEqual(["source.python"]); - expect(tokens[0][4].value).toBe("rf"); - expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[0][5].value).toBe("'"); - expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[0][6].value).toBe("{{"); - expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.escape.python"]); - expect(tokens[0][7].value).toBe("foo"); - expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[0][8].value).toBe("}}"); - expect(tokens[0][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.escape.python"]); - expect(tokens[0][9].value).toBe("'"); - expect(tokens[0][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[1][0].value).toBe("a"); - expect(tokens[1][0].scopes).toEqual(["source.python"]); - expect(tokens[1][1].value).toBe(" "); - expect(tokens[1][1].scopes).toEqual(["source.python"]); - expect(tokens[1][2].value).toBe("="); - expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[1][3].value).toBe(" "); - expect(tokens[1][3].scopes).toEqual(["source.python"]); - expect(tokens[1][4].value).toBe("r"); - expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python","storage.type.string.python"]); - expect(tokens[1][5].value).toBe("'"); - expect(tokens[1][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.begin.python"]); - expect(tokens[1][6].value).toBe("\\{"); - expect(tokens[1][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python","constant.character.escape.regexp"]); - expect(tokens[1][7].value).toBe("foo"); - expect(tokens[1][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python"]); - expect(tokens[1][8].value).toBe("\\}"); - expect(tokens[1][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python","constant.character.escape.regexp"]); - expect(tokens[1][9].value).toBe("'"); - expect(tokens[1][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python","punctuation.definition.string.end.python"]); - }); - - it("test/regexp/fregexp6.py", - function() { - tokens = grammar.tokenizeLines("a = rf'fo{{{2}}}'\na = rf'fo{{{bar}}}'\na = rf'fo{{2}}'") - expect(tokens[0][0].value).toBe("a"); - expect(tokens[0][0].scopes).toEqual(["source.python"]); - expect(tokens[0][1].value).toBe(" "); - expect(tokens[0][1].scopes).toEqual(["source.python"]); - expect(tokens[0][2].value).toBe("="); - expect(tokens[0][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[0][3].value).toBe(" "); - expect(tokens[0][3].scopes).toEqual(["source.python"]); - expect(tokens[0][4].value).toBe("rf"); - expect(tokens[0][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[0][5].value).toBe("'"); - expect(tokens[0][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[0][6].value).toBe("fo"); - expect(tokens[0][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[0][7].value).toBe("{{"); - expect(tokens[0][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.escape.python"]); - expect(tokens[0][8].value).toBe("{2}"); - expect(tokens[0][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[0][9].value).toBe("}}"); - expect(tokens[0][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.escape.python"]); - expect(tokens[0][10].value).toBe("'"); - expect(tokens[0][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[1][0].value).toBe("a"); - expect(tokens[1][0].scopes).toEqual(["source.python"]); - expect(tokens[1][1].value).toBe(" "); - expect(tokens[1][1].scopes).toEqual(["source.python"]); - expect(tokens[1][2].value).toBe("="); - expect(tokens[1][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[1][3].value).toBe(" "); - expect(tokens[1][3].scopes).toEqual(["source.python"]); - expect(tokens[1][4].value).toBe("rf"); - expect(tokens[1][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[1][5].value).toBe("'"); - expect(tokens[1][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[1][6].value).toBe("fo"); - expect(tokens[1][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[1][7].value).toBe("{{"); - expect(tokens[1][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.escape.python"]); - expect(tokens[1][8].value).toBe("{bar}"); - expect(tokens[1][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[1][9].value).toBe("}}"); - expect(tokens[1][9].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","constant.character.escape.python"]); - expect(tokens[1][10].value).toBe("'"); - expect(tokens[1][10].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - expect(tokens[2][0].value).toBe("a"); - expect(tokens[2][0].scopes).toEqual(["source.python"]); - expect(tokens[2][1].value).toBe(" "); - expect(tokens[2][1].scopes).toEqual(["source.python"]); - expect(tokens[2][2].value).toBe("="); - expect(tokens[2][2].scopes).toEqual(["source.python","keyword.operator.assignment.python"]); - expect(tokens[2][3].value).toBe(" "); - expect(tokens[2][3].scopes).toEqual(["source.python"]); - expect(tokens[2][4].value).toBe("rf"); - expect(tokens[2][4].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","storage.type.string.python"]); - expect(tokens[2][5].value).toBe("'"); - expect(tokens[2][5].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.begin.python"]); - expect(tokens[2][6].value).toBe("fo"); - expect(tokens[2][6].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python"]); - expect(tokens[2][7].value).toBe("{{2}}"); - expect(tokens[2][7].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","keyword.operator.quantifier.regexp"]); - expect(tokens[2][8].value).toBe("'"); - expect(tokens[2][8].scopes).toEqual(["source.python","string.regexp.quoted.single.python string.interpolated.python","punctuation.definition.string.end.python"]); - }); - it("test/regexp/python1.py", function() { tokens = grammar.tokenizeLines("a = r'[a-z]'\na = R'[a-z]'") diff --git a/test/fstrings/empty2.py b/test/fstrings/empty2.py index 77dc9087..9a007e14 100644 --- a/test/fstrings/empty2.py +++ b/test/fstrings/empty2.py @@ -7,20 +7,22 @@ -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -" : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -{ : constant.character.format.placeholder.other.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -} : constant.character.format.placeholder.other.python, source.python, string.interpolated.python, string.regexp.quoted.single.python - : source.python, string.interpolated.python, string.regexp.quoted.single.python -{ : constant.character.format.placeholder.other.python, source.python, string.interpolated.python, string.regexp.quoted.single.python - : invalid.illegal.brace.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -} : constant.character.format.placeholder.other.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -" : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.multi.python -""" : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python -{ : constant.character.format.placeholder.other.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python -} : constant.character.format.placeholder.other.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python -{ : constant.character.format.placeholder.other.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python - : invalid.illegal.brace.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python -} : constant.character.format.placeholder.other.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python -""" : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +" : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python + : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python + : invalid.illegal.brace.python, meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +" : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.multi.python +""" : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.multi.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python + : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.multi.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python + : invalid.illegal.brace.python, meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python + : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.multi.python +""" : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.multi.python diff --git a/test/fstrings/fraw1.py b/test/fstrings/fraw1.py new file mode 100644 index 00000000..31e2196e --- /dev/null +++ b/test/fstrings/fraw1.py @@ -0,0 +1,40 @@ +a = fr'[a-z]' +a = Fr'[a-z]' +a = rf'[a-z]' +a = rF'[a-z]' + + + + +a : source.python + : source.python += : keyword.operator.assignment.python, source.python + : source.python +fr : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +[a-z] : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +a : source.python + : source.python += : keyword.operator.assignment.python, source.python + : source.python +Fr : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +[a-z] : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +a : source.python + : source.python += : keyword.operator.assignment.python, source.python + : source.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +[a-z] : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +a : source.python + : source.python += : keyword.operator.assignment.python, source.python + : source.python +rF : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +[a-z] : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python diff --git a/test/fstrings/fraw2.py b/test/fstrings/fraw2.py new file mode 100644 index 00000000..df0a2fed --- /dev/null +++ b/test/fstrings/fraw2.py @@ -0,0 +1,36 @@ +rf'fo{{2}}' +rf"fo{{2}}" +rf'''fo{{2}}''' +rf"""fo{{2}}""" + + + + +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +fo : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{{ : constant.character.escape.python, meta.fstring.python, source.python +2 : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +}} : constant.character.escape.python, meta.fstring.python, source.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +" : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +fo : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{{ : constant.character.escape.python, meta.fstring.python, source.python +2 : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +}} : constant.character.escape.python, meta.fstring.python, source.python +" : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.multi.python +''' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.multi.python +fo : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.multi.python +{{ : constant.character.escape.python, meta.fstring.python, source.python +2 : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.multi.python +}} : constant.character.escape.python, meta.fstring.python, source.python +''' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.multi.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.multi.python +""" : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.multi.python +fo : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.multi.python +{{ : constant.character.escape.python, meta.fstring.python, source.python +2 : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.multi.python +}} : constant.character.escape.python, meta.fstring.python, source.python +""" : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.multi.python diff --git a/test/fstrings/fraw3.py b/test/fstrings/fraw3.py new file mode 100644 index 00000000..da1a6aff --- /dev/null +++ b/test/fstrings/fraw3.py @@ -0,0 +1,36 @@ +rf'fo{2}' +rf"fo{2}" +rf'''fo{2}''' +rf"""fo{2}""" + + + + +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +fo : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +2 : constant.numeric.dec.python, meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +" : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +fo : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +2 : constant.numeric.dec.python, meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +" : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.multi.python +''' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.multi.python +fo : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.multi.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +2 : constant.numeric.dec.python, meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +''' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.multi.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.multi.python +""" : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.multi.python +fo : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.multi.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +2 : constant.numeric.dec.python, meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +""" : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.multi.python diff --git a/test/fstrings/fraw4.py b/test/fstrings/fraw4.py new file mode 100644 index 00000000..2bf2d465 --- /dev/null +++ b/test/fstrings/fraw4.py @@ -0,0 +1,45 @@ +a = rf'fo{{{2}}}' +a = rf'fo{{{bar}}}' +a = rf'fo{{2}}' + + + + + +a : source.python + : source.python += : keyword.operator.assignment.python, source.python + : source.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +fo : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{{ : constant.character.escape.python, meta.fstring.python, source.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +2 : constant.numeric.dec.python, meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +}} : constant.character.escape.python, meta.fstring.python, source.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +a : source.python + : source.python += : keyword.operator.assignment.python, source.python + : source.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +fo : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{{ : constant.character.escape.python, meta.fstring.python, source.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +bar : meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +}} : constant.character.escape.python, meta.fstring.python, source.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +a : source.python + : source.python += : keyword.operator.assignment.python, source.python + : source.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +fo : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{{ : constant.character.escape.python, meta.fstring.python, source.python +2 : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +}} : constant.character.escape.python, meta.fstring.python, source.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python diff --git a/test/fstrings/prefixes2.py b/test/fstrings/prefixes2.py index 861d2b66..78ee4246 100644 --- a/test/fstrings/prefixes2.py +++ b/test/fstrings/prefixes2.py @@ -22,16 +22,20 @@ obj : meta.fstring.python, source.python } : constant.character.format.placeholder.other.python, meta.fstring.python, source.python ' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.single.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -some : source.python, string.interpolated.python, string.regexp.quoted.single.python -{obj} : source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -rF : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -some : source.python, string.interpolated.python, string.regexp.quoted.single.python -{obj} : source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python +rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +some : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +obj : meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +rF : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +some : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +obj : meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python Rf : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python ' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python some : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python diff --git a/test/fstrings/prefixes3.py b/test/fstrings/prefixes3.py index 200fa896..46d12ffb 100644 --- a/test/fstrings/prefixes3.py +++ b/test/fstrings/prefixes3.py @@ -6,16 +6,20 @@ -fr : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -some : source.python, string.interpolated.python, string.regexp.quoted.single.python -{obj} : source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -Fr : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -some : source.python, string.interpolated.python, string.regexp.quoted.single.python -{obj} : source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python +fr : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +some : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +obj : meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python +Fr : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python +' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python +some : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python +{ : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +obj : meta.fstring.python, source.python +} : constant.character.format.placeholder.other.python, meta.fstring.python, source.python +' : meta.fstring.python, punctuation.definition.string.end.python, source.python, string.interpolated.python, string.quoted.raw.single.python fR : meta.fstring.python, source.python, storage.type.string.python, string.interpolated.python, string.quoted.raw.single.python ' : meta.fstring.python, punctuation.definition.string.begin.python, source.python, string.quoted.raw.single.python some : meta.fstring.python, source.python, string.interpolated.python, string.quoted.raw.single.python diff --git a/test/regexp/fregexp1.py b/test/regexp/fregexp1.py deleted file mode 100644 index 9e77d66b..00000000 --- a/test/regexp/fregexp1.py +++ /dev/null @@ -1,56 +0,0 @@ -a = fr'[a-z]' -a = Fr'[a-z]' -a = rf'[a-z]' -a = rF'[a-z]' - - - - -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -fr : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -[ : constant.other.set.regexp, meta.character.set.regexp, punctuation.character.set.begin.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -a : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -- : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -z : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -] : constant.other.set.regexp, meta.character.set.regexp, punctuation.character.set.end.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -Fr : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -[ : constant.other.set.regexp, meta.character.set.regexp, punctuation.character.set.begin.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -a : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -- : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -z : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -] : constant.other.set.regexp, meta.character.set.regexp, punctuation.character.set.end.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -[ : constant.other.set.regexp, meta.character.set.regexp, punctuation.character.set.begin.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -a : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -- : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -z : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -] : constant.other.set.regexp, meta.character.set.regexp, punctuation.character.set.end.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -rF : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -[ : constant.other.set.regexp, meta.character.set.regexp, punctuation.character.set.begin.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -a : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -- : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -z : constant.character.set.regexp, meta.character.set.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -] : constant.other.set.regexp, meta.character.set.regexp, punctuation.character.set.end.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python diff --git a/test/regexp/fregexp2.py b/test/regexp/fregexp2.py deleted file mode 100644 index 72eccc28..00000000 --- a/test/regexp/fregexp2.py +++ /dev/null @@ -1,28 +0,0 @@ -rf'fo{{2}}' -rf"fo{{2}}" -rf'''fo{{2}}''' -rf"""fo{{2}}""" - - - - -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -fo : source.python, string.interpolated.python, string.regexp.quoted.single.python -{{2}} : keyword.operator.quantifier.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -" : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -fo : source.python, string.interpolated.python, string.regexp.quoted.single.python -{{2}} : keyword.operator.quantifier.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -" : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.multi.python -''' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python -fo : source.python, string.interpolated.python, string.regexp.quoted.multi.python -{{2}} : keyword.operator.quantifier.regexp, source.python, string.interpolated.python, string.regexp.quoted.multi.python -''' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.multi.python -""" : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python -fo : source.python, string.interpolated.python, string.regexp.quoted.multi.python -{{2}} : keyword.operator.quantifier.regexp, source.python, string.interpolated.python, string.regexp.quoted.multi.python -""" : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python diff --git a/test/regexp/fregexp3.py b/test/regexp/fregexp3.py deleted file mode 100644 index ede8a6c3..00000000 --- a/test/regexp/fregexp3.py +++ /dev/null @@ -1,28 +0,0 @@ -rf'fo{2}' -rf"fo{2}" -rf'''fo{2}''' -rf"""fo{2}""" - - - - -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -fo : source.python, string.interpolated.python, string.regexp.quoted.single.python -{2} : source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -" : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -fo : source.python, string.interpolated.python, string.regexp.quoted.single.python -{2} : source.python, string.interpolated.python, string.regexp.quoted.single.python -" : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.multi.python -''' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python -fo : source.python, string.interpolated.python, string.regexp.quoted.multi.python -{2} : source.python, string.interpolated.python, string.regexp.quoted.multi.python -''' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.multi.python -""" : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python -fo : source.python, string.interpolated.python, string.regexp.quoted.multi.python -{2} : source.python, string.interpolated.python, string.regexp.quoted.multi.python -""" : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.multi.python diff --git a/test/regexp/fregexp4.py b/test/regexp/fregexp4.py deleted file mode 100644 index 5b707ad3..00000000 --- a/test/regexp/fregexp4.py +++ /dev/null @@ -1,36 +0,0 @@ -a = rf'fo{{2}}' -a = r'fo{{2}}' -a = r'fo{2}' - - - - - -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -fo : source.python, string.interpolated.python, string.regexp.quoted.single.python -{{2}} : keyword.operator.quantifier.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -r : source.python, storage.type.string.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.regexp.quoted.single.python -fo{ : source.python, string.regexp.quoted.single.python -{2} : keyword.operator.quantifier.regexp, source.python, string.regexp.quoted.single.python -} : source.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.regexp.quoted.single.python -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -r : source.python, storage.type.string.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.regexp.quoted.single.python -fo : source.python, string.regexp.quoted.single.python -{2} : keyword.operator.quantifier.regexp, source.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.regexp.quoted.single.python diff --git a/test/regexp/fregexp5.py b/test/regexp/fregexp5.py deleted file mode 100644 index 0d339e27..00000000 --- a/test/regexp/fregexp5.py +++ /dev/null @@ -1,26 +0,0 @@ -a = rf'{{foo}}' -a = r'\{foo\}' - - - - -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -{{ : constant.character.escape.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -foo : source.python, string.interpolated.python, string.regexp.quoted.single.python -}} : constant.character.escape.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -r : source.python, storage.type.string.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.regexp.quoted.single.python -\{ : constant.character.escape.regexp, source.python, string.regexp.quoted.single.python -foo : source.python, string.regexp.quoted.single.python -\} : constant.character.escape.regexp, source.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.regexp.quoted.single.python diff --git a/test/regexp/fregexp6.py b/test/regexp/fregexp6.py deleted file mode 100644 index a51311d0..00000000 --- a/test/regexp/fregexp6.py +++ /dev/null @@ -1,39 +0,0 @@ -a = rf'fo{{{2}}}' -a = rf'fo{{{bar}}}' -a = rf'fo{{2}}' - - - - - -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -fo : source.python, string.interpolated.python, string.regexp.quoted.single.python -{{ : constant.character.escape.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -{2} : source.python, string.interpolated.python, string.regexp.quoted.single.python -}} : constant.character.escape.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -fo : source.python, string.interpolated.python, string.regexp.quoted.single.python -{{ : constant.character.escape.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -{bar} : source.python, string.interpolated.python, string.regexp.quoted.single.python -}} : constant.character.escape.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -a : source.python - : source.python -= : keyword.operator.assignment.python, source.python - : source.python -rf : source.python, storage.type.string.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.begin.python, source.python, string.interpolated.python, string.regexp.quoted.single.python -fo : source.python, string.interpolated.python, string.regexp.quoted.single.python -{{2}} : keyword.operator.quantifier.regexp, source.python, string.interpolated.python, string.regexp.quoted.single.python -' : punctuation.definition.string.end.python, source.python, string.interpolated.python, string.regexp.quoted.single.python