diff --git a/compiler/nodes.py b/compiler/nodes.py index e5a6b2f..ac79886 100644 --- a/compiler/nodes.py +++ b/compiler/nodes.py @@ -6,7 +6,7 @@ from typing import Any, Iterable from beartype import beartype -from . import ir, semantic +from . import ir, semantic, tokenizer from .errors import SemanticAnalysisError, OverrideMandatoryError from .logger import Logger from .source import SourceLocation @@ -111,6 +111,22 @@ class Literal(Node, ABC): return result +class PseudoNode(Literal): + """ + Only used for better diagnostics + """ + + def __init__(self, token: tokenizer.Token): + super().__init__(token.loc, token.value) + self.token = token + + def intermediate_representation(self) -> list[ir.IRItem]: + return [] + + def semantic_analysis(self, context: semantic.Context): + pass + + class Sum(Node): def intermediate_representation(self) -> list[ir.IRItem]: result: list[ir.IRAction] = []