Skip to content

Commit

Permalink
Support floor division assignment (//=) (#293)
Browse files Browse the repository at this point in the history
* Support floor division assignment (//=)

* Remove from 5.3
  • Loading branch information
chriscerie authored Dec 1, 2023
1 parent e884b09 commit a289a77
Show file tree
Hide file tree
Showing 8 changed files with 830 additions and 510 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ 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).

## Unreleased
### Added
- Added support for parsing Luau's floor division assignment `//=`

## [0.19.0] - 2023-11-10
### Added
- Added support for parsing Luau's floor division `//`
Expand Down
1 change: 1 addition & 0 deletions full-moon/src/ast/parsers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2260,6 +2260,7 @@ make_op_parser!(CompoundOp, ParseCompoundOp,
MinusEqual,
StarEqual,
SlashEqual,
DoubleSlashEqual,
PercentEqual,
CaretEqual,
TwoDotsEqual,
Expand Down
2 changes: 2 additions & 0 deletions full-moon/src/ast/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ make_op!(CompoundOp,
MinusEqual,
StarEqual,
SlashEqual,
DoubleSlashEqual,
PercentEqual,
CaretEqual,
TwoDotsEqual,
Expand All @@ -697,6 +698,7 @@ impl CompoundOp {
| Self::MinusEqual(token)
| Self::StarEqual(token)
| Self::SlashEqual(token)
| Self::DoubleSlashEqual(token)
| Self::PercentEqual(token)
| Self::CaretEqual(token)
| Self::TwoDotsEqual(token) => token,
Expand Down
4 changes: 4 additions & 0 deletions full-moon/src/atom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@ pub(crate) enum Atom {
#[token("/=")]
SlashEqual,

#[cfg(feature = "roblox")]
#[token("//=")]
DoubleSlashEqual,

#[cfg(feature = "roblox")]
#[token("%=")]
PercentEqual,
Expand Down
8 changes: 8 additions & 0 deletions full-moon/src/tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ pub enum Symbol {
#[cfg_attr(feature = "serde", serde(rename = "/="))]
SlashEqual,

#[cfg(feature = "roblox")]
#[cfg_attr(feature = "serde", serde(rename = "//="))]
DoubleSlashEqual,

#[cfg_attr(feature = "serde", serde(rename = "%="))]
PercentEqual,

Expand Down Expand Up @@ -224,6 +228,8 @@ impl TryFrom<Atom> for Symbol {
#[cfg(feature = "roblox")]
Atom::SlashEqual => Symbol::SlashEqual,
#[cfg(feature = "roblox")]
Atom::DoubleSlashEqual => Symbol::DoubleSlashEqual,
#[cfg(feature = "roblox")]
Atom::PercentEqual => Symbol::PercentEqual,
#[cfg(feature = "roblox")]
Atom::CaretEqual => Symbol::CaretEqual,
Expand Down Expand Up @@ -308,6 +314,8 @@ impl Display for Symbol {
Symbol::MinusEqual => "-=",
Symbol::StarEqual => "*=",
Symbol::SlashEqual => "/=",
#[cfg(feature = "roblox")]
Symbol::DoubleSlashEqual => "//=",
Symbol::PercentEqual => "%=",
Symbol::CaretEqual => "^=",
Symbol::TwoDotsEqual => "..=",
Expand Down
Loading

0 comments on commit a289a77

Please sign in to comment.