From 61056dfb241109943e28a3bb0b4dd1d46f38d87f Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Mon, 25 Jul 2022 22:05:52 +0800 Subject: [PATCH] Export is_valid_identifier and is_valid_function_name under internals. --- src/ast/stmt.rs | 4 ++-- src/lib.rs | 4 ++-- src/tokenizer.rs | 8 +++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/ast/stmt.rs b/src/ast/stmt.rs index c2cad9da..ae9b064a 100644 --- a/src/ast/stmt.rs +++ b/src/ast/stmt.rs @@ -260,7 +260,7 @@ impl RangeCase { Self::InclusiveInt(..) => true, } } - /// Get the index to the [`ConditionalStmtBlock`]. + /// Get the index to the [`ConditionalExpr`]. #[inline(always)] #[must_use] pub fn index(&self) -> usize { @@ -268,7 +268,7 @@ impl RangeCase { Self::ExclusiveInt(.., n) | Self::InclusiveInt(.., n) => *n, } } - /// Set the index to the [`ConditionalStmtBlock`]. + /// Set the index to the [`ConditionalExpr`]. #[inline(always)] pub fn set_index(&mut self, index: usize) { match self { diff --git a/src/lib.rs b/src/lib.rs index e476fb15..7b8c9cff 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -272,8 +272,8 @@ pub use tokenizer::{get_next_token, parse_string_literal}; #[cfg(feature = "internals")] pub use tokenizer::{ - InputStream, MultiInputsStream, Span, Token, TokenIterator, TokenizeState, TokenizerControl, - TokenizerControlBlock, + is_valid_function_name, is_valid_identifier, InputStream, MultiInputsStream, Span, Token, + TokenIterator, TokenizeState, TokenizerControl, TokenizerControlBlock, }; #[cfg(feature = "internals")] diff --git a/src/tokenizer.rs b/src/tokenizer.rs index 5b827c38..5cccd741 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -2179,7 +2179,7 @@ fn get_identifier( Some((Token::Identifier(identifier.into()), start_pos)) } -/// Is this keyword allowed as a function? +/// Is a keyword allowed as a function? #[inline] #[must_use] 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] pub fn is_valid_identifier(name: impl Iterator) -> bool { let mut first_alphabetic = false; @@ -2212,7 +2213,8 @@ pub fn is_valid_identifier(name: impl Iterator) -> bool { 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)] #[must_use] pub fn is_valid_function_name(name: &str) -> bool {