This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Rust's function signature on kate's syntax-highlighting

Tags: rust, grammar, kate, syntax rust, grammar, kate, syntax rust, grammar, kate, syntax
(comma "," separated)
bombless
Registered Member
Posts
1
Karma
0
The official highlighting configuration use a type list to distinguish types and other things, which doesn't look right to me.
So I try to write my own configuration and avoiding a list for known types while highlight types in a right way.

Then I bumped into Rust's function signature, which is not documented, but you can check similar things here.

So, function signatures can be something like
fn(c_void)
,
fn(arg1: c_void)
or
fn(arg1: c_void, c_void)
.
That said, argument name can be ignored like C.

Now I have no idea how to capture the type part of this declaration.

Normally you can use RegExpr and lookAhead altogether to handle it.
Here comes the hard part:
if you want to capture the
arg1:
part of
fn(arg1: c_void)
, there can be comments before that colon. Rust support nested comment like /* /* */ */, so you cannot do the same for Rust's grammar.

So is it likely that I can ignore the argument name correctly?

I'll try my best to clarify my question if any part of the post is not clear.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]