From 9e9bcad6fab72fe66a52c174d27fce63dcae106c Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 6 Feb 2019 14:31:14 -0800 Subject: Added underscores for numbers (e.g. 1_000, 0xDEAD_BEEF), and fixed some compatibility and decompiling issues. --- lib/compatibility/compatibility.nom | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'lib/compatibility') diff --git a/lib/compatibility/compatibility.nom b/lib/compatibility/compatibility.nom index b72997e..a7ca0c1 100644 --- a/lib/compatibility/compatibility.nom +++ b/lib/compatibility/compatibility.nom @@ -17,7 +17,7 @@ external: $ACTION_UPGRADES.$version.$stub = $upgrade_fn (upgrade $tree to $version as $body) parses as - upgrade to $version via (($ $end_version) -> ($ with $tree -> $body)) + upgrade to $version via (($ $end_version) -> ($, with ($tree -> $body))) (upgrade action $actions to $version as $body) compiles to: if ($actions is "Action" syntax tree): @@ -70,12 +70,12 @@ external: $tree upgraded to $end_version from $start_version ] all mean: unless ($tree is syntax tree): return $tree - ($ver as list) means (($ as number) for $ in $ver matching "[0-9]+") + ($ver as version list) means (($ as number) for $ in $ver matching "[0-9]+") (Ver $) means: [$lib, $ver] = ($, match "(.*)/([0-9.]+)") if $lib: - return {.lib = $lib, .version = ($ver as list)} - return {.version = ($ as list)} + return {.lib = $lib, .version = ($ver as version list)} + return {.version = ($ as version list)} $start = (Ver $start_version) $end = (Ver $end_version) $end.lib or= $start.lib @@ -89,20 +89,21 @@ external: $versions.$v = (yes) $versions = [: for $v = $ in $versions: if ((Ver $v).lib == $start.lib): add $v] - sort $versions by $ -> ($ as list) + sort $versions by $ -> ($ as version list) for $ver in $versions: - if (($ver as list) <= $start.version): do next $ver - if (($ver as list) > $end.version): stop $ver + if (($ver as version list) <= $start.version): do next $ver + if (($ver as version list) > $end.version): stop $ver if $ACTION_UPGRADES.$ver: $tree = - $tree with $ ->: - if (($ is "Action" syntax tree) and $ACTION_UPGRADES.$ver.($.stub)): - $with_upgraded_args = { - : for $k = $v in $: - add $k = ($v upgraded from $start_version to $end_version) - } - set $with_upgraded_args's metatable to ($'s metatable) - return ($ACTION_UPGRADES.$ver.($.stub) $with_upgraded_args $end_version) + $tree, with + $ ->: + if (($ is "Action" syntax tree) and $ACTION_UPGRADES.$ver.($.stub)): + $with_upgraded_args = { + : for $k = $v in $: + add $k = ($v upgraded from $start_version to $end_version) + } + set $with_upgraded_args's metatable to ($'s metatable) + return ($ACTION_UPGRADES.$ver.($.stub) $with_upgraded_args $end_version) if $UPGRADES.$ver: $with_upgraded_args = { -- cgit v1.2.3