[Issue 977] Expressions inside a struct or array initializer get wrong line number
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Feb 2 12:04:38 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=977
Stewart Gordon <smjg at iname.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |smjg at iname.com
--- Comment #3 from Stewart Gordon <smjg at iname.com> 2012-02-02 12:04:33 PST ---
(In reply to comment #2)
> This happens because the parser scans across the whole initializer to determine
> if it's an expression or an initializer. Because it's already lexed the whole
> initializer, the lexer's loc points to the end, and this is what is assigned to
> each expression. Not sure how to solve this without re-lexing the initializer.
But it manages to give line numbers for errors that occur in the semantic
analysis phase. The D compiler first lexes/parses the entire source file, then
semantically analyses it. So it should be able to get this right.
Two ways I can see to do it:
- Remember the line number of every token just in case
- Realise on hitting the 7 that it is no longer parseable as either an
expression or an initialiser, and deliver the error there and then.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list