github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/lang/expressions/symbols/exp.go (about)

     1  package symbols
     2  
     3  //go:generate stringer -type=Exp
     4  type Exp int
     5  
     6  const (
     7  	// The order of these constants is important.
     8  	// murex saves a few instructions when calculating the order of operations
     9  	// by checking the const ID against a range (rather than checking each
    10  	// operation matches)
    11  
    12  	/*
    13  		ERRORS
    14  	*/
    15  
    16  	Undefined  Exp = 0 // only used to catch edge case bugs where an operator might be allocated but not assigned a role
    17  	Unexpected Exp = iota + 1
    18  	InvalidHyphen
    19  	SubExpressionEnd
    20  	ObjectEnd
    21  	ArrayEnd
    22  
    23  	/*
    24  		DATA VALUES
    25  	*/
    26  	DataValues // not used. Just a title to name a range
    27  
    28  	Bareword
    29  	SubExpressionBegin
    30  	ObjectBegin
    31  	ArrayBegin
    32  	QuoteSingle
    33  	QuoteDouble
    34  	QuoteParenthesis
    35  	Number
    36  	Boolean
    37  	Null
    38  	Scalar
    39  	Calculated // data fields that are a result of a calculation
    40  
    41  	/*
    42  		OPERATIONS
    43  	*/
    44  	Operations // not used. Just a title to name a range
    45  
    46  	// 15. Comma operator
    47  	// 14. Assignment operators (right to left)
    48  	Assign
    49  	AssignUpdate
    50  	AssignAndAdd
    51  	AssignAndSubtract
    52  	AssignAndDivide
    53  	AssignAndMultiply
    54  	AssignAndMerge
    55  
    56  	// 13. Conditional expression (ternary)
    57  	Elvis
    58  	NullCoalescing
    59  
    60  	// 12. Logical OR
    61  	LogicalOr
    62  
    63  	// 11. Logical AND
    64  	LogicalAnd
    65  
    66  	// 10. Bitwise inclusive (normal) OR
    67  	// 09. Bitwise exclusive OR (XOR)
    68  	// 08. Bitwise AND
    69  	// 07. Comparisons: equal and not equal
    70  	EqualTo
    71  	NotEqualTo
    72  	Like
    73  	NotLike
    74  	Regexp
    75  	NotRegexp
    76  
    77  	// 06. Comparisons: less-than and greater-than
    78  	GreaterThan
    79  	GreaterThanOrEqual
    80  	LessThan
    81  	LessThanOrEqual
    82  
    83  	// 05. Bitwise shift left and right
    84  	// 04. Addition and subtraction
    85  	Add
    86  	Subtract
    87  	MergeInto
    88  
    89  	// 03. Multiplication, division, modulo
    90  	Multiply
    91  	Divide
    92  
    93  	// 02. (most) unary operators, sizeof and type casts (right to left)
    94  	// 01. Function call, scope, array/member access
    95  )