aboutsummaryrefslogtreecommitdiff
path: root/src/parse/ast
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2021-11-21 14:52:50 +0100
committerMel <einebeere@gmail.com>2021-11-21 14:52:50 +0100
commitabaa72af8a1be00f3f84d7771a7994bfbbccf719 (patch)
treeb47edcef38cf7bdebae99428510b9fc8857f41bd /src/parse/ast
parent395d086f0dce355ccdcf3da149c309826c539b48 (diff)
downloadrabbithole-abaa72af8a1be00f3f84d7771a7994bfbbccf719.tar.zst
rabbithole-abaa72af8a1be00f3f84d7771a7994bfbbccf719.zip
Rename all Variants to Kinds
Diffstat (limited to 'src/parse/ast')
-rw-r--r--src/parse/ast/nodes.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/parse/ast/nodes.rs b/src/parse/ast/nodes.rs
index c4bb1e8..16d0eaa 100644
--- a/src/parse/ast/nodes.rs
+++ b/src/parse/ast/nodes.rs
@@ -1,4 +1,4 @@
-use crate::lex::token::{Token, TokenVariant::*};
+use crate::lex::token::{Token, TokenKind::*};
use super::{expression::Expression, statement::Statement};
@@ -23,7 +23,7 @@ pub enum BinaryOperator {
impl BinaryOperator {
pub fn from_token(token: Token) -> Self {
- match token.variant {
+ match token.kind {
OpPlus => Self::Plus,
OpMinus => Self::Minus,
OpStar => Self::Star,
@@ -39,7 +39,7 @@ impl BinaryOperator {
Assign => Self::Assign,
ConstAssign => Self::ConstAssign,
Dot => Self::Dot,
- _ => panic!("Can't create binary operator from '{:?}'.", token.variant),
+ _ => panic!("Can't create binary operator from '{:?}'.", token.kind),
}
}
}
@@ -52,10 +52,10 @@ pub enum UnaryOperator {
impl UnaryOperator {
pub fn from_token(token: Token) -> Self {
- match token.variant {
+ match token.kind {
OpMinus => Self::Minus,
OpNot => Self::Not,
- _ => panic!("Can't create unary operator from '{:?}'.", token.variant),
+ _ => panic!("Can't create unary operator from '{:?}'.", token.kind),
}
}
}
@@ -69,12 +69,12 @@ pub enum SimpleLiteral {
impl SimpleLiteral {
pub fn from_token(token: Token) -> Self {
- match token.variant {
+ match token.kind {
Int(int) => Self::Int(int),
Float(float) => Self::Float(float),
KeywordTrue => Self::Bool(true),
KeywordFalse => Self::Bool(false),
- _ => panic!("Can't create literal from '{:?}'.", token.variant),
+ _ => panic!("Can't create literal from '{:?}'.", token.kind),
}
}
}
@@ -115,7 +115,7 @@ pub struct StrNode {
#[derive(Debug, Clone)]
pub enum StrPart {
Literal(String),
- Embed(Expression)
+ Embed(Expression),
}
#[derive(Debug, Clone)]