Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Args:
stream: File object or string containing LookML to be parsed
Raises:
TypeError: If stream is neither a string or a file object
"""
if isinstance(stream, io.TextIOWrapper):
text = stream.read()
elif isinstance(stream, str):
text = stream
else:
raise TypeError("Input stream must be a string or file object.")
lexer = Lexer(text)
tokens = lexer.scan()
parser = Parser(tokens)
result = parser.parse()
return result