[nem-en] change to MainParser

Kamil Dworakowski kamil.dworakowski at googlemail.com
Tue Nov 21 08:09:42 CET 2006


Kamil Skalski wrote:

> Maybe a better way would be to generate Main only if it is unambiguous
> which module it should be placed in. This way if you have more than
> one file with plain expressions you would need to explicitly create
> the Main () method.
I think that is a a good solution -- no new compiler parameter and no 
".nu" recognition in the compiler code. And there will be no requirement 
to have ".nu" extension on the file with tests. Will you implement that?

> The NUnit DLS looks quite pleasant :-)  I hope it could be publicized
> on the wiki or compiler's standard macros once you get it to stable
> form.
sure

-- Kamil Dworakowski

>
> On 11/20/06, Michal Moskal <michal.moskal at gmail.com> wrote:
>> On 11/20/06, Kamil Dworakowski <kamil.dworakowski at googlemail.com> wrote:
>> > Hi all,
>> >
>> > I have made a DSL for NUnit tests.
>>
>> Great!
>>
>> > To make it work, however, I have slightly modified the MainParser 
>> class.
>> >
>> > Currently, if MainParser doesn't encounter top level declaration 
>> (e.g.,
>> > class, module, etc.), but a sequence, it will create a module with a
>> > static Main method to put the sequence there. I would like to 
>> extend it,
>> > so that:
>> > -- parser creates a class with the same name as file
>> > -- the name of the method to put the sequence into would be determined
>> > by the extension of the file. If it is .n file it shall put it in 
>> static
>> > Main(), otherwise public static AutoMethod(): void.
>> >
>> > This should not brake anything.
>>
>> I would be rather for using this AutoMethod() thing in case some
>> special compiler parameter is passed or maybe if the name ends with
>> .nu. I mean it's likely people have nemerle sources ending with .nem
>> or something and I don't want the semantics to change. Also it would
>> be nice to quote the file name somehow (e.g. replace every non
>> alpha-numeric with _).
>>
>> -- 
>>    Michał
>>
>> _______________________________________________
>> https://nemerle.org/mailman/listinfo/devel-en
>>
>>




More information about the devel-en mailing list