pub enum Op {
Show 60 variants
Do,
As,
Block,
Array,
ArRep,
Group,
Tuple,
MetaInner,
MetaOuter,
Try,
Index,
Call,
Pub,
Const,
Static,
Macro,
Loop,
If,
While,
Break,
Return,
Continue,
Dot,
RangeEx,
RangeIn,
Neg,
Not,
Identity,
Refer,
Deref,
Mul,
Div,
Rem,
Add,
Sub,
Shl,
Shr,
And,
Xor,
Or,
Lt,
Leq,
Eq,
Neq,
Geq,
Gt,
LogAnd,
LogXor,
LogOr,
Set,
MulSet,
DivSet,
RemSet,
AddSet,
SubSet,
ShlSet,
ShrSet,
AndSet,
XorSet,
OrSet,
}Expand description
Conlang’s AST is partitioned by data representation, so it considers any expression which is composed solely of keywords, symbols, and other expressions as operator expressions.
This includes:
- Do-sequence expressions:
Expr ; Expr - Type-cast expressions
Expr as Expr - Binding-modifier expressions:
pub Expr,#[Expr] Expr - Block and Group expressions:
{Expr?},(Expr?) - Control flow:
if,while,loop,match,break,return - Function calls
Expr (Expr,*) - Traditional binary and unary operators (add, sub, neg, assign)
Variants§
Do
Expr (; Expr)*
As
Expr as Expr
Block
{ Expr }
Array
[ Expr,* ]
ArRep
[ Expr ; Expr ]
Group
( Expr )
Tuple
Expr (, Expr)*
MetaInner
#![ Expr ]
MetaOuter
#[ Expr ]
Try
Expr '?'
Index
Expr [ Expr ]
Call
Expr ( Expr )
Pub
pub Expr
Const
const Expr
Static
static Expr
Macro
macro Expr
Loop
loop Expr
If
if Expr Expr (else Expr)?
While
while Expr Expr (else Expr)?
Break
break Expr
Return
return Expr
Continue
continue
Dot
Expr . Expr
RangeEx
Expr? ..Expr
RangeIn
Expr? ..=Expr
Neg
-Expr
Not
!Expr
Identity
!!Expr
Refer
&Expr
Deref
*Expr
Mul
Expr * Expr
Div
Expr / Expr
Rem
Expr % Expr
Add
Expr + Expr
Sub
Expr - Expr
Shl
Expr << Expr
Shr
Expr >> Expr
And
Expr & Expr
Xor
Expr ^ Expr
Or
Expr | Expr
Lt
Expr < Expr
Leq
Expr <= Expr
Eq
Expr == Expr
Neq
Expr != Expr
Geq
Expr >= Expr
Gt
Expr > Expr
LogAnd
Expr && Expr
LogXor
Expr ^^ Expr
LogOr
Expr || Expr
Set
Expr = Expr
MulSet
Expr *= Expr
DivSet
Expr /= Expr
RemSet
Expr %= Expr
AddSet
Expr += Expr
SubSet
Expr -= Expr
ShlSet
Expr <<= Expr
ShrSet
Expr >>= Expr
AndSet
Expr &= Expr
XorSet
Expr ^= Expr
OrSet
Expr |= Expr
Trait Implementations§
Source§impl<A: AstTypes> Match<A> for Op
impl<A: AstTypes> Match<A> for Op
Source§fn recurse(_: &mut Subst<A>, pat: &Self, expr: &Self) -> bool
fn recurse(_: &mut Subst<A>, pat: &Self, expr: &Self) -> bool
Source§fn apply_rule(&mut self, pat: &Self, template: &Self) -> bool
fn apply_rule(&mut self, pat: &Self, template: &Self) -> bool
pat to template on self