Browse thread
ocamllex and python-style indentation
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Andreas Rossberg <rossberg@m...> |
| Subject: | Re: [Caml-list] Re: ocamllex and python-style indentation |
Martin Jambon wrote:
> You can even get rid of global variables completely:
>
>
> rule lex x = parse
> eof { () }
> | "(*" { x.start <- pos lexbuf; lexNestComment x lexbuf; lex x lexbuf }
>
> and lexNestComment x = parse
> eof { error (loc x 2) "unterminated comment" }
> | "(*" { lexNestComment x lexbuf }
> | "*)" { () }
> | _ { lexNestComment x lexbuf }
>
Nicer indeed. To my defense I have to say that I wrote the code long
before rule arguments were introduced into ocamllex - I said it was
really old... :-)
- Andreas