| 1 |
/* |
| 2 |
* $Id: html.c 443 2006-05-30 04:37:13Z darren $ |
| 3 |
* |
| 4 |
* Copyright (c) 2003, Darren Hiebert |
| 5 |
* |
| 6 |
* This source code is released for free distribution under the terms of the |
| 7 |
* GNU General Public License. |
| 8 |
* |
| 9 |
* This module contains functions for generating tags for HTML language |
| 10 |
* files. |
| 11 |
*/ |
| 12 |
|
| 13 |
/* |
| 14 |
* INCLUDE FILES |
| 15 |
*/ |
| 16 |
#include "general.h" /* must always come first */ |
| 17 |
#include "parse.h" |
| 18 |
|
| 19 |
/* |
| 20 |
* FUNCTION DEFINITIONS |
| 21 |
*/ |
| 22 |
|
| 23 |
static void installHtmlRegex (const langType language) |
| 24 |
{ |
| 25 |
#define POSSIBLE_ATTRIBUTES "([ \t]+[a-z]+=\"?[^>\"]*\"?)*" |
| 26 |
addTagRegex (language, |
| 27 |
"<a" |
| 28 |
POSSIBLE_ATTRIBUTES |
| 29 |
"[ \t]+name=\"?([^>\"]+)\"?" |
| 30 |
POSSIBLE_ATTRIBUTES |
| 31 |
"[ \t]*>", |
| 32 |
"\\2", "a,anchor,named anchors", "i"); |
| 33 |
|
| 34 |
addTagRegex (language, "^[ \t]*function[ \t]*([A-Za-z0-9_]+)[ \t]*\\(", |
| 35 |
"\\1", "f,function,JavaScript functions", NULL); |
| 36 |
} |
| 37 |
|
| 38 |
/* Create parser definition stucture */ |
| 39 |
extern parserDefinition* HtmlParser (void) |
| 40 |
{ |
| 41 |
static const char *const extensions [] = { "htm", "html", NULL }; |
| 42 |
parserDefinition *const def = parserNew ("HTML"); |
| 43 |
def->extensions = extensions; |
| 44 |
def->initialize = installHtmlRegex; |
| 45 |
def->regex = TRUE; |
| 46 |
return def; |
| 47 |
} |
| 48 |
|
| 49 |
/* vi:set tabstop=4 shiftwidth=4: */ |