Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial error reporting framework #266

Merged
merged 34 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9ab3fd5
Add ftxui submodule
jeaye Dec 20, 2024
051da22
Remove a todo
jeaye Dec 22, 2024
20fb1a7
Merge remote-tracking branch 'jianling/integer' into error-reporting
jeaye Dec 22, 2024
21a0d13
Merge branch 'integer' of https://github.com/jianlingzhong/jank into …
jeaye Dec 26, 2024
eeab30e
Port lex, parse, analysis to new error type
jeaye Dec 31, 2024
ad7f0ac
Add initial highlighted code snippets
jeaye Jan 3, 2025
c052fe3
Merge branch 'main' into error-reporting
jeaye Jan 18, 2025
204dc9f
Merge branch 'main' into error-reporting
jeaye Jan 21, 2025
7d09de9
Get error plans working
jeaye Jan 22, 2025
9c27dc2
Fill in more parse errors
jeaye Jan 23, 2025
3e956c7
Fill out the remaining parse fns
jeaye Jan 23, 2025
c207fc3
Merge branch 'main' of github.com:jank-lang/jank into error-reporting
jeaye Jan 23, 2025
67cfd81
Merge branch 'main' into error-reporting
jeaye Jan 23, 2025
c98571e
Merge branch 'main' into error-reporting
jeaye Jan 23, 2025
7451dc0
Combine notes with ellipsis
jeaye Jan 25, 2025
e994bf4
Merge branch 'main' of github.com:jank-lang/jank into error-reporting
jeaye Feb 5, 2025
713ba97
Update cmake summary
jeaye Feb 5, 2025
1f10b05
Fix merge
jeaye Feb 5, 2025
7428e85
Add graceful lex error handling to highlighting
jeaye Feb 6, 2025
ce00bce
Start polishing the lex errors
jeaye Feb 7, 2025
7f81076
Finish combing through lex errors
jeaye Feb 8, 2025
9a96965
Add a todo
jeaye Feb 8, 2025
7dfb7d1
Fix lex tests
jeaye Feb 12, 2025
19d4423
Get parse tests passing
jeaye Feb 13, 2025
69e4eb9
Improve type_name docs
jeaye Feb 13, 2025
a843151
Remove old script
jeaye Feb 13, 2025
57c9e69
Remove debug code and add more comments
jeaye Feb 13, 2025
004e566
Fix clang-tidy issues
jeaye Feb 13, 2025
9be7cbb
Merge branch 'main' of github.com:jank-lang/jank into error-reporting
jeaye Feb 13, 2025
e7431b6
Bump CI timeout to 35
jeaye Feb 13, 2025
71565a1
Switch to one vector of notes
jeaye Feb 13, 2025
8fa87ab
Migrate analysis errors to dedicated fns
jeaye Feb 13, 2025
950aa76
Address review feedback
jeaye Feb 13, 2025
cb87e86
Comb through all parse errors
jeaye Feb 14, 2025
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
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ misc-definitions-in-headers,\
-cppcoreguidelines-owning-memory,\
-cppcoreguidelines-avoid-const-or-ref-data-members,\
-cppcoreguidelines-rvalue-reference-param-not-moved,\
-cppcoreguidelines-pro-bounds-constant-array-index,\
-bugprone-easily-swappable-parameters,\
-bugprone-reserved-identifier,\
-bugprone-multi-level-implicit-pointer-conversion,\
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
JANK_SANITIZE: ${{ matrix.sanitize }}
ASAN_OPTIONS: detect_leaks=0
TERM: xterm
timeout-minutes: 30
timeout-minutes: 35
steps:
- uses: actions/checkout@v4
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
[submodule "compiler+runtime/third-party/boost-preprocessor"]
path = compiler+runtime/third-party/boost-preprocessor
url = https://github.com/jank-lang/boost-preprocessor.git
[submodule "compiler+runtime/third-party/ftxui"]
path = compiler+runtime/third-party/ftxui
url = https://github.com/jank-lang/FTXUI.git
[submodule "compiler+runtime/test/bash/clojure-test-suite/clojure-test-suite"]
path = compiler+runtime/test/bash/clojure-test-suite/clojure-test-suite
url = https://github.com/jank-lang/clojure-test-suite
21 changes: 20 additions & 1 deletion compiler+runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ execute_process(
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)

set(jank_version "${CMAKE_PROJECT_VERSION}-${jank_git_hash}")
set(jank_version "jank-${CMAKE_PROJECT_VERSION}-${jank_git_hash}")

set(jank_cxx_standard cxx_std_20)

Expand Down Expand Up @@ -71,6 +71,8 @@ set(
-Wno-implicit-fallthrough
-Wno-covered-switch-default
-Wno-invalid-offsetof
-Wno-deprecated-declarations
-Wno-c++23-extensions
-fno-common
-fno-rtti
-fexceptions
Expand Down Expand Up @@ -104,6 +106,10 @@ elseif(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWith
list(APPEND jank_common_compiler_flags -DJANK_RELEASE)
endif()

if(jank_tests)
list(APPEND jank_common_compiler_flags -Werror -DJANK_TEST)
endif()

include(cmake/coverage.cmake)
include(cmake/analyze.cmake)
include(cmake/sanitization.cmake)
Expand Down Expand Up @@ -158,6 +164,13 @@ add_library(
src/cpp/jank/util/clang_format.cpp
src/cpp/jank/util/string_builder.cpp
src/cpp/jank/profile/time.cpp
src/cpp/jank/ui/highlight.cpp
src/cpp/jank/error.cpp
src/cpp/jank/error/report.cpp
src/cpp/jank/error/lex.cpp
src/cpp/jank/error/parse.cpp
src/cpp/jank/error/analyze.cpp
src/cpp/jank/read/source.cpp
src/cpp/jank/read/lex.cpp
src/cpp/jank/read/parse.cpp
src/cpp/jank/runtime/core.cpp
Expand Down Expand Up @@ -249,6 +262,7 @@ target_include_directories(
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third-party/magic_enum/include/magic_enum>"
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third-party/cli11/include>"
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third-party/fmt/include>"
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third-party/ftxui/include>"
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third-party/libzippp/src>"
)

Expand All @@ -262,6 +276,7 @@ set(BUILD_SHARED_LIBS OFF)

include(FetchContent)
include(cmake/dependency/fmt.cmake)
include(cmake/dependency/ftxui.cmake)
include(cmake/dependency/libzippp.cmake)

find_package(OpenSSL REQUIRED COMPONENTS Crypto)
Expand All @@ -278,6 +293,7 @@ target_link_libraries(
clang-cpp
LLVM
Boost::filesystem
ftxui::screen ftxui::dom
OpenSSL::Crypto
)

Expand Down Expand Up @@ -503,3 +519,6 @@ if(NOT CMAKE_SKIP_INSTALL_RULES)
include(cmake/install.cmake)
endif()
# ---- Install rules ----

# Summary
include(cmake/summary.cmake)
16 changes: 16 additions & 0 deletions compiler+runtime/cmake/dependency/ftxui.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
set(CMAKE_C_FLAGS_OLD "${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS_OLD "${CMAKE_CXX_FLAGS}")
set(BUILD_SHARED_LIBS_OLD ${BUILD_SHARED_LIBS})
set(CMAKE_CXX_CLANG_TIDY_OLD ${CMAKE_CXX_CLANG_TIDY})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
set(CMAKE_CXX_CLANG_TIDY "")
set(FTXUI_QUIET ON CACHE BOOL "Disable noisy CMake output")

add_subdirectory(third-party/ftxui)

unset(FTXUI_QUIET)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_OLD}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_OLD}")
set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_OLD})
set(CMAKE_CXX_CLANG_TIDY ${CMAKE_CXX_CLANG_TIDY_OLD})
14 changes: 14 additions & 0 deletions compiler+runtime/cmake/summary.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function(jank_message msg)
message(STATUS "${msg}")
endfunction()

jank_message("┌─ jank options ─────────────────────")
jank_message("│ build type : ${CMAKE_BUILD_TYPE}")
jank_message("│ jank version : ${jank_version}")
jank_message("│ jank tests : ${jank_tests}")
jank_message("│ jank coverage : ${jank_coverage}")
jank_message("│ jank analyze : ${jank_analyze}")
jank_message("│ jank sanitization : ${jank_sanitize}")
jank_message("│ clang version : ${LLVM_PACKAGE_VERSION}")
jank_message("│ clang prefix : ${CLANG_INSTALL_PREFIX}")
jank_message("└─────────────────────────────────────")
6 changes: 2 additions & 4 deletions compiler+runtime/include/cpp/jank/analyze/processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ namespace jank::analyze
file
};

using error = read::error;

struct processor
{
using expression_result = result<expression_ptr, error>;
using expression_result = result<expression_ptr, error_ptr>;

processor() = delete;
processor(runtime::context &rt_ctx);
Expand Down Expand Up @@ -78,7 +76,7 @@ namespace jank::analyze
expression_position,
option<expr::function_context_ptr> const &,
native_bool needs_box);
jank::result<expr::function_arity<expression>, error>
result<expr::function_arity<expression>, error_ptr>
analyze_fn_arity(runtime::obj::persistent_list_ptr const &,
native_persistent_string const &name,
local_frame_ptr &);
Expand Down
Loading