From db51e5dd2365d2f25cb1d386f9e4a5632498e736 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 16 Jun 2013 10:06:52 +0200 Subject: Bug 702066 - VHDL: Bad HTML formatting when using inline sources --- src/vhdlcode.l | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/src/vhdlcode.l b/src/vhdlcode.l index 8e20419..d6104d4 100644 --- a/src/vhdlcode.l +++ b/src/vhdlcode.l @@ -63,7 +63,7 @@ static bool isFuncProto=FALSE; static bool isComponent=FALSE; static bool isPackageBody=FALSE; static bool isProto = FALSE; - +static bool g_startCode = FALSE; static QCString g_PrevString; static QCString g_CurrClass; static QDictg_vhdlKeyDict; @@ -185,6 +185,7 @@ static void startCodeLine() //if (g_currentFontClass) { g_code->endFontClass(); } if (g_sourceFileDef) { + g_startCode=TRUE; //QCString lineNumber,lineAnchor; //lineNumber.sprintf("%05d",g_yyLineNr); //lineAnchor.sprintf("l%05d",g_yyLineNr); @@ -247,12 +248,15 @@ static void endCodeLine() static void nextCodeLine() { + if (g_startCode) + { + endCodeLine(); // + } const char *fc = g_currentFontClass; - endCodeLine(); if (g_yyLineNr } } @@ -347,7 +351,7 @@ static void writeWord(const char *word,const char* curr_class=0,bool classLink=F /*! write a code fragment `text' that may span multiple lines, inserting * line numbers for each line. */ -static void codifyLines(const char *text,const char *cl=0,bool classlink=FALSE) +static void codifyLines(const char *text,const char *cl=0,bool classlink=FALSE,bool comment=FALSE) { if (text==0) return; //printf("codifyLines(%d,\"%s\")\n",g_yyLineNr,text); @@ -365,12 +369,21 @@ static void codifyLines(const char *text,const char *cl=0,bool classlink=FALSE) line = line.left((int)(p-sp)-1); //*(p-1)='\0'; //g_code->codify(sp); - writeWord(line,cl,classlink); + if (comment) + { + writeFont("keyword",line.data()); + } + else + { + writeWord(line,cl,classlink); + } nextCodeLine(); } else { - //g_code->codify(sp); + if (comment) + writeFont("keyword",sp); + else writeWord(sp,cl,classlink); done=TRUE; } @@ -1465,9 +1478,9 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI } else // normal comment { - startFontClass("keyword"); - codifyLines(text); - endFontClass(); + // startFontClass("keyword"); + codifyLines(text,0,FALSE,TRUE); + // endFontClass(); } } <*>{TEXTT} { // found normal or special comment after something @@ -1480,9 +1493,9 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI } else // normal comment { - startFontClass("keyword"); - codifyLines(text); - endFontClass(); + // startFontClass("keyword"); + codifyLines(text,0,FALSE,TRUE); + // endFontClass(); } } @@ -1581,8 +1594,7 @@ void parseVhdlCode(CodeOutputInterface &od,const char *className,const QCString delete g_sourceFileDef; g_sourceFileDef=0; } - - return; + g_startCode=FALSE; } void codeFreeVhdlScanner() -- cgit v0.12