feat: move some token processing to the lexer

This commit is contained in:
rvcas
2023-06-30 14:57:41 -04:00
parent 2226747dc1
commit f878ef7cef
5 changed files with 91 additions and 87 deletions

View File

@@ -23,7 +23,7 @@ fn assert_definitions(code: &str, definitions: Vec<ast::UntypedDefinition>) {
)
}
macro_rules! snapshot_test {
macro_rules! assert_parse {
($name:ident, $code:expr) => {
#[test]
fn $name() {
@@ -41,23 +41,7 @@ macro_rules! snapshot_test {
};
}
snapshot_test!(snapshot_windows_newline, "use aiken/list\r\n");
#[test]
fn windows_newline() {
let code = "use aiken/list\r\n";
assert_definitions(
code,
vec![ast::UntypedDefinition::Use(Use {
location: Span::new((), 0..14),
module: vec!["aiken".to_string(), "list".to_string()],
as_name: None,
unqualified: vec![],
package: (),
})],
)
}
assert_parse!(windows_newline, "use aiken/list\r\n");
#[test]
fn can_handle_comments_at_end_of_file() {

View File

@@ -1,7 +1,7 @@
---
source: crates/aiken-lang/src/tests/parser.rs
description: "use aiken/list\r\n"
info: snapshot_windows_newline
info: windows_newline
---
Module {
name: "",