1extern crate nom;
26
27#[macro_use]
28mod utils;
29#[macro_use]
30mod whitespace;
31mod commands;
32mod expressions;
33mod idents;
34mod memory;
35mod numbers;
36mod script;
37mod sections;
38mod statements;
39
40pub use commands::Command;
41pub use expressions::BinaryOperator;
42pub use expressions::Expression;
43pub use expressions::UnaryOperator;
44pub use memory::Region;
45pub use script::RootItem;
46pub use sections::DataType;
47pub use sections::OutputSectionCommand;
48pub use sections::OutputSectionConstraint;
49pub use sections::OutputSectionType;
50pub use sections::SectionCommand;
51pub use sections::SectionPattern;
52pub use statements::AssignOperator;
53pub use statements::Statement;
54
55pub fn parse(ldscript: &str) -> Result<Vec<RootItem>, String> {
57 match script::parse(ldscript) {
58 Ok((_, result)) => Ok(result),
59 Err(e) => Err(format!("Parsing failed, error: {:?}", e)),
61 }
62}