diff --git a/toltec/bash.py b/toltec/bash.py index 52c66c1..1f6f094 100644 --- a/toltec/bash.py +++ b/toltec/bash.py @@ -144,8 +144,17 @@ def get_declarations(src: str) -> Tuple[Variables, Functions]: if name not in default_variables: variables[name] = value else: - assert next_token == "(" - assert lexer.get_token() == ")" + if next_token != "(": + raise ScriptError( + f"Unexpected token '{next_token}' on line {lexer.lineno}. Expecting '('." + ) + + _token = lexer.get_token() + if _token != ")": + raise ScriptError( + f"Unexpected token '{_token}' on line {lexer.lineno}. Expecting ')'." + ) + start, end = _parse_func(lexer) functions[token] = declarations[start:end].strip(" ")