forked from AbleScript/ablescript
Merge branch 'feature/coercions' of ssh://git.ablecorp.us:20/AbleScript/able-script into feature/coercions
This commit is contained in:
commit
b6413f6219
|
@ -37,12 +37,7 @@ impl<'source> Parser<'source> {
|
||||||
Token::Comment => continue,
|
Token::Comment => continue,
|
||||||
|
|
||||||
// T-Dark block (replace `lang` with `script`)
|
// T-Dark block (replace `lang` with `script`)
|
||||||
Token::TDark => {
|
Token::TDark => ast.extend(self.tdark_flow()?.block),
|
||||||
self.tdark = true;
|
|
||||||
let mut block = self.get_block()?;
|
|
||||||
ast.append(&mut block.block);
|
|
||||||
self.tdark = false;
|
|
||||||
}
|
|
||||||
token => ast.push(self.parse(token)?),
|
token => ast.push(self.parse(token)?),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -329,12 +324,21 @@ impl<'source> Parser<'source> {
|
||||||
loop {
|
loop {
|
||||||
match self.checked_next()? {
|
match self.checked_next()? {
|
||||||
Token::RightCurly => break,
|
Token::RightCurly => break,
|
||||||
|
Token::TDark => block.extend(self.tdark_flow()?.block),
|
||||||
t => block.push(self.parse(t)?),
|
t => block.push(self.parse(t)?),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(Block { block })
|
Ok(Block { block })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Parse T-Dark block
|
||||||
|
fn tdark_flow(&mut self) -> Result<Block, Error> {
|
||||||
|
self.tdark = true;
|
||||||
|
let block = self.get_block();
|
||||||
|
self.tdark = false;
|
||||||
|
block
|
||||||
|
}
|
||||||
|
|
||||||
/// If Statement parser gets any kind of value (Identifier or Literal)
|
/// If Statement parser gets any kind of value (Identifier or Literal)
|
||||||
/// It cannot parse it as it do not parse expressions. Instead of it it
|
/// It cannot parse it as it do not parse expressions. Instead of it it
|
||||||
/// will parse it to function call or print statement.
|
/// will parse it to function call or print statement.
|
||||||
|
|
Loading…
Reference in a new issue