1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-28 23:49:20 +00:00

fixed pixel editor comment handling

This commit is contained in:
Steven Hugg 2019-08-20 10:35:41 -04:00
parent 02be2c9438
commit 94f28461ea
2 changed files with 8 additions and 1 deletions

View File

@ -61,7 +61,7 @@ type PixelEditorMessage = {
/////////////////
// 0xabcd, #$abcd, 5'010101, 0b010101, etc
var pixel_re = /([0#]?)([x$%]|\d'h)([0-9a-f]+)|(\d'b|0b)([01]+)/gim;
var pixel_re = /([0#]?)([x$%]|\d'h)([0-9a-f]+)(?:[;].*)?|(\d'b|0b)([01]+)/gim;
function convertToHexStatements(s:string) : string {
// convert 'hex ....' asm format

View File

@ -65,10 +65,17 @@ describe('Pixel editor', function() {
var words2 = pixed.parseHexWords(datastr2);
assert.deepEqual(words2, [0x03,0x11,0x30,0x27,0x00,0x1c,0x20,0x2c,0x00]);
// test verilog
var datastr3 = " 7'o00: bits = 5'b11111; ";
var words3 = pixed.parseHexWords(datastr3);
assert.deepEqual(words3, [31]);
assert.equal(datastr3, pixed.replaceHexWords(datastr3, pixed.parseHexWords(datastr3)));
// TODO: test (nplanes > 0 && fmt.sl)
// test comments
var datastr4 = " .byte #%01111110;$7E \n .byte #%01111111;$7F";
var words4 = pixed.parseHexWords(datastr4);
assert.deepEqual(words4, [0x7E,0x7F]);
assert.notEqual(datastr4, pixed.replaceHexWords(datastr4, pixed.parseHexWords(datastr4))); // removed comment
});
});