-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try to make generators work (but they dont yet) #52
- Loading branch information
Showing
5 changed files
with
106 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#![feature(nll)] | ||
#![feature(generators, generator_trait)] | ||
|
||
extern crate core; | ||
#[macro_use] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use mango::io::typ::Reader; | ||
use mango::token::tokens::LiteralToken; | ||
use mango::token::Tokens; | ||
use std::cell::RefCell; | ||
use std::ops::Generator; | ||
use std::rc::Rc; | ||
|
||
/// This generator does the real lexing work, but is wrapped in a normal | ||
/// class to satisfy an interface that doesn't expose nightly or unsafe features. | ||
//struct GenCodeLexer<G: Generator<Yield = Tokens, Return = ()>> { | ||
// generator: G | ||
//} | ||
// | ||
//impl<G: Generator<Yield = Tokens, Return = ()>> GenCodeLexer<G> { | ||
// pub fn new() -> Self { | ||
// let mut reader: Rc<RefCell<Reader>>; | ||
// GenCodeLexer{ generator: 0 } | ||
// } | ||
//} | ||
|
||
struct Container<G: Generator<Yield = i32, Return = ()>> { | ||
generator: G, | ||
} | ||
|
||
impl<G: Generator<Yield = i32, Return = ()>> Container<G> { | ||
pub fn new() -> Self { | ||
let mut reader: Rc<RefCell<Reader>>; | ||
Container { | ||
generator: || { | ||
yield 0; | ||
}, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
pub mod typ; | ||
|
||
pub mod code_lexer; | ||
mod gen_code_lexer; | ||
|
||
pub mod comment_lexer; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters