Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hurricup/bugfixes 2 #2914

Merged
merged 2 commits into from
Sep 28, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.PsiUtilCore;
import com.intellij.util.concurrency.Semaphore;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.messages.MessageBusConnection;
import com.intellij.util.ui.update.MergingUpdateQueue;
Expand All @@ -45,7 +46,6 @@
import org.jetbrains.annotations.TestOnly;

import java.util.*;
import com.intellij.util.concurrency.Semaphore;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.BooleanSupplier;

Expand Down Expand Up @@ -132,7 +132,8 @@ private void updateModel() {
LOG.debug("Attempting to update");
if (!myUpdatingModel.getAndSet(true)) {
try {
ReadAction.run(() -> {
//noinspection deprecation
ReadAction.nonBlocking(() -> {
if (myProject.isDisposed()) {
LOG.warn("Project is disposed");
return;
Expand All @@ -142,18 +143,18 @@ private void updateModel() {
scheduleUpdate();
}
else {
try{
try {
LOG.debug("Performing model update");
doUpdateModel();
}
finally {
if( myTestSemaphore != null) {
if (myTestSemaphore != null) {
myTestSemaphore.up();
myTestSemaphore = null;
}
}
}
});
}).executeSynchronously();
}
catch (ProcessCanceledException e) {
LOG.debug("Update was cancelled, rescheduling");
Expand Down
11 changes: 6 additions & 5 deletions plugin/core/grammar/Perl.flex
Original file line number Diff line number Diff line change
Expand Up @@ -880,11 +880,12 @@ POSIX_CHARGROUP_ANY = {POSIX_CHARGROUP}|{POSIX_CHARGROUP_DOUBLE}
}

<VARIABLE_UNBRACED>{
// we are here after a sigil, and we can't cast to the $OLD_PERL_VERSION variable $]
"$" / "]" {return getUnbracedVariableNameToken();}
// this is a subset of builtins, $;, $, for example, can't be dereferenced
"$" / [\{\"\'\[\]\`\\\!\%\&\(\+\-\.\/\<\=\>\|\~\?\:\*\^\@\_\$\:\w_\d] {return processUnbracedScalarSigil();}
"{" {return startBracedVariable();}
// followed by the built-in variable which can't be dereferenced, so this is a variable name
"$" / [\.\,\/\\\|\%\-\+\?\:\=\^\~\!\@\#\*\(\)\<\>0\;\[\]\&\`\'\"] {return getUnbracedVariableNameToken();}
// this is definitely a sigil
"$" / [\{\_\$\w_] {return processUnbracedScalarSigil();}

"{" {return startBracedVariable();}
{VARIABLE_NAME} {return getUnbracedVariableNameToken();}
}

Expand Down
10,574 changes: 5,287 additions & 5,287 deletions plugin/core/src/main/gen/com/perl5/lang/perl/lexer/PerlLexer.java

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions plugin/src/test/java/unit/perl/parser/PerlParserLikeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ protected String getBaseDataPath() {
return "unit/perl/parser";
}

@Test
public void testDoubleBuckConcat() { doTest(false); }

@Test
public void testHeredocInRegexp() { doTest(false); }

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,284 @@
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
.
PERL_OPERATOR => DEFAULT_OPERATION_SIGN
1
PERL_NUMBER => DEFAULT_NUMBER
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
,
PERL_COMMA => DEFAULT_COMMA
1
PERL_NUMBER => DEFAULT_NUMBER
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
/
PERL_OPERATOR => DEFAULT_OPERATION_SIGN
1
PERL_NUMBER => DEFAULT_NUMBER
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
\
PERL_OPERATOR => DEFAULT_OPERATION_SIGN
1
PERL_NUMBER => DEFAULT_NUMBER
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
|
PERL_OPERATOR => DEFAULT_OPERATION_SIGN
1
PERL_NUMBER => DEFAULT_NUMBER
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
%
PERL_OPERATOR => DEFAULT_OPERATION_SIGN
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
-
PERL_OPERATOR => DEFAULT_OPERATION_SIGN
1
PERL_NUMBER => DEFAULT_NUMBER
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
+
PERL_OPERATOR => DEFAULT_OPERATION_SIGN
1
PERL_NUMBER => DEFAULT_NUMBER
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
?
PERL_OPERATOR => DEFAULT_OPERATION_SIGN
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
:
PERL_OPERATOR => DEFAULT_OPERATION_SIGN
1
PERL_NUMBER => DEFAULT_NUMBER
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
=
PERL_OPERATOR => DEFAULT_OPERATION_SIGN
1
PERL_NUMBER => DEFAULT_NUMBER
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
^
PERL_OPERATOR => DEFAULT_OPERATION_SIGN
1
PERL_NUMBER => DEFAULT_NUMBER
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
~
PERL_OPERATOR => DEFAULT_OPERATION_SIGN
1
PERL_NUMBER => DEFAULT_NUMBER
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
!
PERL_OPERATOR => DEFAULT_OPERATION_SIGN
1
PERL_NUMBER => DEFAULT_NUMBER
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
@
PERL_ARRAY => DEFAULT_IDENTIFIER => TEXT
a
PERL_ARRAY => DEFAULT_IDENTIFIER => TEXT
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
#test;
PERL_COMMENT => DEFAULT_LINE_COMMENT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
*
PERL_OPERATOR => DEFAULT_OPERATION_SIGN
1
PERL_NUMBER => DEFAULT_NUMBER
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
[
PERL_BRACKETS => DEFAULT_BRACKETS
1
PERL_NUMBER => DEFAULT_NUMBER
]
PERL_BRACKETS => DEFAULT_BRACKETS
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
(
PERL_PARENTESS => DEFAULT_PARENTHS
)
PERL_PARENTESS => DEFAULT_PARENTHS
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
(
PERL_PARENTESS => DEFAULT_PARENTHS
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
)
PERL_PARENTESS => DEFAULT_PARENTHS
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
<
PERL_OPERATOR => DEFAULT_OPERATION_SIGN
1
PERL_NUMBER => DEFAULT_NUMBER
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
>
PERL_OPERATOR => DEFAULT_OPERATION_SIGN
2
PERL_NUMBER => DEFAULT_NUMBER
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
0
PERL_NUMBER => DEFAULT_NUMBER
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
1
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
[
PERL_BRACKETS => DEFAULT_BRACKETS
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
]
PERL_BRACKETS => DEFAULT_BRACKETS
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
&
PERL_OPERATOR => DEFAULT_OPERATION_SIGN
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
`
PERL_DX_STRING => DEFAULT_STRING
`
PERL_DX_STRING => DEFAULT_STRING
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
'
PERL_SQ_STRING => DEFAULT_STRING
'
PERL_SQ_STRING => DEFAULT_STRING
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
$
PERL_SCALAR => DEFAULT_IDENTIFIER => TEXT
"
PERL_DQ_STRING => DEFAULT_STRING
test
PERL_DQ_STRING => DEFAULT_STRING
"
PERL_DQ_STRING => DEFAULT_STRING
;
PERL_SEMICOLON => DEFAULT_SEMICOLON
29 changes: 29 additions & 0 deletions plugin/src/test/resources/unit/perl/parser/doubleBuckConcat.code
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
$$.1;
$$,1;
$$/1;
$$\1;
$$|1;
$$%;
$$-1;
$$+1;
$$?$$:1;
$$=1;
$$^1;
$$~1;
$$!1;
$$@a;
$$#test;
$$*1;
$$[1];
$$();
($$);
$$<1;
$$>2;
$$0;
$$1;
$$;
[$$];
$$&;
$$``;
$$'';
$$"test";
Loading
Loading