2 * $Id: awk.c 443 2006-05-30 04:37:13Z darren $
4 * Copyright (c) 2000-2002, Darren Hiebert
6 * This source code is released for free distribution under the terms of the
7 * GNU General Public License.
9 * This module contains functions for generating tags for AWK functions.
15 #include "general.h" /* must always come first */
26 typedef enum eAwkKinds
{
30 static kindOption AwkKinds
[] = {
31 { TRUE
, 'f', "function", "functions" }
35 * FUNCTION DEFINITIONS
38 static void findAwkTags (void)
40 vString
*name
= vStringNew ();
41 const unsigned char *line
;
43 while ((line
= fileReadLine ()) != NULL
)
45 if (strncmp ((const char*) line
, "function", (size_t) 8) == 0 &&
46 isspace ((int) line
[8]))
48 const unsigned char *cp
= line
+ 8;
50 while (isspace ((int) *cp
))
52 while (isalnum ((int) *cp
) || *cp
== '_')
54 vStringPut (name
, (int) *cp
);
57 vStringTerminate (name
);
58 while (isspace ((int) *cp
))
61 makeSimpleTag (name
, AwkKinds
, K_FUNCTION
);
70 extern parserDefinition
* AwkParser ()
72 static const char *const extensions
[] = { "awk", "gawk", "mawk", NULL
};
73 parserDefinition
* def
= parserNew ("Awk");
74 def
->kinds
= AwkKinds
;
75 def
->kindCount
= KIND_COUNT (AwkKinds
);
76 def
->extensions
= extensions
;
77 def
->parser
= findAwkTags
;
81 /* vi:set tabstop=4 shiftwidth=4: */