@@ -43,6 +43,7 @@ typedef enum {
4343 K_FIELD ,
4444 K_VARIANT ,
4545 K_METHOD ,
46+ K_CONST ,
4647 K_NONE
4748} RustKind ;
4849
@@ -59,6 +60,7 @@ static kindDefinition rustKinds[] = {
5960 {true, 'm' , "field" , "A struct field" },
6061 {true, 'e' , "enumerator" , "An enum variant" },
6162 {true, 'P' , "method" , "A method" },
63+ {true, 'C' , "constant" , "A constant" },
6264};
6365
6466typedef enum {
@@ -725,6 +727,18 @@ static void parseStatic (lexerState *lexer, vString *scope, int parent_kind)
725727 addTag (lexer -> token_str , NULL , K_STATIC , lexer -> line , lexer -> pos , scope , parent_kind );
726728}
727729
730+ /* Const format:
731+ * "const" <ident>
732+ */
733+ static void parseConst (lexerState * lexer , vString * scope , int parent_kind )
734+ {
735+ advanceToken (lexer , true);
736+ if (lexer -> cur_token != TOKEN_IDENT )
737+ return ;
738+
739+ addTag (lexer -> token_str , NULL , K_CONST , lexer -> line , lexer -> pos , scope , parent_kind );
740+ }
741+
728742/* Type format:
729743 * "type" <ident>
730744 */
@@ -918,6 +932,10 @@ static void parseBlock (lexerState *lexer, bool delim, int kind, vString *scope)
918932 {
919933 parseStatic (lexer , scope , kind );
920934 }
935+ else if (strcmp (vStringValue (lexer -> token_str ), "const" ) == 0 )
936+ {
937+ parseConst (lexer , scope , kind );
938+ }
921939 else if (strcmp (vStringValue (lexer -> token_str ), "trait" ) == 0 )
922940 {
923941 parseTrait (lexer , scope , kind );
0 commit comments