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 |
Sylvain Le Gall wrote:
> May I recommend you to write this in a more simple way:
>
> -------------------------------------------------------------------------
> rule lex =
> parse eof { () }
> | "(*" { start := pos lexbuf; lexNestComment lexbuf; lex lexbuf }
>
> and lexNestComment =
> parse eof { error (loc 2) "unterminated comment" }
> | "(*" { lexNestComment lexbuf }
> | "*)" { () }
> | _ { lexNestComment lexbuf }
> -------------------------------------------------------------------------
>
Mh, I think in lexNestComment it should at least say
| "(*" { lexNestComment lexbuf; lexNestComment lexbuf }
That might work. I am not sure how well the various lexer generators
handle arbitrary recursive invocations and reentrance, though. Have you
tried it? If it works, yes, that's certainly a nicer version.
- Andreas