Skip to content

Commit e61ac27

Browse files
support for symbols in Sublime Text (#34)
Added support for symbols in Sublime Text. The symbols defined are all labels and constants, though only global labels and constants are placed in Sublime's project-scoped symbols list.
1 parent 56d5259 commit e61ac27

File tree

5 files changed

+47
-4
lines changed

5 files changed

+47
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ Changes that are planned but not implemented yet:
2222
## [Unreleased]
2323
* Upgrade python version requirements to 3.11
2424
* Improved several error messages
25-
* Fixed a bug where embedded stringsd weren't properly parsed if they contained a newline character or there were multiple embedded strings per line
25+
* Fixed a bug where embedded strings weren't properly parsed if they contained a newline character or there were multiple embedded strings per line
2626
* Fixed a bug where parsing properly discriminate between labels starting with `BYTE` string and the `BYTEx()` operator.
2727
* Fixed a bug in generating the syntax highlighting configuration that caused mnemonics with special characters to not be highlighted properly.
28+
* Added support for symbol definitions in Sublime Text. Symbols defined are labels and constants.
2829

2930
## [0.4.2]
3031
* Added support for The Minimal 64x4 Home Computer with an example and updated assembler functionality to support it.

src/bespokeasm/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
BESPOKEASM_VERSION_STR = '0.4.3b2'
1+
BESPOKEASM_VERSION_STR = '0.4.3b3'
22

33
# if a cconfig file requires a certain bespoke ASM version, it should be at least this version.
44
BESPOKEASM_MIN_REQUIRED_STR = '0.3.0'
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>name</key>
6+
<string>Source Global Symbol List</string>
7+
<key>scope</key>
8+
<string>source.bespokeasm variable.other.label.global</string>
9+
<key>settings</key>
10+
<dict>
11+
<key>showInIndexedSymbolList</key>
12+
<integer>1</integer>
13+
</dict>
14+
</dict>
15+
</plist>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>name</key>
6+
<string>Source Local Symbol List</string>
7+
<key>scope</key>
8+
<string>source.bespokeasm variable.other.label.global, source.bespokeasm variable.other.label.file, source.bespokeasm variable.other.label.local, source.bespokeasm variable.other.constant</string>
9+
<key>settings</key>
10+
<dict>
11+
<key>showInSymbolList</key>
12+
<integer>1</integer>
13+
<key>symbolTransformation</key>
14+
<string>
15+
s/^(\.[\w\d_]*)/ $1/g;
16+
</string>
17+
</dict>
18+
</dict>
19+
</plist>

src/bespokeasm/configgen/sublime/resources/sublime-syntax.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,17 @@ contexts:
1616
captures:
1717
1: variable.other.constant
1818
2: keyword.operator.assignment
19-
- match: ((?:\.|_|\w){1}[\w\d_]*)(\:)
19+
- match: (\w{1}[\w\d_]*)(\:)
2020
captures:
21-
1: variable.other.label
21+
1: variable.other.label.global
22+
2: punctuation.definition.variable.colon.label
23+
- match: (\.{1}[\w\d_]*)(\:)
24+
captures:
25+
1: variable.other.label.local
26+
2: punctuation.definition.variable.colon.label
27+
- match: (_{1}[\w\d_]*)(\:)
28+
captures:
29+
1: variable.other.label.file
2230
2: punctuation.definition.variable.colon.label
2331
- match: \;
2432
scope: punctuation.definition.comment

0 commit comments

Comments
 (0)