28 lines
575 B
C++
28 lines
575 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <iostream>
|
|
|
|
struct Object {
|
|
Object() = delete;
|
|
virtual ~Object() = default;
|
|
virtual void write(std::ostream &os) const = 0;
|
|
};
|
|
|
|
struct Identifier : public Object {
|
|
virtual void write(std::ostream &os) const final;
|
|
std::string identifier;
|
|
};
|
|
|
|
struct StringLit : public Object {
|
|
virtual void write(std::ostream &os) const final;
|
|
std::string literal;
|
|
};
|
|
|
|
struct Number : public Object {
|
|
virtual void write(std::ostream &os) const final;
|
|
double number;
|
|
};
|
|
|
|
std::ostream &operator<<(std::ostream &os, const Object &obj);
|