| 1 |
/* |
| 2 |
* $Id$ |
| 3 |
* |
| 4 |
* Copyright (c) 2008, David Fishburn |
| 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 MATLAB language files. |
| 10 |
*/ |
| 11 |
|
| 12 |
/* |
| 13 |
* INCLUDE FILES |
| 14 |
*/ |
| 15 |
#include "general.h" /* must always come first */ |
| 16 |
|
| 17 |
#include <string.h> |
| 18 |
#include "parse.h" |
| 19 |
|
| 20 |
/* |
| 21 |
* FUNCTION DEFINITIONS |
| 22 |
*/ |
| 23 |
|
| 24 |
static void installMatLabRegex (const langType language) |
| 25 |
{ |
| 26 |
/* function [x,y,z] = asdf */ |
| 27 |
addTagRegex (language, "^function[ \t]*\\[.*\\][ \t]*=[ \t]*([a-zA-Z0-9_]+)", "\\1", "f,function", NULL); |
| 28 |
/* function x = asdf */ |
| 29 |
addTagRegex (language, "^function[ \t]*[a-zA-Z0-9_]+[ \t]*=[ \t]*([a-zA-Z0-9_]+)", "\\1", "f,function", NULL); |
| 30 |
/* function asdf */ |
| 31 |
addTagRegex (language, "^function[ \t]*([a-zA-Z0-9_]+)[^=]*$", "\\1", "f,function", NULL); |
| 32 |
} |
| 33 |
|
| 34 |
extern parserDefinition* MatLabParser () |
| 35 |
{ |
| 36 |
static const char *const extensions [] = { "m", NULL }; |
| 37 |
parserDefinition* const def = parserNew ("MatLab"); |
| 38 |
def->extensions = extensions; |
| 39 |
def->initialize = installMatLabRegex; |
| 40 |
def->regex = TRUE; |
| 41 |
return def; |
| 42 |
} |
| 43 |
|
| 44 |
/* vi:set tabstop=4 shiftwidth=4: */ |