Skip to content

Commit

Permalink
Add an updated ocaml parser
Browse files Browse the repository at this point in the history
Summary:
This commit fixes ticket universal-ctags#300 (improper handling of ';;' at toplevel)
and universal-ctags#355 (error on parsing empty file). But more importantly, it adds
support for:

proper function recognition (kinda)
let rec ... and ...
module [rec] M : sig ... end = struct ... end
module [rec] M = struct ... end and N = struct ... end

Most of these changes required a single-token lookahead,
so I added this to all of the parsing functions. It's now
used rather prolifically.

Function discovery relies upon the assumption that most
people write functions like
let [rec] my_func a b c = ... or
let [rec] my_func () = ... or
let [rec] () = ...
let [rec] _ = ...

Still unsupported are things such as
let [rec] my_func = function MyCon1 -> ... | MyCon2 ...
let [rec] my_func = fun a b c d -> ...
The first would require two-token lookahead, while
last would require an n-token lookahead. Although, support
_may_ be able to be added by using a 'functionValidation'
function similar to constructorValidation. Something to look into.
  • Loading branch information
toroidal-code committed Jul 22, 2015
1 parent cc28344 commit 7ee6ce4
Showing 1 changed file with 1,614 additions and 1,557 deletions.
Loading

0 comments on commit 7ee6ce4

Please sign in to comment.