Skip to main content

Crate ktrs_parser

Crate ktrs_parser 

Source
Expand description

Port of the Kotlin compiler’s PSI parser (KotlinParsing, KotlinExpressionParsing, KDocParser) on top of a re-implementation of IntelliJ’s PsiBuilder semantics. See builder for the builder contract and parsing for the porting conventions.

Re-exports§

pub use builder::ChameleonCache;

Modules§

builder
Re-implementation of IntelliJ’s PsiBuilderImpl (platform 251.27812.49, the one bundled with Kotlin 2.4.20) and the Kotlin builder wrappers on top of it.
kt_tokens
Token sets and token-class predicates from KtTokens.java (psi-api/…/lexer/KtTokens.java). Individual token kinds live in SyntaxKind under their KtTokens field names.
parsing
Port of org.jetbrains.kotlin.parsing (third_party/kotlin/compiler/psi/parser/src/…/parsing).
token_set
IntelliJ TokenSet: an immutable, const-constructible bit set of SyntaxKinds.

Enums§

FileKind

Functions§

parse_block_code_fragment
parse_block_expression
BlockExpressionElementType.parseContents: the reparse of a collapsed BLOCK.
parse_expression_code_fragment
parse_file
Parses a whole file. text must already have CRLF normalized to LF.
parse_file_cached
parse_file for callers re-parsing similar text: the result is identical, but lazy blocks, lambdas and KDoc whose text was already seen with cache are reused instead of re-parsed.
parse_lambda_expression
LambdaExpressionElementType.parseContents: the reparse of a collapsed LAMBDA_EXPRESSION.
parse_type_code_fragment