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
14 #include "general.h" /* must always come first */
18 * FUNCTION DEFINITIONS
21 static void installHtmlRegex (const langType language
)
23 #define POSSIBLE_ATTRIBUTES "([ \t]+[a-z]+=\"?[^>\"]*\"?)*"
25 addTagRegex (language
,
28 "[ \t]+name=\"?([^>\"]+)\"?"
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>
39 * <h1>Some Text</h1> */
40 #define SPACES "[ \t]*"
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
;
69 /* vi:set tabstop=4 shiftwidth=4: */