Skip to content

Commit

Permalink
Change global macro symbol from @ to ! (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
MysteryBlokHed authored Jul 30, 2021
1 parent f19932d commit 7de1b0d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions docs/macros.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,17 @@ in-game, we could run the following:
Files for macros
----------------

Any file whose name starts with an ``@`` symbol is able to define macros
Any file whose name starts with an ``!`` symbol is able to define macros
that work anywhere in the project. These files, if they only contain macros,
should generally be placed right in the ``src/`` directory as opposed to
in a namespace's ``functions/`` directory, however you can place them wherever
you'd like.

It's important to note that the reason the ``@`` was chosen is that the compiler
It's important to note that the reason the ``!`` was chosen is that the compiler
goes through the ``src/`` directory in alphabetical order. This means that if you,
for example, have two namespaces, ``abc`` and ``xyz``, macros defined in ``xyz``
will not be available in ``abc``. A good idea is to begin the names of any folders
containing macro definitions with an ``@``, similar to the files. That way, they are
containing macro definitions with an ``!``, similar to the files. That way, they are
always compiled first.

Macros that contain calls to other macros can be defined in any order. If you have
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/preprocess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl Compiler {
///
/// - `tokens` - A list of tokens to look for macro calls in
/// - `return_macros` - Whether to return the HashMap of macros.
/// Used for global macros (files beginning with `@`)
/// Used for global macros (files beginning with `!`)
/// - `existing_macros` - Global macros to use
pub fn parse_macros(
&self,
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ fn main() -> std::io::Result<()> {
.unwrap()
.to_str()
.unwrap()
.starts_with('@')
.starts_with('!')
{
let ret = compile.compile(
tokens,
Expand Down

0 comments on commit 7de1b0d

Please sign in to comment.