Skip to content

Commit 12afad1

Browse files
committed
refactor: rename $paste to $as-is
1 parent d0fbbad commit 12afad1

9 files changed

+13
-13
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
- check on number of arguments passed to `type`
2020
- warning when the formatter deletes comment(s) by mistake
2121
- check on arguments passed to `list`, `concat`, `append` and friends to only push valid nodes (that produces a value)
22-
- `$paste` to paste a node inside a maro without evaluating it further ; useful to stop recursive evaluation of nodes inside function macros
2322
- introduced `Ark::internal::Pass` to describe compiler passes: they all output an AST (parser, import solver, macro processor, and optimizer for now)
2423
- add `-f(no-)importsolver`, `-f(no-)macroprocessor` and `-f(no-)optimizer` to toggle on and off those compiler passes
2524
- added resolving `empty?` as a macro when possible
@@ -37,6 +36,7 @@
3736
- basic dead code elimination in the AST optimizer
3837
- new operator `@@` to get elements in list of lists / list of strings
3938
- new builtin `random`, returning a random number between INT_MIN and INT_MAX, or in a custom range
39+
- `$as-is` to paste a node inside a maro without evaluating it further ; useful to stop recursive evaluation of nodes inside function macros
4040

4141
### Changed
4242
- instructions are on 4 bytes: 1 byte for the instruction, 1 byte of padding, 2 bytes for an immediate argument

include/Ark/Compiler/Common.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@ namespace Ark::internal
119119
constexpr std::string_view Symcat = "$symcat";
120120
constexpr std::string_view Argcount = "$argcount";
121121
constexpr std::string_view Repr = "$repr";
122-
constexpr std::string_view Paste = "$paste";
122+
constexpr std::string_view AsIs = "$as-is";
123123

124124
constexpr std::array macros = {
125125
Undef,
126126
Symcat,
127127
Argcount,
128128
Repr,
129-
Paste
129+
AsIs
130130
};
131131

132132
// This list is related to include/Ark/Compiler/Instructions.hpp

lib/std

Submodule std updated 1 file

src/arkreactor/Compiler/Macros/Processor.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -568,10 +568,10 @@ namespace Ark::internal
568568
const Node ast = node.constList()[1];
569569
node.updateValueAndType(Node(NodeType::String, ast.repr()));
570570
}
571-
else if (name == Language::Paste)
571+
else if (name == Language::AsIs)
572572
{
573573
if (node.list().size() != 2)
574-
throwMacroProcessingError(fmt::format("When expanding `{}', expected one argument, got {} arguments", Language::Paste, argcount), node);
574+
throwMacroProcessingError(fmt::format("When expanding `{}', expected one argument, got {} arguments", Language::AsIs, argcount), node);
575575
return node.constList()[1];
576576
}
577577
else if (name == Language::Undef)
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
($ a ($paste b []))
1+
($ a ($as-is b []))
22
(p0000 a)
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
($ a ($paste b []))
1+
($ a ($as-is b []))
22
(print a)
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
($ a ($paste b []))
1+
($ a ($as-is b []))
22
(print a)
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
($ a ($paste b []))
1+
($ a ($as-is b []))
22
(print a)
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
At ($paste b (list)) @ 1:7
2-
1 | ($ a ($paste b []))
1+
At ($as-is b (list)) @ 1:7
2+
1 | ($ a ($as-is b []))
33
| ^~~~~~~~~~~~~~~~~~~
44
2 | (print a)
55
3 |
6-
When expanding `$paste', expected one argument, got 2 arguments
6+
When expanding `$as-is', expected one argument, got 2 arguments

0 commit comments

Comments
 (0)