nitc :: ToolContext :: parse_module
Fatal error if the string
is not a syntactically correct module
# Parse a full module given as a string
# Fatal error if the `string` is not a syntactically correct module
fun parse_module(string: String): AModule
do
var source = new SourceFile.from_string("", string)
var lexer = new Lexer(source)
var parser = new Parser(lexer)
var tree = parser.parse
var eof = tree.n_eof
if eof isa AError then
self.fatal_error(null, "Fatal Error: {eof.message}.")
abort
end
return tree.n_base.as(not null)
end
src/parser_util.nit:22,2--37,4