Compare commits
2 commits
6ab52a5f66
...
dd2a73e1fd
Author | SHA1 | Date | |
---|---|---|---|
xqtc | dd2a73e1fd | ||
xqtc | ef8e57d6b1 |
|
@ -81,11 +81,11 @@
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1,
|
"lastModified": 1,
|
||||||
"narHash": "sha256-8wkkYGr1dPSnX9oVMX8D6dTOROXKOYpBTKfriA0sEBI=",
|
"narHash": "sha256-8wkkYGr1dPSnX9oVMX8D6dTOROXKOYpBTKfriA0sEBI=",
|
||||||
"path": "/nix/store/hprrr24yh5w0pbbbz2hlwblriaqb99kx-source/flake.systems.nix",
|
"path": "/nix/store/3447wnbwfkgd91v8x0d3hj48hvb2h010-source/flake.systems.nix",
|
||||||
"type": "path"
|
"type": "path"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"path": "/nix/store/hprrr24yh5w0pbbbz2hlwblriaqb99kx-source/flake.systems.nix",
|
"path": "/nix/store/3447wnbwfkgd91v8x0d3hj48hvb2h010-source/flake.systems.nix",
|
||||||
"type": "path"
|
"type": "path"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -13,12 +13,13 @@
|
||||||
# Dev tools
|
# Dev tools
|
||||||
treefmt-nix.url = "github:numtide/treefmt-nix";
|
treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||||
};
|
};
|
||||||
inputs.systems.url = "./flake.systems.nix";
|
|
||||||
inputs.systems.flake = false;
|
|
||||||
|
|
||||||
outputs = inputs:
|
outputs = inputs:
|
||||||
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
||||||
systems = import inputs.systems;
|
systems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
];
|
||||||
imports = [
|
imports = [
|
||||||
inputs.treefmt-nix.flakeModule
|
inputs.treefmt-nix.flakeModule
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[
|
|
||||||
"x86_64-linux"
|
|
||||||
"aarch64-linux"
|
|
||||||
]
|
|
14
src/lib.rs
14
src/lib.rs
|
@ -59,6 +59,20 @@ pub struct Lexer {
|
||||||
pub current_char: Option<char>,
|
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 {
|
impl Lexer {
|
||||||
/// Instantiates the [`Lexer`]
|
/// Instantiates the [`Lexer`]
|
||||||
pub fn new(input: &str) -> Self {
|
pub fn new(input: &str) -> Self {
|
||||||
|
|
Loading…
Reference in a new issue