[][src]Enum romulus::ast::Match

pub enum Match {
    Begin,
    End,
    Index(i64),
    Regex(Box<Regex>),
}

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]

#[must_use] fn ne(&self, other: &Rhs) -> bool1.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]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]