Skip to content

Commit

Permalink
tiny updates
Browse files Browse the repository at this point in the history
- handle abort trap \method() in debug() statements
- handle obj[1].method() - numeric indexing
- skip non-symbol names when processing RHS in spin
  • Loading branch information
ironsheep committed Nov 24, 2023
1 parent 9e8795e commit d9a457a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions spin2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Possible next additions:
Update P2 Only

- Fixes to SPIN2 symbol.storageType and object[index].method() parsing
- Handle \methodName() in debug() statements

## [2.2.6] 2023-11-21

Expand Down
9 changes: 8 additions & 1 deletion spin2/server/src/parser/spin2.documentSemanticParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,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 @@ -4667,6 +4667,10 @@ export class Spin2DocumentSemanticParser {
this._logSPIN(` -- SPIN RHS nameOffset=(${nameOffset}), offsetInNonStringRHS=(${offsetInNonStringRHS}), currentOffset=(${currentOffset})`);
for (let index = 0; index < possibleNameSet.length; index++) {
const namePart = possibleNameSet[index];
if (!namePart.charAt(0).match(/[a-zA-Z_]/)) {
nameOffset += namePart.length;
continue;
}
currNameLength = namePart.length;
nameOffset = line.indexOf(namePart, nameOffset);
this._logSPIN(` -- processing name(s) namePart=[${namePart}](${namePart.length})`);
Expand Down Expand Up @@ -6340,6 +6344,9 @@ export class Spin2DocumentSemanticParser {
if (nameParts.length > 1) {
indexNames = nameParts[1];
}
if (indexNames && !indexNames.charAt(0).match(/[a-zA-Z_]/)) {
indexNames = undefined;
}
}
if (indexNames) {
// handle case: instance[index].reference[()] - "index" value
Expand Down
2 changes: 1 addition & 1 deletion spin2/server/src/parser/spin2.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class Spin2ParseUtils {
//this._logMessage(" -- gdnwlp nonDblStringLine=[" + nonDblStringLine + "]");
const nonSglStringLine: string = this.removeDebugSingleQuotedStrings(nonDblStringLine, true);
//this._logMessage(" -- gdnwlp nonSglStringLine=[" + nonSglStringLine + "]");
let lineParts: string[] | null = nonSglStringLine.match(/[^ ,@\[\]\=\+\-\*\/\:\#\<\>\|\^\&\t\(\)\!\?\~]+/g);
let lineParts: string[] | null = nonSglStringLine.match(/[^ ,@\[\]\=\+\-\*\/\:\#\<\>\|\^\&\t\(\)\!\?\~\\]+/g);
//let lineParts: string[] | null = line.match(/[^ ,@\[\]\+\-\*\/\<\>\t\(\)]+/g);
return lineParts == null ? [] : lineParts;
}
Expand Down

0 comments on commit d9a457a

Please sign in to comment.