JuliaLang/julia — pull request #6344 by carlobaldassi (2014-04-01 00:32:23+00:00)
Title: Use julia parser in REPL completion

Instead of the verbose and error-prone heuristic which was ported from the old REPL to determine whether the completion is requested from within a string, a command etc., this uses the julia parser itself. It has the advantage of being much more accurate of course (it deals with comments, for example). However, I had to refine the output of the lisp parser in order to get more information about what type of incomplete expression is detected, so that instead of only `:incomplete` there are more possible outcomes, such as `:incomplete_string`, `:incomplete_comment` etc. I wonder if that's acceptable.
(In principle, one could parse the error message instead, but that doesn't seem right.)
(Another drawback about how things are done in this PR is that the error messages are more verbose and redundant. I did it this way mainly in order to minimize the impact on the code.)

This would also be a first step towards implementing things like #6338, although that would require to further split the `:incomplete` tag probably.