aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r--crates/ra_syntax/src/parsing/lexer.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/parsing/lexer.rs b/crates/ra_syntax/src/parsing/lexer.rs
index 55755be18..d1315e604 100644
--- a/crates/ra_syntax/src/parsing/lexer.rs
+++ b/crates/ra_syntax/src/parsing/lexer.rs
@@ -69,7 +69,7 @@ pub fn lex_single_syntax_kind(text: &str) -> Option<(SyntaxKind, Option<SyntaxEr
69 .map(|(token, error)| (token.kind, error)) 69 .map(|(token, error)| (token.kind, error))
70} 70}
71 71
72/// The same as `single_syntax_kind()` but returns only `SyntaxKind` and 72/// The same as `lex_single_syntax_kind()` but returns only `SyntaxKind` and
73/// returns `None` if any tokenization error occured. 73/// returns `None` if any tokenization error occured.
74/// 74///
75/// Beware that unescape errors are not checked at tokenization time. 75/// Beware that unescape errors are not checked at tokenization time.
@@ -79,10 +79,12 @@ pub fn lex_single_valid_syntax_kind(text: &str) -> Option<SyntaxKind> {
79 .map(|(token, _error)| token.kind) 79 .map(|(token, _error)| token.kind)
80} 80}
81 81
82/// Returns the first encountered token at the beginning of the string. 82/// Returns `SyntaxKind` and `Option<SyntaxError>` of the first token
83/// encountered at the beginning of the string.
83/// 84///
84/// Returns `None` if the string contains zero tokens or if the token was parsed 85/// Returns `None` if the string contains zero tokens or if the token was parsed
85/// with an error. 86/// with an error.
87/// The token is malformed if the returned error is not `None`.
86/// 88///
87/// Beware that unescape errors are not checked at tokenization time. 89/// Beware that unescape errors are not checked at tokenization time.
88fn first_token(text: &str) -> Option<(Token, Option<SyntaxError>)> { 90fn first_token(text: &str) -> Option<(Token, Option<SyntaxError>)> {