Skip to content
← Back

src/syntax/process/relational_rewrite.ghul

1
namespace Syntax.Process is
2
// Whether a binary expression that resolved to a `<>` member got
3
// there by the parser's relational rewrite rather than by being
4
// written as `<>`.
5
//
6
// `<`, `<=`, `>` and `>=` all parse into a call to `<>` (see
7
// `_real_operation` in the expression parser), so the operation
8
// name alone cannot tell the two apart. The distinction decides
9
// what the expression produces: a rewritten token wants the bool
10
// its surface syntax promised, reduced from the ordering value,
11
// while a literal `<>` yields that ordering value itself.
12
class RELATIONAL_REWRITE is
13
is_relational_rewrite(operation_name: string?, actual_operation: string?) -> bool static is
14
if !operation_name? \/ !(operation_name =~ "<>") then
15
return false
16
fi
17
18
return
19
actual_operation =~ "<" \/ actual_operation =~ "<=" \/
20
actual_operation =~ ">" \/ actual_operation =~ ">="
21
si
22
si
23
si