Permalink
Browse files

Fixef bad tag when parsing empty OCaml file, reported by Marc Weber.

  • Loading branch information...
1 parent c10e6de commit 642e50e0807df25c2f0fc0de73baaf6d5f5f0681 Darren Hiebert committed Sep 11, 2010
Showing with 16 additions and 5 deletions.
  1. +2 −1 NEWS
  2. 0 Test/ocaml_empty.ml
  3. +2 −0 entry.c
  4. +12 −4 ocaml.c
View
@@ -1,12 +1,13 @@
Current Version: @VERSION@
ctags-@VERSION@ (@DATE@)
-* Added support for new "detachable" keyword [Eiffel].
+* Added support for new "attached" and "detachable" keywords [Eiffel].
* Fixed parsing of comments after import statements and other tags, contributed by Huandari Lopez to Geany [Python].
* Fixed PHP parser to ignore keywords inside comments [PHP, Bug #1795926].
* Fixed regular expressions for Ant so they won't span multiple tags [Ant].
* Fixed infinite loop with malformed Makefiles, contributed by Martin Dorey [Make, Bug #2959889].
* Fixed Verilog parameter parsing, contributed by Nicolas Vincent [Verilog, Patch #2747828].
+* Fixed error when parsing empty file [OCaml].
* Enabled Large File System support. [Bug #3062068]
ctags-5.8 (09 Jul 2009)
View
No changes.
View
@@ -772,6 +772,8 @@ static int writePatternEntry (const tagEntryInfo *const tag)
boolean newlineTerminated;
int length = 0;
+ if (line == NULL)
+ error (FATAL, "bad tag in %s", vStringValue (File.name));
if (tag->truncateLine)
truncateTagLine (line, tag->name, FALSE);
newlineTerminated = (boolean) (line [strlen (line) - 1] == '\n');
View
@@ -866,6 +866,11 @@ static void prepareTag (tagEntryInfo * tag, vString const *name, ocamlKind kind)
tag->kindName = OcamlKinds[kind].name;
tag->kind = OcamlKinds[kind].letter;
+ if (kind == K_MODULE)
+ {
+ tag->lineNumberEntry = TRUE;
+ tag->lineNumber = 1;
+ }
parentIndex = getLastNamedIndex ();
if (parentIndex >= 0)
{
@@ -880,9 +885,12 @@ static void prepareTag (tagEntryInfo * tag, vString const *name, ocamlKind kind)
* more information to it in the future */
static void addTag (vString * const ident, int kind)
{
- tagEntryInfo toCreate;
- prepareTag (&toCreate, ident, kind);
- makeTagEntry (&toCreate);
+ if (OcamlKinds [kind].enabled && ident != NULL && vStringLength (ident) > 0)
+ {
+ tagEntryInfo toCreate;
+ prepareTag (&toCreate, ident, kind);
+ makeTagEntry (&toCreate);
+ }
}
boolean needStrongPoping = FALSE;
@@ -1769,7 +1777,7 @@ static void computeModuleName ( void )
if (isLowerAlpha (moduleName->buffer[0]))
moduleName->buffer[0] += ('A' - 'a');
- makeSimpleTag (moduleName, OcamlKinds, K_MODULE);
+ addTag (moduleName, K_MODULE);
vStringDelete (moduleName);
}

0 comments on commit 642e50e

Please sign in to comment.