-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#141] Add support for parser cancellation
- Loading branch information
1 parent
0f10d90
commit 7af0835
Showing
7 changed files
with
101 additions
and
13 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
src/commonMain/kotlin/org/intellij/markdown/ExperimentalApi.kt
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,13 @@ | ||
package org.intellij.markdown | ||
|
||
/** | ||
* API elements marked with this annotation should be considered unstable and might change | ||
* in the future breaking source/binary compatibility. | ||
*/ | ||
@RequiresOptIn( | ||
message = "This API is experimental and might change in the future.", | ||
level = RequiresOptIn.Level.ERROR | ||
) | ||
@Retention(AnnotationRetention.BINARY) | ||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR) | ||
annotation class ExperimentalApi |
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
12 changes: 12 additions & 0 deletions
12
src/commonMain/kotlin/org/intellij/markdown/parser/CancellationToken.kt
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,12 @@ | ||
package org.intellij.markdown.parser | ||
|
||
import org.intellij.markdown.ExperimentalApi | ||
|
||
@ExperimentalApi | ||
fun interface CancellationToken { | ||
fun checkCancelled() | ||
|
||
object NonCancellable: CancellationToken { | ||
override fun checkCancelled() = Unit | ||
} | ||
} |
11 changes: 10 additions & 1 deletion
11
src/commonMain/kotlin/org/intellij/markdown/parser/InlineBuilder.kt
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
19 changes: 18 additions & 1 deletion
19
...mmonMain/kotlin/org/intellij/markdown/parser/sequentialparsers/SequentialParserManager.kt
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