From 4e823c6cbf83bd552796e5da30d9728fd06b43ef Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Tue, 22 Aug 2000 03:13:47 +0000 Subject: Added SCE_H_VALUE class for HTML for unquoted values. --- src/LexHTML.cxx | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'src/LexHTML.cxx') diff --git a/src/LexHTML.cxx b/src/LexHTML.cxx index 15f7ed3cb..54fac38e1 100644 --- a/src/LexHTML.cxx +++ b/src/LexHTML.cxx @@ -115,9 +115,13 @@ static int stateForPrintState(int StateToPrint) { return state; } -static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { - bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.') || +static inline bool IsNumber(unsigned int start, Accessor &styler) { + return isdigit(styler[start]) || (styler[start] == '.') || (styler[start] == '-') || (styler[start] == '#'); +} + +static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { + bool wordIsNumber = IsNumber(start, styler); char chAttr = SCE_H_ATTRIBUTEUNKNOWN; if (wordIsNumber) { chAttr = SCE_H_NUMBER; @@ -603,6 +607,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty } else { state = SCE_H_DEFAULT; } + } else if (ch == '=') { + styler.ColourTo(i, SCE_H_OTHER); + state = SCE_H_VALUE; } else { state = SCE_H_OTHER; } @@ -623,6 +630,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty } else if (ch == '\'') { styler.ColourTo(i - 1, StateToPrint); state = SCE_H_SINGLESTRING; + } else if (ch == '=') { + styler.ColourTo(i, StateToPrint); + state = SCE_H_VALUE; } else if (ch == '/' && chNext == '>') { styler.ColourTo(i - 1, StateToPrint); styler.ColourTo(i + 1, SCE_H_TAGEND); @@ -658,6 +668,32 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty state = SCE_H_OTHER; } break; + case SCE_H_VALUE: + if (!ishtmlwordchar(ch)) { + if (ch == '\"') { + // Should really test for being first character + state = SCE_H_DOUBLESTRING; + } else if (ch == '\'') { + state = SCE_H_SINGLESTRING; + } else { + if (IsNumber(styler.GetStartSegment(), styler)) { + styler.ColourTo(i - 1, SCE_H_NUMBER); + } else { + styler.ColourTo(i - 1, StateToPrint); + } + if (ch == '>') { + styler.ColourTo(i, SCE_H_TAG); + if (inScriptType == eNonHtmlScript) { + state = StateForScript(scriptLanguage); + } else { + state = SCE_H_DEFAULT; + } + } else { + state = SCE_H_OTHER; + } + } + } + break; case SCE_HJ_DEFAULT: case SCE_HJ_START: case SCE_HJ_SYMBOLS: -- cgit v1.2.3