On 6/11/2012 1:10 PM, Roman D. Boiko wrote:
On Sunday, 10 June 2012 at 18:45:55 UTC, Roman D. Boiko wrote:
On Sunday, 10 June 2012 at 18:16:39 UTC, Rainer Schuetze wrote:
I have recently refactored the code so that the parser and the
semantic analysis can run in an different process (a local COM
server). This was mainly to avoid GC stalls within the IDE, but could
also be used to plugin other code for semantic analysis. The current
interface is here:
https://github.com/rainers/visuald/blob/master/vdc/ivdserver.d
Great! This simplifies my task a lot. Interface and implementation
seem to be straightforward. Of course, I'll need to understand overall
design first, but now I have a good starting point.
Do I understand correctly that syntax coloring is implemented via using
GetTip / GetTipResult pair of functions, which serialize tokens using
ast.node.Node.toD(CodeWriter)? If yes, is format defined by some
standard or documented? If no, what mechanism is used to highlight syntax?

No. Syntax highlighting is done by the lexer, no (complex) parsing involved. The only case where the parser is consulted (but not waiting for an answer, just using cached information) is to figure out whether "in"/"is" are used as operators or as parameter modifier/IsExpression, respectively.

Syntax highlighting needs to be rather fast, as it is done during drawing, so switching context is out of the question. Instead, Visual D keeps a lexer-state (an int) per line and continues scanning from the start of the line when color information is requested by the IDE.

Reply via email to