Skip to content

Commit

Permalink
Merge pull request #436 from ArkScript-lang/remove-macro-blocks
Browse files Browse the repository at this point in the history
feat!: $* macro as it is not needed anymore
  • Loading branch information
SuperFola authored Mar 17, 2024
2 parents 936307f + 2d88098 commit 061c2f3
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
config:
- {
os: ubuntu-latest, name: "Ubuntu Clang 15", cc: "clang-15", cxx: "clang++-15",
artifact: "ubuntu-clang-15", sanitizers: "On", preconfigure: ""
artifact: "ubuntu-clang-15", sanitizers: "Off", preconfigure: ""
}
- {
os: ubuntu-latest, name: "Ubuntu Clang 15 (valgrind)", cc: "clang-15", cxx: "clang++-15",
Expand Down
1 change: 0 additions & 1 deletion include/Ark/Compiler/AST/Parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ namespace Ark::internal
std::optional<Node> functionArgs();
std::optional<Node> function();
std::optional<Node> macroCondition();
std::optional<Node> macroBlock();
std::optional<Node> macroArgs();
std::optional<Node> macro();
std::optional<Node> functionCall();
Expand Down
2 changes: 1 addition & 1 deletion lib/std
Submodule std updated 1 files
+12 −8 .github/workflows/ci.yml
33 changes: 0 additions & 33 deletions src/arkreactor/Compiler/AST/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ namespace Ark::internal
else
backtrack(position);

if (auto result = macroBlock())
return result;
else
backtrack(position);

if (auto result = macro(); result.has_value())
return result;
else
Expand Down Expand Up @@ -505,34 +500,6 @@ namespace Ark::internal
return leaf;
}

std::optional<Node> Parser::macroBlock()
{
if (!accept(IsChar('(')))
return std::nullopt;
newlineOrComment();

if (!oneOf({ "$*" }))
return std::nullopt;
newlineOrComment();

Node leaf(NodeType::List);

while (!isEOF())
{
if (auto value = nodeOrValue(); value.has_value())
{
leaf.push_back(value.value());
newlineOrComment();
}
else
break;
}

newlineOrComment();
expect(IsChar(')'));
return leaf;
}

std::optional<Node> Parser::macroArgs()
{
if (accept(IsChar('(')))
Expand Down
2 changes: 1 addition & 1 deletion tests/arkscript/macro-tests.ark
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
($if (> x 1)
(suffix-dup sym (- x 1)))
(symcat sym x)})
(let magic_func (fun ($* (suffix-dup a 3)) (- a1 a2 a3)))
(let magic_func (fun ((suffix-dup a 3)) (- a1 a2 a3)))
(set tests (assert-eq (magic_func 1 2 3) (- 1 2 3) "macro symdup" tests))

($ partial (func ...defargs) {
Expand Down

0 comments on commit 061c2f3

Please sign in to comment.