From 63183f1925e1a80c747e122b19d8d48550d39501 Mon Sep 17 00:00:00 2001 From: Steven Oliver Date: Tue, 22 May 2012 22:25:31 -0400 Subject: [PATCH 01/11] Update and cleanup falcon parser: * Add helper functions skipString and skipSpace * Update copyright header * Replace white space loops with new skipSpace function * Add another file type extension to parserDefinition * Add boolean function isIdentifierChar to identify alpha-numeric characters or underscores. Implement in loops. --- falcon.c | 54 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/falcon.c b/falcon.c index 3321cc7e04..9bf165e840 100644 --- a/falcon.c +++ b/falcon.c @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 2011 Steven Oliver + * Copyright (c) 2011, 2012 Steven Oliver * * This source code is released for free distribution under the terms of the * GNU General Public License. @@ -44,6 +44,38 @@ static kindOption FalconKinds [] = { /* * 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 (); @@ -59,9 +91,9 @@ static void findFalconTags (void) if (strncmp ((const char*) cp, "function", (size_t) 8) == 0) { cp += 8; - while (isspace ((int) *cp)) - ++cp; - while (isalnum ((int) *cp) || *cp == '_') + cp = skipSpace (cp); + + while (isIdentifierChar ((int) *cp)) { vStringPut (name, (int) *cp); ++cp; @@ -73,9 +105,9 @@ static void findFalconTags (void) else if (strncmp ((const char*) cp, "class", (size_t) 5) == 0) { cp += 5; - while (isspace ((int) *cp)) - ++cp; - while (isalnum ((int) *cp) || *cp == '_') + cp = skipSpace (cp); + + while (isIdentifierChar ((int) *cp)) { vStringPut (name, (int) *cp); ++cp; @@ -87,9 +119,9 @@ static void findFalconTags (void) else if (strncmp ((const char*) cp, "load", (size_t) 4) == 0) { cp += 4; - while (isspace ((int) *cp)) - ++cp; - while (isalnum ((int) *cp) || *cp == '_') + cp = skipSpace (cp); + + while (isIdentifierChar ((int) *cp)) { vStringPut (name, (int) *cp); ++cp; @@ -107,7 +139,7 @@ static void findFalconTags (void) */ extern parserDefinition* FalconParser (void) { - static const char *const extensions [] = { "fal", NULL }; + static const char *const extensions [] = { "fal", "ftd", NULL }; parserDefinition *def = parserNew ("Falcon"); def->kinds = FalconKinds; def->kindCount = KIND_COUNT (FalconKinds); From caeb408a3f413a22fef5e652472fb34b9013e40d Mon Sep 17 00:00:00 2001 From: Steven Oliver Date: Tue, 22 May 2012 22:28:52 -0400 Subject: [PATCH 02/11] Add import statement to test --- Test/simple.fal | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Test/simple.fal b/Test/simple.fal index 1545258e19..9280df7bd9 100644 --- a/Test/simple.fal +++ b/Test/simple.fal @@ -4,6 +4,8 @@ * COMMENT */ +import from socket + const CONSTANT = "1" test = " From feb92b928429ab4916a69ad6a6dd45813b7f69f7 Mon Sep 17 00:00:00 2001 From: Steven Oliver Date: Wed, 23 May 2012 17:00:41 -0300 Subject: [PATCH 03/11] This package is maintained on Github, no point in listing sourceforge user names. --- MAINTAINERS | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index f87bb9af84..86dfb3b1cb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1,30 +1,30 @@ The following individuals are registered as developers for the maintenance of -Exuberant Ctags. They are listed by their SourgeForge username and by the -To send email to any one of them, send it to . +Exuberant Ctags. They are listed by their Github username. -Ctags SourgeForge Full +Ctags Github Full Parser username Name ---------- ----------- ----- -Ant dfishburn David Fishburn -AWK jkoshy Joseph Koshy -Basic elias Elias Pschernig -C# elliotth Elliott Hughes -DosBatch dfishburn David Fishburn -Flex dfishburn David Fishburn -Java elliotth Elliott Hughes -JavaScript dfishburn David Fishburn -MATlAB dfishburn David Fishburn -Objective-C aeruder Andrew Ruder -OCaml vberthoux Vincent Berthoux -Perl perlguy0 Dmitri Tikhonov -PHP jafl John Lindal -Python elias Elias Pschernig -Ruby elliotth Elliott Hughes -SML jkoshy Joseph Koshy -SQL dfishburn David Fishburn -TeX dfishburn David Fishburn -Vim dfishburn David Fishburn -All else dhiebert Darren Hiebert +Ant fishman David Fishburn +AWK Joseph Koshy +Basic Elias Pschernig +C# Elliott Hughes +DosBatch fishman David Fishburn +Falcon steveno Steven Oliver +Flex fishman David Fishburn +Java Elliott Hughes +JavaScript fishman David Fishburn +MATlAB fishman David Fishburn +Objective-C Andrew Ruder +OCaml Vincent Berthoux +Perl Dmitri Tikhonov +PHP John Lindal +Python Elias Pschernig +Ruby Elliott Hughes +SML Joseph Koshy +SQL fishman David Fishburn +TeX fishman David Fishburn +Vim fishman David Fishburn +All else Darren Hiebert How To Build & Test Like A Maintainer ===================================== From 9e31ccb42f3c0777006da161e020ce5fcdedcaec Mon Sep 17 00:00:00 2001 From: Steven Oliver Date: Thu, 24 May 2012 10:13:50 -0300 Subject: [PATCH 04/11] Add Elias Pschernig's github name. Move real name column over 2 spaces. --- MAINTAINERS | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 86dfb3b1cb..41a73bb5fa 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4,27 +4,27 @@ Exuberant Ctags. They are listed by their Github username. Ctags Github Full Parser username Name ---------- ----------- ----- -Ant fishman David Fishburn -AWK Joseph Koshy -Basic Elias Pschernig -C# Elliott Hughes -DosBatch fishman David Fishburn -Falcon steveno Steven Oliver -Flex fishman David Fishburn -Java Elliott Hughes -JavaScript fishman David Fishburn -MATlAB fishman David Fishburn -Objective-C Andrew Ruder -OCaml Vincent Berthoux -Perl Dmitri Tikhonov -PHP John Lindal -Python Elias Pschernig -Ruby Elliott Hughes -SML Joseph Koshy -SQL fishman David Fishburn -TeX fishman David Fishburn -Vim fishman David Fishburn -All else Darren Hiebert +Ant fishman David Fishburn +AWK Joseph Koshy +Basic elias-pschernig Elias Pschernig +C# Elliott Hughes +DosBatch fishman David Fishburn +Falcon steveno Steven Oliver +Flex fishman David Fishburn +Java Elliott Hughes +JavaScript fishman David Fishburn +MATlAB fishman David Fishburn +Objective-C Andrew Ruder +OCaml Vincent Berthoux +Perl Dmitri Tikhonov +PHP John Lindal +Python elias-pschernig Elias Pschernig +Ruby Elliott Hughes +SML Joseph Koshy +SQL fishman David Fishburn +TeX fishman David Fishburn +Vim fishman David Fishburn +All else Darren Hiebert How To Build & Test Like A Maintainer ===================================== From 83ff0fd69d2086d43c16dcddb72102b5bea4b9ad Mon Sep 17 00:00:00 2001 From: Steven Oliver Date: Thu, 24 May 2012 10:14:09 -0300 Subject: [PATCH 05/11] Fix full name column header --- MAINTAINERS | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 41a73bb5fa..e3c8f1cc34 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1,9 +1,9 @@ The following individuals are registered as developers for the maintenance of Exuberant Ctags. They are listed by their Github username. -Ctags Github Full -Parser username Name ----------- ----------- ----- +Ctags Github Full +Parser username Name +---------- ----------- ----- Ant fishman David Fishburn AWK Joseph Koshy Basic elias-pschernig Elias Pschernig From c1ff3396e0fb3b362f77a8a99e3feff471c19dbf Mon Sep 17 00:00:00 2001 From: Steven Oliver Date: Thu, 24 May 2012 10:15:49 -0300 Subject: [PATCH 06/11] Replace "Red Hat" with Fedora and up2date with yum --- MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index e3c8f1cc34..9d83ead25c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -41,9 +41,9 @@ Prerequisites Install the Xcode developer tools, available here: http://developer.apple.com/tools/download/ - RedHat: + Fedora: - up2date --nosig subversion autoheader autoconf + yum install subversion autoheader autoconf Windows: From 8d4dba960a187dfc921e6d068fc7f7f7dc6c7d44 Mon Sep 17 00:00:00 2001 From: Steven Oliver Date: Thu, 24 May 2012 10:16:57 -0300 Subject: [PATCH 07/11] We use git now, now SVN --- MAINTAINERS | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 9d83ead25c..4b4067672d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -54,9 +54,7 @@ Building First time: - svn co https://ctags.svn.sourceforget.net/svnroot/ctags/trunk ctags - # Miss off the "/trunk" above if you want access to old releases or the - # web site. + git clone git://github.com/fishman/ctags.git cd ctags autoheader autoconf @@ -66,7 +64,7 @@ Building Later: cd ctags - svn update + git pull make -j Testing From 1cda4496451ce584e1d47c647325012b30fe68a2 Mon Sep 17 00:00:00 2001 From: Steven Oliver Date: Fri, 25 May 2012 10:52:50 -0300 Subject: [PATCH 08/11] fishman on github != Fishburn --- MAINTAINERS | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 4b4067672d..5e31af11c7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4,16 +4,16 @@ Exuberant Ctags. They are listed by their Github username. Ctags Github Full Parser username Name ---------- ----------- ----- -Ant fishman David Fishburn +Ant David Fishburn AWK Joseph Koshy Basic elias-pschernig Elias Pschernig C# Elliott Hughes -DosBatch fishman David Fishburn +DosBatch David Fishburn Falcon steveno Steven Oliver -Flex fishman David Fishburn +Flex David Fishburn Java Elliott Hughes -JavaScript fishman David Fishburn -MATlAB fishman David Fishburn +JavaScript David Fishburn +MATlAB David Fishburn Objective-C Andrew Ruder OCaml Vincent Berthoux Perl Dmitri Tikhonov @@ -21,9 +21,9 @@ PHP John Lindal Python elias-pschernig Elias Pschernig Ruby Elliott Hughes SML Joseph Koshy -SQL fishman David Fishburn -TeX fishman David Fishburn -Vim fishman David Fishburn +SQL David Fishburn +TeX David Fishburn +Vim David Fishburn All else Darren Hiebert How To Build & Test Like A Maintainer From 33e1ae9b24a864248c9940f223bc790b748aad3e Mon Sep 17 00:00:00 2001 From: Steven Oliver Date: Sun, 10 Jun 2012 01:57:34 -0400 Subject: [PATCH 09/11] Remove vim mode line. --- falcon.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/falcon.c b/falcon.c index 9bf165e840..2730462854 100644 --- a/falcon.c +++ b/falcon.c @@ -147,5 +147,3 @@ extern parserDefinition* FalconParser (void) def->parser = findFalconTags; return def; } - -/* vi:set tabstop=4 shiftwidth=4: */ From 97f1154f472a9dbe7983ff9244eac4b86f6dbeb5 Mon Sep 17 00:00:00 2001 From: Steven Oliver Date: Fri, 15 Jun 2012 10:26:27 -0300 Subject: [PATCH 10/11] Falcon doesn't use the underscore as marker --- falcon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/falcon.c b/falcon.c index 9bf165e840..9a16b354b2 100644 --- a/falcon.c +++ b/falcon.c @@ -47,7 +47,7 @@ static kindOption FalconKinds [] = { static boolean isIdentifierChar (int c) { - return (boolean) (isalnum (c) || c == '_'); + return (boolean) (isalnum (c)); } static const char *skipSpace (const char *cp) From e65af821cf8b1d249deda0cc05eab83786b71fed Mon Sep 17 00:00:00 2001 From: Steven Oliver Date: Fri, 15 Jun 2012 19:20:00 -0400 Subject: [PATCH 11/11] Add import from. Remove unused function. --- falcon.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/falcon.c b/falcon.c index f26e8727c3..27e38043c8 100644 --- a/falcon.c +++ b/falcon.c @@ -19,7 +19,6 @@ #include #include -#include "parse.h" #include "read.h" /* @@ -58,23 +57,9 @@ static const char *skipSpace (const char *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; -} +/* + * Main parsing function + */ static void findFalconTags (void) { @@ -85,6 +70,8 @@ static void findFalconTags (void) { const unsigned char *cp = line; + // Skip lines starting with # which in falcon + // would only be the "crunch bang" statement if (*cp == '#') continue; @@ -121,6 +108,20 @@ static void findFalconTags (void) cp += 4; cp = skipSpace (cp); + while (isIdentifierChar ((int) *cp)) + { + vStringPut (name, (int) *cp); + ++cp; + } + vStringTerminate (name); + makeSimpleTag (name, FalconKinds, K_NAMESPACE); + vStringClear (name); + } + else if (strncmp ((const char*) cp, "import from", (size_t) 11) == 0) + { + cp += 12; + cp = skipSpace (cp); + while (isIdentifierChar ((int) *cp)) { vStringPut (name, (int) *cp);