lang: parser, funcs: Change the logical operators to OR, AND, NOT

This makes it easier to read for some, and easier to parse for us. This
also frees up more characters to use elsewhere.
This commit is contained in:
James Shubin
2023-10-09 16:41:03 -04:00
parent e8f11286dc
commit 05d570d250
12 changed files with 20 additions and 20 deletions

View File

@@ -14,7 +14,7 @@ $threshold = 1.5 # change me if you like
$h1 = $theload > $threshold
$h2 = $theload{1} > $threshold
$h3 = $theload{2} > $threshold
$unload = $h1 || $h2 || $h3
$unload = $h1 or $h2 or $h3
virt "mgmt1" {
uri => "qemu:///session",

View File

@@ -9,7 +9,7 @@ $mod0 = math.mod($now, 8) == 0
$mod1 = math.mod($now, 8) == 1
$mod2 = math.mod($now, 8) == 2
$mod3 = math.mod($now, 8) == 3
$mod = $mod0 || $mod1 || $mod2 || $mod3
$mod = $mod0 or $mod1 or $mod2 or $mod3
$fn = func($x) { # notable because concrete type is fn(t1) t2, where t1 != t2
len($x)

View File

@@ -9,13 +9,13 @@ $mod0 = math.mod($now, 8) == 0
$mod1 = math.mod($now, 8) == 1
$mod2 = math.mod($now, 8) == 2
$mod3 = math.mod($now, 8) == 3
$moda = $mod0 || $mod1 || $mod2 || $mod3
$moda = $mod0 or $mod1 or $mod2 or $mod3
$mod4 = math.mod($now, 8) == 4
$mod5 = math.mod($now, 8) == 5
$mod6 = math.mod($now, 8) == 6
$mod7 = math.mod($now, 8) == 7
$modb = $mod4 || $mod5 || $mod6 || $mod7
$modb = $mod4 or $mod5 or $mod6 or $mod7
$fn = if $moda {
func($x) { # notable because concrete type is fn(t1) t2, where t1 != t2

View File

@@ -9,7 +9,7 @@ $s1 = template("Hello! It is now: {{ datetime_print . }}\n", $now)
$s2 = if $is_friday {
"It's friday!!! (don't break anything, read-only)"
} else {
if $day == "saturday" || $day == "sunday" {
if $day == "saturday" or $day == "sunday" {
"It's the weekend!"
} else {
fmt.printf("Unfortunately, it is %s. Go to work!", $day)

View File

@@ -8,7 +8,7 @@ $mod0 = math.mod($now, 8) == 0
$mod1 = math.mod($now, 8) == 1
$mod2 = math.mod($now, 8) == 2
$mod3 = math.mod($now, 8) == 3
$mod = $mod0 || $mod1 || $mod2 || $mod3
$mod = $mod0 or $mod1 or $mod2 or $mod3
file "/tmp/mgmt/" {
state => $const.res.file.state.exists,

View File

@@ -8,7 +8,7 @@ $mod0 = math.mod($now, 8) == 0
$mod1 = math.mod($now, 8) == 1
$mod2 = math.mod($now, 8) == 2
$mod3 = math.mod($now, 8) == 3
$mod = $mod0 || $mod1 || $mod2 || $mod3
$mod = $mod0 or $mod1 or $mod2 or $mod3
file "/tmp/mgmt/" {
state => $const.res.file.state.exists,

View File

@@ -8,7 +8,7 @@ $mod0 = math.mod($now, 8) == 0
$mod1 = math.mod($now, 8) == 1
$mod2 = math.mod($now, 8) == 2
$mod3 = math.mod($now, 8) == 3
$mod = $mod0 || $mod1 || $mod2 || $mod3
$mod = $mod0 or $mod1 or $mod2 or $mod3
file "/tmp/mgmt/" {
state => $const.res.file.state.exists,

View File

@@ -4,7 +4,7 @@ $ns = "estate"
$exchanged = world.kvlookup($ns)
$state = maplookup($exchanged, $hostname, "default")
if $state == "one" || $state == "default" {
if $state == "one" or $state == "default" {
file "/tmp/mgmt/state" {
state => $const.res.file.state.exists,