Skip to content

Commit

Permalink
add MODCZ operand constants (Spin2) - turn off debug log in prep for …
Browse files Browse the repository at this point in the history
…release
  • Loading branch information
ironsheep committed Dec 8, 2022
1 parent a047145 commit 4ac6205
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 16 deletions.
18 changes: 11 additions & 7 deletions spin2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Possible next additions:
- Add new-file templates as Snippets
- Add additional Snippets as the community identifies them

## [1.7.2] 2022-12-06
## [1.7.2] 2022-12-07

Update Spin highlighting (syntax and/or semantic parser fixes)

Expand All @@ -35,11 +35,18 @@ Update Spin2 highlighting (syntax and/or semantic parser fixes)
- Spin2: Recognize non-float decimal numbers with exponents
- Spin2: Recognize `debug_main` and `debug_coginit` compile time directives
- Spin2: Recognize event names in pasm2 correctly
- Spin2: Fix cases where 'debug' used without parenthesis causes extension crash
- Spin2: Fix cases where `debug` used without parenthesis causes extension crash
- Spin2: Recognize coginit constants (some pasm2 cases were being missed)
- Spin2: Add recognition of LutColors directive in debug statements with run-time termainal assignment
- Spin2: Add recognition of LutColors directive in debug statements with run-time terminal assignment
- Spin2: Recognize `modcz` operand constants

**NOTE:** *There is no change in our "Known Issues" list for this release.*
### - Known Issues w/v1.7.2

- We haven't yet learned how to control the ending position of the edit cursor. So in many cases when using selection, not an insert point, the cursor may end up not being where you might expect it to be after pressing TAB or Shift+TAB. We are looking into how to solve this. Even tho' this problem exists the formatting ability this new service provides is well worth this minor headache. We will keep looking for a means to get this under control.
- The single-quote comment (now only on debug statements) is being handled by the semantic (vs. syntactic) parser this is causing external VSCode extensions to do brace, parenthesis, and bracket paring to be marked within trailing line comments on debug lines
- Syntax highlight of DAT section sometimes fails... (although it is less often now...)
- Semantic highlight: the 'modification' attribute is being over-applied, should use more than := as test!!!!
- *I'm sure there are more issues...*

## [1.7.1] 2022-12-05

Expand All @@ -55,7 +62,6 @@ Update to keyboard mapping: All key mapping now reenabled and Align mode now ful
- The single-quote comment (now only on debug statements) is being handled by the semantic (vs. syntactic) parser this is causing external VSCode extensions to do brace, parenthesis, and bracket paring to be marked within trailing line comments on debug lines
- Syntax highlight of DAT section sometimes fails... (although it is less often now...)
- Semantic highlight: the 'modification' attribute is being over-applied, should use more than := as test!!!!
- *I'm sure there are more issues...*

## [1.7.0] 2022-12-02

Expand All @@ -77,7 +83,6 @@ Fun Update! First release of two **NEW** features and more.
- The single-quote comment (now only on debug statements) is being handled by the semantic (vs. syntactic) parser this is causing external VSCode extensions to do brace, parenthesis, and bracket paring to be marked within trailing line comments on debug lines
- Syntax highlight of DAT section sometimes fails... (although it is less often now...)
- Semantic highlight: the 'modification' attribute is being over-applied, should use more than := as test!!!!
- *I'm sure there are more issues...*

## [1.6.1] 2022-11-29

Expand All @@ -95,7 +100,6 @@ Minor update to the formal release (*clean up muli-line behavior, clean up in-li
- Syntax highlight of DAT section sometimes fails... (although it is less often now...)
- Semantic highlight: the 'modification' attribute is being over-applied, should use more than := as test!!!!


## [1.6.0] 2022-11-28

First formal release - Update for tabbing. Now operates according to latest Spec.
Expand Down
10 changes: 10 additions & 0 deletions spin2/TEST/spin2/221206-fixes.spin2
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,13 @@ pasm_program debug 'do a DEBUG at the start of the program to open debugger
jmp #.loop

long 0[12] 'fill with some NOP's to make it easy to see the code above
' -----------------------------------------------------------------
DAT
org
' $1F8..$1F9 = ptra_, ptrb_
' $1FA..$1FF = direct
' $200..$3FF = lut
'
rdreg modz _clr wz 'force read BUG: "_clr" is RED

' -----------------------------------------------------------------
2 changes: 1 addition & 1 deletion spin2/src/spin1.semanticAndOutline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2621,7 +2621,7 @@ export class Spin1DocumentSemanticTokensProvider implements vscode.DocumentSeman

private spin1log: any = undefined;
// 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 showCON: boolean = true;
private showOBJ: boolean = true;
Expand Down
55 changes: 47 additions & 8 deletions spin2/src/spin2.semanticAndOutline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1570,6 +1570,7 @@ export class Spin2DocumentSemanticTokensProvider implements vscode.DocumentSeman
!this._isBinaryOperator(namePart) &&
!this._isBuiltinReservedWord(namePart) &&
!this._isCoginitReservedSymbol(namePart) &&
!this._isPasmModczOperand(namePart) &&
!this._isDebugMethod(namePart) &&
!bIsAlsoDebugLine
) {
Expand Down Expand Up @@ -3287,7 +3288,7 @@ export class Spin2DocumentSemanticTokensProvider implements vscode.DocumentSeman

private spin2log: any = undefined;
// 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 showCON: boolean = true;
private showOBJ: boolean = true;
Expand Down Expand Up @@ -4360,6 +4361,45 @@ export class Spin2DocumentSemanticTokensProvider implements vscode.DocumentSeman
return reservedStatus;
}

private _isPasmModczOperand(name: string): boolean {
const pasmModczOperand: string[] = [
"_clr",
"_nc_and_nz",
"_nz_and_nc",
" _gt",
"_nc_and_z",
"_z_and_nc",
"_nc",
"_ge",
"_c_and_nz",
"_nz_and_c",
"_nz",
"_ne",
"_c_ne_z",
"_z_ne_c",
"_nc_or_nz",
"_nz_or_nc",
"_c_and_z",
"_z_and_c",
"_c_eq_z",
"_z_eq_c",
"_z",
"_e",
"_nc_or_z",
"_z_or_nc",
"_c",
"_lt",
"_c_or_nz",
"_nz_or_c",
"_c_or_z",
"_z_or_c",
"_le",
"_set",
];
const reservedStatus: boolean = pasmModczOperand.indexOf(name.toLowerCase()) != -1;
return reservedStatus;
}

private _isSpinBuiltinMethod(name: string): boolean {
const spinMethodNames: string[] = [
"akpin",
Expand Down Expand Up @@ -4446,7 +4486,6 @@ export class Spin2DocumentSemanticTokensProvider implements vscode.DocumentSeman

private _isPasmReservedWord(name: string): boolean {
const pasmReservedswordsOfNote: string[] = [
// EVENT_(INT|CT1|CT2|CT3|SE1|SE2|SE3|SE4|PAT|FBW|XMT|XFI|XRO|XRL|ATN|QMT)
"ijmp1",
"ijmp2",
"ijmp3",
Expand Down Expand Up @@ -4475,10 +4514,6 @@ export class Spin2DocumentSemanticTokensProvider implements vscode.DocumentSeman
"addbits",
"true",
"false",
//'eventse1', 'eventse2', 'eventse3', 'eventse4',
//'eventct1', 'eventct2', 'eventct3', 'eventct4',
//'eventpat', 'eventfbw', 'eventxmt', 'eventxfi',
//'eventxro', 'eventxrl', 'eventatn', 'eventqmt'
];
const reservedStatus: boolean = pasmReservedswordsOfNote.indexOf(name.toLowerCase()) != -1;
return reservedStatus;
Expand Down Expand Up @@ -4975,8 +5010,10 @@ export class Spin2DocumentSemanticTokensProvider implements vscode.DocumentSeman
if (name.length > 2) {
const checkType: string = name.toUpperCase();
// yeah, FILE too! (oddly enough)
if (checkType == "BYTEFIT" || checkType == "WORDFIT" || checkType == "BYTE" || checkType == "WORD" || checkType == "LONG" || checkType == "RES" || checkType == "FILE") {
if (checkType == "FILE") {
returnStatus = true;
} else {
returnStatus = this._isDatStorageType(name);
}
}
return returnStatus;
Expand All @@ -4986,8 +5023,10 @@ export class Spin2DocumentSemanticTokensProvider implements vscode.DocumentSeman
let returnStatus: boolean = false;
if (name.length > 2) {
const checkType: string = name.toUpperCase();
if (checkType == "BYTEFIT" || checkType == "WORDFIT" || checkType == "BYTE" || checkType == "WORD" || checkType == "LONG" || checkType == "RES") {
if (checkType == "RES") {
returnStatus = true;
} else {
returnStatus = this._isStorageType(name);
}
}
return returnStatus;
Expand Down
7 changes: 7 additions & 0 deletions spin2/syntaxes/spin2.tmLanguage.YAML-tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ repository:
include: '#cog_register_names'
-
include: '#coginit_constants'
-
include: '#modcz_constants'
-
name: storage.modifier.pasm2
match: '(?i)\b(ORG(F|H)?|FIT)\b'
Expand Down Expand Up @@ -445,6 +447,8 @@ repository:
include: '#cog_register_names'
-
include: '#coginit_constants'
-
include: '#modcz_constants'
-
name: storage.type.pasm.spin2
match: '(?i)\b(BYTE|WORD|BYTEFIT|WORDFIT|LONG)\b'
Expand Down Expand Up @@ -499,6 +503,9 @@ repository:
event_constants:
name: constant.language.events-interrupts.spin2
match: '(?i)\bEVENT_(INT|CT1|CT2|CT3|SE1|SE2|SE3|SE4|PAT|FBW|XMT|XFI|XRO|XRL|ATN|QMT)\b'
modcz_constants:
name: constant.language.modcz.operands.spin2
match: '(?i)\b((_c(_and_nz|_and_z|eq_z|ne_z|or_nz|or_z)?|_(clr|e|ge|gt|le|lt|ne|set)?|_nc(_and_nz|and_z|or_nz|or_z)?|_nz(_and_c|_and_nc|_or_c|_or_nc)?|_z(_and_c|_and_nc|_eq_c|_ne_c|_or_c|_or_nc)?))\b'
smartpins_constants:
name: meta.block.spin.language.spin2
patterns:
Expand Down
10 changes: 10 additions & 0 deletions spin2/syntaxes/spin2.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,9 @@
{
"include": "#coginit_constants"
},
{
"include": "#modcz_constants"
},
{
"name": "storage.modifier.pasm2",
"match": "(?i)\\b(ORG(F|H)?|FIT)\\b"
Expand Down Expand Up @@ -662,6 +665,9 @@
{
"include": "#coginit_constants"
},
{
"include": "#modcz_constants"
},
{
"name": "storage.type.pasm.spin2",
"match": "(?i)\\b(BYTE|WORD|BYTEFIT|WORDFIT|LONG)\\b"
Expand Down Expand Up @@ -736,6 +742,10 @@
"name": "constant.language.events-interrupts.spin2",
"match": "(?i)\\bEVENT_(INT|CT1|CT2|CT3|SE1|SE2|SE3|SE4|PAT|FBW|XMT|XFI|XRO|XRL|ATN|QMT)\\b"
},
"modcz_constants": {
"name": "constant.language.modcz.operands.spin2",
"match": "(?i)\\b((_c(_and_nz|_and_z|eq_z|ne_z|or_nz|or_z)?|_(clr|e|ge|gt|le|lt|ne|set)?|_nc(_and_nz|and_z|or_nz|or_z)?|_nz(_and_c|_and_nc|_or_c|_or_nc)?|_z(_and_c|_and_nc|_eq_c|_ne_c|_or_c|_or_nc)?))\\b"
},
"smartpins_constants": {
"name": "meta.block.spin.language.spin2",
"patterns": [
Expand Down

0 comments on commit 4ac6205

Please sign in to comment.