Added errors on parse prolem instead of getting NoneType error in the next node over.

This commit is contained in:
mcDandy
2025-08-29 21:35:39 +02:00
parent 9c4577bbd1
commit b07accab53
6 changed files with 17 additions and 5 deletions
+2 -1
View File
@@ -3,7 +3,7 @@ from inspect import cleandoc
from antlr4 import CommonTokenStream
from antlr4.atn.LexerActionExecutor import InputStream
import torch
from .helper_functions import getIndexTensorAlongDim
from .helper_functions import ThrowingErrorListener, getIndexTensorAlongDim
from .Parser.MathExprParser import MathExprParser
from .Parser.MathExprLexer import MathExprLexer
@@ -111,6 +111,7 @@ class ImageMathNode:
lexer = MathExprLexer(input_stream)
stream = CommonTokenStream(lexer)
parser = MathExprParser(stream)
parser.addErrorListener(ThrowingErrorListener())
tree = parser.expr()
print("Tree\n"+tree.toStringTree(recog=parser))
visitor = TensorEvalVisitor(variables,a.shape)