diff options
author | Markus Heidelberg <markus.heidelberg@web.de> | 2015-01-11 09:04:00 +1100 |
---|---|---|
committer | Markus Heidelberg <markus.heidelberg@web.de> | 2015-01-11 09:04:00 +1100 |
commit | 683c68c04540c42b0b22de78da9c046b98ad50e2 (patch) | |
tree | 8d7daf95b255579c050ee42fa7fe0e9a28eaa485 | |
parent | 52156dcd3465f5db9734b0e8ca8d726eae60c9f2 (diff) | |
download | scintilla-mirror-683c68c04540c42b0b22de78da9c046b98ad50e2.tar.gz |
LexHex: add a new state for garbage data after the record
IHex and Srec just set to the DEFAULT state before, TEHex used the
SCE_HEX_DATA_UNKNOWN state for garbage data, which is not the actual intention
for this state.
-rw-r--r-- | include/SciLexer.h | 1 | ||||
-rw-r--r-- | include/Scintilla.iface | 1 | ||||
-rw-r--r-- | lexers/LexHex.cxx | 20 |
3 files changed, 14 insertions, 8 deletions
diff --git a/include/SciLexer.h b/include/SciLexer.h index 7c63a9de2..9dd1f240f 100644 --- a/include/SciLexer.h +++ b/include/SciLexer.h @@ -1767,6 +1767,7 @@ #define SCE_HEX_CHECKSUM 15 #define SCE_HEX_CHECKSUM_WRONG 16 #define SCE_HEX_RECTYPE_UNKNOWN 17 +#define SCE_HEX_GARBAGE 18 /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ #endif diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 9c802cd3d..df70dfeea 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -4570,6 +4570,7 @@ val SCE_HEX_DATA_EMPTY=14 val SCE_HEX_CHECKSUM=15 val SCE_HEX_CHECKSUM_WRONG=16 val SCE_HEX_RECTYPE_UNKNOWN=17 +val SCE_HEX_GARBAGE=18 # Lexical state for SCLEX_IHEX (shared with Srec) lex IHex=SCLEX_IHEX SCE_HEX_ # Lexical state for SCLEX_TEHEX (shared with Srec) diff --git a/lexers/LexHex.cxx b/lexers/LexHex.cxx index 935b026d2..c0ffa0cbe 100644 --- a/lexers/LexHex.cxx +++ b/lexers/LexHex.cxx @@ -95,6 +95,9 @@ * * - States in parentheses in the upper format descriptions indicate that they * should not appear in a valid hex file. + * + * - State SCE_HEX_GARBAGE means garbage data after the intended end of the + * record, the line is too long then. This state is used in all lexers. */ #include <stdlib.h> @@ -692,8 +695,9 @@ static void ColouriseSrecDoc(unsigned int startPos, int length, int initStyle, W case SCE_HEX_CHECKSUM: case SCE_HEX_CHECKSUM_WRONG: - // record finished - sc.SetState(SCE_HEX_DEFAULT); + case SCE_HEX_GARBAGE: + // record finished or line too long + sc.SetState(SCE_HEX_GARBAGE); ForwardWithinLine(sc); break; } @@ -802,8 +806,9 @@ static void ColouriseIHexDoc(unsigned int startPos, int length, int initStyle, W case SCE_HEX_CHECKSUM: case SCE_HEX_CHECKSUM_WRONG: - // record finished - sc.SetState(SCE_HEX_DEFAULT); + case SCE_HEX_GARBAGE: + // record finished or line too long + sc.SetState(SCE_HEX_GARBAGE); ForwardWithinLine(sc); break; } @@ -946,10 +951,9 @@ static void ColouriseTEHexDoc(unsigned int startPos, int length, int initStyle, case SCE_HEX_DATA_ODD: case SCE_HEX_DATA_EVEN: - case SCE_HEX_DATA_UNKNOWN: - - // line too long - sc.SetState(SCE_HEX_DATA_UNKNOWN); + case SCE_HEX_GARBAGE: + // record finished or line too long + sc.SetState(SCE_HEX_GARBAGE); ForwardWithinLine(sc); break; } |