diff options
Diffstat (limited to 'lib/compatibility')
| -rw-r--r-- | lib/compatibility/2.4.nom | 9 | ||||
| -rw-r--r-- | lib/compatibility/2.nom | 5 | ||||
| -rw-r--r-- | lib/compatibility/4.10.12.7.nom | 12 | ||||
| -rw-r--r-- | lib/compatibility/4.8.10.nom | 10 | ||||
| -rw-r--r-- | lib/compatibility/4.9.nom | 5 | ||||
| -rw-r--r-- | lib/compatibility/compatibility.nom | 6 |
6 files changed, 24 insertions, 23 deletions
diff --git a/lib/compatibility/2.4.nom b/lib/compatibility/2.4.nom index 953307b..1296777 100644 --- a/lib/compatibility/2.4.nom +++ b/lib/compatibility/2.4.nom @@ -10,7 +10,8 @@ upgrade $tree to "2.4" as: unless ($tree is "Action" syntax tree): return if $tree.stub is: "when" "if": - if ((size of $tree) == 3): return $tree + if ((#$tree) == 3): + return $tree $conditions = [] $new_lines = [] $body = @@ -22,7 +23,7 @@ upgrade $tree to "2.4" as: $new_lines, add $line ($line.stub == "*"): - if ((size of $line) == 2): + if ((#$line) == 2): $conditions, add $line.2 ..else: $new_lines, add $line @@ -60,7 +61,7 @@ upgrade $tree to "2.4" as: $new_lines, add $line ($line.stub == "*"): - if ((size of $line) == 2): + if ((#$line) == 2): $values, add $line.2 ..else: $new_lines, add $line @@ -82,4 +83,4 @@ upgrade $tree to "2.4" as: .var = ($tree.2 upgraded) .body = =lua "SyntaxTree{type='Block', source=\$tree[5].source, unpack(\$new_lines)}" - } + }
\ No newline at end of file diff --git a/lib/compatibility/2.nom b/lib/compatibility/2.nom index da11245..782ccb0 100644 --- a/lib/compatibility/2.nom +++ b/lib/compatibility/2.nom @@ -33,6 +33,5 @@ upgrade $tree to "2" as: $bits = [: for $ in $tree: add (($ upgraded) if ($ is syntax tree) else $)] unless (($bits, last) is "Block" syntax tree): $body = ($bits, last) - $bits.(size of $bits) = - =lua "SyntaxTree{type='Block', source=\$body.source, \$body}" - return (=lua "SyntaxTree{type='Action', source=\$tree.source, unpack(\$bits)}") + $bits.(#$bits) = (=lua "SyntaxTree{type='Block', source=\$body.source, \$body}") + return (=lua "SyntaxTree{type='Action', source=\$tree.source, unpack(\$bits)}")
\ No newline at end of file diff --git a/lib/compatibility/4.10.12.7.nom b/lib/compatibility/4.10.12.7.nom index be53cb6..f134476 100644 --- a/lib/compatibility/4.10.12.7.nom +++ b/lib/compatibility/4.10.12.7.nom @@ -40,7 +40,7 @@ upgrade action ($k = $v for $i in $start to $stop via $step) to "4.10.12.7" as {: for $i in $start to $stop by $step: add $k = $v} upgrade action (parse $text from $filename) to "4.10.12.7" as - (NomsuCode from (Source $filename 1 (size of $text)) $text) parsed + (NomsuCode from (Source $filename 1 (#$text)) $text) parsed upgrade action ($ as lua statements) to "4.10.12.7" as ($ as lua) upgrade action (compile error at $pos $err hint $hint) to "4.10.12.7" as @@ -54,7 +54,7 @@ upgrade $tree to "4.10.12.7" as: $first_chunk = $tree.1 $i = 1 $has_use = (no) - repeat while ($i <= (size of $first_chunk)): + repeat while ($i <= (#$first_chunk)): if (($first_chunk.$i.type == "Action") and ($first_chunk.$i.stub == "use")): $has_use = (yes) ..else: @@ -69,12 +69,10 @@ upgrade $tree to "4.10.12.7" as: for $j in 1 to ($i - 1): $chunk1.$j = $first_chunk.$j - for $j in $i to (size of $first_chunk): + for $j in $i to (#$first_chunk): $chunk2.($j - $i + 1) = $first_chunk.$j $new_tree = ("FileChunks" tree from $tree.source with $chunk1 $chunk2) - - for $i in 2 to (size of $tree): + for $i in 2 to (#$tree): $new_tree.($i + 1) = $tree.$i - - return $new_tree + return $new_tree
\ No newline at end of file diff --git a/lib/compatibility/4.8.10.nom b/lib/compatibility/4.8.10.nom index 15a502b..71d69d0 100644 --- a/lib/compatibility/4.8.10.nom +++ b/lib/compatibility/4.8.10.nom @@ -11,7 +11,7 @@ upgrade action "local action" to "4.8.10" via $body = $tree.4 if $spec.type is: "List": - if ((size of $spec) == 1): + if ((#$spec) == 1): return \($spec.1 means $body) ..else: return \($spec all mean $body) @@ -26,7 +26,7 @@ upgrade action "action" to "4.8.10" via if $body: if $spec.type is: "List": - if ((size of $spec) == 1): + if ((#$spec) == 1): return \(externally $spec.1 means $body) ..else: return \(externally $spec all mean $body) @@ -42,7 +42,7 @@ upgrade action "compile 1 to" to "4.8.10" via $body = $tree.4 if $spec.type is: "List": - if ((size of $spec) == 1): + if ((#$spec) == 1): return \($spec.1 compiles to $body) ..else: return \($spec all compile to $body) @@ -56,7 +56,7 @@ upgrade action "parse 1 as" to "4.8.10" via $body = $tree.4 if $spec.type is: "List": - if ((size of $spec) == 1): + if ((#$spec) == 1): return \($spec.1 parses as $body) ..else: return \($spec all parse as $body) @@ -65,4 +65,4 @@ upgrade action "parse 1 as" to "4.8.10" via return \($spec parse as $body) upgrade action (compile as $) to "4.8.10" as (what $ compiles to) -upgrade action (remove action $) to "4.8.10" as (($'s meaning) = (nil)) +upgrade action (remove action $) to "4.8.10" as (($'s meaning) = (nil))
\ No newline at end of file diff --git a/lib/compatibility/4.9.nom b/lib/compatibility/4.9.nom index d8260a4..67d40c5 100644 --- a/lib/compatibility/4.9.nom +++ b/lib/compatibility/4.9.nom @@ -7,5 +7,6 @@ use "compatibility/compatibility" upgrade action "if" to "4.9" via for ($tree $end_version): - if ((size of $tree) > 2): return $tree - return \(when $tree.2) + if ((#$tree) > 2): + return $tree + return \(when $tree.2)
\ No newline at end of file diff --git a/lib/compatibility/compatibility.nom b/lib/compatibility/compatibility.nom index dc21f0b..123f4d9 100644 --- a/lib/compatibility/compatibility.nom +++ b/lib/compatibility/compatibility.nom @@ -25,7 +25,7 @@ external: $lua = (Lua "") for $action in $actions: $replacements = {} - for $i in 1 to (size of $action): + for $i in 1 to (#$action): if ($action.$i is "Var" syntax tree): $replacements.($action.$i.1) = "\(\$tree as lua id)[\$i]" define mangler @@ -74,6 +74,7 @@ external: if ($ver is "Text"): return (($ as number) for $ in $ver matching "[0-9]+") return $ver + (Ver $) means: if ($ is "a List"): if ($.1 is "Text"): @@ -83,6 +84,7 @@ external: if $lib: 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 @@ -137,4 +139,4 @@ external: $tree upgraded from ($tree.version or $(NOMSU VERSION)) to $end_version ($tree upgraded) means - $tree upgraded from ($tree.version or $(NOMSU VERSION)) to $(NOMSU VERSION) + $tree upgraded from ($tree.version or $(NOMSU VERSION)) to $(NOMSU VERSION)
\ No newline at end of file |
