From 08a4d16881b4c832efde6f84e06a3034b29873ef Mon Sep 17 00:00:00 2001 From: Hayden Kroepfl Date: Sat, 6 Jan 2018 19:24:19 -0700 Subject: [PATCH 1/2] Added INC and DEC instructions to front-end --- mar/ace/mode-mar.js | 4 ++-- mar/ace/mode-mar.min.js | 2 +- mar/editor.js | 4 ++-- mar/editor.min.js | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mar/ace/mode-mar.js b/mar/ace/mode-mar.js index 922b5a6..3102a3d 100755 --- a/mar/ace/mode-mar.js +++ b/mar/ace/mode-mar.js @@ -47,7 +47,7 @@ define("ace/mode/mar_rules", ["require", "exports", "module", "ace/lib/oop", "ac start: [{ token: 'keyword.function.assembly', - regex: '\\b(?:mov|add|sub|and|or|test|cmp|shl|shr|mul|push|pop|div|xor|dw|nop|equ|neg|hwq|not|ror|rol|sal|sar)\\b', + regex: '\\b(?:mov|add|sub|and|or|test|cmp|shl|shr|mul|push|pop|div|xor|dw|nop|equ|neg|hwq|not|ror|rol|sal|sar|inc|dec)\\b', caseInsensitive: true }, { @@ -114,4 +114,4 @@ define("ace/mode/mar", ["require", "exports", "module", "ace/lib/oop", "ace/mode }).call(Mode.prototype); exports.Mode = Mode; -}); \ No newline at end of file +}); diff --git a/mar/ace/mode-mar.min.js b/mar/ace/mode-mar.min.js index 4dbaece..ecbb174 100644 --- a/mar/ace/mode-mar.min.js +++ b/mar/ace/mode-mar.min.js @@ -1,4 +1,4 @@ -define("ace/mode/mar_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(a,d,b){b=a("../lib/oop");a=a("./text_highlight_rules").TextHighlightRules;var c=function(){this.$rules={start:[{token:"keyword.function.assembly",regex:"\\b(?:mov|add|sub|and|or|test|cmp|shl|shr|mul|push|pop|div|xor|dw|nop|equ|neg|hwq|not|ror|rol|sal|sar)\\b",caseInsensitive:!0},{token:"keyword.operator.assembly",regex:"\\b(?:call|ret|jmp|jnz|jg|jl|jge|jle|hwi|jz|js|jns|jc|jnc)\\b",caseInsensitive:!0}, +define("ace/mode/mar_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(a,d,b){b=a("../lib/oop");a=a("./text_highlight_rules").TextHighlightRules;var c=function(){this.$rules={start:[{token:"keyword.function.assembly",regex:"\\b(?:mov|add|sub|and|or|test|cmp|shl|shr|mul|push|pop|div|xor|dw|nop|equ|neg|hwq|not|ror|rol|sal|sar|inc|dec)\\b",caseInsensitive:!0},{token:"keyword.operator.assembly",regex:"\\b(?:call|ret|jmp|jnz|jg|jl|jge|jle|hwi|jz|js|jns|jc|jnc)\\b",caseInsensitive:!0}, {token:"variable.predefined.ahk",regex:"\\b(?:brk|dup)\\b",caseInsensitive:!0},{token:"variable.parameter.register.assembly",regex:"\\b(?:A|B|C|D|X|Y|bp|sp)\\b",caseInsensitive:!0},{token:"constant.character.decimal.assembly",regex:"\\b[0-9]+\\b"},{token:"constant.character.hexadecimal.assembly",regex:"\\b0x[A-F0-9]+\\b",caseInsensitive:!0},{token:"string.assembly",regex:/"([^\\"]|\\.)*"/},{token:"comment.assembly",regex:";.*$"},{token:"support.function.directive.assembly",regex:/^\.text|\.data/}, {token:"entity.name.function.assembly",regex:/\w*:/}]};this.normalizeRules()};c.metaData={fileTypes:["asm"],name:"Much Assembly Required",scopeName:"source.assembly"};b.inherits(c,a);d.MarHighlightRules=c}); define("ace/mode/mar","require exports module ace/lib/oop ace/mode/text ace/mode/mar_rules".split(" "),function(a,d,b){b=a("../lib/oop");var c=a("./text").Mode,e=a("./mar_rules").MarHighlightRules;a=function(){this.HighlightRules=e;this.$behaviour=this.$defaultBehaviour};b.inherits(a,c);a.prototype.lineCommentStart=";";a.prototype.$id="ace/mode/mar";d.Mode=a}); diff --git a/mar/editor.js b/mar/editor.js index 9c5b0c9..cc3487f 100644 --- a/mar/editor.js +++ b/mar/editor.js @@ -256,7 +256,7 @@ function parseInstruction(line, result, currentLine) { if (!parseDWInstruction(line, result, currentLine)) { - if (new RegExp('\\b(?:mov|add|sub|and|or|test|cmp|shl|shr|mul|push|pop|div|xor|hwi|hwq|nop|neg|' + + if (new RegExp('\\b(?:mov|add|sub|and|or|test|cmp|shl|shr|mul|push|pop|div|xor|hwi|hwq|nop|neg|inc|dec' + 'call|ret|jmp|jnz|jg|jl|jge|jle|int|jz|js|jns|brk|not|jc|jnc|ror|rol|sal|sar|jo|jno)\\b').test(mnemonic.toLowerCase())) { @@ -315,7 +315,7 @@ function parseInstruction(line, result, currentLine) { strO1 = line.substring(line.indexOf(mnemonic) + mnemonic.length).trim(); //Validate operand number - if (!new RegExp('\\b(?:push|mul|pop|div|neg|call|jnz|jg|jl|jge|jle|hwi|hwq|jz|js|jns|ret|jmp|not|jc|jnc|jo|jno)\\b').test(mnemonic.toLowerCase())) { + if (!new RegExp('\\b(?:push|mul|pop|div|neg|inc|dec|call|jnz|jg|jl|jge|jle|hwi|hwq|jz|js|jns|ret|jmp|not|jc|jnc|jo|jno)\\b').test(mnemonic.toLowerCase())) { result.annotations.push({ row: currentLine, column: 0, diff --git a/mar/editor.min.js b/mar/editor.min.js index 0898478..ee54e32 100644 --- a/mar/editor.min.js +++ b/mar/editor.min.js @@ -10,8 +10,8 @@ function parseDWInstruction(a,c,b){a=a.trim();if("dw"===a.substr(0,2).toLowerCas column:0,text:"Usage: DW IMM, IMM ...",type:"error"});break}}return!0}return!1} function getOperandType(a,c){a=a.trim();if(""===a)return OPERAND_INVALID;if(!isNaN(Number(a))&&Number(a)===Math.floor(Number(a))&&-1===a.indexOf("o")&&-1===a.indexOf("e"))return OPERAND_IMM;if(/^(a|b|c|d|x|y|bp|sp)$/.test(a.toLowerCase()))return OPERAND_REG;for(b=0;b Date: Sat, 6 Jan 2018 19:26:59 -0700 Subject: [PATCH 2/2] Fixed missing | in regex after dec --- mar/editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mar/editor.js b/mar/editor.js index cc3487f..8e1c9f1 100644 --- a/mar/editor.js +++ b/mar/editor.js @@ -256,7 +256,7 @@ function parseInstruction(line, result, currentLine) { if (!parseDWInstruction(line, result, currentLine)) { - if (new RegExp('\\b(?:mov|add|sub|and|or|test|cmp|shl|shr|mul|push|pop|div|xor|hwi|hwq|nop|neg|inc|dec' + + if (new RegExp('\\b(?:mov|add|sub|and|or|test|cmp|shl|shr|mul|push|pop|div|xor|hwi|hwq|nop|neg|inc|dec|' + 'call|ret|jmp|jnz|jg|jl|jge|jle|int|jz|js|jns|brk|not|jc|jnc|ror|rol|sal|sar|jo|jno)\\b').test(mnemonic.toLowerCase())) {