[netmod] rfc6991-bis: "token" type?

Kent Watsen <kent+ietf@watsen.net> Thu, 18 April 2019 04:51 UTC

Return-Path: <0100016a2ec8ed5f-14648cab-7615-4af4-9131-e85bf5826a03-000000@amazonses.watsen.net>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 0AE751202E5 for <netmod@ietfa.amsl.com>; Wed, 17 Apr 2019 21:51:24 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=amazonses.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qpChy6S_fjok for <netmod@ietfa.amsl.com>; Wed, 17 Apr 2019 21:51:22 -0700 (PDT)
Received: from a8-32.smtp-out.amazonses.com (a8-32.smtp-out.amazonses.com [54.240.8.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 6CC4A1202E3 for <netmod@ietf.org>; Wed, 17 Apr 2019 21:51:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw; d=amazonses.com; t=1555563081; h=From:Content-Type:Content-Transfer-Encoding:Mime-Version:Subject:Date:References:To:In-Reply-To:Message-Id:Feedback-ID; bh=RbRU7NSvU5Xlqtqrl2Z7RPoR+zcihMDHdFJx21m4+QM=; b=BQeUpQW4fPZeNLZ6QVsrXyyg3o3COqfAGpXq+ARw/8LDjwiBAp8H2XL9HiL9nLrf MmMVLfc7wieXsosfnaFQxMPPxDHUZMLCfLXtoAMzLrunr3rGM6r83ZABmKBoYibWohw eG5qz8sY9A1t3N+usc/izQd8nvm/c4pKuSgS43QE=
From: Kent Watsen <kent+ietf@watsen.net>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\))
Date: Thu, 18 Apr 2019 04:51:21 +0000
References: <155535446032.10827.9204466950651701790@ietfa.amsl.com>
To: "netmod@ietf.org" <netmod@ietf.org>
In-Reply-To: <155535446032.10827.9204466950651701790@ietfa.amsl.com>
Message-ID: <0100016a2ec8ed5f-14648cab-7615-4af4-9131-e85bf5826a03-000000@email.amazonses.com>
X-Mailer: Apple Mail (2.3445.102.3)
X-SES-Outgoing: 2019.04.18-54.240.8.32
Feedback-ID: 1.us-east-1.DKmIRZFhhsBhtmFMNikgwZUWVrODEw9qVcPhqJEI2DA=:AmazonSES
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/5yu9I1AICtsjnD0GoYKQd0NGqoI>
Subject: [netmod] rfc6991-bis: "token" type?
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 18 Apr 2019 04:51:24 -0000

Many times in models I want a non-empty version of what XSD calls a "token":

    token    A string that does not contain line feeds,
             carriage returns, tabs, leading or trailing
             spaces, or multiple spaces.

So how about the following?

  typedef token {
      type string;
      length "1.max";         // non-empty (some expr do this already)
      pattern "[^\n\r\t"]+"   // no LFs, CRs, or Tabs
      pattern "[^ ].*";       // no leading space     (min-length 1?)
      pattern ".*[^ ]";       // no trailing space    (min-length 1?)
      pattern ".*[^ ][^ ].*"  // no multiple spaces   (min-length 2?)
  }

Kent // contributor