dlang-community / drepl

A REPL for D
Boost Software License 1.0
78 stars 20 forks source link

crash on import without ending semicolon #65

Closed FraMecca closed 7 years ago

FraMecca commented 7 years ago
Welcome to D REPL.
D> import std.file;
std
D> import std.stdio
core.exception.RangeError@../../.dub/packages/libdparse-0.7.0/libdparse/src/dparse/parser.d(7178): Range violation
----------------
??:? _d_arrayboundsp [0x922a4ec6]
../../.dub/packages/libdparse-0.7.0/libdparse/src/dparse/parser.d:7178 const(pure nothrow @property @nogc @safe std.experimental.lexer.TokenStructure!(ubyte, "\x0a    string comment;\x0a    string trailingComment;\x0a\x0a    int opCmp(size_t i) const pure nothrow @safe {\x0a        if (index < i) return -1;\x0a        if (index > i) return 1;\x0a        return 0;\x0a    }\x0a\x0a    int opCmp(ref const typeof(this) other) const pure nothrow @safe {\x0a        return opCmp(other.index);\x0a    }\x0a").TokenStructure function()) dparse.parser.Parser.current [0x617152]
../../.dub/packages/libdparse-0.7.0/libdparse/src/dparse/parser.d:3415 dparse.ast.ImportDeclaration dparse.parser.Parser.parseImportDeclaration() [0x60b499]
../../.dub/packages/libdparse-0.7.0/libdparse/src/dparse/parser.d:2011 dparse.ast.Declaration dparse.parser.Parser.parseDeclaration(bool, bool) [0x605f0b]
src/drepl/interpreter.d:104 bool drepl.interpreter.Interpreter!(drepl.engines.dmd.DMDEngine).Interpreter.parse!(0).parse(const(std.experimental.lexer.TokenStructure!(ubyte, "\x0a    string comment;\x0a    string trailingComment;\x0a\x0a    int opCmp(size_t i) const pure nothrow @safe {\x0a        if (index < i) return -1;\x0a        if (index > i) return 1;\x0a        return 0;\x0a    }\x0a\x0a    int opCmp(ref const typeof(this) other) const pure nothrow @safe {\x0a        return opCmp(other.index);\x0a    }\x0a").TokenStructure[])) [0x5dcd45]
src/drepl/interpreter.d:84 drepl.interpreter.Interpreter!(drepl.engines.dmd.DMDEngine).Interpreter.Kind drepl.interpreter.Interpreter!(drepl.engines.dmd.DMDEngine).Interpreter.classify(const(char[])) [0x5dc35d]
src/drepl/interpreter.d:37 drepl.interpreter.InterpreterResult drepl.interpreter.Interpreter!(drepl.engines.dmd.DMDEngine).Interpreter.interpret(const(char)[]) [0x5dbf6b]
src/console.d:29 _Dmain [0x5a1397]
??:? _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFNlZv [0x922cc7a3]
??:? scope void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x922cc6d3]
??:? scope void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() [0x922cc74c]
??:? scope void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x922cc6d3]
??:? _d_run_main [0x922cc643]
??:? main [0x5c5bed]
??:? __libc_start_main [0x90d8a1c0]
ghost commented 7 years ago

The bug is fixed in dparse. The resolution consists into using the most recent beta.