Skip to content
Snippets Groups Projects
Commit fc489d31 authored by Arthur B's avatar Arthur B
Browse files

Correct Camelcase for exercise 1. All tests for exercise 1 were passed

parent be0eb6b9
Branches
No related merge requests found
......@@ -4,85 +4,75 @@ use logos::Logos;
pub enum C1Token {
// TODO: Define variants and their token/regex
#[token("bool")]
KW_BOOLEAN,
KwBoolean,
#[token("do")]
KW_DO,
KwDo,
#[token("else")]
KW_ELSE,
KwElse,
#[token("float")]
KW_FLOAT,
KwFloat,
#[token("for")]
KW_FOR,
KwFor,
#[token("if")]
KW_IF,
KwIf,
#[token("int")]
KW_INT,
KwInt,
#[token("printf")]
KW_PRINTF,
KwPrintf,
#[token("return")]
KW_RETURN,
KwReturn,
#[token("void")]
KW_VOID,
KwVoid,
#[token("while")]
KW_WHILE,
KwWhile,
#[token("+")]
PLUS,
Plus,
#[token("-")]
MINUS,
Minus,
#[token("*")]
ASTERISK,
Asterisk,
#[token("/")]
SLASH,
Slash,
#[token("=")]
ASSIGN,
Assign,
#[token("==")]
EQ,
Eq,
#[token("!=")]
NEQ,
Neq,
#[token("<")]
LSS,
Lss,
#[token(">")]
GRT,
Grt,
#[token("<=")]
LEQ,
Leq,
#[token(">=")]
GEQ,
Geq,
#[token("&&")]
AND,
And,
#[token("||")]
OR,
Or,
#[token(",")]
COMMA,
Comma,
#[token(";")]
SEMICOLON,
Semicolon,
#[token("(")]
LPAREN,
LParen,
#[token(")")]
RPAREN,
RParen,
#[token("{")]
LBRACE,
LBrace,
#[token("}")]
RBRACE,
/*
#[regex("[0-9]")]
DIGIT,
RBrace,
#[regex(r#"[0-9]+"#)]
INTEGER,
#[regex(r#"[0-9]+\.[0-9]+|\.[0-9]+"#)]
FLOAT,
#[regex("[a-zA-Z]")]
LETTER,*/
//termvar
#[regex(r#"[0-9]+"#)]
CONST_INT,
ConstInt,
#[regex(r#"([0-9]+\.[0-9]+|\.[0-9]+)([eE]([-+])?[0-9]+)?|[0-9]+[eE]([-+])?[0-9]+"#)]
CONST_FLOAT,
ConstFloat,
#[regex("true|false")]
CONST_BOOLEAN,
ConstBoolean,
#[regex("\"[^\n\"]*\"")]
CONST_STRING,
ConstString,
#[regex(r#"[a-zA-Z]+([0-9]|[a-zA-Z])*"#)]
ID,
Id,
// Logos requires one token variant to handle errors,
// it can be named anything you wish.
#[error]
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment