Skip to content

Commit

Permalink
MIsc highlighting updates
Browse files Browse the repository at this point in the history
- change syntax reported name of spin built-in functions  (make other themes highlight better)
- add couple more test files (used while working constant definition recognition problem
- repair recognition of constants (CON section and use in OBJ section)
  • Loading branch information
ironsheep committed Dec 13, 2022
1 parent 4cd626f commit 6e29e2f
Show file tree
Hide file tree
Showing 14 changed files with 853 additions and 633 deletions.
7 changes: 7 additions & 0 deletions spin2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ Possible next additions:
- Add new-file templates as Snippets
- Add additional Snippets as the community identifies them

## [1.7.4] 2022-12-13

Minor highlighting update

- Constant declarations now identified correctly
- Spin builtin methods now identified so other themes can render them better

## [1.7.3] 2022-12-09

Minor update to Extension Settings
Expand Down
56 changes: 56 additions & 0 deletions spin2/TEST/syn_sem_coloring.spin
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
' comment - single line
'' doc comment - single line

{
comment block
}

{{
doc comment block
}}

CON { this is our con section }
DIGIT_NOVALUE = -2 ' digit value when NOT [0-9] (semantic bad, should be constant!)

#0, ST_UNKNOWN, ST_FORWARD, ST_REVERSE

MAX_DIGITS = 6

SIGN_SHIFT = 31
EXP_OFFSET = 127 ' offset for exponent field
EXP_SHIFT = 23 ' shift for reading the exponent field
MAX_EXP = 255
EXP_MASK = MAX_EXP
MIN_SIG = $800_000 ' smallest significand
FIRST_STATE = ST_FORWARD

OBJ { Objects Used by this Object }

screen : "isp_hub75_screenAccess"
pixels : "isp_hub75_screenUtils"
color : "isp_hub75_color"
digit[color.NBR_DIGITS] : "isp_hub75_7seg"
digitTens[color.MAX_DIGITS] : "isp_hub75_7seg"

DAT
strings1 byte "string",0

PUB getServerStatus(x, y): server, port, ssl, ca | temp
unpack(5)
getServerStatus(5, 4)

digit[1].draw()

ca := 5
temp := x

PRI Unpack(x) : s, e, b | shift, exp_fixup
s := x>>31
e := (x>>EXP_SHIFT) & EXP_MASK
b := x & ((1<<EXP_SHIFT)-1)
' handle denormalized numbers
if e == 0
if b <> 0
e := 1 ' denormalized number
elseif e <> MAX_EXP
b |= MIN_SIG ' restore implied bit
57 changes: 57 additions & 0 deletions spin2/TEST/syn_sem_coloring.spin2
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
' comment - single line
'' doc comment - single line

{
comment block
}

{{
doc comment block
}}

CON { this is our con section }
DIGIT_NOVALUE = -2 ' digit value when NOT [0-9] (semantic bad, should be constant!)

#0, ST_UNKNOWN, ST_FORWARD, ST_REVERSE

MAX_DIGITS = 6

SIGN_SHIFT = 31
EXP_OFFSET = 127 ' offset for exponent field
EXP_SHIFT = 23 ' shift for reading the exponent field
MAX_EXP = 255
EXP_MASK = MAX_EXP
MIN_SIG = $800_000 ' smallest significand
FIRST_STATE = ST_FORWARD

OBJ { Objects Used by this Object }

screen : "isp_hub75_screenAccess"
pixels : "isp_hub75_screenUtils"
color : "isp_hub75_color"
digit[color.NBR_DIGITS] : "isp_hub75_7seg"
digitTens[color.MAX_DIGITS] : "isp_hub75_7seg"

DAT
strings1 byte "string",0

PUB getServerStatus(x, y): server, port, ssl, ca | temp
unpack(5)
getServerStatus(5, 4)

digit[1].draw()

ca := 5
temp := x
debug(`TERM EGterm pos 10 10 title 'Envelope Parameters' SIZE 50 26 TEXTSIZE 15 UPDATE)

PRI Unpack(x) : s, e, b | shift, exp_fixup
s := x>>31
e := (x>>EXP_SHIFT) & EXP_MASK
b := x & ((1<<EXP_SHIFT)-1)
' handle denormalized numbers
if e == 0
if b <> 0
e := 1 ' denormalized number
elseif e <> MAX_EXP
b |= MIN_SIG ' restore implied bit
2 changes: 1 addition & 1 deletion spin2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Spin2",
"description": "Spin2/Pasm2 Syntax/Semantic Highlighting w/Code Outline and Custom tabbing support",
"icon": "images/Propeller.ico",
"version": "1.7.3",
"version": "1.7.4",
"publisher": "IronSheepProductionsLLC",
"repository": {
"type": "git",
Expand Down
Loading

0 comments on commit 6e29e2f

Please sign in to comment.