[anjuta] Add falcon pl to anjuta-tags
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] Add falcon pl to anjuta-tags
- Date: Thu, 26 Jul 2012 15:07:29 +0000 (UTC)
commit 4ee9da6ea6471703b6ab6feb2e7b004f178420bc
Author: Steven Oliver <oliver steven gmail com>
Date: Tue Jun 12 22:20:04 2012 -0400
Add falcon pl to anjuta-tags
plugins/symbol-db/anjuta-tags/Makefile.am | 1 +
plugins/symbol-db/anjuta-tags/falcon.c | 149 +++++++++++++++++++++++++++++
plugins/symbol-db/anjuta-tags/parsers.h | 1 +
3 files changed, 151 insertions(+), 0 deletions(-)
---
diff --git a/plugins/symbol-db/anjuta-tags/Makefile.am b/plugins/symbol-db/anjuta-tags/Makefile.am
index 5d15ef6..0c24dfb 100644
--- a/plugins/symbol-db/anjuta-tags/Makefile.am
+++ b/plugins/symbol-db/anjuta-tags/Makefile.am
@@ -63,6 +63,7 @@ anjuta_tags_SOURCES = \
e_riscos.h \
erlang.c \
e_vms.h \
+ falcon.c \
flex.c \
fortran.c \
general.h \
diff --git a/plugins/symbol-db/anjuta-tags/falcon.c b/plugins/symbol-db/anjuta-tags/falcon.c
new file mode 100644
index 0000000..2730462
--- /dev/null
+++ b/plugins/symbol-db/anjuta-tags/falcon.c
@@ -0,0 +1,149 @@
+/*
+ * $Id$
+ *
+ * Copyright (c) 2011, 2012 Steven Oliver <oliver steven gmail com>
+ *
+ * This source code is released for free distribution under the terms of the
+ * GNU General Public License.
+ *
+ * This module contains functions for generating tags for Falcon language
+ * files.
+ */
+
+
+/*
+ * INCLUDE FILES
+ */
+#include "general.h"
+
+#include <string.h>
+#include <ctype.h>
+
+#include "parse.h"
+#include "read.h"
+
+/*
+ * Data Definitions
+ */
+typedef enum eFalconKinds {
+ K_CLASS,
+ K_FUNCTION,
+ K_MEMBER,
+ K_VARIABLE,
+ K_NAMESPACE
+} falconKind;
+
+static kindOption FalconKinds [] = {
+ {TRUE, 'c', "class", "classes" },
+ {TRUE, 'f', "function", "functions"},
+ {TRUE, 'm', "member", "class members"},
+ {TRUE, 'v', "variable", "variables"},
+ {TRUE, 'i', "namespace", "imports"}
+};
+
+/*
+ * Function Definitions
+ */
+
+static boolean isIdentifierChar (int c)
+{
+ return (boolean) (isalnum (c) || c == '_');
+}
+
+static const char *skipSpace (const char *cp)
+{
+ while (isspace ((int) *cp))
+ ++cp;
+
+ return cp;
+}
+
+static const char *skipString (const char *cp)
+{
+ const char *start = cp;
+ int escaped = 0;
+
+ for (cp++; *cp; cp++)
+ {
+ if (escaped)
+ escaped--;
+ else if (*cp == '\\')
+ escaped++;
+ else if (*cp == *start)
+ return cp + 1;
+ }
+
+ return cp;
+}
+
+static void findFalconTags (void)
+{
+ vString *name = vStringNew ();
+ const unsigned char *line;
+
+ while ((line = fileReadLine ()) != NULL)
+ {
+ const unsigned char *cp = line;
+
+ if (*cp == '#')
+ continue;
+
+ if (strncmp ((const char*) cp, "function", (size_t) 8) == 0)
+ {
+ cp += 8;
+ cp = skipSpace (cp);
+
+ while (isIdentifierChar ((int) *cp))
+ {
+ vStringPut (name, (int) *cp);
+ ++cp;
+ }
+ vStringTerminate (name);
+ makeSimpleTag (name, FalconKinds, K_FUNCTION);
+ vStringClear (name);
+ }
+ else if (strncmp ((const char*) cp, "class", (size_t) 5) == 0)
+ {
+ cp += 5;
+ cp = skipSpace (cp);
+
+ while (isIdentifierChar ((int) *cp))
+ {
+ vStringPut (name, (int) *cp);
+ ++cp;
+ }
+ vStringTerminate (name);
+ makeSimpleTag (name, FalconKinds, K_CLASS);
+ vStringClear (name);
+ }
+ else if (strncmp ((const char*) cp, "load", (size_t) 4) == 0)
+ {
+ cp += 4;
+ cp = skipSpace (cp);
+
+ while (isIdentifierChar ((int) *cp))
+ {
+ vStringPut (name, (int) *cp);
+ ++cp;
+ }
+ vStringTerminate (name);
+ makeSimpleTag (name, FalconKinds, K_NAMESPACE);
+ vStringClear (name);
+ }
+ }
+ vStringDelete (name);
+}
+
+/*
+ * Parser definition structure
+ */
+extern parserDefinition* FalconParser (void)
+{
+ static const char *const extensions [] = { "fal", "ftd", NULL };
+ parserDefinition *def = parserNew ("Falcon");
+ def->kinds = FalconKinds;
+ def->kindCount = KIND_COUNT (FalconKinds);
+ def->extensions = extensions;
+ def->parser = findFalconTags;
+ return def;
+}
diff --git a/plugins/symbol-db/anjuta-tags/parsers.h b/plugins/symbol-db/anjuta-tags/parsers.h
index bf5cb98..52688bc 100644
--- a/plugins/symbol-db/anjuta-tags/parsers.h
+++ b/plugins/symbol-db/anjuta-tags/parsers.h
@@ -30,6 +30,7 @@
DosBatchParser, \
EiffelParser, \
ErlangParser, \
+ Falcon, \
FlexParser, \
FortranParser, \
GirParser, \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]