feat: add initial plot.py module with beast visualization logic

This commit introduces the core plotting module for the beast project, including
the initial implementation of data visualization functions and chart generation
utilities. The module provides the foundational structure for rendering beast-related
metrics and graphical outputs.
This commit is contained in:
2025-12-02 05:54:32 +00:00
commit f9c7a0fa78
58 changed files with 9092 additions and 0 deletions
+74
View File
@@ -0,0 +1,74 @@
#include "lexer.h"
#include <string.h>
typedef struct {
const char *keyword;
RavaTokenType_e type;
} RavaKeyword_t;
static const RavaKeyword_t KEYWORDS[] = {
{"abstract", RAVA_TOKEN_KEYWORD_ABSTRACT},
{"assert", RAVA_TOKEN_KEYWORD_ASSERT},
{"boolean", RAVA_TOKEN_KEYWORD_BOOLEAN},
{"break", RAVA_TOKEN_KEYWORD_BREAK},
{"byte", RAVA_TOKEN_KEYWORD_BYTE},
{"case", RAVA_TOKEN_KEYWORD_CASE},
{"catch", RAVA_TOKEN_KEYWORD_CATCH},
{"char", RAVA_TOKEN_KEYWORD_CHAR},
{"class", RAVA_TOKEN_KEYWORD_CLASS},
{"const", RAVA_TOKEN_KEYWORD_CONST},
{"continue", RAVA_TOKEN_KEYWORD_CONTINUE},
{"default", RAVA_TOKEN_KEYWORD_DEFAULT},
{"do", RAVA_TOKEN_KEYWORD_DO},
{"double", RAVA_TOKEN_KEYWORD_DOUBLE},
{"else", RAVA_TOKEN_KEYWORD_ELSE},
{"enum", RAVA_TOKEN_KEYWORD_ENUM},
{"extends", RAVA_TOKEN_KEYWORD_EXTENDS},
{"false", RAVA_TOKEN_LITERAL_FALSE},
{"final", RAVA_TOKEN_KEYWORD_FINAL},
{"finally", RAVA_TOKEN_KEYWORD_FINALLY},
{"float", RAVA_TOKEN_KEYWORD_FLOAT},
{"for", RAVA_TOKEN_KEYWORD_FOR},
{"goto", RAVA_TOKEN_KEYWORD_GOTO},
{"if", RAVA_TOKEN_KEYWORD_IF},
{"implements", RAVA_TOKEN_KEYWORD_IMPLEMENTS},
{"import", RAVA_TOKEN_KEYWORD_IMPORT},
{"instanceof", RAVA_TOKEN_KEYWORD_INSTANCEOF},
{"int", RAVA_TOKEN_KEYWORD_INT},
{"interface", RAVA_TOKEN_KEYWORD_INTERFACE},
{"long", RAVA_TOKEN_KEYWORD_LONG},
{"native", RAVA_TOKEN_KEYWORD_NATIVE},
{"new", RAVA_TOKEN_KEYWORD_NEW},
{"null", RAVA_TOKEN_LITERAL_NULL},
{"package", RAVA_TOKEN_KEYWORD_PACKAGE},
{"private", RAVA_TOKEN_KEYWORD_PRIVATE},
{"protected", RAVA_TOKEN_KEYWORD_PROTECTED},
{"public", RAVA_TOKEN_KEYWORD_PUBLIC},
{"return", RAVA_TOKEN_KEYWORD_RETURN},
{"short", RAVA_TOKEN_KEYWORD_SHORT},
{"static", RAVA_TOKEN_KEYWORD_STATIC},
{"strictfp", RAVA_TOKEN_KEYWORD_STRICTFP},
{"super", RAVA_TOKEN_KEYWORD_SUPER},
{"switch", RAVA_TOKEN_KEYWORD_SWITCH},
{"synchronized", RAVA_TOKEN_KEYWORD_SYNCHRONIZED},
{"this", RAVA_TOKEN_KEYWORD_THIS},
{"throw", RAVA_TOKEN_KEYWORD_THROW},
{"throws", RAVA_TOKEN_KEYWORD_THROWS},
{"transient", RAVA_TOKEN_KEYWORD_TRANSIENT},
{"true", RAVA_TOKEN_LITERAL_TRUE},
{"try", RAVA_TOKEN_KEYWORD_TRY},
{"void", RAVA_TOKEN_KEYWORD_VOID},
{"volatile", RAVA_TOKEN_KEYWORD_VOLATILE},
{"while", RAVA_TOKEN_KEYWORD_WHILE},
};
static const size_t KEYWORDS_COUNT = sizeof(KEYWORDS) / sizeof(KEYWORDS[0]);
RavaTokenType_e rava_lexer_lookup_keyword(const char *identifier) {
for (size_t i = 0; i < KEYWORDS_COUNT; i++) {
if (strcmp(identifier, KEYWORDS[i].keyword) == 0) {
return KEYWORDS[i].type;
}
}
return RAVA_TOKEN_IDENTIFIER;
}