This repository has been archived by the owner on Mar 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
feat: PRCE-compliant RegEx updates for GitHub Linguist #57
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b168d24
chore: dependency updates
muenzpraeger 3987482
fix: pinned node version
muenzpraeger abf923d
fix: changed vscode-tmgrammar-test invocation for new version
muenzpraeger 38f6510
fix: change registry to new textmate version requirements
muenzpraeger 2e43ac7
feat: update regex to be PCRE compliant for GitHub
muenzpraeger ada34e0
feat: build output of yml changes
muenzpraeger 7775e59
chore: formatting updates
muenzpraeger 352ec37
Merge branch 'main' into rw/regex-updates
randi274 a24d4c3
chore: update lock file
randi274 bf398af
ci: add manual run for test workflows
randi274 a310c5e
ci: align node engine with CLI testing versions
randi274 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
name: Unit Tests | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches-ignore: [main] | ||
|
||
|
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 |
---|---|---|
|
@@ -1914,15 +1914,15 @@ | |
<dict> | ||
<key>begin</key> | ||
<string>(?x) | ||
(?<type-name> | ||
(?<type_name> | ||
(?: | ||
(?: | ||
(?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\s*\:\:\s*)? # alias-qualification | ||
(?<name-and-type-args> # identifier + type arguments (if any) | ||
(?<name_and_type_args> # identifier + type arguments (if any) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another dumb questions: Should Or is that a comment, and it doesn't matter? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @muenzpraeger same question here |
||
\g<identifier>\s* | ||
(?<type-args>\s*<(?:[^<>]|\g<type-args>)+>\s*)? | ||
(?<type_args>\s*<(?:[^<>]|\g<type_args>)+>\s*)? | ||
) | ||
(?:\s*\.\s*\g<name-and-type-args>)* | ||
(?:\s*\.\s*\g<name_and_type_args>)* | ||
) | ||
(?:\s*\?\s*)? # nullable suffix? | ||
(?:\s*\[(?:\s*,\s*)*\]\s*)* # array suffix? | ||
|
@@ -1985,25 +1985,25 @@ | |
<key>begin</key> | ||
<string>(?x) | ||
(?!.*\b(?:class|interface|enum)\b)\s* | ||
(?<return-type> | ||
(?<type-name> | ||
(?<return_type> | ||
(?<type_name> | ||
(?: | ||
(?:ref\s+)? # ref return | ||
(?: | ||
(?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\s*\:\:\s*)? # alias-qualification | ||
(?<name-and-type-args> # identifier + type arguments (if any) | ||
(?<name_and_type_args> # identifier + type arguments (if any) | ||
\g<identifier>\s* | ||
(?<type-args>\s*<(?:[^<>]|\g<type-args>)+>\s*)? | ||
(?<type_args>\s*<(?:[^<>]|\g<type_args>)+>\s*)? | ||
) | ||
(?:\s*\.\s*\g<name-and-type-args>)* | ||
(?:\s*\.\s*\g<name_and_type_args>)* | ||
) | ||
(?:\s*\?\s*)? # nullable suffix? | ||
(?:\s*\[(?:\s*,\s*)*\]\s*)* # array suffix? | ||
) | ||
)\s+ | ||
) | ||
(?<interface-name>\g<type-name>\s*\.\s*)? | ||
(?<property-name>\g<identifier>)\s* | ||
(?<interface_name>\g<type_name>\s*\.\s*)? | ||
(?<property_name>\g<identifier>)\s* | ||
(?=\{|=>|$)</string> | ||
<key>beginCaptures</key> | ||
<dict> | ||
|
@@ -2067,25 +2067,25 @@ | |
<dict> | ||
<key>begin</key> | ||
<string>(?x) | ||
(?<return-type> | ||
(?<type-name> | ||
(?<return_type> | ||
(?<type_name> | ||
(?: | ||
(?:ref\s+)? # ref return | ||
(?: | ||
(?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\s*\:\:\s*)? # alias-qualification | ||
(?<name-and-type-args> # identifier + type arguments (if any) | ||
(?<name_and_type_args> # identifier + type arguments (if any) | ||
\g<identifier>\s* | ||
(?<type-args>\s*<(?:[^<>]|\g<type-args>)+>\s*)? | ||
(?<type_args>\s*<(?:[^<>]|\g<type_args>)+>\s*)? | ||
) | ||
(?:\s*\.\s*\g<name-and-type-args>)* | ||
(?:\s*\.\s*\g<name_and_type_args>)* | ||
) | ||
(?:\s*\?\s*)? # nullable suffix? | ||
(?:\s*\[(?:\s*,\s*)*\]\s*)* # array suffix? | ||
) | ||
)\s+ | ||
) | ||
(?<interface-name>\g<type-name>\s*\.\s*)? | ||
(?<indexer-name>this)\s* | ||
(?<interface_name>\g<type_name>\s*\.\s*)? | ||
(?<indexer_name>this)\s* | ||
(?=\[)</string> | ||
<key>beginCaptures</key> | ||
<dict> | ||
|
@@ -2205,24 +2205,24 @@ | |
<dict> | ||
<key>begin</key> | ||
<string>(?x) | ||
(?<return-type> | ||
(?<type-name> | ||
(?<return_type> | ||
(?<type_name> | ||
(?: | ||
(?:ref\s+)? # ref return | ||
(?: | ||
(?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\s*\:\:\s*)? # alias-qualification | ||
(?<name-and-type-args> # identifier + type arguments (if any) | ||
(?<name_and_type_args> # identifier + type arguments (if any) | ||
\g<identifier>\s* | ||
(?<type-args>\s*<(?:[^<>]|\g<type-args>)+>\s*)? | ||
(?<type_args>\s*<(?:[^<>]|\g<type_args>)+>\s*)? | ||
) | ||
(?:\s*\.\s*\g<name-and-type-args>)* | ||
(?:\s*\.\s*\g<name_and_type_args>)* | ||
) | ||
(?:\s*\?\s*)? # nullable suffix? | ||
(?:\s*\[(?:\s*,\s*)*\]\s*)* # array suffix? | ||
) | ||
)\s+ | ||
) | ||
(?<interface-name>\g<type-name>\s*\.\s*)? | ||
(?<interface_name>\g<type_name>\s*\.\s*)? | ||
(\g<identifier>)\s* | ||
(<([^<>]+)>)?\s* | ||
(?=\()</string> | ||
|
@@ -3235,15 +3235,15 @@ | |
<dict> | ||
<key>match</key> | ||
<string>(?x) | ||
(?<type-name> | ||
(?<type_name> | ||
(?: | ||
(?: | ||
(?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\s*\:\:\s*)? # alias-qualification | ||
(?<name-and-type-args> # identifier + type arguments (if any) | ||
(?<name_and_type_args> # identifier + type arguments (if any) | ||
\g<identifier>\s* | ||
(?<type-args>\s*<(?:[^<>]|\g<type-args>)+>\s*)? | ||
(?<type_args>\s*<(?:[^<>]|\g<type_args>)+>\s*)? | ||
) | ||
(?:\s*\.\s*\g<name-and-type-args>)* | ||
(?:\s*\.\s*\g<name_and_type_args>)* | ||
) | ||
(?:\s*\?\s*)? # nullable suffix? | ||
(?:\s*\[(?:\s*,\s*)*\]\s*)* # array suffix? | ||
|
@@ -3305,16 +3305,16 @@ | |
<string>(?x) | ||
(?: | ||
(?:(\bref)\s+)?(\bvar\b)| # ref local | ||
(?<type-name> | ||
(?<type_name> | ||
(?: | ||
(?:ref\s+)? # ref local | ||
(?: | ||
(?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\s*\:\:\s*)? # alias-qualification | ||
(?<name-and-type-args> # identifier + type arguments (if any) | ||
(?<name_and_type_args> # identifier + type arguments (if any) | ||
\g<identifier>\s* | ||
(?<type-args>\s*<(?:[^<>]|\g<type-args>)+>\s*)? | ||
(?<type_args>\s*<(?:[^<>]|\g<type_args>)+>\s*)? | ||
) | ||
(?:\s*\.\s*\g<name-and-type-args>)* | ||
(?:\s*\.\s*\g<name_and_type_args>)* | ||
) | ||
(?:\s*\?\s*)? # nullable suffix? | ||
(?:\s*\[(?:\s*,\s*)*\]\s*)* # array suffix? | ||
|
@@ -3383,16 +3383,16 @@ | |
<dict> | ||
<key>begin</key> | ||
<string>(?x) | ||
(?<const-keyword>\b(?:const)\b)\s* | ||
(?<type-name> | ||
(?<const_keyword>\b(?:const)\b)\s* | ||
(?<type_name> | ||
(?: | ||
(?: | ||
(?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\s*\:\:\s*)? # alias-qualification | ||
(?<name-and-type-args> # identifier + type arguments (if any) | ||
(?<name_and_type_args> # identifier + type arguments (if any) | ||
\g<identifier>\s* | ||
(?<type-args>\s*<(?:[^<>]|\g<type-args>)+>\s*)? | ||
(?<type_args>\s*<(?:[^<>]|\g<type_args>)+>\s*)? | ||
) | ||
(?:\s*\.\s*\g<name-and-type-args>)* | ||
(?:\s*\.\s*\g<name_and_type_args>)* | ||
) | ||
(?:\s*\?\s*)? # nullable suffix? | ||
(?:\s*\[(?:\s*,\s*)*\]\s*)* # array suffix? | ||
|
@@ -3796,15 +3796,15 @@ | |
<key>match</key> | ||
<string>(?x) | ||
(\()\s* | ||
(?<type-name> | ||
(?<type_name> | ||
(?: | ||
(?: | ||
(?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\s*\:\:\s*)? # alias-qualification | ||
(?<name-and-type-args> # identifier + type arguments (if any) | ||
(?<name_and_type_args> # identifier + type arguments (if any) | ||
\g<identifier>\s* | ||
(?<type-args>\s*<(?:[^<>]|\g<type-args>)+>\s*)? | ||
(?<type_args>\s*<(?:[^<>]|\g<type_args>)+>\s*)? | ||
) | ||
(?:\s*\.\s*\g<name-and-type-args>)* | ||
(?:\s*\.\s*\g<name_and_type_args>)* | ||
) | ||
(?:\s*\?\s*)? # nullable suffix? | ||
(?:\s*\[(?:\s*,\s*)*\]\s*)* # array suffix? | ||
|
@@ -3858,7 +3858,7 @@ | |
<string>(?x) | ||
(?:(\??\.)\s*)? # safe navigator or accessor | ||
(@?[_[:alpha:]][_[:alnum:]]*)\s* # method name | ||
(?<type-args>\s*<([^<>]|\g<type-args>)+>\s*)?\s* # type arguments | ||
(?<type_args>\s*<([^<>]|\g<type_args>)+>\s*)?\s* # type arguments | ||
(?=\() # open paren of argument list</string> | ||
<key>beginCaptures</key> | ||
<dict> | ||
|
@@ -3985,7 +3985,7 @@ | |
<string>(?x) | ||
(\??\.)?\s* | ||
(@?[_[:alpha:]][_[:alnum:]]*) | ||
(?<type-params>\s*<([^<>]|\g<type-params>)+>\s*) | ||
(?<type_params>\s*<([^<>]|\g<type_params>)+>\s*) | ||
(?= | ||
(\s*\?)? | ||
\s*\.\s*@?[_[:alpha:]][_[:alnum:]]* | ||
|
@@ -4066,15 +4066,15 @@ | |
<string>(?x) | ||
(delete|insert|undelete|update|upsert)? | ||
\s*(new)\s+ | ||
(?<type-name> | ||
(?<type_name> | ||
(?: | ||
(?: | ||
(?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\s*\:\:\s*)? # alias-qualification | ||
(?<name-and-type-args> # identifier + type arguments (if any) | ||
(?<name_and_type_args> # identifier + type arguments (if any) | ||
\g<identifier>\s* | ||
(?<type-args>\s*<(?:[^<>]|\g<type-args>)+>\s*)? | ||
(?<type_args>\s*<(?:[^<>]|\g<type_args>)+>\s*)? | ||
) | ||
(?:\s*\.\s*\g<name-and-type-args>)* | ||
(?:\s*\.\s*\g<name_and_type_args>)* | ||
) | ||
(?:\s*\?\s*)? # nullable suffix? | ||
(?:\s*\[(?:\s*,\s*)*\]\s*)* # array suffix? | ||
|
@@ -4124,15 +4124,15 @@ | |
<string>(?x) | ||
(delete|insert|undelete|update|upsert)? | ||
\s*(new)\s+ | ||
(?<type-name> | ||
(?<type_name> | ||
(?: | ||
(?: | ||
(?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\s*\:\:\s*)? # alias-qualification | ||
(?<name-and-type-args> # identifier + type arguments (if any) | ||
(?<name_and_type_args> # identifier + type arguments (if any) | ||
\g<identifier>\s* | ||
(?<type-args>\s*<(?:[^<>]|\g<type-args>)+>\s*)? | ||
(?<type_args>\s*<(?:[^<>]|\g<type_args>)+>\s*)? | ||
) | ||
(?:\s*\.\s*\g<name-and-type-args>)* | ||
(?:\s*\.\s*\g<name_and_type_args>)* | ||
) | ||
(?:\s*\?\s*)? # nullable suffix? | ||
(?:\s*\[(?:\s*,\s*)*\]\s*)* # array suffix? | ||
|
@@ -4172,15 +4172,15 @@ | |
<key>begin</key> | ||
<string>(?x) | ||
\b(new)\b\s* | ||
(?<type-name> | ||
(?<type_name> | ||
(?: | ||
(?: | ||
(?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\s*\:\:\s*)? # alias-qualification | ||
(?<name-and-type-args> # identifier + type arguments (if any) | ||
(?<name_and_type_args> # identifier + type arguments (if any) | ||
\g<identifier>\s* | ||
(?<type-args>\s*<(?:[^<>]|\g<type-args>)+>\s*)? | ||
(?<type_args>\s*<(?:[^<>]|\g<type_args>)+>\s*)? | ||
) | ||
(?:\s*\.\s*\g<name-and-type-args>)* | ||
(?:\s*\.\s*\g<name_and_type_args>)* | ||
) | ||
(?:\s*\?\s*)? # nullable suffix? | ||
(?:\s*\[(?:\s*,\s*)*\]\s*)* # array suffix? | ||
|
@@ -4266,16 +4266,16 @@ | |
<key>match</key> | ||
<string>(?x) | ||
(?:(?:\b(this)\b)\s+)? | ||
(?<type-name> | ||
(?<type_name> | ||
(?: | ||
(?:ref\s+)? # ref return | ||
(?: | ||
(?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\s*\:\:\s*)? # alias-qualification | ||
(?<name-and-type-args> # identifier + type arguments (if any) | ||
(?<name_and_type_args> # identifier + type arguments (if any) | ||
\g<identifier>\s* | ||
(?<type-args>\s*<(?:[^<>]|\g<type-args>)+>\s*)? | ||
(?<type_args>\s*<(?:[^<>]|\g<type_args>)+>\s*)? | ||
) | ||
(?:\s*\.\s*\g<name-and-type-args>)* | ||
(?:\s*\.\s*\g<name_and_type_args>)* | ||
) | ||
(?:\s*\?\s*)? # nullable suffix? | ||
(?:\s*\[(?:\s*,\s*)*\]\s*)* # array suffix? | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dumb question: should everything between a
<string></string>
be changed fromfoo-bar
tofoo_bar
? (or is it only that which starts with(?x)
?)If yes, what about line 1909, line 1899, etc...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@muenzpraeger can you help answer this, given the update needs for Github Linguist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no dumb questions. ;-) Especially not with this change. It took me a while to find this small statement in the PCRE docs for named capture groups.
So yes, the change only applies to
(?<the_name>)
.Also the source of the changes is src/apex.tmLanguage.yml, which is the source definition for this TextMate grammar. Looking at that will make it clearer.
The grammar outputs in the grammars folder are auto-generated via gulp.