Files
openfoam/src/finiteVolume/expressions/patch/patchExprLemonParser.h
Mark Olesen e6697edb52 ENH: robuster lemon parsing
- previously simply reused the scan token, which works fine for
  non-nested tokenizations but becomes too fragile with nesting.

  Now changed to use tagged unions that can be copied about
  and still retain some rudimentary knowledge of their types,
  which can be manually triggered with a destroy() call.

- provide an 'identifier' non-terminal as an additional catch
  to avoid potential leakage on parsing failure.

- adjust lemon rules and infrastructure:

  - use %token to predefine standard tokens.
    Will reduce some noise on the generated headers by retaining the
    order on the initial token names.

  - Define BIT_NOT, internal token rename NOT -> LNOT

- handle non-terminal vector values.
  Support vector::x, vector::y and vector::z constants

- permit fieldExpr access to time().
  Probably not usable or useful for an '#eval' expression,
  but useful for a Function1.

- provisioning for hooks into function calls. Establishes token
  names for next commit(s).
2021-11-26 12:24:35 +01:00

126 lines
5.7 KiB
C

#define TOK_LPAREN 1
#define TOK_RPAREN 2
#define TOK_COMMA 3
#define TOK_QUESTION 4
#define TOK_COLON 5
#define TOK_LOR 6
#define TOK_LAND 7
#define TOK_LNOT 8
#define TOK_BIT_OR 9
#define TOK_BIT_XOR 10
#define TOK_BIT_AND 11
#define TOK_BIT_NOT 12
#define TOK_EQUAL 13
#define TOK_NOT_EQUAL 14
#define TOK_LESS 15
#define TOK_LESS_EQ 16
#define TOK_GREATER 17
#define TOK_GREATER_EQ 18
#define TOK_PLUS 19
#define TOK_MINUS 20
#define TOK_TIMES 21
#define TOK_DIVIDE 22
#define TOK_PERCENT 23
#define TOK_NEGATE 24
#define TOK_DOT 25
#define TOK_BOOL 26
#define TOK_LTRUE 27
#define TOK_LFALSE 28
#define TOK_NUMBER 29
#define TOK_ZERO 30
#define TOK_IDENTIFIER 31
#define TOK_PI 32
#define TOK_DEG_TO_RAD 33
#define TOK_RAD_TO_DEG 34
#define TOK_ARG 35
#define TOK_TIME 36
#define TOK_DELTA_T 37
#define TOK_SCALAR_FUNCTION_ID 38
#define TOK_VECTOR_VALUE 39
#define TOK_VECTOR_FUNCTION_ID 40
#define TOK_SCALAR_ID 41
#define TOK_SSCALAR_ID 42
#define TOK_INTERNAL_FIELD 43
#define TOK_NEIGHBOUR_FIELD 44
#define TOK_SN_GRAD 45
#define TOK_MIN 46
#define TOK_MAX 47
#define TOK_SUM 48
#define TOK_AVERAGE 49
#define TOK_EXP 50
#define TOK_LOG 51
#define TOK_LOG10 52
#define TOK_SQR 53
#define TOK_SQRT 54
#define TOK_CBRT 55
#define TOK_SIN 56
#define TOK_COS 57
#define TOK_TAN 58
#define TOK_ASIN 59
#define TOK_ACOS 60
#define TOK_ATAN 61
#define TOK_SINH 62
#define TOK_COSH 63
#define TOK_TANH 64
#define TOK_POW 65
#define TOK_ATAN2 66
#define TOK_POS 67
#define TOK_NEG 68
#define TOK_POS0 69
#define TOK_NEG0 70
#define TOK_SIGN 71
#define TOK_FLOOR 72
#define TOK_CEIL 73
#define TOK_ROUND 74
#define TOK_HYPOT 75
#define TOK_RAND 76
#define TOK_VECTOR_ID 77
#define TOK_SVECTOR_ID 78
#define TOK_SPH_TENSOR_ID 79
#define TOK_SSPH_TENSOR_ID 80
#define TOK_SYM_TENSOR_ID 81
#define TOK_SSYM_TENSOR_ID 82
#define TOK_IDENTITY_TENSOR 83
#define TOK_TENSOR_ID 84
#define TOK_STENSOR_ID 85
#define TOK_SBOOL_ID 86
#define TOK_CELL_SET 87
#define TOK_CELL_ZONE 88
#define TOK_FACE_SET 89
#define TOK_FACE_ZONE 90
#define TOK_FACE_AREA 91
#define TOK_FACE_EXPR 92
#define TOK_WEIGHT_AVERAGE 93
#define TOK_WEIGHT_SUM 94
#define TOK_POINT_EXPR 95
#define TOK_PSCALAR_ID 96
#define TOK_PVECTOR_ID 97
#define TOK_PSPH_TENSOR_ID 98
#define TOK_PSYM_TENSOR_ID 99
#define TOK_PTENSOR_ID 100
#define TOK_PBOOL_ID 101
#define TOK_POINTS 102
#define TOK_MAG 103
#define TOK_MAGSQR 104
#define TOK_VECTOR 105
#define TOK_TENSOR 106
#define TOK_SYM_TENSOR 107
#define TOK_SPH_TENSOR 108
#define TOK_CMPT_X 109
#define TOK_CMPT_Y 110
#define TOK_CMPT_Z 111
#define TOK_CMPT_XX 112
#define TOK_CMPT_XY 113
#define TOK_CMPT_XZ 114
#define TOK_CMPT_YX 115
#define TOK_CMPT_YY 116
#define TOK_CMPT_YZ 117
#define TOK_CMPT_ZX 118
#define TOK_CMPT_ZY 119
#define TOK_CMPT_ZZ 120
#define TOK_CMPT_II 121
#define TOK_TRANSPOSE 122
#define TOK_DIAG 123
#define TOK_POINT_TO_FACE 124
#define TOK_FACE_TO_POINT 125