Create basic linter
This commit is contained in:
parent
e90a4495e7
commit
467a24766f
40
first.jai
40
first.jai
@ -1,39 +1,4 @@
|
||||
ascii_car : string = #string DONE
|
||||
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⡤⢤⣶⣶⣶⣶⣶⣒⣒⣀⣺⣿⣿⠿⢶⣶⣶⣶⣦⣤⣤⣤⣄⣀⣀⣀⣀⡀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⠴⠚⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠛⠒⠲⠦⢤⣉⠙⣿⣿⣿⣟⢿⣿⠿⠿⠿⢿⣿
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣶⣷⡦⠞⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⡇⠀⠈⠛⢿⣿⡀⠀⠀⠀⠻
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣤⠤⢴⣿⣉⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠇⠀⠀⠀⠀⠙⣿⣄⡀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣤⣤⡶⠞⠛⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠓⠒⠒⠢⠤⠤⣄⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⠀⢠⠤⠤⠤⣤⣾⠀⠙⢦⡀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⣠⠴⣾⣛⣩⢴⣿⠿⠶⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠙⠒⠒⠒⠤⠤⢤⣤⣾⢿⣴⢏⣀⣀⣤⡼⠻⡆⠀⠈⢷
|
||||
⠀⠀⠀⠀⠀⢀⣴⠋⠁⠀⠀⠀⠀⠙⠓⠲⠤⠬⠷⠀⠀⢀⣀⣀⣀⣀⣀⣀⣀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⠤⠞⠉⠀⠀⠹⡟⠀⠀⠀⠀⠀⢱⠀⢠⣼
|
||||
⠀⠀⠀⣀⡴⠋⠈⢙⡞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠛⠢⠤⢄⣀⣠⠴⠛⣋⣠⠴⠒⠉⠉⢉⣲⠶⠀⣀⡠⠤⠒⠊⠉⠁⠀⠀⠀⠀⠀⠀⠀⢹⠀⠀⠀⠀⠀⣼⢰⣿⣿
|
||||
⡀⣠⣼⠏⠀⠀⣰⠟⠦⢤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠓⠒⠒⠒⠋⣉⠤⠒⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⢀⣯⣼⣿⣿
|
||||
⡟⠋⠹⢤⣠⠞⠁⠀⠀⠀⠀⠈⠉⠐⠲⠤⢄⣀⡀⠀⠀⠀⠀⣀⠤⠤⠤⠤⠤⣄⣀⣀⠀⢀⡠⠖⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⡀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⢸⣿⣿⣿⣿
|
||||
⢻⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⢒⡶⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⢦⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⡿⣿⡝⣆⠀⠀⠀⠀⢸⠀⠀⣠⣴⠿⣻⣿⣿⠈
|
||||
⢿⣿⣿⠶⢤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢨⠇⠀⠀⠀⠀⣀⣀⣤⣤⣾⣿⢿⡆⢸⣧⢹⠀⠀⣠⣴⣿⣴⠟⢋⣥⠴⢻⣿⠏⠀
|
||||
⢸⣿⣿⡇⠀⠘⣿⣶⣦⣤⣀⡀⠀⠀⠀⠀⠀⠀⠈⠑⠲⠤⢤⣀⣀⡀⠀⠀⠀⠀⠀⠀⣀⣀⣞⣀⣠⣤⣾⣿⣿⣿⣿⣿⣿⢻⢸⣿⣾⣿⣾⣤⣾⣿⠿⢋⡡⠞⠉⠉⠉⠉⠀⠀⠀
|
||||
⣼⡟⣿⡇⠀⠀⢹⣄⠈⠙⠒⠯⣽⣶⢶⣤⣤⣄⣀⣀⠀⠀⠀⠀⠈⠙⠻⠿⠿⠿⠿⠿⠿⠛⠛⠛⢉⣉⣽⠶⣿⠟⣿⣿⣧⣿⣾⣿⣿⡇⢹⡿⠋⣡⠖⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⣇⠳⣼⣧⠴⠛⠉⠉⠉⠒⣦⣤⣀⡀⠀⠀⠉⠙⢦⠀⠉⠉⢙⣷⣶⠒⠒⠒⠶⡶⠶⠶⢶⣤⠖⠚⠉⠁⠀⣰⣷⠾⣿⢿⢥⣼⣾⣿⣿⠃⣸⣠⠞⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠈⠳⣌⣿⢦⣄⠀⢀⣴⣿⣿⣷⣿⡯⣗⠲⠤⣀⡈⣇⠀⠀⠻⡄⠈⣷⠀⠀⠀⡿⠒⠶⠾⢿⠀⠀⠀⢠⣾⡏⠁⣸⡇⢸⡸⢠⡌⢡⣿⠴⠿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠈⠙⠳⢿⣙⠺⢽⣿⣮⣿⣿⠗⠋⠀⠀⠀⠉⡿⠀⠀⣀⣹⣿⣯⣤⣶⣚⣛⣒⣛⣓⣿⠀⠀⠀⢽⣿⣶⣶⡏⢧⣼⣷⡿⢁⣾⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠈⠙⠢⢬⣙⠛⠧⢤⣀⣀⠀⢀⣴⠃⠀⢀⣹⢦⣤⣉⣉⣯⣍⣹⣿⣿⣿⡃⣀⡤⠴⠛⠋⠁⠀⡇⠘⣜⣏⣠⣿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠓⠦⢤⣈⡉⠉⠙⠛⠛⠛⠲⠤⠤⠤⠴⣶⣶⣿⣿⢿⡿⣯⠀⠀⠀⠀⠀⢀⣠⡟⠤⠿⠟⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⠒⠲⠤⢤⣄⣀⣀⣀⣤⣈⣤⣤⠤⣴⣿⣥⠤⠴⠒⠚⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
|
||||
|
||||
|
||||
░██████████░█████████ ░██ ░██ ░██████████ ░███ ░██ ░██████
|
||||
░██ ░██ ░██ ░██ ░██ ░██ ░████ ░██ ░██ ░██
|
||||
░██ ░██ ░██ ░██ ░██ ░██ ░██░██ ░██ ░██ ░██
|
||||
░██ ░█████████ ░██ ░██ ░█████████ ░██ ░██ ░██ ░██ ░██
|
||||
░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██░██ ░██ ░██
|
||||
░██ ░██ ░██ ░██ ░██ ░██ ░██ ░████ ░██ ░██
|
||||
░██ ░██ ░██ ░██████ ░██████████ ░██ ░███ ░██████
|
||||
|
||||
|
||||
DONE
|
||||
|
||||
#load "./src/meta/meta.jai";
|
||||
Iprof :: #import "Iprof"(IMPORT_MODE = .METAPROGRAM);
|
||||
|
||||
#run {
|
||||
@ -184,9 +149,12 @@ Iprof :: #import "Iprof"(IMPORT_MODE = .METAPROGRAM);
|
||||
iprof_plugin.add_source(iprof_plugin);
|
||||
add_build_file("src/platform_specific/main_native.jai", w);
|
||||
|
||||
lint_ok := true;
|
||||
while true {
|
||||
message := compiler_wait_for_message();
|
||||
iprof_plugin.message(iprof_plugin, message);
|
||||
if !lint_checks(message) then lint_ok = false;
|
||||
|
||||
if message.kind == .COMPLETE then break;
|
||||
}
|
||||
compiler_end_intercept(w);
|
||||
|
||||
@ -1,18 +1,6 @@
|
||||
#run {
|
||||
tacomaString : string = #string DONE
|
||||
___ ___ ___ ___ ___ ___
|
||||
/\ \ /\ \ /\ \ /\ \ /\__\ /\ \
|
||||
\:\ \ /::\ \ /::\ \ /::\ \ /::| | /::\ \
|
||||
\:\ \ /:/\:\ \ /:/\:\ \ /:/\:\ \ /:|:| | /:/\:\ \
|
||||
/::\ \ /::\~\:\ \ /:/ \:\ \ /:/ \:\ \ /:/|:|__|__ /::\~\:\ \
|
||||
/:/\:\__\ /:/\:\ \:\__\ /:/__/ \:\__\ /:/__/ \:\__\ /:/ |::::\__\ /:/\:\ \:\__\
|
||||
/:/ \/__/ \/__\:\/:/ / \:\ \ \/__/ \:\ \ /:/ / \/__/~~/:/ / \/__\:\/:/ /
|
||||
/:/ / \::/ / \:\ \ \:\ /:/ / /:/ / \::/ /
|
||||
\/__/ /:/ / \:\ \ \:\/:/ / /:/ / /:/ /
|
||||
/:/ / \:\__\ \::/ / /:/ / /:/ /
|
||||
\/__/ \/__/ \/__/ \/__/ \/__/
|
||||
DONE
|
||||
print("%\n", tacomaString);
|
||||
#load "../../meta/ascii.jai";
|
||||
print("%\n", ascii_tacoma);
|
||||
}
|
||||
|
||||
Tacoma :: #import "Tacoma";
|
||||
|
||||
@ -9,6 +9,7 @@ mandatory_loads_done :: () -> bool {
|
||||
}
|
||||
|
||||
init_font_loads :: () {
|
||||
mandatory_loads_left += 1;
|
||||
sfetch_send(*(sfetch_request_t.{
|
||||
path = "./resources/DroidSerif-Regular.ttf".data,
|
||||
callback = fontcb,
|
||||
@ -23,5 +24,5 @@ fontcb :: (res: *sfetch_response_t) #c_call {
|
||||
push_context,defer_pop default_context;
|
||||
state.font_default.fons_font = fonsAddFontMem(state.fons, "sans", res.data.ptr, xx res.data.size, 0);
|
||||
ui_init_font_fields(*state.font_default);
|
||||
mandatory_done = true;
|
||||
mandatory_loads_left -= 1;
|
||||
}
|
||||
|
||||
49
src/meta/ascii.jai
Normal file
49
src/meta/ascii.jai
Normal file
@ -0,0 +1,49 @@
|
||||
ascii_car : string : #string DONE
|
||||
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⡤⢤⣶⣶⣶⣶⣶⣒⣒⣀⣺⣿⣿⠿⢶⣶⣶⣶⣦⣤⣤⣤⣄⣀⣀⣀⣀⡀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⠴⠚⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠛⠒⠲⠦⢤⣉⠙⣿⣿⣿⣟⢿⣿⠿⠿⠿⢿⣿
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣶⣷⡦⠞⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⡇⠀⠈⠛⢿⣿⡀⠀⠀⠀⠻
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣤⠤⢴⣿⣉⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠇⠀⠀⠀⠀⠙⣿⣄⡀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣤⣤⡶⠞⠛⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠓⠒⠒⠢⠤⠤⣄⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⠀⢠⠤⠤⠤⣤⣾⠀⠙⢦⡀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⣠⠴⣾⣛⣩⢴⣿⠿⠶⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠙⠒⠒⠒⠤⠤⢤⣤⣾⢿⣴⢏⣀⣀⣤⡼⠻⡆⠀⠈⢷
|
||||
⠀⠀⠀⠀⠀⢀⣴⠋⠁⠀⠀⠀⠀⠙⠓⠲⠤⠬⠷⠀⠀⢀⣀⣀⣀⣀⣀⣀⣀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⠤⠞⠉⠀⠀⠹⡟⠀⠀⠀⠀⠀⢱⠀⢠⣼
|
||||
⠀⠀⠀⣀⡴⠋⠈⢙⡞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠛⠢⠤⢄⣀⣠⠴⠛⣋⣠⠴⠒⠉⠉⢉⣲⠶⠀⣀⡠⠤⠒⠊⠉⠁⠀⠀⠀⠀⠀⠀⠀⢹⠀⠀⠀⠀⠀⣼⢰⣿⣿
|
||||
⡀⣠⣼⠏⠀⠀⣰⠟⠦⢤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠓⠒⠒⠒⠋⣉⠤⠒⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⢀⣯⣼⣿⣿
|
||||
⡟⠋⠹⢤⣠⠞⠁⠀⠀⠀⠀⠈⠉⠐⠲⠤⢄⣀⡀⠀⠀⠀⠀⣀⠤⠤⠤⠤⠤⣄⣀⣀⠀⢀⡠⠖⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⡀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⢸⣿⣿⣿⣿
|
||||
⢻⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⢒⡶⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⢦⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⡿⣿⡝⣆⠀⠀⠀⠀⢸⠀⠀⣠⣴⠿⣻⣿⣿⠈
|
||||
⢿⣿⣿⠶⢤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢨⠇⠀⠀⠀⠀⣀⣀⣤⣤⣾⣿⢿⡆⢸⣧⢹⠀⠀⣠⣴⣿⣴⠟⢋⣥⠴⢻⣿⠏⠀
|
||||
⢸⣿⣿⡇⠀⠘⣿⣶⣦⣤⣀⡀⠀⠀⠀⠀⠀⠀⠈⠑⠲⠤⢤⣀⣀⡀⠀⠀⠀⠀⠀⠀⣀⣀⣞⣀⣠⣤⣾⣿⣿⣿⣿⣿⣿⢻⢸⣿⣾⣿⣾⣤⣾⣿⠿⢋⡡⠞⠉⠉⠉⠉⠀⠀⠀
|
||||
⣼⡟⣿⡇⠀⠀⢹⣄⠈⠙⠒⠯⣽⣶⢶⣤⣤⣄⣀⣀⠀⠀⠀⠀⠈⠙⠻⠿⠿⠿⠿⠿⠿⠛⠛⠛⢉⣉⣽⠶⣿⠟⣿⣿⣧⣿⣾⣿⣿⡇⢹⡿⠋⣡⠖⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⣇⠳⣼⣧⠴⠛⠉⠉⠉⠒⣦⣤⣀⡀⠀⠀⠉⠙⢦⠀⠉⠉⢙⣷⣶⠒⠒⠒⠶⡶⠶⠶⢶⣤⠖⠚⠉⠁⠀⣰⣷⠾⣿⢿⢥⣼⣾⣿⣿⠃⣸⣠⠞⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠈⠳⣌⣿⢦⣄⠀⢀⣴⣿⣿⣷⣿⡯⣗⠲⠤⣀⡈⣇⠀⠀⠻⡄⠈⣷⠀⠀⠀⡿⠒⠶⠾⢿⠀⠀⠀⢠⣾⡏⠁⣸⡇⢸⡸⢠⡌⢡⣿⠴⠿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠈⠙⠳⢿⣙⠺⢽⣿⣮⣿⣿⠗⠋⠀⠀⠀⠉⡿⠀⠀⣀⣹⣿⣯⣤⣶⣚⣛⣒⣛⣓⣿⠀⠀⠀⢽⣿⣶⣶⡏⢧⣼⣷⡿⢁⣾⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠈⠙⠢⢬⣙⠛⠧⢤⣀⣀⠀⢀⣴⠃⠀⢀⣹⢦⣤⣉⣉⣯⣍⣹⣿⣿⣿⡃⣀⡤⠴⠛⠋⠁⠀⡇⠘⣜⣏⣠⣿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠓⠦⢤⣈⡉⠉⠙⠛⠛⠛⠲⠤⠤⠤⠴⣶⣶⣿⣿⢿⡿⣯⠀⠀⠀⠀⠀⢀⣠⡟⠤⠿⠟⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⠒⠲⠤⢤⣄⣀⣀⣀⣤⣈⣤⣤⠤⣴⣿⣥⠤⠴⠒⠚⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
|
||||
|
||||
|
||||
░██████████░█████████ ░██ ░██ ░██████████ ░███ ░██ ░██████
|
||||
░██ ░██ ░██ ░██ ░██ ░██ ░████ ░██ ░██ ░██
|
||||
░██ ░██ ░██ ░██ ░██ ░██ ░██░██ ░██ ░██ ░██
|
||||
░██ ░█████████ ░██ ░██ ░█████████ ░██ ░██ ░██ ░██ ░██
|
||||
░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██░██ ░██ ░██
|
||||
░██ ░██ ░██ ░██ ░██ ░██ ░██ ░████ ░██ ░██
|
||||
░██ ░██ ░██ ░██████ ░██████████ ░██ ░███ ░██████
|
||||
|
||||
|
||||
DONE
|
||||
|
||||
ascii_tacoma : string : #string DONE
|
||||
___ ___ ___ ___ ___ ___
|
||||
/\ \ /\ \ /\ \ /\ \ /\__\ /\ \
|
||||
\:\ \ /::\ \ /::\ \ /::\ \ /::| | /::\ \
|
||||
\:\ \ /:/\:\ \ /:/\:\ \ /:/\:\ \ /:|:| | /:/\:\ \
|
||||
/::\ \ /::\~\:\ \ /:/ \:\ \ /:/ \:\ \ /:/|:|__|__ /::\~\:\ \
|
||||
/:/\:\__\ /:/\:\ \:\__\ /:/__/ \:\__\ /:/__/ \:\__\ /:/ |::::\__\ /:/\:\ \:\__\
|
||||
/:/ \/__/ \/__\:\/:/ / \:\ \ \/__/ \:\ \ /:/ / \/__/~~/:/ / \/__\:\/:/ /
|
||||
/:/ / \::/ / \:\ \ \:\ /:/ / /:/ / \::/ /
|
||||
\/__/ /:/ / \:\ \ \:\/:/ / /:/ / /:/ /
|
||||
/:/ / \:\__\ \::/ / /:/ / /:/ /
|
||||
\/__/ \/__/ \/__/ \/__/ \/__/
|
||||
DONE
|
||||
54
src/meta/lint.jai
Normal file
54
src/meta/lint.jai
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
Custom linting rules to maintain some style things in the
|
||||
engine, just so I don't forget to follow the style I want to follow,
|
||||
mostly with function names and variable names.
|
||||
*/
|
||||
|
||||
lint_errors_found := 0;
|
||||
|
||||
lint_checks :: (message: *Message) -> bool {
|
||||
// We are only interested declarations being typechecked, and we'll look at
|
||||
// them after typechecking.
|
||||
if message.kind != .TYPECHECKED then return true;
|
||||
code := cast(*Message_Typechecked) message;
|
||||
|
||||
lint_ok := true;
|
||||
|
||||
|
||||
for code.declarations {
|
||||
import := it.expression.enclosing_load.enclosing_import;
|
||||
if import.module_type != .MAIN_PROGRAM then return true;
|
||||
if !lint_declaration(it.expression) {
|
||||
lint_ok = false;
|
||||
}
|
||||
}
|
||||
return lint_ok;
|
||||
}
|
||||
|
||||
lint_declaration :: (expression: Code_Declaration) -> bool {
|
||||
if expression.expression && expression.expression.kind == .PROCEDURE_HEADER {
|
||||
return lint_procedure_name(expression.name, expression.expression);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
lint_procedure_name :: (name: string, node: Code_Node) -> bool {
|
||||
name_ok := true;
|
||||
wrong_char : u8;
|
||||
for name {
|
||||
if it >= #char "a" && it <= #char "z" then continue;
|
||||
if it == #char "_" then continue;
|
||||
if it >= #char "0" && it <= #char "9" then continue;
|
||||
name_ok = false;
|
||||
wrong_char = it;
|
||||
break;
|
||||
}
|
||||
if !name_ok {
|
||||
error := sprint("Linter: Name % contains illegal char % for procedure names\n", name, wrong_char);
|
||||
compiler_report(error, make_location(*node), .ERROR);
|
||||
lint_errors_found += 1;
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
2
src/meta/meta.jai
Normal file
2
src/meta/meta.jai
Normal file
@ -0,0 +1,2 @@
|
||||
#load "ascii.jai";
|
||||
#load "lint.jai";
|
||||
Loading…
x
Reference in New Issue
Block a user