pub enum Instr {
Show 22 variants Any(usize), BackCommit(usize), Call(usize), Char(u8), Choice(usize), Commit(usize), End, EndFail, Fail, FailTwice, Jump(usize), Label(usize), Nop, PartialCommit(usize), Return, Set(NormalSet), Span(NormalSet), TestAny(usizeusize), TestChar(u8usize), TestCharNoChoice(u8usize), TestSet(NormalSetusize), TestSetNoChoice(NormalSetusize),
}
Expand description

List of Instructions

Variants

Any(usize)

Advances ip and consume n u8 from subject if possible, fails otherwise. Fails only by reaching the end of the subject.

BackCommit(usize)

pops backtrack entry from the stack, updates sp and jumps to usize

Call(usize)

Pushes the next IP to the stack as a return address and jumps to usize. Used to implement non-terminals.

Char(u8)

Increment IP and Consume u8 if it matches, ip becomes None otherwise.

Choice(usize)

Pushes a backtrack entry storing u8 and sp so that parser can backtrack to this position later and parse a different pattern.

Commit(usize)

Pops the top entry off the stack and jumps to usize. Allows the machine to commit to a state and discard a backtrack entry.

End

Ends matching and accepts the subject.

EndFail

Ends matching and rejects the subject.

Fail

Sets ip to None.

FailTwice

pops top entry from the stack and sets IP to None

Jump(usize)

Sets ip Index to usize.

Label(usize)

used to mark a location in the instruction code with an unique ID. Maybe we could get rid of that ? Likely to be deleted as Label will probably become a HashMap<Label, Program[index]

Nop

No operation Likely to be deleted ?

PartialCommit(usize)

Commit and Choice in 1 instruction

Return

Pops a return address from the stack and jumps to it.

Set(NormalSet)

advances ip and consumes u8 from subject if contained in character set NormalSet. Goes to Instr::Fail state otherwise.

Span(NormalSet)

TestAny(usizeusize)

checks if there is at least 1st arg characters remaining -> pushes backtrack entry and advances sp by 1st arg. if not jumps to 2nd arg.

TestChar(u8usize)

checks if 1st arg matches at current sp -> pushes backtrack entry on stack and advances sp. if not, jumps to 2nd arg.

TestCharNoChoice(u8usize)

checks if 1st arg matches at sp -> advances sp. if not jumps to 2nd arg.

TestSet(NormalSetusize)

checks if 1st arg (Set) matches at current sp -> pushes backtrack entry on stack and advances sp. if not, jumps to 2nd arg.

TestSetNoChoice(NormalSetusize)

Checks if NormalSet matches at sp -> advances sp. If not jumps to 2nd arg.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Converts self into T using Into<T>. Read more

Causes self to use its Binary implementation when Debug-formatted. Read more

Causes self to use its Display implementation when Debug-formatted. Read more

Causes self to use its LowerExp implementation when Debug-formatted. Read more

Causes self to use its LowerHex implementation when Debug-formatted. Read more

Causes self to use its Octal implementation when Debug-formatted. Read more

Causes self to use its Pointer implementation when Debug-formatted. Read more

Causes self to use its UpperExp implementation when Debug-formatted. Read more

Causes self to use its UpperHex implementation when Debug-formatted. Read more

Formats each item in a sequence. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Pipes by value. This is generally the method you want to use. Read more

Borrows self and passes that borrow into the pipe function. Read more

Mutably borrows self and passes that borrow into the pipe function. Read more

Borrows self, then passes self.borrow() into the pipe function. Read more

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more

Borrows self, then passes self.as_ref() into the pipe function.

Mutably borrows self, then passes self.as_mut() into the pipe function. Read more

Borrows self, then passes self.deref() into the pipe function.

Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more

Immutable access to a value. Read more

Mutable access to a value. Read more

Immutable access to the Borrow<B> of a value. Read more

Mutable access to the BorrowMut<B> of a value. Read more

Immutable access to the AsRef<R> view of a value. Read more

Mutable access to the AsMut<R> view of a value. Read more

Immutable access to the Deref::Target of a value. Read more

Mutable access to the Deref::Target of a value. Read more

Calls .tap() only in debug builds, and is erased in release builds.

Calls .tap_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more

Attempts to convert self into T using TryInto<T>. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.