Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib/spar_bytecode_heatmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var opcodesWeight = Object.freeze({
"MOV": 0.3, // MOV is most common opcode, it should give much weight but sometimes you need to organize it properly
"NOT": 1, // Unary opcodes
"UNM": 1,
"LEN": 2, // Lenght might get expensive on tables
"LEN": 2, // Length might get expensive on tables
"ADDVN": 1, // Arithmetics with literal + var is fine
"SUBVN": 1,
"MULVN": 1,
Expand All @@ -49,7 +49,7 @@ var opcodesWeight = Object.freeze({
"KNUM": 1,
"KPRI": 1,
"KNIL": 1,
"UGET": 3, // Getting upvalue. The complexity is unkown because we don't know how far is the original local is, so we count as getting 3 locals.
"UGET": 3, // Getting upvalue. The complexity is unknown because we don't know how far is the original local is, so we count as getting 3 locals.
"USETV": 3.5, // Little expensive for the cost of getting value from the stack
"USETS": 3, // These are fine
"USETN": 3,
Expand Down
8 changes: 4 additions & 4 deletions src/signatureProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,19 @@ class SignatureProvider {
let cursor = line.text.substr(0, pos.character);

let tokenized = new Tokenizer(cursor);
if (tokenized.invalidLua || tokenized.openParanthesis.length === 0) return;
if (tokenized.invalidLua || tokenized.openParenthesis.length === 0) return;

let func = tokenized.openParanthesis[tokenized.openParanthesis.length-1];
let func = tokenized.openParenthesis[tokenized.openParenthesis.length-1];
if (func == false) return;

let activeCallbackParameter;
let callback = false;
if (tokenized.openParanthesis.length > 1) {
if (tokenized.openParenthesis.length > 1) {
// Detect a callback function
if (func[0] === "function") {
callback = true;
activeCallbackParameter = func.length - 1;
func = tokenized.openParanthesis[tokenized.openParanthesis.length-2];
func = tokenized.openParenthesis[tokenized.openParenthesis.length-2];
}
}

Expand Down
16 changes: 8 additions & 8 deletions src/tokenizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Tokenizer {
this.openMultilineString = false;
this.openEscape = false;

this.openParanthesis = [];
this.openParenthesis = [];
this.openShortFuncCall = false; // e.g. AddCSLuaFile "whatever.lua"

this.history = {
Expand All @@ -48,12 +48,12 @@ class Tokenizer {
functionCallOpen(i) {
let func = [this.token];
this.history.functionCallsOpen[func] = i - this.token.length - 1;
this.openParanthesis.push(func);
this.openParenthesis.push(func);
this.token = "";
}

functionCallClose(i) {
let func = this.openParanthesis.pop();
let func = this.openParenthesis.pop();
this.history.functionCallsClosed.push([func, this.history.functionCallsOpen[func], i + 1]);
delete this.history.functionCallsOpen[func];
this.token = "";
Expand Down Expand Up @@ -83,7 +83,7 @@ class Tokenizer {
this.openString = false;
this.token += "\"";
if (this.openShortFuncCall) {
this.openParanthesis.pop();
this.openParenthesis.pop();
this.token = "";
}
this.openShortFuncCall = false;
Expand Down Expand Up @@ -189,12 +189,12 @@ class Tokenizer {
break;
}
} else {
this.openParanthesis.push(false);
this.openParenthesis.push(false);
}
break;

case ")":
if (this.openParanthesis !== false) {
if (this.openParenthesis !== false) {
this.functionCallClose(i);
break;
} else {
Expand All @@ -207,8 +207,8 @@ class Tokenizer {
this.invalidLua = true;
break tokenize;
}
if (this.openParanthesis.length > 0) {
let func = this.openParanthesis[this.openParanthesis.length-1];
if (this.openParenthesis.length > 0) {
let func = this.openParenthesis[this.openParenthesis.length-1];
if (func === false) {
this.invalidLua = true;
break tokenize;
Expand Down
2 changes: 1 addition & 1 deletion src/wikiProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class WikiProvider {
}

stripCodeFormatting(str) {
return str.replace(/```[\s\S]+?```/g, "_< ommitted code block >_").replace(/^[\t\r ]*/gm, "");
return str.replace(/```[\s\S]+?```/g, "_< omitted code block >_").replace(/^[\t\r ]*/gm, "");
}

markdownURL(url) {
Expand Down