Skip to content

Commit

Permalink
Prevent copy
Browse files Browse the repository at this point in the history
  • Loading branch information
Kampfkarren committed Jul 6, 2024
1 parent 8e01d3f commit 8e3d5f0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.0-rc.2] - 2024-07-05
### Changed
- Changed `Error::error_message()` to return `Cow<'_, str>` instead of `Cow<'static, str>`.
- Changed `AstError::error_message()` to return `&str` instead of `Cow<'static, str>`.

## [1.0.0-rc.1] - 2024-07-05
### Added
- **full-moon now has the ability to return multiple errors.** Added `parse_fallible`, which will return a struct containing the best possible AST, and a vector of errors. Read the documentation for guarantees on the partial AST.
Expand All @@ -19,7 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **[BREAKING CHANGE]** `Expression::Function((TokenReference, FunctionBody))` variant is now Boxed to ``Expression::Function(Box<(TokenReference, FunctionBody)>)` to reduce type sizes and reduce stack overflows
- **[BREAKING CHANGE]** Associativity of union / intersection types are fixed: they are parsed as left associative, whilst originally parsed as right associative
- **[BREAKING CHANGE]** LuaJIT parsing support is available as a separate feature flag `luajit`, rather than mixed with `lua52`. Added `LuaVersion::luajit()` to support this.
- **[BREAKING CHANGE]** `Symbol::Ellipse` and other references of `ellipse` have been renamed to `Symbol::Ellipsis` / `ellipsis`
- **[BREAKING CHANGE]** `Symbol::Ellipse` and other references of `ellipse` have been renamed to `Symbol::Ellipsis` / `ellipsis`
- Shebangs provide their trailing trivia more accurately to the rest of full-moon.
- Attempting to display `StringLiteralQuoteType::Brackets` now returns an error rather than being marked as unreachable.
- Significantly optimized the entire codebase, helping both time to parse and wasting less stack, especially in debug mode.
Expand Down
2 changes: 1 addition & 1 deletion full-moon/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "full_moon"
version = "1.0.0-rc.1"
version = "1.0.0-rc.2"
authors = ["Kampfkarren <[email protected]>"]
description = "A lossless Lua parser"
license = "MPL-2.0"
Expand Down
4 changes: 2 additions & 2 deletions full-moon/src/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2234,8 +2234,8 @@ impl AstError {
}

/// Returns a human readable error message
pub fn error_message(&self) -> Cow<'static, str> {
self.additional.clone()
pub fn error_message(&self) -> &str {
self.additional.as_ref()
}

/// Returns the range of the error
Expand Down
4 changes: 2 additions & 2 deletions full-moon/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ pub enum Error {

impl Error {
/// Returns a human readable error message
pub fn error_message(&self) -> Cow<'static, str> {
pub fn error_message(&self) -> Cow<'_, str> {
match self {
Error::AstError(error) => error.error_message(),
Error::AstError(error) => Cow::from(error.error_message()),
Error::TokenizerError(error) => error.to_string().into(),
}
}
Expand Down

0 comments on commit 8e3d5f0

Please sign in to comment.