implement meta token replacement

This commit is contained in:
2025-08-24 20:54:20 +02:00
parent ddba3423df
commit 015de5dc0a
7 changed files with 128 additions and 22 deletions

View File

@@ -11,6 +11,7 @@ comments = ["^--.*", ""]
with = ["^#with ([\\w./]+)", "cat $1"]
date = ["#date_now", "date"]
user = ["#user", "user"]
test = ["#test", "cat ./mathlib.mlc"]
# Describes tokens to be replaced by identifiers and then later swapped back in after the tokenizer.
# All special tokens are treated as constants
@@ -28,7 +29,7 @@ operands = [":=", "->", "<=", ">=", "<", ">", "!", "+", "-", "/", "*", "(", ")",
terminator = [";"]
[semantics]
keywords = ["if", "then", "else", "end", "with"]
keywords = ["if", "then", "else", "end"]
[constants]
number = "(?:0b[01]+|0x[0-9a-fA-F]+|0[0-7]+|[1-9][0-9]*)"