[][src]Struct scdlang::Scdlang

pub struct Scdlang<'g> {
    pub semantic_error: bool,
    // some fields omitted
}

Core parser and also Builder.

Examples

This example is not tested
use scdlang::semantics::Kind;

let mut parser = Scdlang::new();
parser.with_err_path("test.scl")

for semantic_type in iter_from(source)? {
	match semantic_type {
		Kind::Expression(expr) => {/* expr.[methods] */}
		Kind::Statement(stmnt) => {/* stmnt.[methods] */}
		Kind::Declaration(declr) => {
			/*
			declr.expressions.[methods] // access each expressions
			declr.statements.[methods] //access each statements
			*/
		}
	}
}

Fields

semantic_error: bool

Methods

impl<'s> Scdlang<'s>[src]

pub fn new() -> Self[src]

This method is prefered for instantiating than using Default::default()

pub fn finish(self) -> Result<Self, Error>[src]

Call this when Drop cause panic!.

Manually drop this object which can return Err(Deadlock), useful when in multi-thread process.

impl<'g> Scdlang<'g>[src]

pub fn parse(&self, source: &'g str) -> Result<Pairs<Rule>, Error>[src]

Parse from source and also reformat the error messages.

pub fn parse_from(source: &str) -> Result<Pairs<Rule>, Error>[src]

Parse from source but don't modify or fix the error messages.

pub fn iter_from(&self, source: &'g str) -> Result<Vec<Kind>, Error>[src]

Parse from source then iterate. This is the preferred methods for implementing transpiler, codegen, or compiler.

Trait Implementations

impl<'g> Builder<'g> for Scdlang<'g>[src]

impl<'g> Drop for Scdlang<'g>[src]

impl<'g> Default for Scdlang<'g>[src]

impl<'g> Clone for Scdlang<'g>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<'_> Display for Scdlang<'_>[src]

impl<'g> Parser<Rule> for Scdlang<'g>[src]

Auto Trait Implementations

impl<'g> Send for Scdlang<'g>

impl<'g> Unpin for Scdlang<'g>

impl<'g> Sync for Scdlang<'g>

impl<'g> UnwindSafe for Scdlang<'g>

impl<'g> RefUnwindSafe for Scdlang<'g>

Blanket Implementations

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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