Making "inline" behave like an attribute. Fixes #1
[arduino-ctags.git] / awk.c
blobd825d6f11b86f7ac48c00ae5923f6cc2af0a90c5
1 /*
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.
13 * INCLUDE FILES
15 #include "general.h" /* must always come first */
17 #include <string.h>
19 #include "parse.h"
20 #include "read.h"
21 #include "vstring.h"
24 * DATA DEFINITIONS
26 typedef enum eAwkKinds {
27 K_FUNCTION
28 } awkKind;
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))
51 ++cp;
52 while (isalnum ((int) *cp) || *cp == '_')
54 vStringPut (name, (int) *cp);
55 ++cp;
57 vStringTerminate (name);
58 while (isspace ((int) *cp))
59 ++cp;
60 if (*cp == '(')
61 makeSimpleTag (name, AwkKinds, K_FUNCTION);
62 vStringClear (name);
63 if (*cp != '\0')
64 ++cp;
67 vStringDelete (name);
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;
78 return def;
81 /* vi:set tabstop=4 shiftwidth=4: */