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 version 2 or (at your option) any later version.
7 * This module contains functions for generating tags for HTML language
14 #include "general.h" /* must always come first */
19 * FUNCTION DEFINITIONS
22 static void installHtmlRegex (const langType language
)
24 #define POSSIBLE_ATTRIBUTES "([ \t]+[a-z]+=\"?[^>\"]*\"?)*"
26 addTagRegex (language
,
29 "[ \t]+name=\"?([^>\"]+)\"?"
32 "\\2", "a,anchor,named anchors", "i");
34 addTagRegex (language
, "^[ \t]*function[ \t]*([A-Za-z0-9_]+)[ \t]*\\(",
35 "\\1", "f,function,JavaScript functions", NULL
);
37 /* the following matches headings with tags inside like
38 * <h1><a href="#id109"><i>Some Text</i></a></h1>
40 * <h1>Some Text</h1> */
41 #define SPACES "[ \t]*"
43 #define INNER_HEADING \
44 ATTRS ">" SPACES "(<" ATTRS ">" SPACES ")*([^<]+).*"
46 addTagRegex (language
,
47 "<h1" INNER_HEADING
"</h1>",
48 "\\2", "n,namespace,H1 heading", "i");
50 addTagRegex (language
,
51 "<h2" INNER_HEADING
"</h2>",
52 "\\2", "c,class,H2 heading", "i");
54 addTagRegex (language
,
55 "<h3" INNER_HEADING
"</h3>",
56 "\\2", "v,variable,H3 heading", "i");
59 /* Create parser definition structure */
60 extern parserDefinition
* HtmlParser (void)
62 static const char *const extensions
[] = { "htm", "html", NULL
};
63 parserDefinition
*const def
= parserNew ("HTML");
64 def
->extensions
= extensions
;
65 def
->initialize
= installHtmlRegex
;
70 /* vi:set tabstop=4 shiftwidth=4: */