Compare commits

...

2 commits

Author SHA1 Message Date
xqtc dd2a73e1fd Add lex! macro
Some checks failed
/ build (push) Failing after 1m40s
/ clippy (push) Successful in 1m43s
2024-07-12 17:55:43 +02:00
xqtc ef8e57d6b1 remove flake.systems.nix 2024-07-12 17:54:49 +02:00
4 changed files with 20 additions and 9 deletions

View file

@ -81,11 +81,11 @@
"locked": {
"lastModified": 1,
"narHash": "sha256-8wkkYGr1dPSnX9oVMX8D6dTOROXKOYpBTKfriA0sEBI=",
"path": "/nix/store/hprrr24yh5w0pbbbz2hlwblriaqb99kx-source/flake.systems.nix",
"path": "/nix/store/3447wnbwfkgd91v8x0d3hj48hvb2h010-source/flake.systems.nix",
"type": "path"
},
"original": {
"path": "/nix/store/hprrr24yh5w0pbbbz2hlwblriaqb99kx-source/flake.systems.nix",
"path": "/nix/store/3447wnbwfkgd91v8x0d3hj48hvb2h010-source/flake.systems.nix",
"type": "path"
}
},

View file

@ -13,12 +13,13 @@
# Dev tools
treefmt-nix.url = "github:numtide/treefmt-nix";
};
inputs.systems.url = "./flake.systems.nix";
inputs.systems.flake = false;
outputs = inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = import inputs.systems;
systems = [
"x86_64-linux"
"aarch64-linux"
];
imports = [
inputs.treefmt-nix.flakeModule
];

View file

@ -1,4 +0,0 @@
[
"x86_64-linux"
"aarch64-linux"
]

View file

@ -59,6 +59,20 @@ pub struct Lexer {
pub current_char: Option<char>,
}
/// Instantiates Lexer and retrieves Tokens of given source.
/// Returns Arc<[Token]>
/// Equivalent to:
/// ```
/// let source = "some source";
/// let lexed = Lexer::new(source).get_tokens();
/// ```
#[macro_export]
macro_rules! lex {
($source:expr) => {{
$crate::Lexer::get_tokens(&mut $crate::Lexer::new($source))
}};
}
impl Lexer {
/// Instantiates the [`Lexer`]
pub fn new(input: &str) -> Self {