pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/MagicStack/MagicPython/pull/270/files

l" rel="stylesheet" href="https://github.githubassets.com/assets/code-2d31826944fd3be8.css" /> add rudimentary support for PEP 695 by asottile · Pull Request #270 · MagicStack/MagicPython · GitHub
Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 136 additions & 2 deletions grammars/MagicPython.cson
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ repository:
{
include: "#import"
}
{
include: "#type-declaration"
}
{
include: "#class-declaration"
}
Expand Down Expand Up @@ -1099,6 +1102,45 @@ repository:
]
}
]
"type-declaration":
name: "meta.type.python"
begin: '''
(?x)
\\s*(type)\\s+
(?=
[[:alpha:]_][[:word:]]* \\s* [=\\[]
)

'''
end: "((?=[=]))"
beginCaptures:
"1":
name: "storage.type.type.python"
patterns: [
{
include: "#type-name"
}
{
include: "#type-parameters"
}
]
"type-name":
patterns: [
{
include: "#illegal-object-name"
}
{
include: "#builtin-possible-callables"
}
{
name: "entity.name.type.type.python"
match: '''
(?x)
\\b ([[:alpha:]_]\\w*) \\b

'''
}
]
"class-declaration":
patterns: [
{
Expand All @@ -1107,7 +1149,7 @@ repository:
(?x)
\\s*(class)\\s+
(?=
[[:alpha:]_]\\w* \\s* (:|\\()
[[:alpha:]_]\\w* \\s* (:|[\\[(])
)

'''
Expand All @@ -1125,6 +1167,9 @@ repository:
{
include: "#class-inheritance"
}
{
include: "#type-parameters"
}
]
}
]
Expand Down Expand Up @@ -1355,7 +1400,7 @@ repository:
\\s*
(?:\\b(async) \\s+)? \\b(def)\\s+
(?=
[[:alpha:]_][[:word:]]* \\s* \\(
[[:alpha:]_][[:word:]]* \\s* [(\\[]
)

'''
Expand All @@ -1372,6 +1417,9 @@ repository:
{
include: "#function-def-name"
}
{
include: "#type-parameters"
}
{
include: "#parameters"
}
Expand Down Expand Up @@ -1399,6 +1447,67 @@ repository:
'''
}
]
"type-parameters":
name: "meta.function.parameters.type.python"
begin: "(\\[)"
end: "(\\])"
beginCaptures:
"1":
name: "punctuation.definition.parameters.begin.python"
endCaptures:
"1":
name: "punctuation.definition.parameters.end.python"
patterns: [
{
name: "keyword.operator.unpacking.parameter.python"
match: "(\\*\\*|\\*)"
}
{
include: "#lambda-incomplete"
}
{
include: "#illegal-names"
}
{
include: "#illegal-object-name"
}
{
match: '''
(?x)
([[:alpha:]_]\\w*)
\\s* (?: (,) | (?=[\\]#\\n=]))

'''
captures:
"1":
name: "variable.parameter.function.language.python"
"2":
name: "punctuation.separator.parameters.python"
}
{
include: "#comments"
}
{
include: "#type-loose-default"
}
{
include: "#type-annotated-parameter"
}
]
"type-loose-default":
begin: "(=)"
end: "(,)|(?=\\])"
beginCaptures:
"1":
name: "keyword.operator.python"
endCaptures:
"1":
name: "punctuation.separator.parameters.python"
patterns: [
{
include: "#expression"
}
]
parameters:
name: "meta.function.parameters.python"
begin: "(\\()"
Expand Down Expand Up @@ -1482,6 +1591,31 @@ repository:
include: "#expression"
}
]
"type-annotated-parameter":
begin: '''
(?x)
\\b
([[:alpha:]_]\\w*) \\s* (:)

'''
end: "(,)|(?=\\])"
beginCaptures:
"1":
name: "variable.parameter.function.language.python"
"2":
name: "punctuation.separator.annotation.python"
endCaptures:
"1":
name: "punctuation.separator.parameters.python"
patterns: [
{
include: "#expression"
}
{
name: "keyword.operator.assignment.python"
match: "=(?!=)"
}
]
"annotated-parameter":
begin: '''
(?x)
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy