Skip to content

Commit 8dd7d53

Browse files
added typedef
1 parent 637046d commit 8dd7d53

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
### Added
1313
- added compile-if and pools scope
14+
- added typedef
1415

1516
## [1.0.2] - 2023-02-17
1617

PSS.sublime-syntax

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ contexts:
5959
- include: compile-if
6060
- include: actions
6161
- include: enum-declaration
62+
- include: typedef-declaration
6263
- include: function-declaration
6364
- include: components
6465
- include: structs
@@ -380,13 +381,32 @@ contexts:
380381
- include: code
381382

382383
# B.13 Data Types
384+
# enum
383385
enum-declaration:
384386
- match: \b(enum)\s+\b{{valid_name}}\b
385387
captures:
386388
1: keyword.declaration.enum.pss
387389
2: storage.type.pss
388390
push: enum-values-declaration
389391

392+
# typedef
393+
typedef-declaration:
394+
# scalars
395+
- match: '^\s*(typedef)\s+\b(?:{{valid_scalar_type}})\s+(?:{{valid_id}}\s*)(;|\=)'
396+
captures:
397+
1: keyword.declaration.type.pss
398+
2: storage.type.pss
399+
3: storage.modifier.range.pss
400+
4: storage.type.pss
401+
5: punctuation.terminator.pss
402+
# other types
403+
- match: '^\s*(typedef)\s+\b(?:{{valid_name}})\s+(?:{{valid_id}}\s*)(;|\=)'
404+
captures:
405+
1: keyword.declaration.type.pss
406+
2: storage.type.pss
407+
3: storage.type.pss
408+
4: punctuation.terminator.pss
409+
390410
enum-values-declaration:
391411
- meta_content_scope: meta.type.enum.pss
392412
- match: (\{)

test/package.pss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ extend buffer sml_data_buff {
6161
constraint mem_seg.size in [1..4];
6262
}
6363

64-
buffer foo : bla_pkg:foo_base {
64+
buffer foo : bla_pkg::foo_base {
6565

6666
}
6767

test/variables.pss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ enum numbering_e
2020
ONCE, TWICE
2121
}
2222

23+
typedef int xyz;
24+
25+
typedef bit[8*16:1] rs_demo_string_t;
26+
27+
typedef my_pkg::my_component comp_t;
28+
2329
component x2 {
2430
resource channel_r {};
2531
pool [3] channel_r channel_p;

0 commit comments

Comments
 (0)