xref: /Universal-ctags/Units/option-regex-attaching-role.r/extending-existing-parser.d/args.ctags (revision 97d2a1217882963dbd8e66b5e60a5ec6ac31c268)
1#
2# This is an example of capturing reference tags by extending
3# already existing parser.
4#
5# Gauche is an implementation Scheme language.
6# It has a module system.
7#
8# Copyright: 2018 Masatake YAMATO
9# License: GPL-2
10#
11--langdef=myGauche{base=Scheme}
12
13--kinddef-myGauche=m,module,modules
14--_roledef-myGauche.m=used,specified as argument for use
15--_roledef-myGauche.{module}=exported,specified as argument for export
16--_roledef-myGauche.{module}=selected,specified as argument for select
17
18--_tabledef-myGauche=main
19--_tabledef-myGauche=export
20
21
22#
23# MAIN TABLE
24#
25
26# Cut the corners.
27# In serious parser, You should define tables for select-module, define-module and use.
28--_mtable-regex-myGauche=main/\(define-module[ \t\n]+([-a-zA-Z0-9]+)/\1/m/{tenter=main}{scope=push}
29
30--_mtable-regex-myGauche=main/\(//{tenter=main}{scope=push}{placeholder}
31--_mtable-regex-myGauche=main/\)//{tleave}{scope=pop}
32--_mtable-regex-myGauche=main/[ \t\n]+//
33
34# Cut the corners.
35--_mtable-regex-myGauche=main/select-module[ \t\n]+([-a-zA-Z0-9]+)/\1/m/{_role=selected}{scope=set}
36--_mtable-regex-myGauche=main/use[ \t\n]+([-a-zA-Z0-9]+)/\1/m/{_role=used}{scope=ref}
37
38--_mtable-regex-myGauche=main/export[ \t\n]+//{tenter=export}
39
40# TODO: This fall-back pattern should be implementated in ctags main side as default behaviour.
41--_mtable-regex-myGauche=main/.//
42
43#
44# EXPORT TABLE
45#
46
47--_mtable-regex-myGauche=export/[ \t\n]+//
48
49# TODO: Why \0 is not allowed?
50--_mtable-regex-myGauche=export/([-a-zA-Z0-9]+)/\1/m/{_role=exported}{scope=ref}
51
52# Return to parent table with ungetc
53--_mtable-regex-myGauche=export/\)//{_advanceTo=0start}{tleave}
54--_mtable-regex-myGauche=export/.//
55
56
57--extras=+r
58--fields=+r
59
60--fields=+K{scope}{language}
61
62--sort=no
63