These patches adapt LexHex.cxx to support Intel HEX in addition to Motorola S-Record. Patches 1-3 fix/extend some S-Record stuff, patch 4 prepares some helper functions for reusing in Intel HEX, patch 5 adds the new lexer. In the example file, the first section is valid and the second section contains errors (unknown type, wrong byte count, wrong checksum).
I wonder whether it would be better to use the same lexical states for both lexers because they are mostly equal with few states only occuring in one of the lexers. I.e. SCE_HEX_ instead of SCE_SREC_ and SCE_IHEX_.
Another tought is about reordering the states to keep related states side by side. And also keeping gaps between groups for extensibility, is this usual?
I know, the states must not be changed for compatibility reasons, but maybe this is not true as long as the states/lexers have not been released yet?
Patches for Scintilla.
Patches for SciTE.
The states are similar enough that sharing would be reasonable. Sharing may lead to better support in projects using these lexers.
If you want to renumber states then do it before this is in a release. The next release is likely in 2 to 4 weeks.
Current lexers mostly avoid gaps so downstream projects do not expect them and may behave in unexpected ways.
State ordering is not generally important although it may lead to ordering in UI elements.
Patches v2 for Scintilla.
0001..0004 are unchanged.
Coverity is warning of overflow:
Patch 0004 v3 for Scintilla.
Variable "cs" is now signed int and I have changed the return line to:
return -cs & 0xFF;
Patches v2 for SciTE.
0001 is unchanged.
Last edit: Markus Heidelberg 2014-12-28
Committed as [50344d], [8ace46], [f4f5cb], [bde286], [058f4a], [dc22b7], [db73bf], [84d1ad], [315e7c], [25548c], [e85d2a], [f952d1].
Since I don't have a paid Coverity license, it can only be run once a week so I don't know yet whether it will OK the updated checksum calculation.
Related
Commit: [25548c]
Commit: [315e7c]
Commit: [e85d2a]
Commit: [f952d1]
Commit: [058f4a]
Commit: [50344d]
Commit: [84d1ad]
Commit: [8ace46]
Commit: [bde286]
Commit: [db73bf]
Commit: [dc22b7]
Commit: [f4f5cb]