Skip to content

Commit

Permalink
final cleanup for release
Browse files Browse the repository at this point in the history
  • Loading branch information
ironsheep committed Nov 9, 2023
1 parent 46fd9ac commit 9dc7e4b
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 54 deletions.
2 changes: 1 addition & 1 deletion spin2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"icon": "images/Propeller.ico",
"author": "IronSheep",
"license": "MIT",
"version": "2.2.1",
"version": "2.2.2",
"repository": {
"type": "git",
"url": "https://github.com/ironsheep/P2-vscode-langserv-extension"
Expand Down
7 changes: 6 additions & 1 deletion spin2/server/src/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,15 @@ export function resolveReferencedIncludes(includedFiles: string[], rootDirSpec:
if (!fileBaseName.toLowerCase().includes(".spin")) {
matchFilename = `${fileBaseName}.`.toLowerCase();
}
//ctx.logger.log(`TRC: looking for matchFilename=[${matchFilename}]`);
for (let index = 0; index < fileSpecs.length; index++) {
const fileSpec: string = fileSpecs[index];
if (fileSpec.toLowerCase().includes(matchFilename)) {
const pathParts: string[] = fileSpec.split("/");
const fileName = pathParts[pathParts.length - 1].toLowerCase();
//ctx.logger.log(`TRC: checking fileSpec=[${fileSpec}]`);
if (fileName.startsWith(matchFilename)) {
matchedFiles.push(fileSpec);
//ctx.logger.log(`TRC: matched fileSpec=[${fileSpec}]`);
}
}
}
Expand Down
17 changes: 10 additions & 7 deletions spin2/server/src/parser/spin.semantic.findings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,9 @@ export class DocumentFindings {
public getPublicToken(tokenName: string): RememberedToken | undefined {
// return public token or undefined is not present or token is not public
let referenceDetails: RememberedToken | undefined = this.getGlobalToken(tokenName);
this._logMessage(` -- gPublToken(${tokenName}) -> (${referenceDetails})`);
if (referenceDetails && !referenceDetails.isPublic()) {
this._logMessage(` -- gPublToken() -> NOT public, disqualified! (${referenceDetails})`);
referenceDetails = undefined;
}
return referenceDetails;
Expand Down Expand Up @@ -1246,9 +1248,9 @@ export class DocumentFindings {
const spanInfo: IMethodSpan = { startLineNbr: this.currMethodStartLineNbr, endLineNbr: lineNbr };
if (!this.spanInfoByMethodName.has(this.currMethodName)) {
this.spanInfoByMethodName.set(this.currMethodName, spanInfo);
this._logMessage(` -- NEW-locTOK method=[${this.currMethodName}], span=[${spanInfo.startLineNbr}, ${spanInfo.endLineNbr}]`);
this._logMessage(` -- END-Method method=[${this.currMethodName}], span=[${spanInfo.startLineNbr}, ${spanInfo.endLineNbr}]`);
} else {
this._logMessage(` -- DUPE!! locTOK method=[${this.currMethodName}], span=[${spanInfo.startLineNbr}, ${spanInfo.endLineNbr}] IGNORED!`);
this._logMessage(` -- DUPE!! method=[${this.currMethodName}], span=[${spanInfo.startLineNbr}, ${spanInfo.endLineNbr}] IGNORED!`);
}
}
// now clear in progress
Expand Down Expand Up @@ -1503,17 +1505,18 @@ export class TokenSet {
}

public rememberdTokenString(tokenName: string, aToken: RememberedToken | undefined): string {
let desiredInterp: string = " -- token=[len:" + tokenName.length + " [" + tokenName + "](undefined)";
let desiredInterp: string = ` -- token=[len:${tokenName.length} [${tokenName}](undefined)`;
if (aToken != undefined) {
desiredInterp = " -- token=[len:" + tokenName.length + " [" + tokenName + "](" + aToken.type + "[" + aToken.modifiers + "])]";
desiredInterp = ` -- token=[len:${tokenName.length} [${tokenName}](${aToken.type}[${aToken.modifiers}])]`;
}
return desiredInterp;
}

public hasToken(tokenName: string): boolean {
let foundStatus: boolean = false;
const desiredTokenKey: string = tokenName.toLowerCase();
if (tokenName.length > 0) {
foundStatus = this.rememberedTokenByName.has(tokenName.toLowerCase());
foundStatus = this.rememberedTokenByName.has(desiredTokenKey);
}
if (foundStatus) {
this._logMessage(`* ${this.id} [${tokenName}] found: ${foundStatus}`);
Expand All @@ -1527,9 +1530,9 @@ export class TokenSet {
if (!this.hasToken(tokenName)) {
this.rememberedTokenByName.set(desiredTokenKey, token);
const currCt: number = this.length();
this._logMessage(`* ${this.id} #${currCt}: ` + this.rememberdTokenString(tokenName, token));
this._logMessage(`* ${this.id} #${currCt}: ${this.rememberdTokenString(tokenName, token)}`);
} else {
this._logMessage(`* ${this.id} DUPE Token, NOT ADDED! ` + this.rememberdTokenString(tokenName, token));
this._logMessage(`* ${this.id} DUPE Token, NOT ADDED! ${this.rememberdTokenString(tokenName, token)}`);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions spin2/server/src/parser/spin1.documentSemanticParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class Spin1DocumentSemanticParser {

private bLogStarted: boolean = false;
// adjust following true/false to show specific parsing debug
private spin1DebugLogEnabled: boolean = true; // WARNING (REMOVE BEFORE FLIGHT)- change to 'false' - disable before commit
private spin1DebugLogEnabled: boolean = false; // WARNING (REMOVE BEFORE FLIGHT)- change to 'false' - disable before commit
private showSpinCode: boolean = true;
private showPreProc: boolean = true;
private showCON: boolean = true;
Expand Down Expand Up @@ -180,7 +180,7 @@ export class Spin1DocumentSemanticParser {
// now start our processing
if (currState == eParseState.inMultiLineDocComment) {
// in multi-line doc-comment, hunt for end '}}' to exit
let closingOffset = trimmedNonCommentLine.indexOf("}}");
let closingOffset = lineWOutInlineComments.indexOf("}}");
if (closingOffset != -1) {
// have close, comment ended
// end the comment recording
Expand All @@ -202,7 +202,7 @@ export class Spin1DocumentSemanticParser {
} else if (currState == eParseState.inMultiLineComment) {
// in multi-line non-doc-comment, hunt for end '}' to exit
// ALLOW {...} on same line without closing!
const closingOffset: number = trimmedNonCommentLine.indexOf("}");
const closingOffset: number = lineWOutInlineComments.indexOf("}");
if (closingOffset != -1) {
// have close, comment ended
// end the comment recording
Expand Down Expand Up @@ -488,7 +488,7 @@ export class Spin1DocumentSemanticParser {
if (currState == eParseState.inMultiLineDocComment) {
// in multi-line doc-comment, hunt for end '}}' to exit
// ALLOW {cmt}, {{cmt}} on same line without closing!
let closingOffset = trimmedNonCommentLine.indexOf("}}");
let closingOffset = lineWOutInlineComments.indexOf("}}");
if (closingOffset != -1) {
// have close, comment ended
currState = priorState;
Expand All @@ -501,7 +501,7 @@ export class Spin1DocumentSemanticParser {
// in multi-line non-doc-comment, hunt for end '}' to exit
// ALLOW {...} on same line without closing!
this._logMessage(" hunt for '}' Ln#" + lineNbr + " trimmedLine=[" + trimmedLine + "]");
const closingOffset: number = trimmedNonCommentLine.indexOf("}");
const closingOffset: number = lineWOutInlineComments.indexOf("}");
if (closingOffset != -1) {
// have close, comment ended
this._logMessage(" FOUND '}' Ln#" + lineNbr + " trimmedLine=[" + trimmedLine + "]");
Expand Down
32 changes: 16 additions & 16 deletions spin2/server/src/parser/spin1.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ export class Spin1ParseUtils {
didReplace = true;
}

if (didReplace) {
this._logMessage(` -- gLWoInLnC line [${line}]`);
this._logMessage(` -- [${cleanedLine}]`);
}
//if (didReplace) {
// this._logMessage(` -- gLWoInLnC line [${line}]`);
// this._logMessage(` -- [${cleanedLine}]`);
//}
}
return cleanedLine;
}
Expand Down Expand Up @@ -235,22 +235,22 @@ export class Spin1ParseUtils {

// do we have a comment?
if (beginCommentOffset != -1) {
this._logMessage(` - p1 gNCLR ofs=${startingOffset}, line=[${line}](${line.length})`);
this._logMessage(` - p1 gRWoTTC ofs=${startingOffset}, line=[${line}](${line.length})`);
}
const nonCommentEOL: number = beginCommentOffset != -1 ? beginCommentOffset : line.length;
//this._logMessage('- gnclr startingOffset=[' + startingOffset + '], currentOffset=[' + currentOffset + ']');
lineWithoutTrailingCommentStr = lineWithoutTrailingCommentStr.substring(0, nonCommentEOL).trimEnd();
//this._logMessage('- gnclr lineWithoutTrailingCommentStr=[' + startingOffset + ']');
if (lineWithoutTrailingCommentStr.trim().length == 0) {
lineWithoutTrailingCommentStr = "";
this._logMessage(` -- gNCLR line forced to EMPTY`);
//this._logMessage(` -- gRWoTTC line forced to EMPTY`);
}
if (line.substr(startingOffset) !== lineWithoutTrailingCommentStr) {
this._logMessage(` -- gNCLR line [${line}](${line.length})`);
this._logMessage(` -- [${lineWithoutTrailingCommentStr}](${lineWithoutTrailingCommentStr.length})`);
}
} else {
this._logMessage(` - gNCLR SKIPPED ofs=${startingOffset}, line=[${line}](${line.length})`);
//if (line.substr(startingOffset) !== lineWithoutTrailingCommentStr) {
// this._logMessage(` -- gRWoTTC line [${line}](${line.length})`);
// this._logMessage(` -- [${lineWithoutTrailingCommentStr}](${lineWithoutTrailingCommentStr.length})`);
//}
//} else {
//this._logMessage(` - gRWoTTC SKIPPED ofs=${startingOffset}, line=[${line}](${line.length})`);
}
return lineWithoutTrailingCommentStr;
}
Expand Down Expand Up @@ -442,10 +442,10 @@ export class Spin1ParseUtils {
}
}

if (didRemove) {
this._logMessage(" -- RDQS line [" + line + "]");
this._logMessage(" -- [" + trimmedLine + "]");
}
//if (didRemove) {
// this._logMessage(" -- RDQS line [" + line + "]");
// this._logMessage(" -- [" + trimmedLine + "]");
//}

return trimmedLine;
}
Expand Down
12 changes: 6 additions & 6 deletions spin2/server/src/parser/spin2.documentSemanticParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class Spin2DocumentSemanticParser {

private bLogStarted: boolean = false;
// adjust following true/false to show specific parsing debug
private spin2DebugLogEnabled: boolean = true; // WARNING (REMOVE BEFORE FLIGHT)- change to 'false' - disable before commit
private spin2DebugLogEnabled: boolean = false; // WARNING (REMOVE BEFORE FLIGHT)- change to 'false' - disable before commit
private showSpinCode: boolean = true;
private showPreProc: boolean = true;
private showCON: boolean = true;
Expand Down Expand Up @@ -157,7 +157,7 @@ export class Spin2DocumentSemanticParser {
const lineWOutInlineComments: string = this.parseUtils.getLineWithoutInlineComments(line);
const bHaveLineToProcess: boolean = lineWOutInlineComments.length > 0;
const trimmedNonCommentLine: string = bHaveLineToProcess ? this.parseUtils.getRemainderWOutTrailingTicComment(0, lineWOutInlineComments).trimStart() : "";
this._logMessage(` -- Ln#${lineNbr} CHK trimmedNonCommentLine=[${trimmedNonCommentLine}](${trimmedNonCommentLine.length})`);
//this._logMessage(` -- Ln#${lineNbr} CHK trimmedNonCommentLine=[${trimmedNonCommentLine}](${trimmedNonCommentLine.length})`);
const offSet: number = trimmedNonCommentLine.length > 0 ? line.indexOf(trimmedNonCommentLine) + 1 : line.indexOf(trimmedLine) + 1;
const tempComment: string = line.substring(trimmedNonCommentLine.length + offSet).trim();
this.rightEdgeComment = tempComment.length > 0 ? tempComment : undefined;
Expand Down Expand Up @@ -194,7 +194,7 @@ export class Spin2DocumentSemanticParser {
// now start our processing
if (currState == eParseState.inMultiLineDocComment) {
// in multi-line doc-comment, hunt for end '}}' to exit
let closingOffset = trimmedNonCommentLine.indexOf("}}");
let closingOffset = lineWOutInlineComments.indexOf("}}");
let commentLen: number = line.length;
if (closingOffset != -1) {
commentLen = closingOffset + 2;
Expand Down Expand Up @@ -223,7 +223,7 @@ export class Spin2DocumentSemanticParser {
} else if (currState == eParseState.inMultiLineComment) {
// in multi-line non-doc-comment, hunt for end '}' to exit
// ALLOW {...} on same line without closing!
const closingOffset: number = trimmedNonCommentLine.indexOf("}");
const closingOffset: number = lineWOutInlineComments.indexOf("}");
if (closingOffset != -1) {
// have close, comment ended
// end the comment recording
Expand Down Expand Up @@ -587,7 +587,7 @@ export class Spin2DocumentSemanticParser {
if (currState == eParseState.inMultiLineDocComment) {
// in multi-line doc-comment, hunt for end '}}' to exit
// ALLOW {cmt}, {{cmt}} on same line without closing!
let closingOffset = trimmedNonCommentLine.indexOf("}}");
let closingOffset = lineWOutInlineComments.indexOf("}}");
if (closingOffset != -1) {
// have close, comment ended
currState = priorState;
Expand All @@ -600,7 +600,7 @@ export class Spin2DocumentSemanticParser {
} else if (currState == eParseState.inMultiLineComment) {
// in multi-line non-doc-comment, hunt for end '}' to exit
// ALLOW {cmt}, {{cmt}} on same line without closing!
const closingOffset: number = trimmedNonCommentLine.indexOf("}");
const closingOffset: number = lineWOutInlineComments.indexOf("}");
if (closingOffset != -1) {
// have close, comment ended
currState = priorState;
Expand Down
36 changes: 18 additions & 18 deletions spin2/server/src/parser/spin2.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,10 @@ export class Spin2ParseUtils {
didReplace = true;
}

if (didReplace) {
this._logMessage(` -- gLWoInLnC line [${line}]`);
this._logMessage(` -- [${cleanedLine}]`);
}
//if (didReplace) {
// this._logMessage(` -- gLWoInLnC line [${line}]`);
// this._logMessage(` -- [${cleanedLine}]`);
//}
}
return cleanedLine;
}
Expand Down Expand Up @@ -528,23 +528,23 @@ export class Spin2ParseUtils {
}

// do we have a comment?
if (beginCommentOffset != -1) {
this._logMessage(` - p2 gNCLR ofs=${startingOffset}, line=[${line}](${line.length})`);
}
//if (beginCommentOffset != -1) {
// this._logMessage(` - p2 gRWoTTC ofs=${startingOffset}, line=[${line}](${line.length})`);
//}
const nonCommentEOL: number = beginCommentOffset != -1 ? beginCommentOffset : line.length;
//this._logMessage('- gnclr startingOffset=[' + startingOffset + '], currentOffset=[' + currentOffset + ']');
lineWithoutTrailingCommentStr = lineWithoutTrailingCommentStr.substring(0, nonCommentEOL).trimEnd();
//this._logMessage('- gnclr lineWithoutTrailingCommentStr=[' + startingOffset + ']');
if (lineWithoutTrailingCommentStr.trim().length == 0) {
lineWithoutTrailingCommentStr = "";
this._logMessage(` -- gNCLR line forced to EMPTY`);
//this._logMessage(` -- gRWoTTC line forced to EMPTY`);
}
if (line.substr(startingOffset) !== lineWithoutTrailingCommentStr) {
this._logMessage(` -- gNCLR line [${line}](${line.length})`);
this._logMessage(` -- [${lineWithoutTrailingCommentStr}](${lineWithoutTrailingCommentStr.length})`);
}
} else {
this._logMessage(` - gNCLR SKIPPED ofs=${startingOffset}, line=[${line}](${line.length})`);
//if (line.substr(startingOffset) !== lineWithoutTrailingCommentStr) {
// this._logMessage(` -- gRWoTTC line [${line}](${line.length})`);
// this._logMessage(` -- [${lineWithoutTrailingCommentStr}](${lineWithoutTrailingCommentStr.length})`);
//}
//} else {
//this._logMessage(` - gRWoTTC SKIPPED ofs=${startingOffset}, line=[${line}](${line.length})`);
}
return lineWithoutTrailingCommentStr;
}
Expand Down Expand Up @@ -632,10 +632,10 @@ export class Spin2ParseUtils {
}
}

if (didRemove) {
this._logMessage(" -- RDQS line [" + line + "]");
this._logMessage(" -- [" + trimmedLine + "]");
}
//if (didRemove) {
// this._logMessage(" -- RDQS line [" + line + "]");
// this._logMessage(" -- [" + trimmedLine + "]");
//}

return trimmedLine;
}
Expand Down

0 comments on commit 9dc7e4b

Please sign in to comment.