KCL: Comparison operators (#4025)
Add `==, !=, >, >=, <, <=` to the language parser, executor and tests. Closes https://github.com/KittyCAD/modeling-app/issues/4020 Currently these comparison operators are associative, allowing users to chain them, e.g. (x <= y <= z). This should not be allowed, will do in a follow-up. See https://github.com/KittyCAD/modeling-app/issues/4155
This commit is contained in:
@ -83520,6 +83520,48 @@
|
||||
"enum": [
|
||||
"^"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Are two numbers equal?",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"=="
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Are two numbers not equal?",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"!="
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left greater than right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
">"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left greater than or equal to right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
">="
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left less than right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"<"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left less than or equal to right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"<="
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -87076,6 +87118,48 @@
|
||||
"enum": [
|
||||
"^"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Are two numbers equal?",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"=="
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Are two numbers not equal?",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"!="
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left greater than right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
">"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left greater than or equal to right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
">="
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left less than right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"<"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left less than or equal to right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"<="
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -90636,6 +90720,48 @@
|
||||
"enum": [
|
||||
"^"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Are two numbers equal?",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"=="
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Are two numbers not equal?",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"!="
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left greater than right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
">"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left greater than or equal to right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
">="
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left less than right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"<"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left less than or equal to right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"<="
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -115048,6 +115174,48 @@
|
||||
"enum": [
|
||||
"^"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Are two numbers equal?",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"=="
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Are two numbers not equal?",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"!="
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left greater than right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
">"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left greater than or equal to right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
">="
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left less than right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"<"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left less than or equal to right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"<="
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -118997,6 +119165,48 @@
|
||||
"enum": [
|
||||
"^"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Are two numbers equal?",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"=="
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Are two numbers not equal?",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"!="
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left greater than right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
">"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left greater than or equal to right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
">="
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left less than right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"<"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left less than or equal to right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"<="
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -122553,6 +122763,48 @@
|
||||
"enum": [
|
||||
"^"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Are two numbers equal?",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"=="
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Are two numbers not equal?",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"!="
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left greater than right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
">"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left greater than or equal to right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
">="
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left less than right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"<"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left less than or equal to right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"<="
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -126107,6 +126359,48 @@
|
||||
"enum": [
|
||||
"^"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Are two numbers equal?",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"=="
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Are two numbers not equal?",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"!="
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left greater than right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
">"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left greater than or equal to right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
">="
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left less than right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"<"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Is left less than or equal to right",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"<="
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@ -82,6 +82,78 @@ Raise a number to a power.
|
||||
|
||||
|
||||
|
||||
----
|
||||
Are two numbers equal?
|
||||
|
||||
**enum:** `==`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
Are two numbers not equal?
|
||||
|
||||
**enum:** `!=`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
Is left greater than right
|
||||
|
||||
**enum:** `>`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
Is left greater than or equal to right
|
||||
|
||||
**enum:** `>=`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
Is left less than right
|
||||
|
||||
**enum:** `<`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
Is left less than or equal to right
|
||||
|
||||
**enum:** `<=`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
----
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user