-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into babenek-patch-1
- Loading branch information
Showing
102 changed files
with
8,369 additions
and
6,081 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -260,10 +260,8 @@ Name | E-Mail | |
-- | -- | ||
[Jaeku Yun](https://github.com/silentearth) | [email protected] | ||
[Shinhyung Choi](https://github.com/csh519) | [email protected] | ||
[Yujeong Lee](https://github.com/yuzzyuzz) | [email protected] | ||
[Oleksandra Sokol](https://github.com/meanrin) | [email protected] | ||
[Dmytro Kuzmenko](https://github.com/Dmitriy-NK) | [email protected] | ||
[Arkadiy Melkonyan](https://github.com/ARKAD97) | [email protected] | ||
[Roman Babenko](https://github.com/babenek) | [email protected] | ||
[Yuliia Tatarinova](https://github.com/Yullia) | [email protected] | ||
|
||
## How to Contact | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import re | ||
|
||
|
||
class KeywordPattern: | ||
"""Pattern set of keyword types""" | ||
key_left = r"(\\[nrt])?"\ | ||
r"(?P<variable>(([`'\"]+[^:='\"`}<>\\/&?]*|[^:='\"`}<>\s()\\/&?]*)" \ | ||
r"(?P<keyword>" | ||
# there will be inserted a keyword | ||
key_right = r")" \ | ||
r"[^:='\"`<>{?!&]*)[`'\"]*)" # <variable> | ||
separator = r"(\s|\\+[tnr])*\]?(\s|\\+[tnr])*" \ | ||
r"(?P<separator>:( [a-z]{3,9}[?]? )?=|:|=(>|>|\\u0026gt;)|!=|===|==|=)" \ | ||
r"(\s|\\+[tnr])*" | ||
# might be curly, square or parenthesis with words before | ||
wrap = r"(?P<wrap>(" \ | ||
r"(new(\s|\\+[tnr])+)?" \ | ||
r"([0-9a-z_.]|-(>|(&|\\\\*u0026)gt;))*" \ | ||
r"[\[\(\{]"\ | ||
r"(\s|\\+[tnr])*" \ | ||
r"([0-9a-z_]{1,32}=)?" \ | ||
r")+)?" | ||
string_prefix = r"(((b|r|br|rb|u|f|rf|fr|l|@)(?=(\\*[`'\"])))?" | ||
left_quote = r"(?P<value_leftquote>((?P<esq>\\{1,8})?[`'\"]){1,4}))?" | ||
# Authentication scheme ( oauth | basic | bearer | apikey ) precedes to credential | ||
auth_keywords = r"( ?(oauth|bot|basic|bearer|apikey|accesskey) )?" | ||
value = r"(?P<value>" \ | ||
r"(?(value_leftquote)" \ | ||
r"(" \ | ||
r"(?!(?P=value_leftquote))" \ | ||
r"(?(esq)((?!(?P=esq)['`\"]).)|((?!(?P=value_leftquote)).)))" \ | ||
r"|" \ | ||
r"(\\+([ tnr]|[^\s`'\"])|[^\s`'\",;\\])" \ | ||
r"){3,8000}" \ | ||
r"|(\{[^}]{3,8000}\})" \ | ||
r"|(<[^>]{3,8000}>)" \ | ||
r")" | ||
right_quote = r"(?(value_leftquote)" \ | ||
r"(?P<value_rightquote>(?<!\\)(?P=value_leftquote)|\\$|(?<=[0-9a-z+_/-])$)" \ | ||
r"|" \ | ||
r"(?(wrap)[\]\)\},;]))" | ||
|
||
@classmethod | ||
def get_keyword_pattern(cls, keyword: str) -> re.Pattern: | ||
"""Returns compiled regex pattern""" | ||
expression = "".join([ # | ||
cls.key_left, # | ||
keyword, # | ||
cls.key_right, # | ||
cls.separator, # | ||
cls.wrap, # | ||
cls.string_prefix, # | ||
cls.left_quote, # | ||
cls.auth_keywords, # | ||
cls.value, # | ||
cls.right_quote, # | ||
]) | ||
return re.compile(expression, flags=re.IGNORECASE | re.DOTALL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.