Skip to content

Commit 553cfe5

Browse files
authored
Merge pull request #85 from Tbusk/feature/syntax-enhancements
feature: syntax enhancements
2 parents afa1d3e + 980b4e2 commit 553cfe5

File tree

102 files changed

+3852
-1568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+3852
-1568
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
.idea
33
.intellijPlatform
44
.qodana
5-
build
5+
build
6+
bin
7+
vala_repo

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,35 @@
66

77
### What's Changed
88

9+
- Added main block support (including using methods, fields with var, etc. outside namespace)
10+
- Added support for declaring interfaces in interfaces
11+
- More forgiving on identifier keywords being used when not specifying @ before to match the Vala parser
12+
- Allow use of dynamic in foreach statement
13+
- Allow use of weak in foreach statement
14+
- Allow permitted type declaration modifiers in interface (abstract, extern, and sealed)
15+
- Allow permitted type declaration modifiers in enum (abstract, extern, and sealed)
16+
- Allow one use of a default statement in a switch
17+
- Remove using expression in default statement in a switch
18+
- Added support for unlock statement
19+
- Allow nullability question mark to be used after identifier in object/array creation expressions
20+
- Allow use of void pointer array type
21+
- Allow use of weak and unowned in local variable declarations
22+
- Now only allow permitted type declaration modifiers in errordomain (extern, abstract, partial, sealed)
23+
- Now only allow permitted type declaration modifiers in delegate (abstract, async, class, extern, inline, override,
24+
sealed, static, and virtual)
25+
- Add better support for parameter direction (in, out, ref) and ownage (own, unowned)
26+
- Adjust what is permissible with yield statements / expression based on the Vala parser (before any expression could be
27+
used. Now only method calls can be, and now return isn't permitted after yield)
28+
- Update try, catch, finally block to match the Vala parser (need either finally block or catch clause with a try
29+
statement, and only one finally)
30+
- Add support for identifiers ending with @ used in config files
31+
- Removed unused spell-check support as platform updated
32+
- Added capability to run parsing/lexing tests on sample files and any repo link
33+
34+
## [1.2.2-ALPHA]
35+
36+
### What's Changed
37+
938
- Added missing keyword highlighting (dynamic, typeof, sizeof, as, is, global, get, set, default, etc.)
1039
- Added additional syntax support for arrays, slicing, and variable usage instead of just numbers
1140
- Fixed issue with '@' not taking account all possible keywords in parser.

build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ dependencies {
5454
plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })
5555

5656
testFramework(TestFrameworkType.Platform)
57-
58-
pluginVerifier(version = "1.388")
5957
}
6058
}
6159

docs/parser/ParserTokens.md

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
# Tokens
2+
3+
Found in `valatokentype.vala`
4+
5+
## Keywords and Identifiers
6+
7+
TokenType.AS = 'as'
8+
TokenType.BASE = 'base'
9+
TokenType.BREAK = 'break'
10+
TokenType.CASE = 'case'
11+
TokenType.CATCH = 'catch'
12+
TokenType.CONST = 'const'
13+
TokenType.CONSTRUCT = 'construct'
14+
TokenType.CONTINUE = 'continue'
15+
TokenType.DEFAULT = 'default'
16+
TokenType.DELEGATE = 'delegate'
17+
TokenType.DELETE = 'delete'
18+
TokenType.DO = 'do'
19+
TokenType.DYNAMIC = 'dynamic'
20+
TokenType.ELSE = 'else'
21+
TokenType.ENUM = 'enum'
22+
TokenType.ENSURES = 'ensures'
23+
TokenType.ERRORDOMAIN = 'errordomain'
24+
TokenType.FALSE = 'false'
25+
TokenType.FINALLY = 'finally'
26+
TokenType.FOR = 'for'
27+
TokenType.FOREACH = 'foreach'
28+
TokenType.GET = 'get'
29+
TokenType.IF = 'if'
30+
TokenType.IN = 'in'
31+
TokenType.INTERFACE = 'interface'
32+
TokenType.INTERNAL = 'internal'
33+
TokenType.IS = 'is'
34+
TokenType.LOCK = 'lock'
35+
TokenType.NAMESPACE = 'namespace'
36+
TokenType.NULL = 'null'
37+
TokenType.OUT = 'out'
38+
TokenType.OWNED = 'owned'
39+
TokenType.PRIVATE = 'private'
40+
TokenType.PROTECTED = 'protected'
41+
TokenType.PUBLIC = 'public'
42+
TokenType.REF = 'ref'
43+
TokenType.REQUIRES = 'requires'
44+
TokenType.RETURN = 'return'
45+
TokenType.SET = 'set'
46+
TokenType.SIGNAL = 'signal'
47+
TokenType.SIZEOF = 'sizeof'
48+
TokenType.STRUCT = 'struct'
49+
TokenType.SWITCH = 'switch'
50+
TokenType.THIS = 'this'
51+
TokenType.THROW = 'throw'
52+
TokenType.THROWS = 'throws'
53+
TokenType.TRUE = 'true'
54+
TokenType.TRY = 'try'
55+
TokenType.TYPEOF = 'typeof'
56+
TokenType.UNLOCK = 'unlock'
57+
TokenType.UNOWNED = 'unowned'
58+
TokenType.USING = 'using'
59+
TokenType.VAR = 'var'
60+
TokenType.VOID = 'void'
61+
TokenType.VOLATILE = 'volatile'
62+
TokenType.WEAK = 'weak'
63+
TokenType.WHILE = 'while'
64+
TokenType.WITH = 'with'
65+
TokenType.YIELD = 'yield'
66+
67+
### Declaration Keywords
68+
69+
TokenType.CLASS = 'class'
70+
71+
### Modifiers
72+
73+
`enum ModifierFlags`
74+
TokenType.NONE = '0'
75+
TokenType.ABSTRACT = 'abstract'
76+
TokenType.CLASS = 'class'
77+
TokenType.EXTERN = 'extern'
78+
TokenType.INLINE = 'inline'
79+
TokenType.NEW = 'new'
80+
TokenType.OVERRIDE = 'override'
81+
TokenType.STATIC = 'static'
82+
TokenType.VIRTUAL 'virtual'
83+
TokenType.ASYNC = 'async'
84+
TokenType.SEALED = 'sealed'
85+
TokenType.PARTIAL = 'partial'
86+
87+
## Operators
88+
89+
TokenType.PLUS = '+'
90+
TokenType.MINUS = '-'
91+
TokenType.STAR = '*'
92+
TokenType.DIV = '/'
93+
TokenType.PERCENT = '%'
94+
(increment)
95+
TokenType.OP_INC = '++'
96+
(decrement)
97+
TokenType.OP_DEC = '--'
98+
(less than)
99+
TokenType.OP_LT = '<'
100+
(greater than)
101+
TokenType.OP_GT = '>'
102+
(less than or equal to)
103+
TokenType.OP_LE = '<='
104+
(greater than or equal to)
105+
TokenType.OP_GE = '>='
106+
(equal to)
107+
TokenType.OP_EQ = '=='
108+
(not equal to)
109+
TokenType.OP_NE = '!='
110+
(not)
111+
TokenType.OP_NEG = '!'
112+
(and)
113+
TokenType.OP_AND = '&&'
114+
(or)
115+
TokenType.OP_OR = '||'
116+
(coalescing operator)
117+
TokenType.OP_COALESCING = '??'
118+
(bitwise shift left)
119+
TokenType.OP_SHIFT_LEFT = '<<'
120+
(pointer operator)
121+
TokenType.OP_PTR = '->'
122+
TokenType.BITWISE_AND = '&'
123+
TokenType.BITWISE_OR = '|'
124+
125+
## Assignment Operators
126+
127+
TokenType.ASSIGN = '='
128+
129+
TokenType.ASSIGN_ADD = '+='
130+
TokenType.ASSIGN_SUB = '-='
131+
TokenType.ASSIGN_MUL = '*='
132+
TokenType.ASSIGN_DIV = '/='
133+
134+
TokenType.ASSIGN_PERCENT = '%='
135+
TokenType.ASSIGN_BITWISE_AND = '&='
136+
TokenType.ASSIGN_BITWISE_OR = '|='
137+
TokenType.ASSIGN_BITWISE_XOR = '^='
138+
TokenType.ASSIGN_SHIFT_LEFT = '<<='
139+
(not in source?)
140+
TokenType.ASSIGN_SHIFT_RIGHT = '>>='
141+
142+
## Punctuation and Delimiters
143+
144+
TokenType.OPEN_PARENS = '('
145+
TokenType.CLOSE_PARENS = ')'
146+
TokenType.OPEN_BRACKET = '['
147+
TokenType.CLOSE_BRACKET = ']'
148+
TokenType.OPEN_BRACE = '{'
149+
TokenType.CLOSE_BRACE = '}'
150+
TokenType.SEMICOLON = ';'
151+
TokenType.COMMA = ','
152+
TokenType.COLON = ':'
153+
TokenType.DOT = '.'
154+
TokenType.DOUBLE_COLON = '::'
155+
TokenType.INTERR = '?'
156+
TokenType.LAMBDA = '=>'
157+
TokenType.HASH = '#'
158+
TokenType.ELLIPSIS = '...'
159+
TokenType.CARRET = '^'
160+
TokenType.TILDE = '~'
161+
162+
## Literals
163+
164+
TokenType.INTEGER_LITERAL
165+
TokenType.REAL_LITERAL
166+
TokenType.CHARACTER_LITERAL
167+
TokenType.STRING_LITERAL
168+
TokenType.TEMPLATE_STRING_LITERAL
169+
TokenType.VERBATIM_STRING_LITERAL
170+
TokenType.VERBATIM_TEMPLATE_STRING_LITERAL
171+
TokenType.REGEX_LITERAL
172+
173+
## Special Tokens
174+
175+
(usecase unknown)
176+
TokenType.EOF
177+
TokenType.OPEN_TEMPLATE
178+
TokenType.CLOSE_TEMPLATE
179+
TokenType.IDENTIFIER
180+
TokenType.PARAMS
181+
TokenType.OPEN_REGEX_LITERAL
182+
TokenType.CLOSE_REGEX_LITERAL
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# Vala Repo Parser/Lexer Testing
2+
3+
## Results
4+
5+
Failed to parse for 'girtest.vala'
6+
Failed to parse for 'arrays.vala'
7+
Failed to parse for 'bug778632.vala'
8+
Failed to parse for 'regex.vala'
9+
Failed to parse for 'signals.vala'
10+
Failed to parse for 'plugin-module-init.vala'
11+
Failed to parse for 'with-nested.vala'
12+
Failed to parse for 'methods.vala'
13+
Failed to parse for 'singleton.vala'
14+
Failed to parse for 'peek-inner-types.vala'
15+
Failed to parse for 'params-array-with-throws.vala'
16+
Failed to parse for 'params-array.vala'
17+
Failed to parse for 'array-length.vala'
18+
Failed to parse for 'var-type-dynamic.vala'
19+
Failed to parse for 'var-type-nullable.vala'
20+
Failed to parse for 'field-multi-one-line.vala'
21+
Failed to parse for 'switch-statement.vala'
22+
Failed to parse for 'verbatim-template.vala'
23+
Failed to parse for 'statement-keyword-as-identifier.vala'
24+
Failed to parse for 'with-declaration-cast-type.vala'
25+
Failed to parse for 'with-declaration.vala'
26+
Failed to parse for 'var-type.vala'
27+
Failed to parse for 'params-array-with-throws.vala'
28+
Failed to parse for 'params-array.vala'
29+
Failed to parse for 'lambda.vala'
30+
Failed to parse for 'local-functions.vala'
31+
Failed to parse for 'bug622570.vala'
32+
Failed to parse for 'local-functions-to-delegate.vala'
33+
Failed to parse for 'conditional-glib-api.vala'
34+
Failed to parse for 'description.vala'
35+
Failed to parse for 'constructor-params-array.vala'
36+
Failed to parse for 'bug688732.vala'
37+
Failed to parse for 'bug613513.vala'
38+
Failed to parse for 'bug761267-1.vala'
39+
Failed to parse for 'null-conditional-bool.vala'
40+
Failed to parse for 'bug761267-2.vala'
41+
Failed to parse for 'bug622178.vala'
42+
Failed to parse for 'floats-hexadecimal.vala'
43+
Failed to parse for 'bug647222.vala'
44+
Failed to parse for 'gvariants.vala'
45+
Failed to parse for 'integers-octal.vala'
46+
Failed to parse for 'strings.vala'
47+
Failed to parse for 'bug761736.vala'
48+
Failed to parse for 'arrays.vala'
49+
Failed to parse for 'bug571486.vala'
50+
Failed to parse for 'bug731017.vala'
51+
Failed to parse for 'bug643612.vala'
52+
Failed to parse for 'bug761307.vala'
53+
Failed to parse for 'class-field-fixed-length-initializer.vala'
54+
Failed to parse for 'fixed-length-init0-not-allowed.vala'
55+
Failed to parse for 'length-type.vala'
56+
Failed to parse for 'gtktemplate.vala'
57+
Failed to parse for 'moduleloader.vala'
58+
Failed to parse for 'tree.vala'
59+
Failed to parse for 'basicdoclet.vala'
60+
Failed to parse for 'timsort.vala'
61+
Failed to parse for 'valageniescanner.vala'
62+
Failed to parse for 'valagenieparser.vala'
63+
Failed to parse for 'valascanner.vala'
64+
Failed to parse for 'valacodecontext.vala'
65+
Failed to parse for 'valagirparser.vala'
66+
Failed to parse for 'generic-api-test.vala'
67+
Failed to parse for 'api-test.data.vapi'
68+
Failed to parse for 'generator.vala'
69+
Failed to parse for 'valaccodeconstant.vala'
70+
Failed to parse for 'posix.vapi'
71+
Failed to parse for 'glib-2.0.vapi'
72+
Failed to parse for 'rest-1.0.vapi'
73+
Failed to parse for 'tiff.vapi'
74+
Failed to parse for 'gstreamer-video-1.0.vapi'
75+
Failed to parse for 'webkit2gtk-web-extension-4.1.vapi'
76+
Failed to parse for 'avahi-client.vapi'
77+
Failed to parse for 'libgnomeui-2.0.vapi'
78+
Failed to parse for 'gnutls.vapi'
79+
Failed to parse for 'polkit-gobject-1.vapi'
80+
Failed to parse for 'libgsf-1.vapi'
81+
Failed to parse for 'lua.vapi'
82+
Failed to parse for 'xcb.vapi'
83+
Failed to parse for 'tokyocabinet.vapi'
84+
Failed to parse for 'pixman-1.vapi'
85+
Failed to parse for 'goocanvas-2.0.vapi'
86+
Failed to parse for 'gnome-rr-4.vapi'
87+
Failed to parse for 'gstreamer-rtp-1.0.vapi'
88+
Failed to parse for 'v4l2.vapi'
89+
Failed to parse for 'gdesktopenums-3.0.vapi'
90+
Failed to parse for 'libsoup-2.4.vapi'
91+
Failed to parse for 'Gio-2.0-custom.vala'
92+
Failed to parse for 'Gst-1.0-custom.vala'
93+
Failed to parse for 'Gtk-3.0-custom.vala'
94+
Failed to parse for 'Clutter-1.0-custom.vala'
95+
Failed to parse for 'clutter-1.0.vapi'
96+
Failed to parse for 'linux.vapi'
97+
Failed to parse for 'gmodule-2.0.vapi'
98+
Failed to parse for 'libesmtp.vapi'
99+
Failed to parse for 'libpeas-1.0.vapi'
100+
Failed to parse for 'readline.vapi'
101+
Failed to parse for 'gobject-2.0.vapi'
102+
Failed to parse for 'poppler-glib.vapi'
103+
Failed to parse for 'gstreamer-rtsp-1.0.vapi'
104+
Failed to parse for 'harfbuzz-gobject.vapi'
105+
Failed to parse for 'libwnck-3.0.vapi'
106+
Failed to parse for 'gio-2.0.vapi'
107+
Failed to parse for 'gdk-3.0.vapi'
108+
Failed to parse for 'udisks2.vapi'
109+
Failed to parse for 'gtk4.vapi'
110+
Failed to parse for 'pango.vapi'
111+
Failed to parse for 'gtk+-3.0.vapi'
112+
Failed to parse for 'javascriptcoregtk-6.0.vapi'
113+
Failed to parse for 'gtk+-2.0.vapi'
114+
Failed to parse for 'atk.vapi'
115+
Failed to parse for 'webkit2gtk-web-extension-4.0.vapi'
116+
Failed to parse for 'xcb-icccm.vapi'
117+
Failed to parse for 'json-glib-1.0.vapi'
118+
Failed to parse for 'gobject-introspection-1.0.vapi'
119+
Failed to parse for 'rest-0.7.vapi'
120+
Failed to parse for 'gdk-2.0.vapi'
121+
Failed to parse for 'gsl.vapi'
122+
Failed to parse for 'gstreamer-1.0.vapi'
123+
Failed to parse for 'javascriptcoregtk-4.1.vapi'
124+
Failed to parse for 'gstreamer-webrtc-1.0.vapi'
125+
Failed to parse for 'libftdi.vapi'
126+
Failed to parse for 'packagekit-glib2.vapi'
127+
Failed to parse for 'libsoup-3.0.vapi'
128+
Failed to parse for 'javascriptcoregtk-4.0.vapi'
129+
130+
Pass rate: 1243/1367

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ pluginGroup = com.tbusk.vala_plugin
44
pluginName = Vala Language
55
pluginRepositoryUrl = https://github.com/Tbusk/vala-jetbrains-plugin
66
# SemVer format -> https://semver.org
7-
pluginVersion=1.2.2-ALPHA
7+
pluginVersion=1.2.3-ALPHA
88

99
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
1010
pluginSinceBuild = 251
1111
pluginUntilBuild = 252.*
1212

1313
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
1414
platformType = IC
15-
platformVersion = 2025.1.1.1
15+
platformVersion=2025.2
1616

1717
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
1818
# Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP
19-
platformPlugins =com.redhat.devtools.lsp4ij:0.13.0
19+
platformPlugins=com.redhat.devtools.lsp4ij:0.14.2
2020
# Example: platformBundledPlugins = com.intellij.java
2121
platformBundledPlugins =
2222

0 commit comments

Comments
 (0)