From e665d9725c4bb02f4c18d16527367f424cb880fa Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 20 Mar 2019 15:55:57 -0700 Subject: Auto-updated to 7.0.0 syntax and removed some shims. --- lib/core/id.nom | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'lib/core/id.nom') diff --git a/lib/core/id.nom b/lib/core/id.nom index 936fd40..7324eea 100644 --- a/lib/core/id.nom +++ b/lib/core/id.nom @@ -1,5 +1,6 @@ -#!/usr/bin/env nomsu -V6.15.13.8 -# +#!/usr/bin/env nomsu -V7.0.0 + +### A simple UUID function based on RFC 4122: http://www.ietf.org/rfc/rfc4122.txt use "core/metaprogramming" @@ -35,27 +36,29 @@ set $id_by_obj's metatable to { external: (uuid) means: - # Set all the other bits to randomly (or pseudo-randomly) chosen values. + ### Set all the other bits to randomly (or pseudo-randomly) chosen values. $bytes = [ - # time-low, time-mid, time-high-and-version + ### time-low, time-mid, time-high-and-version randint (2 ^ (4 * 8)), randint (2 ^ (2 * 8)), randint (2 ^ (2 * 8 - 4)) - # clock-seq-and-reserved, clock-seq-low + + ### clock-seq-and-reserved, clock-seq-low randint (2 ^ (1 * 8 - 2)), randint (2 ^ (1 * 8)), randint (2 ^ (3 * 8)) - # node + + ### node randint (2 ^ (3 * 8)) ] - # Set the four most significant bits (bits 12 through 15) of the - # time_hi_and_version field to the 4-bit version number from - # Section 4.1.3. + ### Set the four most significant bits (bits 12 through 15) of the + ### time_hi_and_version field to the 4-bit version number from + ### Section 4.1.3. $bytes.3 += 0x4000 - # Set the two most significant bits (bits 6 and 7) of the - # clock_seq_hi_and_reserved to zero and one, respectively. + ### Set the two most significant bits (bits 6 and 7) of the + ### clock_seq_hi_and_reserved to zero and one, respectively. $bytes.4 += 0xC0 return (=lua "('%08x-%04x-%04x-%02x%02x-%6x%6x'):format(unpack(\$bytes))") - # For strict identity checking, use ($x's id) == ($y's id) + ### For strict identity checking, use ($x's id) == ($y's id) test: assume (([] == []) and ((id of []) != (id of []))) seed random with 0 @@ -64,4 +67,4 @@ external: seed random with 0 assume ((id of $x) != (id of [])) seed random - [id of $, $'s id, $'id] all mean $id_by_obj.$ + [id of $, $'s id, $'id] all mean $id_by_obj.$ \ No newline at end of file -- cgit v1.2.3