1+ /**
2+ * Provides classes representing comparison operators.
3+ */
4+
15import python
26
37/** A class representing the six comparison operators, ==, !=, <, <=, > and >=. */
@@ -34,6 +38,7 @@ class CompareOp extends int {
3438 this = ge ( ) and result = le ( )
3539 }
3640
41+ /** Gets the textual representation of `this`. */
3742 string repr ( ) {
3843 this = eq ( ) and result = "=="
3944 or
@@ -48,6 +53,7 @@ class CompareOp extends int {
4853 this = ge ( ) and result = ">="
4954 }
5055
56+ /** Holds if `op` is the `Cmpop` corresponding to `this`. */
5157 predicate forOp ( Cmpop op ) {
5258 op instanceof Eq and this = eq ( )
5359 or
@@ -70,16 +76,22 @@ class CompareOp extends int {
7076 }
7177}
7278
79+ /** The `CompareOp` for "equals". */
7380CompareOp eq ( ) { result = 1 }
7481
82+ /** The `CompareOp` for "not equals". */
7583CompareOp ne ( ) { result = 2 }
7684
85+ /** The `CompareOp` for "less than". */
7786CompareOp lt ( ) { result = 3 }
7887
88+ /** The `CompareOp` for "less than or equal to". */
7989CompareOp le ( ) { result = 4 }
8090
91+ /** The `CompareOp` for "greater than". */
8192CompareOp gt ( ) { result = 5 }
8293
94+ /** The `CompareOp` for "greater than or equal to". */
8395CompareOp ge ( ) { result = 6 }
8496
8597/* Workaround precision limits in floating point numbers */
0 commit comments