OCaml Forge

Detail: [#1347] Wrong handling of core sexplib syntax when pasting

Bugs: Browse | Download .csv | Monitor

[#1347] Wrong handling of core sexplib syntax when pasting

Date:
2013-11-22 20:30
Priority:
3
State:
Open
Submitted by:
Igor Borski (sir_grey)
Assigned to:
Nobody (None)
Hardware:
PC
Resolution:
None
Severity:
minor
Version:
v1.1
Component:
None
Operating System:
Linux
Product:
None
 
URL:
Summary:
Wrong handling of core sexplib syntax when pasting

Detailed description
When I am pasting a fragment with a default type flag utop gets confused about new lines and syntax extension fails with ."several default expressions are given". Default toplevel is unaffected.

Code in question:
=====================================================
open Core.Std;;

type http_server_config = {
port: int with default(80);
web_root: string;
addr: string with default("localhost")
} with sexp ;;
======================================================

utop version 1.7 (using OCaml version 4.01.0)
on Debian GNU/Linux testing (jessie/sid)

Example:

─( 03:00:00 )─< command 0 >─────────────────────────────────{ counter: 0 }─
utop # type http_server_config = {
port: int with default(80);
web_root: string;
Error: Failure: "several default expressions are given"
─( 23:17:08 )─< command 1 >─────────────────────────────────{ counter: 0 }─
utop # addr: string with default("localhost")
Error: Parse error: [str_item] or ";;" expected (in [top_phrase])
─( 23:21:22 )─< command 2 >─────────────────────────────────{ counter: 0 }─
utop # } with sexp ;;
Error: Parse error: illegal begin of top_phrase
─( 23:21:22 )─< command 3 >─────────────────────────────────{ counter: 0 }─
utop #

===========================================================================

Meanwhile #use loads ok:

─( 23:21:22 )─< command 3 >─────────────────────────────────{ counter: 0 }─
utop # #use "a.ml";;
type http_server_config = { port : int; web_root : string; addr : string; }
val http_server_config_of_sexp : Sexp.t -> http_server_config = <fun> val sexp_of_http_server_config : http_server_config -> Sexp.t = <fun>
─( 23:21:27 )─< command 4 >─────────────────────────────────{ counter: 0 }─

===========================================================================

Default toplevel is fine:
...
/home/ig/.opam/4.01.0/lib/core_bench/core_bench.cma: loaded
# open Core.Std;;

type http_server_config = {
port: int with default(80);
web_root: string;
addr: string with default("localhost")
} with sexp ;;
# type http_server_config = { port : int; web_root : string; addr : string; }
val __http_server_config_of_sexp__ : Sexplib.Sexp.t -> http_server_config =
<fun>
val http_server_config_of_sexp : Sexplib.Sexp.t -> http_server_config = <fun>
val sexp_of_http_server_config : http_server_config -> Sexplib.Sexp.t = <fun>
#

Followup

Message
Date: 2013-11-23 08:53
Sender: Jérémie Dimino

Hi,

Can you open the bug on github? This tracker shouldn't be used anymore. And can you try with utop 1.8?

Attached Files:

Changes:

No Changes Have Been Made to This Item