solorice/vscode/extensions/magicstack.magicpython-1.1.0/grammars/MagicRegExp.cson
2022-04-28 20:54:44 +03:00

436 lines
10 KiB
Plaintext

# AUTOGENERATED FROM grammars/src/MagicRegExp.syntax.yaml
name: "MagicRegExp"
scopeName: "source.regexp.python"
fileTypes: [
"re"
]
uuid: "39e15186-71e6-11e5-b82c-7c6d62900c7c"
patterns: [
{
include: "#regexp-expression"
}
]
repository:
"regexp-base-expression":
patterns: [
{
include: "#regexp-quantifier"
}
{
include: "#regexp-base-common"
}
]
"fregexp-base-expression":
patterns: [
{
include: "#fregexp-quantifier"
}
{
include: "#fstring-formatting-braces"
}
{
match: "\\{.*?\\}"
}
{
include: "#regexp-base-common"
}
]
"fstring-formatting-braces":
patterns: [
{
comment: "empty braces are illegal"
match: "({)(\\s*?)(})"
captures:
"1":
name: "constant.character.format.placeholder.other.python"
"2":
name: "invalid.illegal.brace.python"
"3":
name: "constant.character.format.placeholder.other.python"
}
{
name: "constant.character.escape.python"
match: "({{|}})"
}
]
"regexp-base-common":
patterns: [
{
name: "support.other.match.any.regexp"
match: "\\."
}
{
name: "support.other.match.begin.regexp"
match: "\\^"
}
{
name: "support.other.match.end.regexp"
match: "\\$"
}
{
name: "keyword.operator.quantifier.regexp"
match: "[+*?]\\??"
}
{
name: "keyword.operator.disjunction.regexp"
match: "\\|"
}
{
include: "#regexp-escape-sequence"
}
]
"regexp-quantifier":
name: "keyword.operator.quantifier.regexp"
match: '''
(?x)
\\{(
\\d+ | \\d+,(\\d+)? | ,\\d+
)\\}
'''
"fregexp-quantifier":
name: "keyword.operator.quantifier.regexp"
match: '''
(?x)
\\{\\{(
\\d+ | \\d+,(\\d+)? | ,\\d+
)\\}\\}
'''
"regexp-backreference-number":
name: "meta.backreference.regexp"
match: "(\\\\[1-9]\\d?)"
captures:
"1":
name: "entity.name.tag.backreference.regexp"
"regexp-backreference":
name: "meta.backreference.named.regexp"
match: '''
(?x)
(\\() (\\?P= \\w+(?:\\s+[[:alnum:]]+)?) (\\))
'''
captures:
"1":
name: "punctuation.parenthesis.backreference.named.begin.regexp support.other.parenthesis.regexp"
"2":
name: "entity.name.tag.named.backreference.regexp"
"3":
name: "punctuation.parenthesis.backreference.named.end.regexp support.other.parenthesis.regexp"
"regexp-flags":
name: "storage.modifier.flag.regexp"
match: "\\(\\?[aiLmsux]+\\)"
"regexp-escape-special":
name: "support.other.escape.special.regexp"
match: "\\\\([AbBdDsSwWZ])"
"regexp-escape-character":
name: "constant.character.escape.regexp"
match: '''
(?x)
\\\\ (
x[0-9A-Fa-f]{2}
| 0[0-7]{1,2}
| [0-7]{3}
)
'''
"regexp-escape-unicode":
name: "constant.character.unicode.regexp"
match: '''
(?x)
\\\\ (
u[0-9A-Fa-f]{4}
| U[0-9A-Fa-f]{8}
)
'''
"regexp-escape-catchall":
name: "constant.character.escape.regexp"
match: "\\\\(.|\\n)"
"regexp-escape-sequence":
patterns: [
{
include: "#regexp-escape-special"
}
{
include: "#regexp-escape-character"
}
{
include: "#regexp-escape-unicode"
}
{
include: "#regexp-backreference-number"
}
{
include: "#regexp-escape-catchall"
}
]
"regexp-charecter-set-escapes":
patterns: [
{
name: "constant.character.escape.regexp"
match: "\\\\[abfnrtv\\\\]"
}
{
include: "#regexp-escape-special"
}
{
name: "constant.character.escape.regexp"
match: "\\\\([0-7]{1,3})"
}
{
include: "#regexp-escape-character"
}
{
include: "#regexp-escape-unicode"
}
{
include: "#regexp-escape-catchall"
}
]
codetags:
match: "(?:\\b(NOTE|XXX|HACK|FIXME|BUG|TODO)\\b)"
captures:
"1":
name: "keyword.codetag.notation.python"
"regexp-expression":
patterns: [
{
include: "#regexp-base-expression"
}
{
include: "#regexp-character-set"
}
{
include: "#regexp-comments"
}
{
include: "#regexp-flags"
}
{
include: "#regexp-named-group"
}
{
include: "#regexp-backreference"
}
{
include: "#regexp-lookahead"
}
{
include: "#regexp-lookahead-negative"
}
{
include: "#regexp-lookbehind"
}
{
include: "#regexp-lookbehind-negative"
}
{
include: "#regexp-conditional"
}
{
include: "#regexp-parentheses-non-capturing"
}
{
include: "#regexp-parentheses"
}
]
"regexp-character-set":
patterns: [
{
match: '''
(?x)
\\[ \\^? \\] (?! .*?\\])
'''
}
{
name: "meta.character.set.regexp"
begin: "(\\[)(\\^)?(\\])?"
end: "(\\])"
beginCaptures:
"1":
name: "constant.other.set.regexp punctuation.character.set.begin.regexp"
"2":
name: "keyword.operator.negation.regexp"
"3":
name: "constant.character.set.regexp"
endCaptures:
"1":
name: "constant.other.set.regexp punctuation.character.set.end.regexp"
"2":
name: "invalid.illegal.newline.python"
patterns: [
{
include: "#regexp-charecter-set-escapes"
}
{
name: "constant.character.set.regexp"
match: "[^\\n]"
}
]
}
]
"regexp-named-group":
name: "meta.named.regexp"
begin: '''
(?x)
(\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>)
'''
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: "#regexp-expression"
}
]
"regexp-comments":
name: "comment.regexp"
begin: "\\(\\?#"
end: "(\\))"
beginCaptures:
"0":
name: "punctuation.comment.begin.regexp"
endCaptures:
"1":
name: "punctuation.comment.end.regexp"
"2":
name: "invalid.illegal.newline.python"
patterns: [
{
include: "#codetags"
}
]
"regexp-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: "#regexp-expression"
}
]
"regexp-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: "#regexp-expression"
}
]
"regexp-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: "#regexp-expression"
}
]
"regexp-lookbehind-negative":
begin: "(\\()\\?<!"
end: "(\\))"
beginCaptures:
"0":
name: "keyword.operator.lookbehind.negative.regexp"
"1":
name: "punctuation.parenthesis.lookbehind.begin.regexp"
endCaptures:
"1":
name: "punctuation.parenthesis.lookbehind.end.regexp keyword.operator.lookbehind.negative.regexp"
"2":
name: "invalid.illegal.newline.python"
patterns: [
{
include: "#regexp-expression"
}
]
"regexp-conditional":
begin: "(\\()\\?\\((\\w+(?:\\s+[[:alnum:]]+)?|\\d+)\\)"
end: "(\\))"
beginCaptures:
"0":
name: "keyword.operator.conditional.regexp"
"1":
name: "punctuation.parenthesis.conditional.begin.regexp"
endCaptures:
"1":
name: "punctuation.parenthesis.conditional.end.regexp keyword.operator.conditional.negative.regexp"
"2":
name: "invalid.illegal.newline.python"
patterns: [
{
include: "#regexp-expression"
}
]
"regexp-parentheses-non-capturing":
begin: "\\(\\?:"
end: "(\\))"
beginCaptures:
"0":
name: "punctuation.parenthesis.non-capturing.begin.regexp support.other.parenthesis.regexp"
endCaptures:
"1":
name: "punctuation.parenthesis.non-capturing.end.regexp support.other.parenthesis.regexp"
"2":
name: "invalid.illegal.newline.python"
patterns: [
{
include: "#regexp-expression"
}
]
"regexp-parentheses":
begin: "\\("
end: "(\\))"
beginCaptures:
"0":
name: "punctuation.parenthesis.begin.regexp support.other.parenthesis.regexp"
endCaptures:
"1":
name: "punctuation.parenthesis.end.regexp support.other.parenthesis.regexp"
"2":
name: "invalid.illegal.newline.python"
patterns: [
{
include: "#regexp-expression"
}
]