mirror of
https://github.com/danog/parser.git
synced 2025-01-22 21:11:55 +01:00
chore: format
This commit is contained in:
parent
7bac78f039
commit
4f795e94bc
@ -179,14 +179,14 @@ impl Parser {
|
|||||||
self.semi()?;
|
self.semi()?;
|
||||||
|
|
||||||
Statement::Goto { label }
|
Statement::Goto { label }
|
||||||
},
|
}
|
||||||
TokenKind::Identifier(_) if self.peek.kind == TokenKind::Colon => {
|
TokenKind::Identifier(_) if self.peek.kind == TokenKind::Colon => {
|
||||||
let label = self.ident()?.into();
|
let label = self.ident()?.into();
|
||||||
|
|
||||||
expect!(self, TokenKind::Colon, "expected :");
|
expect!(self, TokenKind::Colon, "expected :");
|
||||||
|
|
||||||
Statement::Label { label }
|
Statement::Label { label }
|
||||||
},
|
}
|
||||||
TokenKind::HaltCompiler => {
|
TokenKind::HaltCompiler => {
|
||||||
self.next();
|
self.next();
|
||||||
|
|
||||||
@ -4096,16 +4096,12 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn simple_goto() {
|
fn simple_goto() {
|
||||||
assert_ast("<?php goto a;", &[
|
assert_ast("<?php goto a;", &[Statement::Goto { label: "a".into() }]);
|
||||||
Statement::Goto { label: "a".into() }
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn label() {
|
fn label() {
|
||||||
assert_ast("<?php a:", &[
|
assert_ast("<?php a:", &[Statement::Label { label: "a".into() }]);
|
||||||
Statement::Label { label: "a".into() }
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assert_ast(source: &str, expected: &[Statement]) {
|
fn assert_ast(source: &str, expected: &[Statement]) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user