From 5feaeff9b6ea231d61cbc9fee5d5cf4bbee65590 Mon Sep 17 00:00:00 2001 From: Stephen M Moraco Date: Tue, 16 Mar 2021 13:38:21 -0600 Subject: [PATCH] Lots of parser cleanup - see changelog --- spin2/CHANGELOG.md | 18 +- spin2/TEST/docs-spin2-language.spin2 | 71 ++++-- spin2/spin2.language-configuration.json | 5 +- spin2/src/spin2.extension.ts | 238 ++++++++++-------- .../syntaxes/spin2.tmLanguage.YAML-tmLanguage | 6 +- spin2/syntaxes/spin2.tmLanguage.json | 6 +- 6 files changed, 206 insertions(+), 138 deletions(-) diff --git a/spin2/CHANGELOG.md b/spin2/CHANGELOG.md index 9ef9f68..24b73b6 100644 --- a/spin2/CHANGELOG.md +++ b/spin2/CHANGELOG.md @@ -18,10 +18,10 @@ Possible next additions: - Add new-file templates as Snippets - Add additional Snippets as the community identifies them -## [0.3.3] 2021-03-?? +## [0.3.3] 2021-03-16 4th Release of Semantic Highlighting -This represents further improvement in parsing +This represents a noticeable cleanup of parsing most existing code. ### - What's new @@ -37,10 +37,14 @@ Semantic Adjustments: - Update: VAR declarations - parses all examples in spin2 doc - Update: CON declarations - parses all examples in spin2 doc - Update: parses all examples shipped with PNut (less `Spin2_interpreter.spin2`) -- Addition: if variables are used but not (yet?) defined they'll be shown in RED +- Update: now parses most of the P2 OBEX cleanly... still more to do tho' +- NEW: if variables are used but not (yet?) defined they'll be shown in RED - BUGFIX: no longer marking vars within `{ }` single line comments - BUGFIX: now handles multi-line enum declarations - BUGFIX: now handles comma-delimited constant assignments +- BUGFIX: most if not all embedded assignment (e.g., `until ((b := rxcheck()) >= 0)`) now correct +- BUGFIX: most if not all shorter variable highlight is now working +- BUGFIX: multiple assignment LHS of := now highlighted correctly Syntax Adjustments: @@ -50,16 +54,14 @@ Syntax Adjustments: - BUGFIX add missing `clkfreq_`, `_clkfreq` constant - BUGFIX add missing `FVAR`, `FVARS` overrides - BUGFIX add missing `REG`, `AND` operators -- BUGFIX add missing spin built-ins `getms()`, `QSIN()`, `QCOS()` +- BUGFIX add missing spin built-ins `getms()`, `QSIN()`, `QCOS()`, `PINC()` +- BUGFIX adjusted pub/pri to allow space before open paren -### - Known Issues w/v0.3.2 +### - Known Issues w/v0.3.3 - Pasm: doesn't recognize round(), float(), and trunc() as pasm operand -- Spin: Badly handles embedded assignment (e.g., `until ((b := rxcheck()) >= 0)`) -- Spin: Badly handles marking multiple vars LHS of assignment - Spin: Badly handles strings (should be ignoring contents of them) - Incorrectly colors **built-in** constants (should be own color) - Fails to parse some debug() statements correctly -- Fails to properly identify location of shorter variable name when is found within longer name earler in line... - Syntax highlight of DAT section sometimes fails... RES and FIT not colored correctly - Semantic highlight: the 'modification' attribute is being over-applied - Semantic highlight: the 'modification' attribute should use more than := as test!!!! diff --git a/spin2/TEST/docs-spin2-language.spin2 b/spin2/TEST/docs-spin2-language.spin2 index f3abad8..962a2f0 100644 --- a/spin2/TEST/docs-spin2-language.spin2 +++ b/spin2/TEST/docs-spin2-language.spin2 @@ -58,25 +58,26 @@ pub something() varName = INB DAT - varName mov a,IJMP3 - varName mov a,IRET3 - varName mov a,IJMP2 - varName mov a,IRET2 - varName mov a,IJMP1 - varName mov a,IRET1 - - varName mov a,PA - varName mov a,PB - varName mov a,PTRA - varName mov a,PTRB - - varName mov a,DIRA - varName mov a,DIRB - varName mov a,OUTA - varName mov a,OUTB - varName mov a,INA - varName mov a,INB - + varName mov a7,IJMP3 + varName mov a7,IRET3 + varName mov a7,IJMP2 + varName mov a7,IRET2 + varName mov a7,IJMP1 + varName mov a7,IRET1 + + varName mov a7,PA + varName mov a7,PB + varName mov a7,PTRA + varName mov a7,PTRB + + varName mov a7,DIRA + varName mov a7,DIRB + varName mov a7,OUTA + varName mov a7,OUTB + varName mov a7,INA + varName mov a7,INB + +a7 long 0 ' ----------------------------------------------------------------------------- '' Pin Fields - Spin2 Pg 7 @@ -181,7 +182,6 @@ pub built_in_Methods4(RegOrHubAddr, HubAddr) pub built_in_Methods5(x, y, angle32bit, length, angle, twopi, mult1, mult2, divisor) | x, y, rotx, roty, quotient, Rnd '' Math Methods - ' TODO: multi-return value not colored correctly! rotx, roty := ROTXY(x, y, angle32bit) x, y := POLXY(length, angle32bit) length, angle32bit := XYPOL(x, y) @@ -227,7 +227,7 @@ pub using_methods1(ToStr, FromStr) | x x := GETRND() +// 100 'Get a random number between 0 and 99 BYTEMOVE(ToStr, FromStr, STRSIZE(FromStr) + 1) -pub using_methods2(ToStr, FromStr, rho1, rho2, theta1, theta2, xin, yin, theta) | x +pub using_methods2(ToStr, FromStr, rho1, rho2, theta1, theta2, xin, yin, theta) | x, y '' Methods that return single results x,y := SumPoints(POLXY(rho1,theta1), POLXY(rho2,theta2)) @@ -257,3 +257,32 @@ PRI Sub3() | ErrorCode ' Sub3 ABORTs, returning to Sub1 with ErrorCode ErrorCode := -1 ABORT ErrorCode ' ABORT and return ErrorCode PINLOW(0) ' PINLOW never executes + +' ----------------------------------------------------------------------------- +'' Using Methods - Spin2 Pg 7 +' ----------------------------------------------------------------------------- +pub using_methods3(register, index, address, bitfield) | AnyVar + + AnyVar ' Hub or permanent register variable + HubVar.WORD ' Hub variable with BYTE/WORD/LONG size override + BYTE[address] ' Hub BYTE/WORD/LONG by address + REG[register] ' Register, 'register' may be symbol declared in ORG section + + AnyVar[index] ' Hub or permanent register variable with index + HubVar.BYTE[index] ' Hub variable with size override and index + LONG[address][index] ' Hub BYTE/WORD/LONG by address with index + REG[register][index] ' Register with index + + AnyVar.[bitfield] ' Hub or permanent register variable with bitfield + HubVar.LONG.[bitfield] ' Hub variable with size override and bitfield + WORD[address].[bitfield] ' Hub BYTE/WORD/LONG by address with bitfield + REG[register].[bitfield] ' Register with bitfield + + AnyVar[index].[bitfield] ' Hub or permanent register variable with index and bitfield + HubVar.BYTE[index].[bitfield] ' Hub variable with size override, index, and bitfield + LONG[address][index].[bitfield] ' Hub BYTE/WORD/LONG by address with index and bitfield + REG[register][index].[bitfield] ' Register with index and bitfield + +dat + ORGH +HubVar long 0 diff --git a/spin2/spin2.language-configuration.json b/spin2/spin2.language-configuration.json index 67f8b00..e1f3894 100644 --- a/spin2/spin2.language-configuration.json +++ b/spin2/spin2.language-configuration.json @@ -20,8 +20,7 @@ ["{", "}"], ["[", "]"], ["(", ")"], - ["\"", "\""], - ["'", "'"] + ["\"", "\""] ], "wordPattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\#\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\?\\s]+)" -} \ No newline at end of file +} diff --git a/spin2/src/spin2.extension.ts b/spin2/src/spin2.extension.ts index 0480598..fccd3d6 100644 --- a/spin2/src/spin2.extension.ts +++ b/spin2/src/spin2.extension.ts @@ -856,7 +856,7 @@ class Spin2DocumentSemanticTokensProvider implements vscode.DocumentSemanticToke // find open paren currentOffset = line.indexOf('(', currentOffset); let nameLength = currentOffset - startNameOffset - const newName = line.substr(startNameOffset, nameLength); + const newName = line.substr(startNameOffset, nameLength).trim(); const nameType: string = (isPrivate) ? 'private': 'public'; this._logSPIN(' -- GetMethodDecl newName=[' + newName + '](' + nameType + ')'); this.currentMethodName = newName; // notify of latest method name so we can track inLine PASM symbols @@ -1443,7 +1443,7 @@ class Spin2DocumentSemanticTokensProvider implements vscode.DocumentSemanticToke const startNameOffset = currentOffset // find open paren - skipping past method name currentOffset = line.indexOf('(', currentOffset); - const methodName: string = line.substr(startNameOffset, currentOffset - startNameOffset); + const methodName: string = line.substr(startNameOffset, currentOffset - startNameOffset).trim(); this.currentMethodName = methodName; // notify of latest method name so we can track inLine PASM symbols // record definition of method const declModifiers: string[] = (isPrivate) ? ['declaration'] : ['declaration', 'static'] @@ -1460,7 +1460,7 @@ class Spin2DocumentSemanticTokensProvider implements vscode.DocumentSemanticToke tokenType: 'method', tokenModifiers: refModifiers }) - this._logSPIN('-reportMethod: methodName=[' + methodName + ']'); + this._logSPIN('-reportPubPriSig: methodName=[' + methodName + '](' + startNameOffset + ')'); // ----------------------------------- // Parameters // @@ -1525,8 +1525,8 @@ class Spin2DocumentSemanticTokensProvider implements vscode.DocumentSemanticToke } for (let index = 0; index < returnValueNames.length; index++) { const returnValueName = returnValueNames[index].trim(); - this._logSPIN(' -- returnValueName=[' + returnValueName + ']'); - const nameOffset = line.indexOf(returnValueName, currentOffset + 1); + const nameOffset = line.indexOf(returnValueName, currentOffset); + this._logSPIN(' -- returnValueName=[' + returnValueName + '](' + nameOffset + ')'); tokenSet.push({ line: lineNumber, startCharacter: nameOffset, @@ -1582,8 +1582,8 @@ class Spin2DocumentSemanticTokensProvider implements vscode.DocumentSemanticToke let localNameParts: string[] = localName.split('['); localName = localNameParts[0]; } - this._logSPIN(' -- localName=[' + localName + ']'); const nameOffset = line.indexOf(localName, localVariableOffset); + this._logSPIN(' -- localName=[' + localName + '](' + nameOffset + ')'); if (index == nameParts.length - 1) { // have name tokenSet.push({ @@ -1639,125 +1639,156 @@ class Spin2DocumentSemanticTokensProvider implements vscode.DocumentSemanticToke // ------------------------------------------- // have line assigning value to new constant // ------------------------------------------- - const variableName = line.substr(currentOffset, (assignmentOffset - 1) - currentOffset).trim() - if (variableName.includes("[")) { - // NOTE this handles code: byte[pColor][2] := {value} - // have complex target name, parse in loop - const variableNameParts: string[] = variableName.split(/[ \t\[\]\+\-\(\)\<\>]/); - this._logSPIN(' -- Spin: variableNameParts=[' + variableNameParts + ']'); - let haveModification: boolean = false; - for (let index = 0; index < variableNameParts.length; index++) { - const variableNamePart = variableNameParts[index].replace('@',''); - const nameOffset = line.indexOf(variableNamePart, currentOffset); - if (variableNamePart.substr(0, 1).match(/[a-zA-Z_]/)) { - this._logSPIN(' -- variableNamePart=[' + variableNamePart + ', (' + nameOffset + 1 + ')]'); - if (this._isStorageType(variableNamePart)) { - tokenSet.push({ - line: lineNumber, - startCharacter: nameOffset, - length: variableNamePart.length, - tokenType: 'storageType', - tokenModifiers: [] - }); + const possibleVariableName = line.substr(currentOffset, (assignmentOffset - 1) - currentOffset).trim() + let varNameList: string[] = [possibleVariableName] + if (possibleVariableName.includes(",")) { + varNameList = possibleVariableName.split(','); + } + else if(possibleVariableName.includes(" ")) { + varNameList = this._getNonWhiteSpinLineParts(possibleVariableName); + } + this._logSPIN(' -- Spin: varNameList=[' + varNameList + ']'); + for (let index = 0; index < varNameList.length; index++) { + const variableName = varNameList[index]; + if (variableName.includes("[")) { + // NOTE this handles code: byte[pColor][2] := {value} + // have complex target name, parse in loop + const variableNameParts: string[] = variableName.split(/[ \t\[\]\+\-\(\)\<\>]/); + this._logSPIN(' -- Spin: [] variableNameParts=[' + variableNameParts + ']'); + let haveModification: boolean = false; + for (let index = 0; index < variableNameParts.length; index++) { + let variableNamePart = variableNameParts[index].replace('@', ''); + // secial case handle datar.[i] which leaves var name as 'darar.' + if (variableNamePart.endsWith('.')) { + variableNamePart = variableNamePart.substr(0, variableNamePart.length - 1); } - else { - let referenceDetails: IRememberedToken | undefined = undefined; - if (this._isLocalToken(variableNamePart)) { - referenceDetails = this._getLocalToken(variableNamePart); - this._logSPIN(' -- FOUND local name=[' + variableNamePart + ']'); - } - else if (this._isGlobalToken(variableNamePart)) { - referenceDetails = this._getGlobalToken(variableNamePart); - this._logSPIN(' -- FOUND global name=[' + variableNamePart + ']'); - } - if (referenceDetails != undefined) { - let modificationArray: string[] = referenceDetails.tokenModifiers; - if (!haveModification) { - // place modification attribute on only 1st name - modificationArray.push('modification'); - haveModification = true; - } + const nameOffset = line.indexOf(variableNamePart, currentOffset); + if (variableNamePart.substr(0, 1).match(/[a-zA-Z_]/)) { + this._logSPIN(' -- variableNamePart=[' + variableNamePart + ', (' + nameOffset + 1 + ')]'); + if (this._isStorageType(variableNamePart)) { tokenSet.push({ line: lineNumber, startCharacter: nameOffset, length: variableNamePart.length, - tokenType: referenceDetails.tokenType, - tokenModifiers: modificationArray + tokenType: 'storageType', + tokenModifiers: [] }); } else { - if (!this._isSpinReservedWord(variableNamePart)) { - // we don't have name registered so just mark it - this._logSPIN(' -- SPIN MISSING name=[' + variableNamePart + ']'); + let referenceDetails: IRememberedToken | undefined = undefined; + if (this._isLocalToken(variableNamePart)) { + referenceDetails = this._getLocalToken(variableNamePart); + this._logSPIN(' -- FOUND local name=[' + variableNamePart + ']'); + } + else if (this._isGlobalToken(variableNamePart)) { + referenceDetails = this._getGlobalToken(variableNamePart); + this._logSPIN(' -- FOUND global name=[' + variableNamePart + ']'); + } + if (referenceDetails != undefined) { + let modificationArray: string[] = referenceDetails.tokenModifiers; + if (!haveModification) { + // place modification attribute on only 1st name + modificationArray.push('modification'); + haveModification = true; + } tokenSet.push({ line: lineNumber, startCharacter: nameOffset, length: variableNamePart.length, - tokenType: 'variable', - tokenModifiers: ['modification', 'missingDeclaration'] + tokenType: referenceDetails.tokenType, + tokenModifiers: modificationArray }); } + else { + if (!this._isSpinReservedWord(variableNamePart)) { + // we don't have name registered so just mark it + this._logSPIN(' -- SPIN MISSING name=[' + variableNamePart + ']'); + tokenSet.push({ + line: lineNumber, + startCharacter: nameOffset, + length: variableNamePart.length, + tokenType: 'variable', + tokenModifiers: ['modification', 'missingDeclaration'] + }); + } + } } } + currentOffset += variableNamePart.length + 1; } - currentOffset += variableNamePart.length + 1; - } - } - else { - // have simple target name - const cleanedVariableName: string = variableName.replace(/[\(\)]/, '') - const nameOffset = line.indexOf(cleanedVariableName, currentOffset); - let referenceDetails: IRememberedToken | undefined = undefined; - if (this._isLocalToken(cleanedVariableName)) { - referenceDetails = this._getLocalToken(cleanedVariableName); - this._logSPIN(' -- FOUND local name=[' + cleanedVariableName + ']'); - } - else if (this._isGlobalToken(cleanedVariableName)) { - referenceDetails = this._getGlobalToken(cleanedVariableName); - this._logSPIN(' -- FOUND globel name=[' + cleanedVariableName + ']'); - } - if (referenceDetails != undefined) { - let modificationArray: string[] = referenceDetails.tokenModifiers; - modificationArray.push('modification'); - this._logSPIN(' -- spin: simple variableName=[' + cleanedVariableName + '](' + nameOffset + ')'); - tokenSet.push({ - line: lineNumber, - startCharacter: nameOffset, - length: cleanedVariableName.length, - tokenType: referenceDetails.tokenType, - tokenModifiers: modificationArray - }); } else { - // we don't have name registered so just mark it - if (!this._isSpinReservedWord(cleanedVariableName)) { - this._logSPIN(' -- SPIN MISSING name=[' + cleanedVariableName + ']'); - tokenSet.push({ - line: lineNumber, - startCharacter: nameOffset, - length: cleanedVariableName.length, - tokenType: 'variable', - tokenModifiers: ['modification', 'missingDeclaration'] - }); + // have simple target name, no [] + const cleanedVariableName: string = variableName.replace(/[ \t\(\)]/, ''); + const nameOffset = line.indexOf(cleanedVariableName, currentOffset); + if (cleanedVariableName.substr(0, 1).match(/[a-zA-Z_]/)) { + this._logSPIN(' -- SPIN cleanedVariableName=[' + cleanedVariableName + '](' + nameOffset + ')'); + let referenceDetails: IRememberedToken | undefined = undefined; + if (this._isLocalToken(cleanedVariableName)) { + referenceDetails = this._getLocalToken(cleanedVariableName); + this._logSPIN(' -- FOUND local name=[' + cleanedVariableName + ']'); + } + else if (this._isGlobalToken(cleanedVariableName)) { + referenceDetails = this._getGlobalToken(cleanedVariableName); + this._logSPIN(' -- FOUND globel name=[' + cleanedVariableName + ']'); + } + if (referenceDetails != undefined) { + let modificationArray: string[] = referenceDetails.tokenModifiers; + modificationArray.push('modification'); + this._logSPIN(' -- spin: simple variableName=[' + cleanedVariableName + '](' + nameOffset + ')'); + tokenSet.push({ + line: lineNumber, + startCharacter: nameOffset, + length: cleanedVariableName.length, + tokenType: referenceDetails.tokenType, + tokenModifiers: modificationArray + }); + } + else if (cleanedVariableName == '_') { + this._logSPIN(' -- SPIN built-in=[' + cleanedVariableName + ']'); + tokenSet.push({ + line: lineNumber, + startCharacter: nameOffset, + length: cleanedVariableName.length, + tokenType: 'variable', + tokenModifiers: ['modification', 'defaultLibrary'] + }); + } + else { + // we don't have name registered so just mark it + if (!this._isSpinReservedWord(cleanedVariableName)) { + this._logSPIN(' -- SPIN MISSING name=[' + cleanedVariableName + ']'); + tokenSet.push({ + line: lineNumber, + startCharacter: nameOffset, + length: cleanedVariableName.length, + tokenType: 'variable', + tokenModifiers: ['modification', 'missingDeclaration'] + }); + } + } } } } - currentOffset = assignmentOffset + 2; // skip to RHS of assignment } const assignmentRHSStr = this._getNonCommentLineRemainder(currentOffset, line).replace('..', ' '); + currentOffset = line.indexOf(assignmentRHSStr, currentOffset) this._logSPIN(' -- assignmentRHSStr=[' + assignmentRHSStr + ']'); - let possNames: string[] = assignmentRHSStr.split(/[ \t\-\:\,\+\[\]\@\(\)\!\*\=\<\>\&\|\?\\\~\#\^\/]/); + let possNames: string[] = this._getNonWhiteSpinLineParts(assignmentRHSStr); // special code to handle case range strings: [e.g., SEG_TOP..SEG_BOTTOM:] - const isCaseValue: boolean = assignmentRHSStr.endsWith(':'); - if (isCaseValue && possNames[0].includes("..")) { - possNames = possNames[0].split(".."); - } + //const isCaseValue: boolean = assignmentRHSStr.endsWith(':'); + //if (isCaseValue && possNames[0].includes("..")) { + // possNames = possNames[0].split(".."); + //} + this._logSPIN(' -- possNames=[' + possNames + ']'); for (let index = 0; index < possNames.length; index++) { - const possibleName = possNames[index]; - const currPossibleLen = possibleName.length; - if (currPossibleLen < 1) { - continue; + let possibleName = possNames[index]; + // special code to handle case of var.[bitfield] leaving name a 'var.' + if (possibleName.endsWith('.')) { + possibleName = possibleName.substr(0, possibleName.length - 1); } + const currPossibleLen = possibleName.length; + currentOffset = line.indexOf(possibleName, currentOffset) let possibleNameSet: string[] = []; if (possibleName.substr(0, 1).match(/[a-zA-Z_]/)) { this._logSPIN(' -- possibleName=[' + possibleName + ']'); @@ -2211,7 +2242,7 @@ class Spin2DocumentSemanticTokensProvider implements vscode.DocumentSemanticToke private spin2log: any = undefined; // adjust following true/false to show specific parsing debug - private spinDebugLogEnabled: boolean = true; + private spinDebugLogEnabled: boolean = false; private showSpinCode: boolean = true; private showCON: boolean = true; private showOBJ: boolean = true; @@ -2368,6 +2399,7 @@ private _getNonWhitePasmLineParts(line: string): string[] private _getNonWhiteSpinLineParts(line: string): string[] { + // split(/[ \t\-\:\,\+\[\]\@\(\)\!\*\=\<\>\&\|\?\\\~\#\^\/]/); let lineParts: string[] | null = line.match(/[^ \t\-\:\,\+\[\]\@\(\)\!\*\=\<\>\&\|\?\\\~\#\^\/]+/g); if (lineParts === null) { lineParts = []; @@ -2488,7 +2520,13 @@ private _getNonWhitePasmLineParts(line: string): string[] private _isSpinReservedWord(name: string): boolean { const spinInstructionsOfNote: string[] = [ - 'send', 'addpins', 'reg', 'float', 'round', 'trunc' + 'send', 'addpins', 'reg', 'float', 'round', 'trunc', + 'clkmode', 'clkfreq', 'lookdown', 'send', + 'if', 'ifnot', 'elseif', 'elseifnot', 'else', + 'while', 'repeat', 'until', 'from', 'to', 'step', 'next', 'quit', + 'case', 'case_fast', 'other', + 'true', 'false' + ]; const reservedStatus: boolean = (spinInstructionsOfNote.indexOf(name.toLowerCase()) != -1); return reservedStatus; @@ -2500,7 +2538,7 @@ private _getNonWhitePasmLineParts(line: string): string[] // EVENT_(INT|CT1|CT2|CT3|SE1|SE2|SE3|SE4|PAT|FBW|XMT|XFI|XRO|XRL|ATN|QMT) 'ijmp1', 'ijmp2', 'ijmp3', 'iret1', 'iret2', 'iret3', 'ptra', 'ptrb', 'addpins', 'clkfreq_', 'pa', 'pb', 'clkfreq', '_clkfreq','round', 'float', 'trunc', - 'dira', 'dirb', 'ina', 'inb', 'outa', 'outb', 'fvar', 'addbits' + 'dira', 'dirb', 'ina', 'inb', 'outa', 'outb', 'fvar', 'fvars', 'addbits', 'true', 'false' //'eventse1', 'eventse2', 'eventse3', 'eventse4', //'eventct1', 'eventct2', 'eventct3', 'eventct4', //'eventpat', 'eventfbw', 'eventxmt', 'eventxfi', diff --git a/spin2/syntaxes/spin2.tmLanguage.YAML-tmLanguage b/spin2/syntaxes/spin2.tmLanguage.YAML-tmLanguage index 2c5f4b5..a440869 100644 --- a/spin2/syntaxes/spin2.tmLanguage.YAML-tmLanguage +++ b/spin2/syntaxes/spin2.tmLanguage.YAML-tmLanguage @@ -376,7 +376,7 @@ repository: include: '#pasm_field_operations' private_block: name: meta.block.private.spin2 - begin: '(?i)^(PRI)\s+(\w+)\((?:(.*))?\)(?:\s*\:\s*(\w+))?' + begin: '(?i)^(PRI)\s+(\w+)\s*\((?:(.*))?\)(?:\s*\:\s*(\w+))?' end: '(?i)^(?=(CON|VAR|OBJ|PUB|PRI|DAT))\b' beginCaptures: '1': @@ -392,7 +392,7 @@ repository: include: '#spin_language_tiny' public_block: name: meta.block.public.spin - begin: '(?i)^(PUB)\s+(\w+)\((?:(.*))?\)(?:\s*\:\s*(\w+))?' + begin: '(?i)^(PUB)\s+(\w+)\s*\((?:(.*))?\)(?:\s*\:\s*(\w+))?' end: '(?i)^(?=(CON|VAR|OBJ|PUB|PRI|DAT))\b' beginCaptures: '1': @@ -454,7 +454,7 @@ repository: match: '(?i)\b(COG(CHK|ID|INIT|SPIN|STOP)|(HUB|CLK)SET|LOCK(NEW|RET|TRY|REL|CHK)|(COG|POLL|WAIT)ATN)\b' - name: keyword.spin.methods.pin.spin2 - match: '(?i)\b(PIN(W|WRITE|L|LOW|H|HIGH|T|TOGGLE|F|FLOAT|R|READ|START|CLEAR)|(WR|WX|WY|AK|RD|RQ)PIN)\b' + match: '(?i)\b(PIN(W|WRITE|L|LOW|H|HIGH|T|TOGGLE|F|FLOAT|R|READ|START|C|CLEAR)|(WR|WX|WY|AK|RD|RQ)PIN)\b' - name: keyword.spin.methods.memory.spin2 match: '(?i)\b((GET|SET)REGS|(BYTE|WORD|LONG)MOVE|(BYTE|WORD|LONG)FILL)\b' diff --git a/spin2/syntaxes/spin2.tmLanguage.json b/spin2/syntaxes/spin2.tmLanguage.json index af74a97..715ecce 100644 --- a/spin2/syntaxes/spin2.tmLanguage.json +++ b/spin2/syntaxes/spin2.tmLanguage.json @@ -580,7 +580,7 @@ }, "private_block": { "name": "meta.block.private.spin2", - "begin": "(?i)^(PRI)\\s+(\\w+)\\((?:(.*))?\\)(?:\\s*\\:\\s*(\\w+))?", + "begin": "(?i)^(PRI)\\s+(\\w+)\\s*\\((?:(.*))?\\)(?:\\s*\\:\\s*(\\w+))?", "end": "(?i)^(?=(CON|VAR|OBJ|PUB|PRI|DAT))\\b", "beginCaptures": { "1": { @@ -604,7 +604,7 @@ }, "public_block": { "name": "meta.block.public.spin", - "begin": "(?i)^(PUB)\\s+(\\w+)\\((?:(.*))?\\)(?:\\s*\\:\\s*(\\w+))?", + "begin": "(?i)^(PUB)\\s+(\\w+)\\s*\\((?:(.*))?\\)(?:\\s*\\:\\s*(\\w+))?", "end": "(?i)^(?=(CON|VAR|OBJ|PUB|PRI|DAT))\\b", "beginCaptures": { "1": { @@ -693,7 +693,7 @@ }, { "name": "keyword.spin.methods.pin.spin2", - "match": "(?i)\\b(PIN(W|WRITE|L|LOW|H|HIGH|T|TOGGLE|F|FLOAT|R|READ|START|CLEAR)|(WR|WX|WY|AK|RD|RQ)PIN)\\b" + "match": "(?i)\\b(PIN(W|WRITE|L|LOW|H|HIGH|T|TOGGLE|F|FLOAT|R|READ|START|C|CLEAR)|(WR|WX|WY|AK|RD|RQ)PIN)\\b" }, { "name": "keyword.spin.methods.memory.spin2",