From: Andrej Bauer <andrej.bauer@andrej.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] ocamllex and python-style indentation
Date: Fri, 12 Jun 2009 10:20:13 +0200 [thread overview]
Message-ID: <7d8707de0906120120x10cc8fe0p54adbd189003f3da@mail.gmail.com> (raw)
In-Reply-To: <4A310A5B.9010404@ens-lyon.org>
Thanks to Andreas, I'll have a look at the "old" code.
I think I understand the general idea of inserting "virtual" tokens,
but the details confuse me still. So starting with
> if True:
> x = 3
> y = (2 +
> 4 + 5)
> else:
> x = 5
> if False:
> x = 8
> z = 2
Martin suggests the following:
> {
> if True:
> ;
> {
> x = 3
> ;
> y = (2 +
> ;
> {
> 4 + 5)
> }
> }
> ;
> else:
> ;
> {
> x = 5
> ;
> if False:
> ;
> {
> x = 8
> ;
> z = 2
> }
> }
> }
I have two questions. Notice that the { ... } and ( ... ) need not be
correctly nested (in the top half), so how are we going to deal with
this? The second question is, why are there the separators after and
just before "else:". I would expect separators inside { .... }, but
not around "else".
Presumably the intermediate stage that I would preprocess the token
stream would have to know about indentation levels. I have not tried
this, but ocaml lexer will correctly match things like
| '\n' [' ' '\t']* -> { INDENTATION (compute_indentation (lexeme buf)) }
Yes?
With kind regards,
Andrej
next prev parent reply other threads:[~2009-06-12 8:20 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-11 12:57 Andrej Bauer
2009-06-11 13:12 ` [Caml-list] " yoann padioleau
2009-06-11 13:21 ` Andreas Rossberg
2009-06-11 13:44 ` Martin Jambon
2009-06-12 8:20 ` Andrej Bauer [this message]
2009-06-12 12:56 ` Martin Jambon
2009-06-12 13:34 ` Martin Jambon
2009-06-12 15:43 ` Andreas Rossberg
2009-06-30 18:58 ` Yitzhak Mandelbaum
2009-06-30 20:19 ` Mike Lin
2009-06-30 22:06 ` Andreas Rossberg
2009-07-01 2:13 ` Mike Lin
2009-07-01 7:31 ` Andreas Rossberg
2009-07-01 14:02 ` Mike Lin
2009-07-01 14:17 ` Andreas Rossberg
2009-07-01 14:21 ` Andreas Rossberg
2009-07-01 14:37 ` Mike Lin
2009-07-01 15:03 ` Sylvain Le Gall
2009-07-01 15:16 ` [Caml-list] " Andreas Rossberg
2009-07-01 16:26 ` Sylvain Le Gall
2009-07-01 15:19 ` [Caml-list] " Martin Jambon
2009-07-01 15:43 ` Andreas Rossberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7d8707de0906120120x10cc8fe0p54adbd189003f3da@mail.gmail.com \
--to=andrej.bauer@andrej.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox