Browse Source

AST: Reorder classes

master
Riyyi 2 years ago
parent
commit
de2a207fcb
  1. 36
      src/ast.h

36
src/ast.h

@ -161,22 +161,6 @@ private:
// -----------------------------------------
// Symbols
class Symbol final : public ASTNode {
public:
explicit Symbol(const std::string& symbol);
virtual ~Symbol() = default;
virtual bool isSymbol() const override { return true; }
const std::string& symbol() const { return m_symbol; }
private:
std::string m_symbol;
};
// -----------------------------------------
// true, false, nil
class Value final : public ASTNode {
public:
@ -199,6 +183,22 @@ private:
// -----------------------------------------
// Symbols
class Symbol final : public ASTNode {
public:
explicit Symbol(const std::string& symbol);
virtual ~Symbol() = default;
virtual bool isSymbol() const override { return true; }
const std::string& symbol() const { return m_symbol; }
private:
std::string m_symbol;
};
// -----------------------------------------
using Lambda = std::function<ASTNodePtr(std::span<ASTNodePtr>)>;
class Function final : public ASTNode {
@ -247,10 +247,10 @@ template<>
inline bool ASTNode::fastIs<Number>() const { return isNumber(); }
template<>
inline bool ASTNode::fastIs<Symbol>() const { return isSymbol(); }
inline bool ASTNode::fastIs<Value>() const { return isValue(); }
template<>
inline bool ASTNode::fastIs<Value>() const { return isValue(); }
inline bool ASTNode::fastIs<Symbol>() const { return isSymbol(); }
template<>
inline bool ASTNode::fastIs<Function>() const { return isFunction(); }

Loading…
Cancel
Save