Skip to content
Merged

Dev #28

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2026 Vexil Lang
Copyright (c) 2026 Azin Lang

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
36 changes: 34 additions & 2 deletions libs/frontend/lexer/src/lexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,39 @@ auto lexer::scan_token(std::vector<token>& tokens) -> void {
case ':':
emit(tokens, token_kind::colon, start, line, column);
break;

case '%':
emit(tokens, token_kind::modulo, start, line, column);
break;
case '^':
emit(tokens, token_kind::caret, start, line, column);
break;
case '~':
emit(tokens, token_kind::tilde, start, line, column);
break;
case '.':
emit(tokens, token_kind::dot, start, line, column);
break;
case '[':
emit(tokens, token_kind::left_bracket, start, line, column);
break;
case ']':
emit(tokens, token_kind::right_bracket, start, line, column);
break;
case '|':
if (match('|')) {
emit(tokens, token_kind::logical_or, start, line, column);
} else {
emit(tokens, token_kind::pipe, start, line, column);
}
break;
case '&':
if (match('&')) {
emit(tokens, token_kind::logical_and, start, line, column);
} else {
emit(tokens, token_kind::ampersand, start, line, column);
}
break;

default:
// temporary, it should continue lexing
// with a diagnostic
Expand Down Expand Up @@ -456,4 +488,4 @@ auto lexer::identifier_kind(std::string_view lexeme) noexcept
return token_kind::identifier;
}

} // namespace azc::frontend
} // namespace azc::frontend
22 changes: 21 additions & 1 deletion libs/frontend/token/include/azin/token.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ namespace azc::frontend {
greater,
greater_equal,
arrow,
modulo,
pipe,
logical_or,
logical_and,
ampersand,
caret, // ^, bitwise XOR
tilde, // ~, bitwise NOT

// Delimiters
left_paren,
Expand All @@ -59,6 +66,9 @@ namespace azc::frontend {
comma,
semicolon,
colon,
dot,
left_bracket,
right_bracket,

eof,
};
Expand Down Expand Up @@ -106,15 +116,25 @@ namespace azc::frontend {
case token_kind::greater: return "greater";
case token_kind::greater_equal: return "greater_equal";
case token_kind::arrow: return "arrow";
case token_kind::modulo: return "modulo";
case token_kind::ampersand: return "ampersand";
case token_kind::pipe: return "pipe";
case token_kind::caret: return "caret";
case token_kind::tilde: return "tilde";
case token_kind::logical_or: return "logical_or";
case token_kind::logical_and: return "logical_and";

// Delimiters
case token_kind::left_paren: return "left_paren";
case token_kind::right_paren: return "right_paren";
case token_kind::left_brace: return "left_brace";
case token_kind::right_brace: return "right_brace";
case token_kind::comma: return "comma";
case token_kind::dot: return "dot";
case token_kind::semicolon: return "semicolon";
case token_kind::colon: return "colon";
case token_kind::right_bracket: return "right_bracket";
case token_kind::left_bracket: return "left_bracket";

case token_kind::eof: return "eof";
}
Expand All @@ -137,4 +157,4 @@ namespace azc::frontend {
std::size_t column;
};

} // namespace azc::frontend
} // namespace azc::frontend
Loading