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

Method parse_script

src/parser/script_parser.rs:130–151  ·  view source on GitHub ↗
(&mut self, text: &str)

Source from the content-addressed store, hash-verified

128 let line = line.trim();
129 if line.is_empty() {
130 if !block_lines.is_empty() {
131 self.parse_block(&block_lines)?;
132 block_lines.clear();
133 }
134 } else {
135 block_lines.push((lineno + 1, line.to_string()));
136 }
137 }
138
139 if !block_lines.is_empty() {
140 self.parse_block(&block_lines)?;
141 }
142
143 Ok(self.script)
144 }
145
146 fn parse_block(&mut self, lines: &[(usize, String)]) -> Result<(), EngineError> {
147 use Command::*;
148 use Commands::*;
149
150 let mut block_commands = Vec::new();
151
152 for (index, (line_num, line)) in lines.iter().enumerate() {
153 if let Some(line) = line.strip_prefix('@') {
154 if let Some((cmd, arg)) = line.split_once(' ') {

Callers 1

with_nameMethod · 0.80

Calls 2

parse_blockMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected