[−][src]Enum romulus::ast::Match
A match node which guard a body statement
one of the basic concepts in romulus is to trigger a body of code when a condition is meet.
Here is the basic form
<match condition> {
<actions>
}
Variants
Begin
The case where the first line should be matched
^ {
print("start!")
}
End
The case where the last line should be matched
$ {
print("end!")
}
Index(i64)
The case to run a statements when a line number is reached
1 {
print("Begin of input")
}
Regex(Box<Regex>)
The case to run statements when a line matches a regex
/(?P<type>struct|enum) +(?P<name>[_a-z0-9]+)/ {
print("${name} is a ${type}")
}
This program not only will print when romulus sees "struct SomeType", but it will also extract variables form the line and allow the statements to use elements of the line freely.
This also nests when statements in the body are matches as well.
Trait Implementations
impl PartialEq<Match> for Match
[src]
fn eq(&self, other: &Match) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Debug for Match
[src]
Auto Trait Implementations
impl Send for Match
impl Unpin for Match
impl Sync for Match
impl UnwindSafe for Match
impl !RefUnwindSafe for Match
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,