diff options
author | nyamatongwe <unknown> | 2000-08-22 03:13:47 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2000-08-22 03:13:47 +0000 |
commit | 4e823c6cbf83bd552796e5da30d9728fd06b43ef (patch) | |
tree | 179484a3ebba2fe05ba2ae635aa43f4935a6e901 /src/LexHTML.cxx | |
parent | 6ed3892e53bbad8ac5af2bfacecb773337a501f3 (diff) | |
download | scintilla-mirror-4e823c6cbf83bd552796e5da30d9728fd06b43ef.tar.gz |
Added SCE_H_VALUE class for HTML for unquoted values.
Diffstat (limited to 'src/LexHTML.cxx')
-rw-r--r-- | src/LexHTML.cxx | 40 |
1 files changed, 38 insertions, 2 deletions
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: |