Compare commits
2 Commits
889e078328
...
2df63504e0
Author | SHA1 | Date |
---|---|---|
mars | 2df63504e0 | |
mars | bc4d58ffa2 |
|
@ -133,12 +133,10 @@ impl<'a> Iterator for Lexer<'a> {
|
|||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
while let Some(tok) = self.inner.next() {
|
||||
println!("ate: {:?}", tok);
|
||||
if tok == Token::Newline {
|
||||
self.line_start = self.inner.span().end;
|
||||
self.line_num += 1;
|
||||
} else {
|
||||
println!("{}", self.get_info());
|
||||
return Some(tok);
|
||||
}
|
||||
}
|
||||
|
|
10
src/lib.rs
10
src/lib.rs
|
@ -42,7 +42,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn lex_file() {
|
||||
let source = include_str!("ast_fn.ktn");
|
||||
let source = include_str!("ast_fn.fae");
|
||||
let theme = ColorTheme::new();
|
||||
let mut lex = lexer::Lexer::new(source);
|
||||
|
||||
|
@ -56,7 +56,7 @@ mod tests {
|
|||
// TODO use spans to color-code instead of raw tokens, to show original whitespace
|
||||
/*#[test]
|
||||
fn color_file() {
|
||||
let source = include_str!("../example.ktn");
|
||||
let source = include_str!("../example.fae");
|
||||
let theme = ColorTheme::new();
|
||||
let mut lex = Token::lexer(source);
|
||||
|
||||
|
@ -74,16 +74,16 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn ast_fn() {
|
||||
print_ast(include_str!("ast_fn.ktn"));
|
||||
print_ast(include_str!("ast_fn.fae"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ast_struct() {
|
||||
print_ast(include_str!("ast_struct.ktn"));
|
||||
print_ast(include_str!("ast_struct.fae"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ast_example() {
|
||||
print_ast(include_str!("../example.ktn"));
|
||||
print_ast(include_str!("../example.fae"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue