This commit is contained in:
Simon 2018-11-30 15:11:24 -05:00
parent 3776070689
commit 6c7a2f0a73
3 changed files with 17 additions and 4 deletions

View File

@ -129,7 +129,6 @@ public class Factory extends Structure implements Updatable {
return dbObject;
}
ArrayList<NonPlayerCharacter> getNpcs() {
return npcs;
}

View File

@ -140,7 +140,7 @@ public class Assembler {
try {
//Special thanks to https://stackoverflow.com/questions/1757065/
String[] values = line.substring(2, line.length()).split(",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)", -1);
String[] values = line.substring(2).split(",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)", -1);
for (String value : values) {

View File

@ -4,6 +4,8 @@ OPERAND_MEM_IMM = 1;
OPERAND_MEM_REG = 2;
OPERAND_IMM = 3;
MALFORMED_UTF16_RE = /\\u[0-9a-fA-F]{0,3}([^0-9a-fA-F]|$)/;
//Remove default syntax checker
editor = ace.edit("editor");
editor.session.setOption("useWorker", false);
@ -117,13 +119,11 @@ function checkForORGInstruction(line, result, currentLine) {
function parseDWInstruction(line, result, currentLine) {
line = line.trim();
if (line.substr(0, 2).toLowerCase() === "dw") {
var values = line.substr(2, line.length).split(/,(?=(?:[^"]*"[^"]*")*[^"]*$)/, -1);
for (var i = 0; i < values.length; i++) {
values[i] = values[i].trim();
@ -137,6 +137,20 @@ function parseDWInstruction(line, result, currentLine) {
} else if (values[i].startsWith("\"") && values[i].endsWith("\"")) {
//Handle string
var strText = values[i].substr(1, values[i].length - 2);
if (strText.match(MALFORMED_UTF16_RE) != null) {
result.annotations.push({
row: currentLine,
column: 0,
text: "Malformed UTF-16 escape sequence",
type: "error"
});
return true;
}
//TODO: verify other escape sequences
} else if (getOperandType(values[i], result) === OPERAND_IMM) {