Merge pull request #404 from ntrel/enum-base
[geany-mirror.git] / tagmanager / ctags / html.c
blobc382730d0e88ed86a84a37dcbd4ce27493ea8a69
1 /*
2 * Copyright (c) 2003, Darren Hiebert
4 * This source code is released for free distribution under the terms of the
5 * GNU General Public License.
7 * This module contains functions for generating tags for HTML language
8 * files.
9 */
12 * INCLUDE FILES
14 #include "general.h" /* must always come first */
15 #include "parse.h"
18 * FUNCTION DEFINITIONS
21 static void installHtmlRegex (const langType language)
23 #define POSSIBLE_ATTRIBUTES "([ \t]+[a-z]+=\"?[^>\"]*\"?)*"
25 addTagRegex (language,
26 "<a"
27 POSSIBLE_ATTRIBUTES
28 "[ \t]+name=\"?([^>\"]+)\"?"
29 POSSIBLE_ATTRIBUTES
30 "[ \t]*>",
31 "\\2", "m,member,named anchors", "i");
33 addTagRegex (language, "^[ \t]*function[ \t]*([A-Za-z0-9_]+)[ \t]*\\(",
34 "\\1", "f,function,JavaScript functions", NULL);
36 /* the following matches headings with tags inside like
37 * <h1><a href="#id109"><i>Some Text</i></a></h1>
38 * and
39 * <h1>Some Text</h1> */
40 #define SPACES "[ \t]*"
41 #define ATTRS "[^>]*"
42 #define INNER_HEADING \
43 ATTRS ">" SPACES "(<" ATTRS ">" SPACES ")*([^<]+).*"
45 addTagRegex (language,
46 "<h1" INNER_HEADING "</h1>",
47 "\\2", "n,namespace,H1 heading", "i");
49 addTagRegex (language,
50 "<h2" INNER_HEADING "</h2>",
51 "\\2", "c,class,H2 heading", "i");
53 addTagRegex (language,
54 "<h3" INNER_HEADING "</h3>",
55 "\\2", "v,variable,H3 heading", "i");
58 /* Create parser definition stucture */
59 extern parserDefinition* HtmlParser (void)
61 static const char *const extensions [] = { "htm", "html", NULL };
62 parserDefinition *const def = parserNew ("HTML");
63 def->extensions = extensions;
64 def->initialize = installHtmlRegex;
65 def->regex = TRUE;
66 return def;
69 /* vi:set tabstop=4 shiftwidth=4: */