[mercury-users] foreign code escaping

Ondrej Bojar obo at cuni.cz
Wed Jan 10 11:41:05 AEDT 2007


Michael Day wrote:
>> One thing that I think would be a major improvement over vim's Mercury
>> syntax file would be highlighting foreign_{proc, code} with the syntax
>> highlighting of the target language, rather than just as a string.
> 
> 
> That could get tricky, given that it *is* just a string, so nested 
> strings in foreign code need to be doubly escaped:
> 
>     printf(""Hello, world!\\n"");
> 
> or
> 
>     printf(\"Hello, world!\\n\");
> 
> Some kind of lexical hack to allow arbitrary text inside foreign code 
> would be nice :)

E.g. the bash/perl-style?

:- pragma foreign_proc("C",
c_code(In::in) = (Out::out),
   [promise_pure, will_not_call_mercury, thread_safe],
   << END_OF_CODE
printf("Hello, world!\n");
END_OF_CODE

O.

> 
> Michael
> 

-- 
Ondrej Bojar (mailto:obo at cuni.cz)
http://www.cuni.cz/~obo
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list