xref: /Universal-ctags/parsers/dosbatch.c (revision 1f9cdae041442312d8953a2354c9b1ff206d981a)
1 /*
2 *   Copyright (c) 2009, David Fishburn
3 *
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.
6 *
7 *   This module contains functions for generating tags for DOS Batch language files.
8 */
9 
10 /*
11 *   INCLUDE FILES
12 */
13 #include "general.h"  /* must always come first */
14 
15 #include <string.h>
16 #include "parse.h"
17 #include "routines.h"
18 #include "selectors.h"
19 
20 static tagRegexTable dosTagRegexTable [] = {
21 	{"^:([A-Za-z_0-9]+)", "\\1",
22 	 "l,label,labels", NULL},
23 	{"set[ \t]+([A-Za-z_0-9]+)[ \t]*=", "\\1",
24 	 "v,variable,variables", NULL},
25 };
26 
27 /*
28 *   FUNCTION DEFINITIONS
29 */
30 
DosBatchParser(void)31 extern parserDefinition* DosBatchParser (void)
32 {
33 	static const char *const extensions [] = { "bat", "cmd", NULL };
34 	parserDefinition* const def = parserNew ("DosBatch");
35 	static selectLanguage selectors[] = { selectByRexxCommentAndDosbatchLabelPrefix,
36 					      NULL };
37 
38 	def->extensions = extensions;
39 	def->tagRegexTable = dosTagRegexTable;
40 	def->tagRegexCount = ARRAY_SIZE (dosTagRegexTable);
41 	def->method     = METHOD_NOT_CRAFTED|METHOD_REGEX;
42 	def->selectLanguage = selectors;
43 	return def;
44 }
45