From 683c68c04540c42b0b22de78da9c046b98ad50e2 Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Sun, 11 Jan 2015 09:04:00 +1100 Subject: 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. --- lexers/LexHex.cxx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'lexers') 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 @@ -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; } -- cgit v1.2.3