MCPcopy Create free account
hub / github.com/RustOtomeLab/RustEng / back_and_clean

Method back_and_clean

src/parser/script_parser.rs:101–124  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

99
100pub(crate) struct Parser {
101 script: Script,
102 block_index: usize,
103}
104
105impl Parser {
106 pub(crate) fn new(name: &str) -> Parser {
107 let mut script = Script::new();
108 script.set_name(name);
109 Parser {
110 script,
111 block_index: 0,
112 }
113 }
114
115 pub(crate) fn load(name: &str) -> Result<Script, EngineError> {
116 let path = format!("{}{}.reg", ENGINE_CONFIG.script_path(), name);
117 let text = fs::read_to_string(&path).map_err(|e| ScriptError::ReadFile {
118 path: path.clone(),
119 source: e,
120 })?;
121 Parser::new(name).parse(&text)
122 }
123
124 pub(crate) fn parse(mut self, text: &str) -> Result<Script, EngineError> {
125 let mut block_lines = Vec::new();
126
127 for (lineno, line) in text.lines().enumerate() {

Callers 1

show_moveMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected