<vincenz>
Smerdyakov: you going to participate in the ICFP contest?
<stepcut>
So... Is there a standard tool to generate .pot files from ocaml source ?
<stepcut>
(I believe the answer is no...)
<vincenz>
.pot?
<stepcut>
a .pot file contains a list of all the strings marked for translation in the .ml file
<stepcut>
so you might write -> print_endline (gettext "Hello, World!");;
<stepcut>
An the analyzer would see the "Hello, World!" and put it into the .pot file so people can translate it into different languages
<stepcut>
I can do 'fun str = Grammar.Entry.parse implem (Stream.of_string str)' to turn a .ml into a nice AST, but it is then rather tedious to write a function that drills down into resulting tree looking for instances of (ExApp ... (ExLid "gettext" ...)) because there are atleast 50 constructors that can contain expressions...
<stepcut>
In haskell I can use generics... but I am not sure how best to do this in ocaml...
<stepcut>
maybe I need to parse the mLast.mli file, and then walk over that tree to generate a function that does what I want...
* stepcut
scratches his head
<stepcut>
or maybe I should just make a new parser that just parses the stuff I need
<stepcut>
I can reuse the existing lexer which correctly parses strings and identifiers according to ocaml rules...
<stepcut>
open Generics;;
<Smerdyakov>
Can't you just use regular expression matching?
<vincenz>
stepcut: use dynamic linking
<vincenz>
stepcut: and make the dynamically linked module register the strings
<Smerdyakov>
vincenz, you've just reduced the problem to the same one of finding out which strings there are, so that the dynamic module can register them.
<vincenz>
yes but remove the need for a lexer
<vincenz>
and I misread the problem :D I thought the problem was the loading
<Smerdyakov>
I don't think that removes the need for a lexer.
<vincenz>
nope
<vincenz>
I thought the lexer issue was for the loading of the preference file
<Smerdyakov>
Oh, vincenz.
<stepcut>
Smerdyakov: I was hopefully for an easier alternative to regular expression matching, but there may not be one
<Smerdyakov>
stepcut, what could be easier than regular expression matching?
<Smerdyakov>
Find: gettext \"([^\"]|
<Smerdyakov>
Find: gettext \"([^\"]|\\\")*\"
<stepcut>
Smerdyakov: the string could be on the next line
<stepcut>
and I need to know the line number the string is found on