From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 4EC077EF10 for ; Mon, 23 Feb 2015 20:10:05 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of milanst@gmail.com) identity=pra; client-ip=209.85.213.182; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="milanst@gmail.com"; x-sender="milanst@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of milanst@gmail.com designates 209.85.213.182 as permitted sender) identity=mailfrom; client-ip=209.85.213.182; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="milanst@gmail.com"; x-sender="milanst@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ig0-f182.google.com) identity=helo; client-ip=209.85.213.182; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="milanst@gmail.com"; x-sender="postmaster@mail-ig0-f182.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DOAgCqeutUm7bVVdFBGoNYWgSDBLAyhAOLXYVwAoEeB0MBAQEBAQEQAQEBAQEGCwsJFC6EEAEBBBIRBBkBGxILAQMMBgULDQICCR0CAiEBAREBBQEKEgYTEhCHeAEDEQ03rhk+MYsugWuCd41MChknAwpUhFABAQEBAQEBAQIBAQEBAQEBARQBBQ6BE4lygkSBdzMHgmiBQwWEXQqFY4hmhB+BRoEbOItZA4JGgXQSI4EMCYIhH4FuIDEBgkIBAQE X-IPAS-Result: A0DOAgCqeutUm7bVVdFBGoNYWgSDBLAyhAOLXYVwAoEeB0MBAQEBAQEQAQEBAQEGCwsJFC6EEAEBBBIRBBkBGxILAQMMBgULDQICCR0CAiEBAREBBQEKEgYTEhCHeAEDEQ03rhk+MYsugWuCd41MChknAwpUhFABAQEBAQEBAQIBAQEBAQEBARQBBQ6BE4lygkSBdzMHgmiBQwWEXQqFY4hmhB+BRoEbOItZA4JGgXQSI4EMCYIhH4FuIDEBgkIBAQE X-IronPort-AV: E=Sophos;i="5.09,632,1418079600"; d="scan'208";a="123050346" Received: from mail-ig0-f182.google.com ([209.85.213.182]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 23 Feb 2015 20:09:36 +0100 Received: by mail-ig0-f182.google.com with SMTP id h15so20866155igd.3 for ; Mon, 23 Feb 2015 11:09:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=HCHF4BtIaLWizVvAFcnifrBd2n/gK2uvosxOjY4KSjU=; b=Ma08zaPonWikDPUVPkEiMNw5dR55IEnB7z5njQKCYeVqNuaMWJJlM/x4JZaQT8YcDn PtpaIJMvtTMrwPgrQkaD+MNJOfZAc8bDjoMZx2xbS0Orn2ROE7hmSXh6wy2gqettmHN3 jzgyUEmU5kRp3XRq/C2+vy4jVYtdYaM48AfenbgrQnVGH888yFZHMp+Kz1lfsB6Jn50x h1wGJToKFRoNE9ZGLMD/y+mz0FXUPYXHW2xGAYHAeDaMpz/V1VtE/cFFrKGof9giIJEg k92aMUkWP5dvZZTyHVpe60NfKW/0wDzlan5Tb9r/JvfBy9lMHzz8F/xZ5ToIwLuT7uBU 8IGQ== X-Received: by 10.107.131.224 with SMTP id n93mr16077149ioi.66.1424718575294; Mon, 23 Feb 2015 11:09:35 -0800 (PST) MIME-Version: 1.0 Received: by 10.65.15.105 with HTTP; Mon, 23 Feb 2015 11:08:54 -0800 (PST) In-Reply-To: <54E8E5C0.8070208@gmail.com> References: <54E8E5C0.8070208@gmail.com> From: =?UTF-8?Q?Milan_Stanojevi=C4=87?= Date: Mon, 23 Feb 2015 14:08:54 -0500 Message-ID: To: Benoit Vaugon Cc: Caml List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] scanf question Sorry for the delay, I just created the issue. http://caml.inria.fr/mantis/view.php?id=3D6791 Benoit, can you attach your patch there? On Sat, Feb 21, 2015 at 3:08 PM, Benoit Vaugon wr= ote: > Oups, I confirm it is a bug appearing when we have separated formatting_g= en > to formatting_lit in the implementation of formats to handle Format > constructions like "@{<%s>" and "@[" that collides with scanf > constructions like "%s@{" and "%s@[". I attach a patch (+ 6 lines) that f= ix > the problem, if somebody have time to integrate it... > > Sorry. > Beno=C3=AEt. > > > > Le 21/02/2015 10:55, Gabriel Scherer a =C3=A9crit : > > This seems to be a regression caused by the reimplementation of format > strings in 4.02; some "stop after this character" indications are support= ed, > but some other fail (when they correspond to valid Format specifications). > Would you mind opening a but report ( http://caml.inria.fr/mantis/ )? > > On Fri, Feb 20, 2015 at 8:28 PM, Milan Stanojevi=C4=87 wrote: >> >> I want to parse a bash like sequence string, for example >> "some-thing{1..20}", and extract the string before first { and then >> two numbers inside. >> >> I tried this first >> utop # Scanf.sscanf "some-thing{1..3}" "%s{%d..%d}" (fun s n1 n2 -> >> s,n1,n2);; >> Exception: End_of_file. >> >> Then I realized %s is special and needs scanning indication (character @= ). >> >> So I tried that but I get the same error >> utop # Scanf.sscanf "some-thing{1..3}" "%s@{%d..%d}" (fun s n1 n2 -> >> s,n1,n2);; >> Exception: End_of_file. >> >> But if I use some other character as end of string indication then it >> works. >> utop # Scanf.sscanf "some-thingI{1..3}" "%s@I{%d..%d}" (fun s n1 n2 -> >> s,n1,n2);; >> - : bytes * int * int =3D ("some-thing", 1, 3) >> >> It seems '{' is somehow special but I can't find anything in the docs >> about this. >> Can someone explain what is going on here? >> >> Thanks! >> >> >> p.s. At the end I solved my thing by using a range >> >> utop # Scanf.sscanf "some-thing{1..3}" "%[a-z-]{%d..%d}" (fun s n1 n2 >> -> s,n1,n2);; >> - : bytes * int * int =3D ("some-thing", 1, 3) >> >> -- >> Caml-list mailing list. Subscription management and archives: >> https://sympa.inria.fr/sympa/arc/caml-list >> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >> Bug reports: http://caml.inria.fr/bin/caml-bugs > > >