Skip to content

Commit 8add037

Browse files
committed
VSCode extension: Added highlighting for the 'typeof' directive
1 parent 2740b19 commit 8add037

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

vscode/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Change Log
22

3+
## [0.7.0]
4+
5+
- Brought syntax rules up to speed with Bash++ v0.7.0 by adding support for the `@typeof` keyword
6+
- The `@typeof` directive can be used to determine the type of an object at runtime.
7+
- It can be used in various contexts, such as in `if` statements or variable assignments.
8+
- The syntax is: `@typeof {INPUT}`, where `{INPUT}` can be any rvalue, but should be a pointer to an object.
9+
- The output will be the class name of the object if the input is a valid pointer, or an empty string otherwise.
10+
311
## [0.5.5]
412

513
- Syntax highlighting: properly identify class and object names in object instantations and pointer declarations

vscode/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "bashpp",
33
"displayName": "Bash++",
44
"description": "Language support for Bash++",
5-
"version": "0.5.5",
5+
"version": "0.7.0",
66
"homepage": "https://bpp.sh",
77
"publisher": "rail5",
88
"repository": {

vscode/syntaxes/bashpp.tmLanguage.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@
863863
"bashpp-keyword": {
864864
"patterns": [
865865
{
866-
"match": "(?<!\\\\)(?:@new|@delete|@nullptr|@include_once|@include|@this|@super)(?=\\s|\\(|$)",
866+
"match": "(?<!\\\\)(?:@new|@delete|@nullptr|@include_once|@include|@this|@super|@typeof)(?=\\s|\\(|$)",
867867
"name": "keyword.other.bashpp"
868868
},
869869
{
@@ -918,15 +918,15 @@
918918
"comment": "Matches the class name after '@new'"
919919
},
920920
{
921-
"match": "(?<!\\\\)(@(?!class\\b)(?!public\\b)(?!private\\b)(?!protected\\b)(?!virtual\\b)(?!method\\b)(?!constructor\\b)(?!destructor\\b)(?!new\\b)(?!delete\\b)(?!nullptr\\b)(?!include_once\\b)(?!include\\b)(?!.*__)[a-zA-Z_][a-zA-Z0-9_]*)\\*?\\s+((?!.*__)[a-zA-Z_][a-zA-Z0-9_]*)",
921+
"match": "(?<!\\\\)(@(?!class\\b)(?!public\\b)(?!private\\b)(?!protected\\b)(?!virtual\\b)(?!method\\b)(?!constructor\\b)(?!destructor\\b)(?!new\\b)(?!delete\\b)(?!nullptr\\b)(?!include_once\\b)(?!include\\b)(?!typeof\\b)(?!.*__)[a-zA-Z_][a-zA-Z0-9_]*)\\*?\\s+((?!.*__)[a-zA-Z_][a-zA-Z0-9_]*)",
922922
"captures": {
923923
"1": {
924924
"name": "entity.name.type.class.bashpp",
925-
"comment": "Matches the class name in an object instantiation, e.g. @ClassName object"
925+
"comment": "Matches the class name in an object instantiation or pointer declaration, e.g. @ClassName object or @ClassName* pointer"
926926
},
927927
"2": {
928928
"name": "variable.other.normal.bashpp",
929-
"comment": "Matches te object name in an object instantiation, e.g @type ObjectName"
929+
"comment": "Matches the object name in an object instantiation or pointer declaration, e.g @type ObjectName or @type* PointerName"
930930
}
931931
}
932932
}
@@ -1386,7 +1386,7 @@
13861386
"name": "punctuation.definition.variable.bashpp"
13871387
}
13881388
},
1389-
"match": "(?<!\\\\)(@)(?!class\\b)(?!public\\b)(?!private\\b)(?!protected\\b)(?!virtual\\b)(?!method\\b)(?!constructor\\b)(?!destructor\\b)(?!new\\b)(?!delete\\b)(?!nullptr\\b)(?!include_once\\b)(?!include\\b)((?!__)[a-zA-Z_]([a-zA-Z0-9_]*\\.?)*)",
1389+
"match": "(?<!\\\\)(@)(?!class\\b)(?!public\\b)(?!private\\b)(?!protected\\b)(?!virtual\\b)(?!method\\b)(?!constructor\\b)(?!destructor\\b)(?!new\\b)(?!delete\\b)(?!nullptr\\b)(?!include_once\\b)(?!include\\b)(?!typeof\\b)((?!__)[a-zA-Z_]([a-zA-Z0-9_]*\\.?)*)",
13901390
"name": "variable.other.normal.bashpp",
13911391
"comment": "Matches a full object reference, as in @object.innerObject.method"
13921392
},

0 commit comments

Comments
 (0)