From a32a61813ebaecf0c1e69fd1481bf09d8c8b1420 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Tue, 14 Jul 2026 18:08:44 +0200 Subject: Support more floating point literals --- include/elna/boot/ast.h | 10 ++++++---- include/elna/boot/result.h | 35 +++++++++++++++++++++++------------ include/elna/gcc/elna-diagnostic.h | 1 + 3 files changed, 30 insertions(+), 16 deletions(-) (limited to 'include') diff --git a/include/elna/boot/ast.h b/include/elna/boot/ast.h index fbe65a4..04ffc22 100644 --- a/include/elna/boot/ast.h +++ b/include/elna/boot/ast.h @@ -533,11 +533,12 @@ namespace elna::boot class traits_expression : public expression { public: - std::vector parameters; + const std::vector arguments; const std::string name; std::vector types; - traits_expression(const struct position position, const std::string& name); + traits_expression(const struct position position, const std::string& name, + std::vector&& arguments); ~traits_expression(); void accept(parser_visitor *visitor) override; @@ -666,9 +667,10 @@ namespace elna::boot designator_expression *m_callable; public: - std::vector arguments; + const std::vector arguments; - procedure_call(const struct position position, designator_expression *callable); + procedure_call(const struct position position, designator_expression *callable, + std::vector&& arguments); void accept(parser_visitor *visitor) override; virtual procedure_call *is_call_expression() override; diff --git a/include/elna/boot/result.h b/include/elna/boot/result.h index 1b04bfb..0556dbe 100644 --- a/include/elna/boot/result.h +++ b/include/elna/boot/result.h @@ -26,15 +26,33 @@ along with GCC; see the file COPYING3. If not see namespace elna::boot { /** - * Position in the source text. + * Location in the source text. */ - struct position + struct location { /// Line. - std::size_t line = 1; + const std::size_t line; /// Column. - std::size_t column = 1; + const std::size_t column; + + location(std::size_t line, std::size_t column); + + bool available() const; + }; + + /** + * Span in the source text. + */ + struct position + { + /// Start location. + const location start; + + /// End location. + const location end; + + position(location start, location end); }; /** @@ -46,18 +64,11 @@ namespace elna::boot error(const struct position position); public: + /// Error position. const struct position position; - virtual ~error() = default; - /// Error text. virtual std::string what() const = 0; - - /// Error line in the source text. - std::size_t line() const; - - /// Error column in the source text. - std::size_t column() const; }; using error_list = typename std::deque>; diff --git a/include/elna/gcc/elna-diagnostic.h b/include/elna/gcc/elna-diagnostic.h index a8d4a69..3957003 100644 --- a/include/elna/gcc/elna-diagnostic.h +++ b/include/elna/gcc/elna-diagnostic.h @@ -42,6 +42,7 @@ namespace elna::gcc }; location_t get_location(const boot::position *position); + void fill_range(const boot::position& position, location_t& start, location_t& end); std::string print_type(tree type); void report_errors(const std::deque>& errors); } -- cgit v1.2.3