refactor(parser): change body_h to body result

Refs: #1
This commit is contained in:
2026-06-03 10:45:57 +02:00
parent 6ce2fba9d2
commit 26340c279d
7 changed files with 45 additions and 20 deletions
+26 -1
View File
@@ -1,7 +1,9 @@
#ifndef FURC_AST_FWD_HPP
#define FURC_AST_FWD_HPP
#include "furc/diag.hpp"
#include "furc/handle.hpp"
#include "furlang/result.hpp"
#include <string>
#include <vector>
@@ -13,6 +15,29 @@ namespace furc {
*/
namespace ast {
/**
* @brief AST error.
*/
struct error {
location location; /**< Location of the error. */
/**
* @brief Compares two AST errors for equality.
*
* @param other Error to compare against.
* @return true if the errors are equal.
*/
bool operator==(const error& other) const { return location == other.location; }
/**
* @brief Compares two AST errors for inequality.
*
* @param other Error to compare against.
* @return true if the errors are not equal.
*/
bool operator!=(const error& other) const { return !this->operator==(other); }
};
class node;
/**
@@ -162,7 +187,7 @@ struct body {
* @brief Alias for body result.
* @see body
*/
using body_h = handle<body>;
using body_r = furlang::result<body, error>;
class function_declaration_node;