Enum snoot::Sexpr
[−]
[src]
pub enum Sexpr { List { list_type: ListType, opening_token: TokenInfo, closing_token: TokenInfo, children: Vec<Sexpr>, span: Span, }, UnaryOperator { op: TokenInfo, child: Box<Sexpr>, span: Span, }, Terminal(TokenInfo, Span), String(TokenInfo, Span), }
The S-Expression tree type.
Variants
List
An S-Expression List.
Typically looks like (...)
, [...]
, or {...}
.
Fields of List
list_type: ListType | |
opening_token: TokenInfo | |
closing_token: TokenInfo | |
children: Vec<Sexpr> | |
span: Span |
UnaryOperator
An s-expression unary operator (currently impossible to construct)
Fields of UnaryOperator
op: TokenInfo | |
child: Box<Sexpr> | |
span: Span |
Terminal(TokenInfo, Span)
A "terminal" node in the tree.
Examples: 5.0
, foo
, asdlkh23y823ysd
.
String(TokenInfo, Span)
A "string" node in the tree.
Examples: "foo"
Methods
impl Sexpr
[src]
fn text(&self) -> StrTendril
Returns the text that built this s-expression
This is a shortcut for .span().text()
.
fn kind(&self) -> SexprKind
Returns an easily-matchable SexprKind
value.
fn span(&self) -> &Span
Returns the span over the source code that this s-expression encompasses
fn last_token(&self) -> &TokenInfo
Returns the last token that contributed to building this expression
fn first_token(&self) -> &TokenInfo
Returns the first token that contrtbuted to building this expression
Trait Implementations
impl Eq for Sexpr
[src]
impl PartialEq for Sexpr
[src]
fn eq(&self, __arg_0: &Sexpr) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Sexpr) -> bool
This method tests for !=
.
impl Debug for Sexpr
[src]
impl Clone for Sexpr
[src]
fn clone(&self) -> Sexpr
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more