Handle template expressions that may use the << or >> operators
[arduino-ctags.git] / vala.c
blob555ffc5dae0bed2792345a4d40ff8a9a3e231b83
1 /*
2 * vala.c
4 * Copyright 2008 Abderrahim Kitouni <a.kitouni@gmail.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
23 * INCLUDE FILES
25 #include "general.h" /* must always come first */
26 #include "parse.h"
27 #include "read.h"
29 #include "entry.h"
30 #include "ctags-vala.h"
32 CTagsVisitor *visitor;
33 /* using different data structure because fpos_t isn't available in Vala*/
34 static void make_ctags_entry (CTagsEntry* entry) {
35 tagEntryInfo tag;
36 initTagEntry(&tag, entry->name);
38 tag.lineNumberEntry = TRUE;
39 tag.lineNumber = entry->line_number;
40 tag.kindName = entry->kind_name;
41 tag.kind = entry->kind;
42 /* FIXME: add filePosition */
43 tag.extensionFields.access = entry->access;
44 tag.extensionFields.implementation = entry->implementation;
45 tag.extensionFields.inheritance = entry->inheritance;
46 tag.extensionFields.scope[0] = entry->scope[0];
47 tag.extensionFields.scope[1] = entry->scope[1];
48 tag.extensionFields.typeRef[0] = entry->typeref;
49 tag.extensionFields.returnType = entry->returntype;
50 tag.extensionFields.signature = entry->signature;
51 makeTagEntry(&tag);
54 static kindOption ValaKinds [] = {
55 { TRUE, 'c', "class", "Classes" },
56 { TRUE, 's', "struct", "Structures" },
57 { TRUE, 'i', "interface", "Interfaces" },
58 { TRUE, 'e', "enum", "Enumerations" },
59 { TRUE, 'v', "enumvalue", "Enumeration Values" },
60 { TRUE, 'E', "errordomain", "Error domains" },
61 { TRUE, 'r', "errorcode", "Error codes" },
62 { TRUE, 'd', "delegate", "Delegates" },
63 { TRUE, 'S', "signal", "Signals" },
64 { TRUE, 'f', "field", "Fields" },
65 { TRUE, 'p', "property", "Properties" },
66 { TRUE, 'm', "method", "Methods" },
67 { FALSE, 'l', "local", "Local variables" },
70 static void findValaTags (void) {
71 if (visitor == NULL) {
72 visitor = ctags_visitor_new();
74 ctags_visitor_parse_vala (visitor, getSourceFileName(), (CTagsEntryMaker) make_ctags_entry);
77 extern parserDefinition *ValaParse(void) {
78 g_type_init();
79 static const char *const extensions [] = { "vala", "vapi", NULL };
80 parserDefinition* def = parserNew ("Vala");
81 def->kinds = ValaKinds;
82 def->kindCount = KIND_COUNT (ValaKinds);
83 def->extensions = extensions;
84 def->parser = findValaTags;
85 return def;
88 static void findGenieTags (void) {
89 if (visitor == NULL) {
90 visitor = ctags_visitor_new();
92 ctags_visitor_parse_genie (visitor, getSourceFileName(), (CTagsEntryMaker) make_ctags_entry);
95 extern parserDefinition *GenieParser(void) {
96 static const char *const extensions [] = { "gs", NULL };
97 parserDefinition* def = parserNew ("Genie");
98 def->kinds = ValaKinds;
99 def->kindCount = KIND_COUNT (ValaKinds);
100 def->extensions = extensions;
101 def->parser = findGenieTags;
102 return def;