aboutsummaryrefslogtreecommitdiff
path: root/lib/compatibility/7.nom
blob: c84be0c086e3abde94b60bcbb64caf4400f71333 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env nomsu -V7.0.0

###
    This file defines upgrades from Nomsu <7 to 7
    
use "compatibility/compatibility"

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

upgrade action ($tree with $t -> $replacement) to "7" as
    $tree, with ($t -> $replacement)

upgrade action [
    tree $tree with vars $replacements, $tree with vars $replacements
] to "7" as ($tree, with $replacements)

upgrade action ($tree has subtree $match_tree) to "7" as
    $tree, contains $match_tree

upgrade action (for $var in $iterable at $i $body) to "7" as
    for ($i = $var) in $iterable $body

upgrade action (for $k = $v in $iterable $body) to "7" as
    for ($k = $v) in $iterable $body

upgrade action [
    for $var in $start to $stop by $step $body
    for $var in $start to $stop via $step $body
] to "7" as (for $var in ($start to $stop by $step) $body)

upgrade action (for $var in $start to $stop $body) to "7" as
    for $var in ($start to $stop) $body

upgrade $tree to "7" as:
    if ($tree.type == "EscapedNomsu"):
        $t =
            "Action" tree from $tree.source with ("Text" tree with $tree.1.type) "tree"
                "with"
        
        for $tok in $tree.1:
            if ($tok is "Text"):
                $t, add ("Text" tree with $tok)
            ..else:
                $t, add $tok
        
        return $t

upgrade action "Nomsu version" to "7" via ->(`$(NOMSU VERSION))
upgrade action [
    "Nomsu syntax version", "Nomsu compiler version", "core version", "lib version"
] to "7" via
    for $:
        at $.source fail ("
            Deprecation error: Actions for accessing specific parts of the version number have been deprecated.
            Hint: Use $(NOMSU VERSION).1, etc. instead.
        ")