Export is_valid_identifier and is_valid_function_name under internals.

This commit is contained in:
Stephen Chung 2022-07-25 22:05:52 +08:00
parent 492d79d8a2
commit 61056dfb24
3 changed files with 9 additions and 7 deletions

View File

@ -260,7 +260,7 @@ impl RangeCase {
Self::InclusiveInt(..) => true, Self::InclusiveInt(..) => true,
} }
} }
/// Get the index to the [`ConditionalStmtBlock`]. /// Get the index to the [`ConditionalExpr`].
#[inline(always)] #[inline(always)]
#[must_use] #[must_use]
pub fn index(&self) -> usize { pub fn index(&self) -> usize {
@ -268,7 +268,7 @@ impl RangeCase {
Self::ExclusiveInt(.., n) | Self::InclusiveInt(.., n) => *n, Self::ExclusiveInt(.., n) | Self::InclusiveInt(.., n) => *n,
} }
} }
/// Set the index to the [`ConditionalStmtBlock`]. /// Set the index to the [`ConditionalExpr`].
#[inline(always)] #[inline(always)]
pub fn set_index(&mut self, index: usize) { pub fn set_index(&mut self, index: usize) {
match self { match self {

View File

@ -272,8 +272,8 @@ pub use tokenizer::{get_next_token, parse_string_literal};
#[cfg(feature = "internals")] #[cfg(feature = "internals")]
pub use tokenizer::{ pub use tokenizer::{
InputStream, MultiInputsStream, Span, Token, TokenIterator, TokenizeState, TokenizerControl, is_valid_function_name, is_valid_identifier, InputStream, MultiInputsStream, Span, Token,
TokenizerControlBlock, TokenIterator, TokenizeState, TokenizerControl, TokenizerControlBlock,
}; };
#[cfg(feature = "internals")] #[cfg(feature = "internals")]

View File

@ -2179,7 +2179,7 @@ fn get_identifier(
Some((Token::Identifier(identifier.into()), start_pos)) Some((Token::Identifier(identifier.into()), start_pos))
} }
/// Is this keyword allowed as a function? /// Is a keyword allowed as a function?
#[inline] #[inline]
#[must_use] #[must_use]
pub fn is_keyword_function(name: &str) -> bool { pub fn is_keyword_function(name: &str) -> bool {
@ -2194,7 +2194,8 @@ pub fn is_keyword_function(name: &str) -> bool {
} }
} }
/// Is a text string a valid identifier? /// _(internals)_ Is a text string a valid identifier?
/// Exported under the `internals` feature only.
#[must_use] #[must_use]
pub fn is_valid_identifier(name: impl Iterator<Item = char>) -> bool { pub fn is_valid_identifier(name: impl Iterator<Item = char>) -> bool {
let mut first_alphabetic = false; let mut first_alphabetic = false;
@ -2212,7 +2213,8 @@ pub fn is_valid_identifier(name: impl Iterator<Item = char>) -> bool {
first_alphabetic first_alphabetic
} }
/// Is a text string a valid script-defined function name? /// _(internals)_ Is a text string a valid script-defined function name?
/// Exported under the `internals` feature only.
#[inline(always)] #[inline(always)]
#[must_use] #[must_use]
pub fn is_valid_function_name(name: &str) -> bool { pub fn is_valid_function_name(name: &str) -> bool {