Skip to content

Commit

Permalink
Only have doc comment with lua 5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Kampfkarren committed Jan 20, 2024
1 parent 838461b commit df8a981
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions full-moon/src/tokenizer/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,15 +589,19 @@ impl TokenReference {
/// Returns a symbol with the leading and trailing whitespace,
/// much like [`TokenReference::symbol`], but only if it's valid
/// for the given Lua version.
/// ```rust
/// # use full_moon::tokenizer::{Symbol, TokenReference, TokenType, TokenizerErrorType};
/// # use full_moon::LuaVersion;
/// # fn main() -> Result<(), Box<TokenizerErrorType>> {
/// assert!(TokenReference::symbol_specific_lua_version("goto", LuaVersion::lua51()).is_err());
/// assert!(TokenReference::symbol_specific_lua_version("goto", LuaVersion::lua52()).is_ok());
/// # Ok(())
/// # }
/// ```
#[cfg_attr(
feature = "lua52",
doc = r##"
```rust
# use full_moon::tokenizer::{Symbol, TokenReference, TokenType, TokenizerErrorType};
# use full_moon::LuaVersion;
# fn main() -> Result<(), Box<TokenizerErrorType>> {
assert!(TokenReference::symbol_specific_lua_version("goto", LuaVersion::lua51()).is_err());
assert!(TokenReference::symbol_specific_lua_version("goto", LuaVersion::lua52()).is_ok());
# Ok(())
# }
"##
)]
pub fn symbol_specific_lua_version(
text: &str,
lua_version: LuaVersion,
Expand Down

0 comments on commit df8a981

Please sign in to comment.