#!/usr/bin/env python3
import sys
sys.path.insert(0, 'src')

from alloy.parser import AlloyParser
from alloy.lexer import AlloyLexer

# Create a fresh parser instance
lexer = AlloyLexer()
parser = AlloyParser(lexer)

# Test the tool call case
test_code = 'result, error = parse_data(input)'

print(f"Testing: {test_code}")

print("\nParsing with debug:")
try:
    ast = parser.parse(test_code, debug=True)
    print(f"Result: {ast}")
except Exception as e:
    print(f"Error: {e}")
    import traceback
    traceback.print_exc()