All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Flattened
Expression::Value
to all be variants ofExpression
directly, as this was not used anywhere else. The extratype_assertion
field has been moved into a new variantExpression::TypeAssertion
. None of these variants are boxed. - The following fields/variants have been changed from
Expression
toBox<Expression>
:Prefix::Expression
,Var::Expression
,IfExpression::condition
,IfExpression::if_expression
,IfExpression::else_expression
. - When using serde,
Expression
will no longer act untagged. - Fixed parsing of string interpolation double brace for Luau code
- Fixed
print
on a LocalAssignment in Lua 5.4 or Luau mode not including the variable name when no type specifier or attribute is included
- Added
first
method toPunctuated
.
- Fixed parse failed with Chinese token in comment and bump deps.
- Fixed
\
escapes in strings for Lua 5.2+. - Fixed incorrect line number positions when a token contains consecutive newlines (typically multi line strings or comments)
full_moon::Error
andfull_moon::ast::Ast
now implement Serialize and Deserialize.- Added optional "stacker" feature which uses the stacker crate to conditionally expand stack size to avoid stack overflows, a known problem with full-moon.
- Added support for string interpolation under the
roblox
feature flag - Added support for Lua 5.2 fractional hexidecimal / hexidecimal with exponents, and LuaJIT number suffixes (LL/ULL/i) under the
lua52
feature flag
- Support instantiated generics with no parameters, e.g.
Foo<>
- Support
\z
escapes (followed by line breaks) in strings for Lua 5.2+
- Fixed bracketed strings
[[]]
which contain another]
causing parse errors.
- Fixed comments starting with
--[
and--(
causing parse errors if they weren't multiline.
- Added support for Lua 5.3 under the
lua53
feature flag. This adds in new binary and unary operators. - Added support for Lua 5.4 under the
lua54
feature flag. This adds in variable attributes.
- Fixed issue with lexing strings when it matches the wrong escape sequence.
- Fixed panic when calling
TypeDeclaration::new()
under theroblox
feature flag
- Switched from using peg to logos for lexing.
- Fixed parsing of indexed type information that contains generic packs
- Added support for parsing generic type packs, variadic type packs, and explicit type packs in generic arguments for a type under the
roblox
feature flag (type X<S...> = Y<(string, number), ...string, S...>
) - Added support for string and boolean singleton types under the
roblox
feature flag (type Element = { ["$$typeof"]: number, errorCaught: true, which: "Query" | "Mutation" | "Subscription" }
- Added support for default types in a generic type declaration under the
roblox
feature flag (type Foo<X = string> = X
)
- [BREAKING CHANGE] renamed
TypeInfo::GenericVariadic
toTypeInfo::GenericPack
to better represent its syntax (only affectsroblox
feature flag) - [BREAKING CHANGE] replaced
GenericDeclarationParameter
to allow default types. The onlyGenericDeclarationParameter
enum is nowGenericParameterInfo
, andGenericDeclaratinoParameter
is a struct of a ParameterInfo and optional default type. (only affectsroblox
feature flag)
- Improved the parsing of generic type declarations to ensure generic types are always before generic type packs
- Added
token()
methods onBinOp
,UnOp
andCompoundOp
to get the token associated with the operator - Added handling of UTF8 BOM(Byte order mark)
- Added support for variadic generics and generic variadic type packs under the
roblox
feature flag (type Foo<T...> = () -> T...
) - Added support for generic declarations in callback type specifiers under the
roblox
feature flag - Added support for generic declarations for anonymous functions under the
roblox
feature flag - Added support for if expression syntax under the
roblox
feature flag
- [BREAKING CHANGE]
generics
has been removed fromFunctionDeclaration
andLocalFunction
, and is now available in one place underFunctionBody
.
- Fixed the parsing of
goto
as an identifier when thelua52
flag is not enabled
- Fixed semicolon used as delimeters in Luau type tables leading to a syntax error under the
roblox
feature flag - Fixed nested type arrays failing to parse under the
roblox
feature flag - Fixed parsing of callback types as return types when they contained named parameters under the
roblox
feature flag
- [BREAKING CHANGE] The ast lifetime has been removed from practically everything.
- [BREAKING CHANGE] As a result of the above,
Owned
has been removed.
- Fixed issue with parsing complex function type arguments which began with an indetifier under the
roblox
feature flag
- Added support for parsing generic functions under the
roblox
feature flag - Added support for parsing named function type arguments under the
roblox
feature flag
- Fixed regression in parsing single types within parentheses under the
roblox
feature flag.
- Made
TokenizerError
fields accessible through methods - Added support for typing variadic symbols in function parameters under the
roblox
feature flag - Added support for the
...T
variadic type annotation under theroblox
feature flag. Variadic types are only permitted as a return type (standalone or in a tuple), or as a parameter in a callback type annotation
- Fixed invalid parsing of tuple types under the
roblox
feature flag. Tuple types are only permitted as the return type of function bodies or callback type annotations.
- Switched from using nom to peg for lexing.
- full_moon will now allocate about 200% less stack space in debug mode.
- Added
block.iter_stmts_with_semicolon()
which returns an iterator over tuples containing the statement and an optional semicolon. - Added
Expression::BinaryOperator{ lhs, binop, rhs }
which now handles binary operation expressions, with support for precedence. - Added
operator.precedence()
toBinOp
andUnOp
. This returns the precedence value from a scale of 1-8 for the operator, where 8 is highest precedence. - Added
binop.is_right_associative()
toBinOp
. This returns whether the binary operator is right associative. - Added a
lua52
feature flag for Lua 5.2 specific syntax - Added support for
goto
and labels when using thelua52
feature flag - Added initialiser methods for all Luau-related structs available under the roblox feature flag.
- Added
block.last_stmt_with_semicolon()
which returns a tuple containing the last stmt in the block, and an optional token reference.
- Updated dependency cfg_if to v1.0
- [BREAKING CHANGE] Moved binary operations to
Expression::BinaryOperator
.binop
has been removed fromExpression::Value
- [BREAKING CHANGE] Renamed
Value::ParseExpression
toValue::ParenthesesExpression
- [BREAKING CHANGE] Enums are now be marked as
non_exhaustive
, meaning matches on them must factor in the_
case. - Changed the assertion operator from
as
to::
under the roblox feature flag.AsAssertion
has been renamed toTypeAssertion
, withas_token
renamed toassertion_op
. - [BREAKING CHANGE] Changed how newline trailing trivia is bound to tokens. A token now owns any trailing trivia on the same line up to and including the newline character. See #125 for more details.
- [BREAKING CHANGE] The following names have been changed for consistency.
GenericFor::expr_list
->GenericFor::expressions
GenericFor::with_expr_list
->GenericFor::with_expressions
Assignment::expr_list
->Assignment::expressions
Assignment::with_expr_list
->Assignment::with_expressions
Assignment::var_list
->Assignment::variables
Assignment::with_var_list
->Assignment::with_variables
LocalAssignment::expr_list
->LocalAssignment::expressions
LocalAssignment::with_expr_list
->LocalAssignment::with_expressions
LocalAssignment::name_list
->LocalAssignment::names
LocalAssignment::with_name_list
->LocalAssignment::with_names
Block::iter_stmts
->Block::stmts
Block::iter_stmts_with_semicolon
->stmts_with_semicolon
VarExpression::iter_suffixes
->VarExpression::suffixes
FunctionCall::iter_suffixes
->FunctionCall::suffixes
FunctionBody::func_body
->FunctionBody::body
- [BREAKING CHANGE] All uses of
Cow<'a, TokenReference<'a>>
have been removed, thoughCow<'a, str>
remain.
- Fixed the start position of tokens at the beginning of a line to not be at the end of the previous line.
- TokenReference equality now checks for leading and trailing trivia to be the same.
- Allow numbers to have a trailing decimal
.
.
- Removed
BinOpRhs
. This is now part ofExpression::BinaryOperator
. - Removed
visit_bin_op
and related visitors. Binary operations should be handled in the expression visitor - Removed all deprecated members.
- Added support for retrieving the
Punctuated
sequence of fields in aTableConstructor
TableConstructor::iter_fields
is now deprecated in favour ofparameters().iter
- Fixed visit_numeric_for running twice.
- Added
with_XXX
methods to Roblox-related structs under theroblox
feature flag - Added support for retrieving the
Punctuated
sequence of parameters in aFunctionBody
- Added support for types within generic and numeric for loops under the
roblox
feature flag - Added support for shorthand array type notation (
type Foo = { number }
) under theroblox
feature flag
- Fixed parse error for exponents with an explicit positive sign (eg.
1e+5
)
- Use intra doc links, remove unnecessary linking for some items in docs.
FunctionBody::iter_parameters
is now deprecated in favour ofpunctuated().iter
- Added support for exporting types (
export type Foo = { bar: number }
) under theroblox
feature flag - Added support for using types from other modules (
local x: module.Foo
) under theroblox
feature flag - Added support for parsing a shebang
- Fixed type declaration of objects not supporting trailing commas
- Fixed an issue where
continue
was not treated similar toreturn
orbreak
. It is now moved toLastStmt
instead of aStmt
- Fixed long comments and long strings containing multi-byte characters.
TableConstructor
now usesPunctuated
internally;TableConstructor::iter_fields
returns an iterarator overField
's.
- Fixed an error related with
visit_compound_op
and theroblox
feature flag
- Fixed
visit_un_op
not being called correctly
- Added support for
continue
underroblox
feature flag - Added support for compound assignments (eg.
x += 1
) under theroblox
feature flag - Added support for intersectional types (
string & number
) under theroblox
feature flag - Added support for underscores as numeric seperators (eg.
1_123_531
) under theroblox
feature flag
- Fixed old function return type syntax under
roblox
feature flag - Fixed
leading_trivia
not being populated correctly withinTokenReference
s insideextract_token_references
due to CRLF line endings - Fixed parse error for numbers with negative exponents
- Fixed parse error for fractional numbers with no integer part
- Added
TokenReference::with_token
- Added
Token::new
- Added
Puncutated::from_iter
- Added
TokenType::spaces
andTokenType::tabs
- Added
Punctuated::last
- Display is now implemented on all nodes (Closes #26)
- TokenReference has been completely rewritten to now be a representation of an inner token and its leading/trailing trivia.
ignore
is now deprecated in favor ofis_trivia
last_stmts
is now deprecated in favor oflast_stmt
- Fixed a bug where illogical punctuated sequences were created when function bodies had both named parameters and varargs
- Fixed serde being used even when the
serde
feature flag was not active - Fixed tabs in comments leading to a parser error.
- Added support for Roblox typed Lua syntax under the
roblox
feature flag
- Changed internal parser which should lead to better performance
- Added a
roblox
feature flag for Roblox specific syntax - Added binary literals when using
roblox
feature flag
- Fixed strings with escaped new lines being unparseable
- Removed leftover
dbg!
line
- Fixed a bug where subtraction without spaces and the right hand side being a number would cause a parsing error (e.g.
x-7
)
- Added a
similar
method tonode::Node
to check if two nodes are semantically equivalent
- Fixed performance issue with
Node::start_position
andNode::end_position
- Removed dependency on crossbeam.
- Added
visit_XXX_end
methods for when completing a visit on a node
- Fixed unexpected parsing issues with UTF-8 strings
- Fixed tokens not being visited for
TokenReference
- Fixed a massive performance bug
- Fixed
visit_ast
not following tokens
- Added
Owned
implementation for errors
- Changed signature of
Node::surrounding_ignore_tokens
to have more lenient lifetimes
- Added
node::Node
which containsstart_position
andend_position
methods to obtain the full range of a node, as well assurrounding_ignore_tokens
to get surrounding comments/whitespace. - Added
Punctuated
andPair
, replaced lots of uses ofVec<_>
withPunctuated<_>
- Added
ContainedSpan
, a way to represent structures like(...)
and[...]
- Added
Return
andvisit_return
- Added
Expression::Parentheses
- Added
Owned
trait to get a'static
lifetime version of nodes - Added
TokenKind
to get the kind of a token without any additional data - Added mutation methods:
set_start_position
,set_end_position
,set_token_type
forTokenReference
objects - Added
Ast::update_positions
to update all the position structs if you mutate it
- Fields of
Token
andPosition
have been made private with public accessors - Changed signatures from
Token
toTokenReference
, which dereference to tokens - Changed
If::else_if
to use a newVec<ElseIf>
- Changed
Value::Function
to also include the function token LastStmt::Return
no longer uses an enum struct, and now usesReturn
- Changed
visit_do
to use a newDo
struct instead ofBlock
- Changed
FunctionArgs::Parentheses
to be a struct item
- Fixed unexpected parsing issues with UTF-8 strings
- Added std::fmt::Display and std::error::Error implementations for Error, AstError, and TokenizerError
- Documented all public APIs
- Properties are no longer
pub
and now have public accessor methods - License has been changed from GPL to LGPL
- Fixed
TableConstructorField
parsing not correctly giving separator tokens (#12)
- Added VisitorMut trait which is passed mutable nodes. Mutation is not completely ready yet and may cause side effects
- Added Visit and VisitMut traits that all nodes implement, as well as some utility types such as Vec
- Removed Interpreter in favor of using the Visitor trait directly
- Removed "visitors" feature flag
- BinOpRhs is no longer a type alias to a tuple and is instead its own struct
- Added documentation to visitors::Visitor::Interpreter
- visitors::Interpreter's constructor is no longer accidentally private
- Initial commit
- Tokenizer and parser
- Visitors