[wg-camlp4] On domain-specific foreign syntaxes

Hongbo Zhang hongboz at seas.upenn.edu
Thu Jan 31 13:57:51 GMT 2013


On Thu, Jan 31, 2013 at 8:42 AM, Alain Frisch <alain.frisch at lexifi.com>wrote:

> On 01/31/2013 02:32 PM, Hongbo Zhang wrote:
>
>> Would you mind elaborating a bit why it will complex editor support?
>>
>
> The content of a quotation can use arbitrary grammar and even arbitrary
> lexical rules.
>
> If the editor cannot lex the content of the quotation, it cannot produce
> nice colors for lexical entities in it.  If emacs produce decent colors on
> some example with quotation, it is only because it does not know anything
> about quotation and the example is simple enough so that applying OCaml
> rules works quite well.  But if the content of the quotation follows other
> lexical rules, emacs gets confused. Write:
>
>   let x = foo << " >> bar
>
> This is unfair, how do you overcome this problem in ppx. The same thing,
except that you don't use it

> and emacs will color ">> bar" as if it were a string.  The only decent
> think an editor could do with a quotation is to understand where it stops
> and not try to do anything clever with it.  If we adapt the OCaml emacs
> mode to recognize camlp4's quotation and do that, you won't get any colors
> within quotations (correct behavior, but not if you write non-trivial
> multi-line OCaml expressions in it, as in your 'sedlex' version).
>
> Even if the lexical conventions are right, the editor cannot produce
> correct indentation if it doesn't know the grammar used inside the
> quotation.
>
>
> Alain
>
>


-- 
-- Regards, Hongbo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ocaml.org/pipermail/wg-camlp4/attachments/20130131/94a4aa89/attachment.html>


More information about the wg-camlp4 mailing list