The compiler can currently handle the include keyword.
Skipping the Lexer, the parser can find and replace the include statement as long as it is on a line by itself.
This commit is contained in:
@ -25,9 +25,20 @@ pub const TEST_OUTPUT_FILENAME: &'static str = "test.rs";
|
||||
///
|
||||
pub fn main()
|
||||
{
|
||||
let mut compiler: Compiler;
|
||||
let mut include: PathBuf;
|
||||
let mut input: PathBuf;
|
||||
let mut output: PathBuf;
|
||||
|
||||
// Create a new compiler.
|
||||
compiler = Compiler::new();
|
||||
|
||||
// Add the resource directory as an include directory
|
||||
// for the compiler.
|
||||
include = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
include.push(RESOURCE_DIR);
|
||||
compiler.register_include_dir(&include);
|
||||
|
||||
// Get the input file to test with. It is in the
|
||||
// resources directory.
|
||||
input = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
@ -41,5 +52,5 @@ pub fn main()
|
||||
output.push(TEST_OUTPUT_FILENAME);
|
||||
|
||||
println!("Compiling {:?} to {:?}", input, output);
|
||||
Compiler::compile(input, output);
|
||||
compiler.compile(input, output);
|
||||
}
|
||||
|
Reference in New Issue
Block a user