mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 04:51:24 +07:00
PY-48010 Warn about problems causing SyntaxErrors in PEP 634 patterns
GitOrigin-RevId: 718645cc5dfd6d0a14f1bd802f3c5bb2bb2c6074
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0686325b90
commit
e9d11d1215
@@ -1,5 +1,11 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.jetbrains.python.psi;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface PyKeyValuePattern extends PyPattern {
|
||||
@NotNull PyPattern getKeyPattern();
|
||||
|
||||
@Nullable PyPattern getValuePattern();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.jetbrains.python.psi;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface PyLiteralPattern extends PyPattern {
|
||||
@NotNull PyExpression getExpression();
|
||||
}
|
||||
|
||||
@@ -2,4 +2,30 @@
|
||||
package com.jetbrains.python.psi;
|
||||
|
||||
public interface PyPattern extends PyElement {
|
||||
/**
|
||||
* An irrefutable pattern is a pattern that always succeed (matches).
|
||||
* <p>
|
||||
* Primarily, these are capture patterns and wildcard patterns, as well as group and OR-patterns containing one of those.
|
||||
* <p>
|
||||
* <h3>Examples of irrefutable patterns:</h3>
|
||||
* <ul>
|
||||
* <li>{@code name}</li>
|
||||
* <li>{@code _} (a wildcard)</li>
|
||||
* <li>{@code 42 | name}</li>
|
||||
* <li>{@code (42 | name) as alias}</li>
|
||||
* <li>{@code ((name))}</li>
|
||||
* <li>{@code *args}</li>
|
||||
* <li>{@code **kwargs}</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* <h3>Examples of refutable patterns:</h3>
|
||||
* <ul>
|
||||
* <li>{@code foo.bar}</li>
|
||||
* <li>{@code 'foo'}</li>
|
||||
* <li>{@code [_]}</li>
|
||||
* <li>{@code [*args]}</li>
|
||||
* <li>{@code str(foo)}</li>
|
||||
* </ul>
|
||||
*/
|
||||
boolean isIrrefutable();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.jetbrains.python.psi;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PyPatternArgumentList extends PyElement {
|
||||
@NotNull List<PyPattern> getPatterns();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user