Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcosAndradeV committed Jan 28, 2025
1 parent fb5434d commit b96b0be
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 33 deletions.
33 changes: 0 additions & 33 deletions chs_ast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,3 @@ pub fn parse_file(file_path: String) -> CHSResult<Module> {
Err(err) => chs_error!("{}", err)
}
}


#[cfg(test)]
mod tests {
use nodes::TypedModule;

use super::*;

#[test]
fn check_simple_file() {
match Parser::new(Lexer::new(
file!().into(),
r#"
type v void
type print_int fn(int) -> v
fn main()
print_int(100)
end
"#
.into(),
))
.parse()
{
Ok(m) => {
let res = TypedModule::from_module(m);
assert!(res.is_ok(), "{}", res.unwrap_err());
}
Err(err) => {
assert!(false, "{err}");
}
}
}
}
1 change: 1 addition & 0 deletions chs_ast/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ impl Parser {
Ident if ttoken.val_eq("void") => CHSType::Void,
Ident if ttoken.val_eq("bool") => CHSType::Boolean,
Ident if ttoken.val_eq("char") => CHSType::Char,
Ident if ttoken.val_eq("string") => CHSType::String,
Ident => CHSType::Alias(ttoken.value),
Asterisk => {
let ttp = self.parse_type()?;
Expand Down

0 comments on commit b96b0be

Please sign in to comment.