py-alpha-lib 0.2.3__tar.gz → 0.2.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/CHANGELOG.md +18 -0
  2. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/Cargo.lock +1 -1
  3. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/Cargo.toml +2 -1
  4. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/PKG-INFO +5 -1
  5. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/README.md +4 -0
  6. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/python/alpha/algo/algo_gen.py +93 -0
  7. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/python/alpha/algo.md +4 -0
  8. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/python/alpha/lang/alpha.lark +4 -1
  9. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/python/alpha/lang/parser.py +2 -2
  10. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/python/alpha/lang/to_python.py +17 -7
  11. py_alpha_lib-0.2.5/src/algo/alpha.rs +225 -0
  12. py_alpha_lib-0.2.5/src/algo/beta.rs +261 -0
  13. py_alpha_lib-0.2.5/src/algo/drawdown.rs +225 -0
  14. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/mod.rs +8 -0
  15. py_alpha_lib-0.2.5/src/algo/sharpe.rs +245 -0
  16. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/.agent/skills/add_algo/SKILL.md +0 -0
  17. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/.github/workflows/CI.yml +0 -0
  18. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/.gitignore +0 -0
  19. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/.nwa-config.yaml +0 -0
  20. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/LICENSE +0 -0
  21. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/articles/001.md +0 -0
  22. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/articles/COMPARISON.md +0 -0
  23. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/benchmarks/benchmark_alpha101.py +0 -0
  24. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/benchmarks/benchmark_pandas.py +0 -0
  25. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/benchmarks/benchmark_polars_ta.py +0 -0
  26. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/build.rs +0 -0
  27. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/examples/gtja191/al/__init__.py +0 -0
  28. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/examples/gtja191/al/alpha191.py +0 -0
  29. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/examples/gtja191/al/alpha191_context.py +0 -0
  30. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/examples/gtja191/alpha191.txt +0 -0
  31. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/examples/gtja191/main.py +0 -0
  32. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/examples/wq101/al/__init__.py +0 -0
  33. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/examples/wq101/al/alpha101.py +0 -0
  34. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/examples/wq101/al/alpha101_context.py +0 -0
  35. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/examples/wq101/alpha101.txt +0 -0
  36. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/examples/wq101/main.py +0 -0
  37. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/examples/wq101/pd_/__init__.py +0 -0
  38. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/examples/wq101/pd_/alpha101_adjusted.py +0 -0
  39. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/examples/wq101/pl_/__init__.py +0 -0
  40. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/examples/wq101/pl_/alpha101_adjusted.py +0 -0
  41. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/examples/wq101/result.md +0 -0
  42. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/pyproject.toml +0 -0
  43. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/python/alpha/__init__.py +0 -0
  44. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/python/alpha/algo/__init__.py +0 -0
  45. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/python/alpha/algo/algo.py +0 -0
  46. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/python/alpha/context.py +0 -0
  47. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/python/alpha/lang/__init__.py +0 -0
  48. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/python/alpha/lang/__main__.py +0 -0
  49. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/python/conftest.py +0 -0
  50. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/python/tests/test_grammar.py +0 -0
  51. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/python/tests/test_rank.py +0 -0
  52. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/python/tests/test_talib.py +0 -0
  53. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/python/tests/test_to_python.py +0 -0
  54. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/rustfmt.toml +0 -0
  55. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/backfill.rs +0 -0
  56. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/context.rs +0 -0
  57. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/cross.rs +0 -0
  58. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/ema.rs +0 -0
  59. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/entropy.rs +0 -0
  60. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/error.rs +0 -0
  61. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/extremum.rs +0 -0
  62. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/group.rs +0 -0
  63. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/ma.rs +0 -0
  64. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/misc.rs +0 -0
  65. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/moments.rs +0 -0
  66. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/neutralize.rs +0 -0
  67. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/quantile.rs +0 -0
  68. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/rank.rs +0 -0
  69. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/returns.rs +0 -0
  70. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/scan.rs +0 -0
  71. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/series.rs +0 -0
  72. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/skip_nan_window.rs +0 -0
  73. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/slope.rs +0 -0
  74. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/stats.rs +0 -0
  75. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/stddev.rs +0 -0
  76. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/sum.rs +0 -0
  77. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/algo/zscore.rs +0 -0
  78. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/src/lib.rs +0 -0
  79. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/tests/rank.py +0 -0
  80. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/tests/usage.py +0 -0
  81. {py_alpha_lib-0.2.3 → py_alpha_lib-0.2.5}/tests/verify_sumif.py +0 -0
@@ -1,5 +1,23 @@
1
1
  # ChangeLog
2
2
 
3
+ ## [0.2.5] - 2026-05-11
4
+
5
+ ### Added
6
+
7
+ - Factor Expression translator now support named arguments
8
+
9
+
10
+
11
+ ## [0.2.4] - 2026-04-27
12
+
13
+ ### Added
14
+
15
+ - ALPHA: calculate alpha for a strategy
16
+ - BETA: calculate beta for a strategy
17
+ - SHARPE: calculate sharpe ratio for a strategy
18
+ - MAX_DRAWDOWN: calculate max drawdown of a series
19
+
20
+
3
21
  ## [0.2.3] - 2026-04-13
4
22
 
5
23
  ### Added
@@ -4,7 +4,7 @@ version = 4
4
4
 
5
5
  [[package]]
6
6
  name = "alpha"
7
- version = "0.2.3"
7
+ version = "0.2.5"
8
8
  dependencies = [
9
9
  "anyhow",
10
10
  "log",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "alpha"
3
- version = "0.2.3"
3
+ version = "0.2.5"
4
4
  edition = "2024"
5
5
  authors = ["ElseJJ"]
6
6
  readme = "README.md"
@@ -9,6 +9,7 @@ readme = "README.md"
9
9
  [lib]
10
10
  name = "alpha"
11
11
  crate-type = ["cdylib", "rlib"]
12
+ doctest = false
12
13
 
13
14
  [dependencies]
14
15
  pyo3 = { version = "0.28", features = ["abi3"] }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: py-alpha-lib
3
- Version: 0.2.3
3
+ Version: 0.2.5
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -172,9 +172,11 @@ Naming Rules:
172
172
 
173
173
  | Name | Description |
174
174
  |---|---|
175
+ | ALPHA | Rolling Jensen's Alpha of asset returns against benchmark returns. |
175
176
  | BACKFILL | Forward-fill NaN values with the last valid observation |
176
177
  | BARSLAST | Calculate number of bars since last condition true |
177
178
  | BARSSINCE | Calculate number of bars since first condition true |
179
+ | BETA | Rolling Beta coefficient of asset returns against benchmark returns. |
178
180
  | BINS | Discretize the input into n bins, the ctx.groups() is the number of groups |
179
181
  | CC_RANK | Calculate rank percentage cross group dimension, the ctx.groups() is the number of groups Same value are averaged |
180
182
  | CC_ZSCORE | Calculate cross-sectional Z-Score across groups at each time step |
@@ -199,6 +201,7 @@ Naming Rules:
199
201
  | LONGCROSS | For 2 arrays A and B, return true if previous N periods A < B, Current A >= B |
200
202
  | LWMA | Linear Weighted Moving Average |
201
203
  | MA | Simple Moving Average, also known as arithmetic moving average |
204
+ | MAX_DRAWDOWN | Rolling Maximum Drawdown. |
202
205
  | MIN_MAX_DIFF | Calculate rolling min-max difference (range) over a moving window |
203
206
  | MOMENT | Calculate rolling k-th central moment over a moving window |
204
207
  | NEUTRALIZE | Neutralize the effect of a categorical variable on a numeric variable |
@@ -212,6 +215,7 @@ Naming Rules:
212
215
  | RLONGCROSS | For 2 arrays A and B, return true if previous N periods A > B, Current A <= B |
213
216
  | SCAN_ADD | Conditional cumulative add: r[t] = r[t-1] + (cond[t] ? input[t] : 0) |
214
217
  | SCAN_MUL | Conditional cumulative multiply: r[t] = r[t-1] * (cond[t] ? input[t] : 1) |
218
+ | SHARPE | Rolling Sharpe Ratio of returns. |
215
219
  | SKEWNESS | Calculate rolling sample Skewness over a moving window |
216
220
  | SLOPE | Linear Regression Slope |
217
221
  | SMA | Exponential Moving Average (variant of well-known EMA) weight = m / n |
@@ -157,9 +157,11 @@ Naming Rules:
157
157
 
158
158
  | Name | Description |
159
159
  |---|---|
160
+ | ALPHA | Rolling Jensen's Alpha of asset returns against benchmark returns. |
160
161
  | BACKFILL | Forward-fill NaN values with the last valid observation |
161
162
  | BARSLAST | Calculate number of bars since last condition true |
162
163
  | BARSSINCE | Calculate number of bars since first condition true |
164
+ | BETA | Rolling Beta coefficient of asset returns against benchmark returns. |
163
165
  | BINS | Discretize the input into n bins, the ctx.groups() is the number of groups |
164
166
  | CC_RANK | Calculate rank percentage cross group dimension, the ctx.groups() is the number of groups Same value are averaged |
165
167
  | CC_ZSCORE | Calculate cross-sectional Z-Score across groups at each time step |
@@ -184,6 +186,7 @@ Naming Rules:
184
186
  | LONGCROSS | For 2 arrays A and B, return true if previous N periods A < B, Current A >= B |
185
187
  | LWMA | Linear Weighted Moving Average |
186
188
  | MA | Simple Moving Average, also known as arithmetic moving average |
189
+ | MAX_DRAWDOWN | Rolling Maximum Drawdown. |
187
190
  | MIN_MAX_DIFF | Calculate rolling min-max difference (range) over a moving window |
188
191
  | MOMENT | Calculate rolling k-th central moment over a moving window |
189
192
  | NEUTRALIZE | Neutralize the effect of a categorical variable on a numeric variable |
@@ -197,6 +200,7 @@ Naming Rules:
197
200
  | RLONGCROSS | For 2 arrays A and B, return true if previous N periods A > B, Current A <= B |
198
201
  | SCAN_ADD | Conditional cumulative add: r[t] = r[t-1] + (cond[t] ? input[t] : 0) |
199
202
  | SCAN_MUL | Conditional cumulative multiply: r[t] = r[t-1] * (cond[t] ? input[t] : 1) |
203
+ | SHARPE | Rolling Sharpe Ratio of returns. |
200
204
  | SKEWNESS | Calculate rolling sample Skewness over a moving window |
201
205
  | SLOPE | Linear Regression Slope |
202
206
  | SMA | Exponential Moving Average (variant of well-known EMA) weight = m / n |
@@ -18,6 +18,30 @@ def _to_bool(a):
18
18
  return a
19
19
  return a.astype(bool)
20
20
 
21
+ def ALPHA(
22
+ input: np.ndarray | list[np.ndarray], benchmark: np.ndarray | list[np.ndarray], periods: int
23
+ ) -> np.ndarray | list[np.ndarray]:
24
+ """
25
+ Rolling Jensen's Alpha of asset returns against benchmark returns.
26
+
27
+ Alpha = mean(input) - Beta * mean(benchmark)
28
+ Measures excess return of an asset relative to its expected return given beta.
29
+
30
+ Ref: https://en.wikipedia.org/wiki/Jensen%27s_alpha
31
+ """
32
+ if isinstance(input, list) and isinstance(benchmark, list):
33
+ input = [_to_f64(x) for x in input]
34
+ benchmark = [_to_f64(x) for x in benchmark]
35
+ r = [np.empty_like(x) for x in input]
36
+ _algo.alpha(r, input, benchmark, periods)
37
+ return r
38
+ else:
39
+ input = _to_f64(input)
40
+ benchmark = _to_f64(benchmark)
41
+ r = np.empty_like(input)
42
+ _algo.alpha(r, input, benchmark, periods)
43
+ return r
44
+
21
45
  def BACKFILL(
22
46
  input: np.ndarray | list[np.ndarray]
23
47
  ) -> np.ndarray | list[np.ndarray]:
@@ -76,6 +100,30 @@ def BARSSINCE(
76
100
  _algo.barssince(r, input)
77
101
  return r
78
102
 
103
+ def BETA(
104
+ input: np.ndarray | list[np.ndarray], benchmark: np.ndarray | list[np.ndarray], periods: int
105
+ ) -> np.ndarray | list[np.ndarray]:
106
+ """
107
+ Rolling Beta coefficient of asset returns against benchmark returns.
108
+
109
+ Beta = Covariance(input, benchmark) / Variance(benchmark)
110
+ Measures systematic risk of an asset relative to the market.
111
+
112
+ Ref: https://en.wikipedia.org/wiki/Beta_(finance)
113
+ """
114
+ if isinstance(input, list) and isinstance(benchmark, list):
115
+ input = [_to_f64(x) for x in input]
116
+ benchmark = [_to_f64(x) for x in benchmark]
117
+ r = [np.empty_like(x) for x in input]
118
+ _algo.beta(r, input, benchmark, periods)
119
+ return r
120
+ else:
121
+ input = _to_f64(input)
122
+ benchmark = _to_f64(benchmark)
123
+ r = np.empty_like(input)
124
+ _algo.beta(r, input, benchmark, periods)
125
+ return r
126
+
79
127
  def BINS(
80
128
  input: np.ndarray | list[np.ndarray], bins: int
81
129
  ) -> np.ndarray | list[np.ndarray]:
@@ -542,6 +590,29 @@ def MA(
542
590
  _algo.ma(r, input, periods)
543
591
  return r
544
592
 
593
+ def MAX_DRAWDOWN(
594
+ input: np.ndarray | list[np.ndarray], periods: int
595
+ ) -> np.ndarray | list[np.ndarray]:
596
+ """
597
+ Rolling Maximum Drawdown.
598
+
599
+ MaxDrawdown = minimum peak-to-trough decline within the rolling window.
600
+ Result is expressed as a negative return (e.g. -0.2 means 20% drawdown from peak).
601
+ Input should be a price or equity curve series.
602
+
603
+ Ref: https://en.wikipedia.org/wiki/Drawdown_(economics)
604
+ """
605
+ if isinstance(input, list):
606
+ input = [_to_f64(x) for x in input]
607
+ r = [np.empty_like(x) for x in input]
608
+ _algo.max_drawdown(r, input, periods)
609
+ return r
610
+ else:
611
+ input = _to_f64(input)
612
+ r = np.empty_like(input)
613
+ _algo.max_drawdown(r, input, periods)
614
+ return r
615
+
545
616
  def MIN_MAX_DIFF(
546
617
  input: np.ndarray | list[np.ndarray], periods: int
547
618
  ) -> np.ndarray | list[np.ndarray]:
@@ -811,6 +882,28 @@ def SCAN_MUL(
811
882
  _algo.scan_mul(r, input, condition)
812
883
  return r
813
884
 
885
+ def SHARPE(
886
+ input: np.ndarray | list[np.ndarray], periods: int
887
+ ) -> np.ndarray | list[np.ndarray]:
888
+ """
889
+ Rolling Sharpe Ratio of returns.
890
+
891
+ Sharpe = mean(returns) / stddev(returns)
892
+ Measures risk-adjusted return over a rolling window.
893
+
894
+ Ref: https://en.wikipedia.org/wiki/Sharpe_ratio
895
+ """
896
+ if isinstance(input, list):
897
+ input = [_to_f64(x) for x in input]
898
+ r = [np.empty_like(x) for x in input]
899
+ _algo.sharpe(r, input, periods)
900
+ return r
901
+ else:
902
+ input = _to_f64(input)
903
+ r = np.empty_like(input)
904
+ _algo.sharpe(r, input, periods)
905
+ return r
906
+
814
907
  def SKEWNESS(
815
908
  input: np.ndarray | list[np.ndarray], periods: int
816
909
  ) -> np.ndarray | list[np.ndarray]:
@@ -2,9 +2,11 @@ List of available functions with python type hints:
2
2
 
3
3
  the `np.ndarray` is `ndarray` type in `numpy` package
4
4
 
5
+ - ALPHA(input: np.ndarray[float], benchmark: np.ndarray[float], periods: int): Rolling Jensen's Alpha of asset returns against benchmark returns. Alpha = mean(input) - Beta * mean(benchmark) Measures excess return of an asset relative to its expected return given beta.
5
6
  - BACKFILL(input: np.ndarray[float]): Forward-fill NaN values with the last valid observation Iterates forward through each group; if x[i] is NaN, copies the last valid value. Leading NaNs (before any valid value) remain NaN.
6
7
  - BARSLAST(input: np.ndarray[bool]): Calculate number of bars since last condition true
7
8
  - BARSSINCE(input: np.ndarray[bool]): Calculate number of bars since first condition true
9
+ - BETA(input: np.ndarray[float], benchmark: np.ndarray[float], periods: int): Rolling Beta coefficient of asset returns against benchmark returns. Beta = Covariance(input, benchmark) / Variance(benchmark) Measures systematic risk of an asset relative to the market.
8
10
  - BINS(input: np.ndarray[float], bins: int): Discretize the input into n bins, the ctx.groups() is the number of groups Bins are 0-based index. Same value are assigned to the same bin.
9
11
  - CC_RANK(input: np.ndarray[float]): Calculate rank percentage cross group dimension, the ctx.groups() is the number of groups Same value are averaged
10
12
  - CC_ZSCORE(input: np.ndarray[float]): Calculate cross-sectional Z-Score across groups at each time step Z-Score = (x - mean) / stddev, computed across all groups for each time position. NaN values are excluded from mean/stddev computation. NaN input produces NaN output.
@@ -29,6 +31,7 @@ the `np.ndarray` is `ndarray` type in `numpy` package
29
31
  - LONGCROSS(a: np.ndarray[float], b: np.ndarray[float], n: int): For 2 arrays A and B, return true if previous N periods A < B, Current A >= B
30
32
  - LWMA(input: np.ndarray[float], periods: int): Linear Weighted Moving Average LWMA = SUM(Price * Weight) / SUM(Weight)
31
33
  - MA(input: np.ndarray[float], periods: int): Simple Moving Average, also known as arithmetic moving average
34
+ - MAX_DRAWDOWN(input: np.ndarray[float], periods: int): Rolling Maximum Drawdown. MaxDrawdown = minimum peak-to-trough decline within the rolling window. Result is expressed as a negative return (e.g. -0.2 means 20% drawdown from peak). Input should be a price or equity curve series.
32
35
  - MIN_MAX_DIFF(input: np.ndarray[float], periods: int): Calculate rolling min-max difference (range) over a moving window TS_MIN_MAX_DIFF = TS_MAX(x, d) - TS_MIN(x, d) Single-pass using two monotonic deques for efficiency.
33
36
  - MOMENT(input: np.ndarray[float], periods: int, k: int): Calculate rolling k-th central moment over a moving window MOMENT(x, d, k) = mean((x - mean)^k) over window of d periods. This is the raw (non-adjusted) sample moment. k=2 gives variance (population), k=3 gives raw third moment, etc.
34
37
  - NEUTRALIZE(category: np.ndarray[float], input: np.ndarray[float]): Neutralize the effect of a categorical variable on a numeric variable
@@ -42,6 +45,7 @@ the `np.ndarray` is `ndarray` type in `numpy` package
42
45
  - RLONGCROSS(a: np.ndarray[float], b: np.ndarray[float], n: int): For 2 arrays A and B, return true if previous N periods A > B, Current A <= B
43
46
  - SCAN_ADD(input: np.ndarray[float], condition: np.ndarray[bool]): Conditional cumulative add: r[t] = r[t-1] + (cond[t] ? input[t] : 0) Used for SELF-referencing alpha expressions with additive accumulation. Serial within each stock, parallel across stocks via rayon.
44
47
  - SCAN_MUL(input: np.ndarray[float], condition: np.ndarray[bool]): Conditional cumulative multiply: r[t] = r[t-1] * (cond[t] ? input[t] : 1) Used for SELF-referencing alpha expressions like GTJA #143. Serial within each stock, parallel across stocks via rayon.
48
+ - SHARPE(input: np.ndarray[float], periods: int): Rolling Sharpe Ratio of returns. Sharpe = mean(returns) / stddev(returns) Measures risk-adjusted return over a rolling window.
45
49
  - SKEWNESS(input: np.ndarray[float], periods: int): Calculate rolling sample Skewness over a moving window Uses adjusted Fisher-Pearson formula (matches pandas): skew = n / ((n-1)(n-2)) * sum(((x-mean)/std)^3) Requires at least 3 valid values.
46
50
  - SLOPE(input: np.ndarray[float], periods: int): Linear Regression Slope Calculates the slope of the linear regression line for a moving window.
47
51
  - SMA(input: np.ndarray[float], n: int, m: int): Exponential Moving Average (variant of well-known EMA) weight = m / n
@@ -35,7 +35,9 @@ start: expression
35
35
  !mul_op: STAR | DIV
36
36
 
37
37
  func_call: NAME "(" [arguments] ")"
38
- arguments: expression ("," expression)*
38
+ arguments: argument ("," argument)*
39
+ ?argument: expression
40
+ | NAME ASSIGN expression -> named_argument
39
41
 
40
42
  // Terminals
41
43
  SELF: "SELF"
@@ -44,6 +46,7 @@ MINUS: "-"
44
46
  STAR: "*"
45
47
  DIV: "/"
46
48
  POWER: "^"
49
+ ASSIGN: "="
47
50
  NUMBER: /\d+(\.\d*)?|\.\d+/
48
51
  NAME: /[a-zA-Z_]\w*/
49
52
 
@@ -3561,10 +3561,10 @@ class PythonIndenter(Indenter):
3561
3561
 
3562
3562
  import pickle, zlib, base64
3563
3563
  DATA = (
3564
- {'parser': {'lexer_conf': {'terminals': [{'@': 0}, {'@': 1}, {'@': 2}, {'@': 3}, {'@': 4}, {'@': 5}, {'@': 6}, {'@': 7}, {'@': 8}, {'@': 9}, {'@': 10}, {'@': 11}, {'@': 12}, {'@': 13}, {'@': 14}, {'@': 15}, {'@': 16}, {'@': 17}, {'@': 18}, {'@': 19}, {'@': 20}, {'@': 21}, {'@': 22}], 'ignore': ['WS'], 'g_regex_flags': 0, 'use_bytes': False, 'lexer_type': 'contextual', '__type__': 'LexerConf'}, 'parser_conf': {'rules': [{'@': 23}, {'@': 24}, {'@': 25}, {'@': 26}, {'@': 27}, {'@': 28}, {'@': 29}, {'@': 30}, {'@': 31}, {'@': 32}, {'@': 33}, {'@': 34}, {'@': 35}, {'@': 36}, {'@': 37}, {'@': 38}, {'@': 39}, {'@': 40}, {'@': 41}, {'@': 42}, {'@': 43}, {'@': 44}, {'@': 45}, {'@': 46}, {'@': 47}, {'@': 48}, {'@': 49}, {'@': 50}, {'@': 51}, {'@': 52}, {'@': 53}, {'@': 54}, {'@': 55}, {'@': 56}, {'@': 57}, {'@': 58}, {'@': 59}, {'@': 60}, {'@': 61}, {'@': 62}, {'@': 63}, {'@': 64}, {'@': 65}, {'@': 66}, {'@': 67}, {'@': 68}, {'@': 69}, {'@': 70}], 'start': ['start'], 'parser_type': 'lalr', '__type__': 'ParserConf'}, 'parser': {'tokens': {0: 'COMMA', 1: 'PLUS', 2: 'MORETHAN', 3: 'DIV', 4: '__ANON_1', 5: '__ANON_0', 6: 'POWER', 7: 'MINUS', 8: 'LESSTHAN', 9: '__ANON_4', 10: 'STAR', 11: '__ANON_5', 12: '__ANON_3', 13: '__ANON_2', 14: 'RPAR', 15: 'QMARK', 16: '$END', 17: 'COLON', 18: 'NAME', 19: 'logical_or_expr', 20: 'arguments', 21: 'expression', 22: 'logical_and_expr', 23: 'atom', 24: 'func_call', 25: 'power', 26: 'sum', 27: 'comparison_expr', 28: 'LPAR', 29: 'ternary_expr', 30: 'SELF', 31: 'NUMBER', 32: 'product', 33: '__logical_or_expr_star_0', 34: '__arguments_star_5', 35: 'add_op', 36: 'mul_op', 37: 'DOT', 38: '__product_star_3', 39: '__logical_and_expr_star_1', 40: '__power_star_4', 41: 'start', 42: '__sum_star_2'}, 'states': {0: {0: (1, {'@': 55}), 1: (1, {'@': 55}), 2: (1, {'@': 55}), 3: (1, {'@': 55}), 4: (1, {'@': 55}), 5: (1, {'@': 55}), 6: (1, {'@': 55}), 7: (1, {'@': 55}), 8: (1, {'@': 55}), 9: (1, {'@': 55}), 10: (1, {'@': 55}), 11: (1, {'@': 55}), 12: (1, {'@': 55}), 13: (1, {'@': 55}), 14: (1, {'@': 55}), 15: (1, {'@': 55}), 16: (1, {'@': 55}), 17: (1, {'@': 55})}, 1: {18: (0, 38), 19: (0, 7), 7: (0, 61), 20: (0, 16), 21: (0, 13), 22: (0, 5), 23: (0, 69), 24: (0, 10), 25: (0, 39), 26: (0, 62), 27: (0, 63), 28: (0, 4), 29: (0, 28), 30: (0, 18), 31: (0, 20), 32: (0, 73), 14: (0, 57)}, 2: {0: (1, {'@': 65}), 1: (1, {'@': 65}), 2: (1, {'@': 65}), 3: (1, {'@': 65}), 4: (1, {'@': 65}), 5: (1, {'@': 65}), 7: (1, {'@': 65}), 8: (1, {'@': 65}), 16: (1, {'@': 65}), 9: (1, {'@': 65}), 10: (1, {'@': 65}), 17: (1, {'@': 65}), 11: (1, {'@': 65}), 12: (1, {'@': 65}), 13: (1, {'@': 65}), 14: (1, {'@': 65}), 15: (1, {'@': 65})}, 3: {0: (1, {'@': 50}), 1: (1, {'@': 50}), 2: (1, {'@': 50}), 3: (1, {'@': 50}), 4: (1, {'@': 50}), 5: (1, {'@': 50}), 6: (1, {'@': 50}), 7: (1, {'@': 50}), 8: (1, {'@': 50}), 9: (1, {'@': 50}), 10: (1, {'@': 50}), 11: (1, {'@': 50}), 12: (1, {'@': 50}), 13: (1, {'@': 50}), 14: (1, {'@': 50}), 15: (1, {'@': 50}), 16: (1, {'@': 50}), 17: (1, {'@': 50})}, 4: {18: (0, 38), 19: (0, 7), 7: (0, 61), 21: (0, 67), 23: (0, 69), 24: (0, 10), 25: (0, 39), 26: (0, 62), 27: (0, 63), 22: (0, 5), 28: (0, 4), 29: (0, 28), 30: (0, 18), 31: (0, 20), 32: (0, 73)}, 5: {33: (0, 59), 5: (0, 36), 0: (1, {'@': 28}), 14: (1, {'@': 28}), 15: (1, {'@': 28}), 16: (1, {'@': 28}), 17: (1, {'@': 28})}, 6: {30: (1, {'@': 53}), 31: (1, {'@': 53}), 7: (1, {'@': 53}), 18: (1, {'@': 53}), 28: (1, {'@': 53})}, 7: {15: (0, 42), 0: (1, {'@': 26}), 14: (1, {'@': 26}), 16: (1, {'@': 26}), 17: (1, {'@': 26})}, 8: {30: (1, {'@': 52}), 31: (1, {'@': 52}), 7: (1, {'@': 52}), 18: (1, {'@': 52}), 28: (1, {'@': 52})}, 9: {24: (0, 10), 25: (0, 39), 18: (0, 38), 28: (0, 4), 30: (0, 18), 23: (0, 69), 7: (0, 61), 31: (0, 20), 32: (0, 44)}, 10: {0: (1, {'@': 45}), 1: (1, {'@': 45}), 2: (1, {'@': 45}), 3: (1, {'@': 45}), 4: (1, {'@': 45}), 5: (1, {'@': 45}), 6: (1, {'@': 45}), 7: (1, {'@': 45}), 8: (1, {'@': 45}), 9: (1, {'@': 45}), 10: (1, {'@': 45}), 11: (1, {'@': 45}), 12: (1, {'@': 45}), 13: (1, {'@': 45}), 14: (1, {'@': 45}), 15: (1, {'@': 45}), 16: (1, {'@': 45}), 17: (1, {'@': 45})}, 11: {17: (0, 21)}, 12: {18: (0, 38), 19: (0, 7), 7: (0, 61), 23: (0, 69), 24: (0, 10), 25: (0, 39), 21: (0, 23), 26: (0, 62), 27: (0, 63), 22: (0, 5), 28: (0, 4), 29: (0, 28), 30: (0, 18), 31: (0, 20), 32: (0, 73)}, 13: {0: (0, 66), 34: (0, 34), 14: (1, {'@': 58})}, 14: {18: (0, 38), 7: (0, 61), 23: (0, 69), 24: (0, 10), 25: (0, 39), 26: (0, 62), 27: (0, 63), 28: (0, 4), 30: (0, 18), 22: (0, 41), 31: (0, 20), 32: (0, 73)}, 15: {16: (1, {'@': 23})}, 16: {14: (0, 0)}, 17: {0: (1, {'@': 67}), 1: (1, {'@': 67}), 2: (1, {'@': 67}), 3: (1, {'@': 67}), 4: (1, {'@': 67}), 5: (1, {'@': 67}), 6: (1, {'@': 67}), 7: (1, {'@': 67}), 8: (1, {'@': 67}), 9: (1, {'@': 67}), 16: (1, {'@': 67}), 10: (1, {'@': 67}), 17: (1, {'@': 67}), 11: (1, {'@': 67}), 12: (1, {'@': 67}), 13: (1, {'@': 67}), 14: (1, {'@': 67}), 15: (1, {'@': 67})}, 18: {0: (1, {'@': 47}), 1: (1, {'@': 47}), 2: (1, {'@': 47}), 3: (1, {'@': 47}), 4: (1, {'@': 47}), 5: (1, {'@': 47}), 6: (1, {'@': 47}), 7: (1, {'@': 47}), 8: (1, {'@': 47}), 9: (1, {'@': 47}), 10: (1, {'@': 47}), 11: (1, {'@': 47}), 12: (1, {'@': 47}), 13: (1, {'@': 47}), 14: (1, {'@': 47}), 15: (1, {'@': 47}), 16: (1, {'@': 47}), 17: (1, {'@': 47})}, 19: {7: (0, 8), 35: (0, 9), 1: (0, 65), 0: (1, {'@': 38}), 2: (1, {'@': 38}), 4: (1, {'@': 38}), 5: (1, {'@': 38}), 14: (1, {'@': 38}), 11: (1, {'@': 38}), 12: (1, {'@': 38}), 13: (1, {'@': 38}), 8: (1, {'@': 38}), 9: (1, {'@': 38}), 15: (1, {'@': 38}), 16: (1, {'@': 38}), 17: (1, {'@': 38})}, 20: {0: (1, {'@': 46}), 1: (1, {'@': 46}), 2: (1, {'@': 46}), 3: (1, {'@': 46}), 4: (1, {'@': 46}), 5: (1, {'@': 46}), 6: (1, {'@': 46}), 7: (1, {'@': 46}), 8: (1, {'@': 46}), 9: (1, {'@': 46}), 10: (1, {'@': 46}), 11: (1, {'@': 46}), 12: (1, {'@': 46}), 13: (1, {'@': 46}), 14: (1, {'@': 46}), 15: (1, {'@': 46}), 16: (1, {'@': 46}), 17: (1, {'@': 46})}, 21: {18: (0, 38), 19: (0, 7), 7: (0, 61), 29: (0, 22), 23: (0, 69), 24: (0, 10), 25: (0, 39), 26: (0, 62), 27: (0, 63), 22: (0, 5), 28: (0, 4), 30: (0, 18), 31: (0, 20), 32: (0, 73)}, 22: {0: (1, {'@': 25}), 14: (1, {'@': 25}), 16: (1, {'@': 25}), 17: (1, {'@': 25})}, 23: {0: (1, {'@': 70}), 14: (1, {'@': 70})}, 24: {24: (0, 10), 25: (0, 39), 18: (0, 38), 28: (0, 4), 32: (0, 73), 30: (0, 18), 23: (0, 69), 7: (0, 61), 26: (0, 75), 31: (0, 20)}, 25: {0: (1, {'@': 62}), 4: (1, {'@': 62}), 5: (1, {'@': 62}), 17: (1, {'@': 62}), 14: (1, {'@': 62}), 16: (1, {'@': 62}), 15: (1, {'@': 62})}, 26: {24: (0, 10), 25: (0, 39), 18: (0, 38), 28: (0, 4), 32: (0, 73), 30: (0, 18), 26: (0, 54), 23: (0, 69), 7: (0, 61), 31: (0, 20)}, 27: {0: (1, {'@': 61}), 4: (1, {'@': 61}), 5: (1, {'@': 61}), 17: (1, {'@': 61}), 14: (1, {'@': 61}), 16: (1, {'@': 61}), 15: (1, {'@': 61})}, 28: {0: (1, {'@': 24}), 14: (1, {'@': 24}), 16: (1, {'@': 24})}, 29: {0: (1, {'@': 59}), 5: (1, {'@': 59}), 16: (1, {'@': 59}), 17: (1, {'@': 59}), 14: (1, {'@': 59}), 15: (1, {'@': 59})}, 30: {24: (0, 10), 25: (0, 39), 18: (0, 38), 28: (0, 4), 32: (0, 73), 30: (0, 18), 23: (0, 69), 7: (0, 61), 26: (0, 52), 31: (0, 20)}, 31: {18: (0, 60)}, 32: {36: (0, 74), 3: (0, 48), 10: (0, 6), 0: (1, {'@': 40}), 1: (1, {'@': 40}), 2: (1, {'@': 40}), 4: (1, {'@': 40}), 5: (1, {'@': 40}), 11: (1, {'@': 40}), 13: (1, {'@': 40}), 12: (1, {'@': 40}), 15: (1, {'@': 40}), 7: (1, {'@': 40}), 8: (1, {'@': 40}), 14: (1, {'@': 40}), 9: (1, {'@': 40}), 17: (1, {'@': 40}), 16: (1, {'@': 40})}, 33: {24: (0, 10), 18: (0, 38), 28: (0, 4), 30: (0, 18), 7: (0, 61), 31: (0, 20), 23: (0, 64)}, 34: {0: (0, 12), 14: (1, {'@': 57})}, 35: {4: (0, 56), 15: (1, {'@': 29}), 0: (1, {'@': 29}), 14: (1, {'@': 29}), 5: (1, {'@': 29}), 16: (1, {'@': 29}), 17: (1, {'@': 29})}, 36: {18: (0, 38), 7: (0, 61), 22: (0, 29), 23: (0, 69), 24: (0, 10), 25: (0, 39), 26: (0, 62), 27: (0, 63), 28: (0, 4), 30: (0, 18), 31: (0, 20), 32: (0, 73)}, 37: {0: (1, {'@': 44}), 1: (1, {'@': 44}), 2: (1, {'@': 44}), 3: (1, {'@': 44}), 4: (1, {'@': 44}), 5: (1, {'@': 44}), 6: (1, {'@': 44}), 7: (1, {'@': 44}), 8: (1, {'@': 44}), 9: (1, {'@': 44}), 10: (1, {'@': 44}), 11: (1, {'@': 44}), 12: (1, {'@': 44}), 13: (1, {'@': 44}), 14: (1, {'@': 44}), 15: (1, {'@': 44}), 16: (1, {'@': 44}), 17: (1, {'@': 44})}, 38: {28: (0, 1), 37: (0, 31), 0: (1, {'@': 48}), 1: (1, {'@': 48}), 2: (1, {'@': 48}), 3: (1, {'@': 48}), 4: (1, {'@': 48}), 5: (1, {'@': 48}), 6: (1, {'@': 48}), 7: (1, {'@': 48}), 8: (1, {'@': 48}), 9: (1, {'@': 48}), 10: (1, {'@': 48}), 11: (1, {'@': 48}), 12: (1, {'@': 48}), 13: (1, {'@': 48}), 14: (1, {'@': 48}), 15: (1, {'@': 48}), 16: (1, {'@': 48}), 17: (1, {'@': 48})}, 39: {3: (0, 48), 36: (0, 46), 38: (0, 32), 10: (0, 6), 0: (1, {'@': 41}), 1: (1, {'@': 41}), 2: (1, {'@': 41}), 4: (1, {'@': 41}), 5: (1, {'@': 41}), 11: (1, {'@': 41}), 13: (1, {'@': 41}), 12: (1, {'@': 41}), 15: (1, {'@': 41}), 7: (1, {'@': 41}), 8: (1, {'@': 41}), 14: (1, {'@': 41}), 9: (1, {'@': 41}), 17: (1, {'@': 41}), 16: (1, {'@': 41})}, 40: {6: (0, 33), 0: (1, {'@': 42}), 1: (1, {'@': 42}), 2: (1, {'@': 42}), 3: (1, {'@': 42}), 10: (1, {'@': 42}), 4: (1, {'@': 42}), 5: (1, {'@': 42}), 7: (1, {'@': 42}), 9: (1, {'@': 42}), 11: (1, {'@': 42}), 12: (1, {'@': 42}), 13: (1, {'@': 42}), 8: (1, {'@': 42}), 14: (1, {'@': 42}), 15: (1, {'@': 42}), 16: (1, {'@': 42}), 17: (1, {'@': 42})}, 41: {0: (1, {'@': 60}), 5: (1, {'@': 60}), 16: (1, {'@': 60}), 17: (1, {'@': 60}), 14: (1, {'@': 60}), 15: (1, {'@': 60})}, 42: {18: (0, 38), 19: (0, 7), 7: (0, 61), 23: (0, 69), 24: (0, 10), 25: (0, 39), 26: (0, 62), 27: (0, 63), 22: (0, 5), 28: (0, 4), 30: (0, 18), 31: (0, 20), 32: (0, 73), 29: (0, 11)}, 43: {24: (0, 10), 18: (0, 38), 28: (0, 4), 30: (0, 18), 7: (0, 61), 31: (0, 20), 23: (0, 17)}, 44: {0: (1, {'@': 64}), 1: (1, {'@': 64}), 4: (1, {'@': 64}), 2: (1, {'@': 64}), 5: (1, {'@': 64}), 7: (1, {'@': 64}), 8: (1, {'@': 64}), 16: (1, {'@': 64}), 9: (1, {'@': 64}), 17: (1, {'@': 64}), 11: (1, {'@': 64}), 12: (1, {'@': 64}), 13: (1, {'@': 64}), 14: (1, {'@': 64}), 15: (1, {'@': 64})}, 45: {24: (0, 10), 25: (0, 39), 18: (0, 38), 28: (0, 4), 30: (0, 18), 23: (0, 69), 7: (0, 61), 31: (0, 20), 32: (0, 72)}, 46: {24: (0, 10), 18: (0, 38), 28: (0, 4), 25: (0, 2), 30: (0, 18), 23: (0, 69), 7: (0, 61), 31: (0, 20)}, 47: {24: (0, 10), 25: (0, 39), 18: (0, 38), 28: (0, 4), 32: (0, 73), 30: (0, 18), 23: (0, 69), 7: (0, 61), 31: (0, 20), 26: (0, 51)}, 48: {30: (1, {'@': 54}), 31: (1, {'@': 54}), 7: (1, {'@': 54}), 18: (1, {'@': 54}), 28: (1, {'@': 54})}, 49: {0: (1, {'@': 32}), 4: (1, {'@': 32}), 5: (1, {'@': 32}), 14: (1, {'@': 32}), 15: (1, {'@': 32}), 16: (1, {'@': 32}), 17: (1, {'@': 32})}, 50: {0: (1, {'@': 34}), 4: (1, {'@': 34}), 5: (1, {'@': 34}), 14: (1, {'@': 34}), 15: (1, {'@': 34}), 16: (1, {'@': 34}), 17: (1, {'@': 34})}, 51: {0: (1, {'@': 33}), 4: (1, {'@': 33}), 5: (1, {'@': 33}), 14: (1, {'@': 33}), 15: (1, {'@': 33}), 16: (1, {'@': 33}), 17: (1, {'@': 33})}, 52: {0: (1, {'@': 31}), 4: (1, {'@': 31}), 5: (1, {'@': 31}), 14: (1, {'@': 31}), 15: (1, {'@': 31}), 16: (1, {'@': 31}), 17: (1, {'@': 31})}, 53: {24: (0, 10), 25: (0, 39), 18: (0, 38), 28: (0, 4), 32: (0, 73), 30: (0, 18), 23: (0, 69), 7: (0, 61), 31: (0, 20), 26: (0, 49)}, 54: {0: (1, {'@': 36}), 4: (1, {'@': 36}), 5: (1, {'@': 36}), 14: (1, {'@': 36}), 15: (1, {'@': 36}), 16: (1, {'@': 36}), 17: (1, {'@': 36})}, 55: {}, 56: {18: (0, 38), 7: (0, 61), 23: (0, 69), 24: (0, 10), 25: (0, 39), 26: (0, 62), 28: (0, 4), 30: (0, 18), 31: (0, 20), 32: (0, 73), 27: (0, 25)}, 57: {0: (1, {'@': 56}), 1: (1, {'@': 56}), 2: (1, {'@': 56}), 3: (1, {'@': 56}), 4: (1, {'@': 56}), 5: (1, {'@': 56}), 6: (1, {'@': 56}), 7: (1, {'@': 56}), 8: (1, {'@': 56}), 9: (1, {'@': 56}), 10: (1, {'@': 56}), 11: (1, {'@': 56}), 12: (1, {'@': 56}), 13: (1, {'@': 56}), 14: (1, {'@': 56}), 15: (1, {'@': 56}), 16: (1, {'@': 56}), 17: (1, {'@': 56})}, 58: {0: (1, {'@': 69}), 14: (1, {'@': 69})}, 59: {5: (0, 14), 0: (1, {'@': 27}), 14: (1, {'@': 27}), 15: (1, {'@': 27}), 16: (1, {'@': 27}), 17: (1, {'@': 27})}, 60: {0: (1, {'@': 49}), 1: (1, {'@': 49}), 2: (1, {'@': 49}), 3: (1, {'@': 49}), 4: (1, {'@': 49}), 5: (1, {'@': 49}), 6: (1, {'@': 49}), 7: (1, {'@': 49}), 8: (1, {'@': 49}), 9: (1, {'@': 49}), 10: (1, {'@': 49}), 11: (1, {'@': 49}), 12: (1, {'@': 49}), 13: (1, {'@': 49}), 14: (1, {'@': 49}), 15: (1, {'@': 49}), 16: (1, {'@': 49}), 17: (1, {'@': 49})}, 61: {24: (0, 10), 18: (0, 38), 23: (0, 37), 28: (0, 4), 30: (0, 18), 7: (0, 61), 31: (0, 20)}, 62: {2: (0, 71), 12: (0, 53), 13: (0, 30), 8: (0, 47), 11: (0, 26), 9: (0, 24), 0: (1, {'@': 37}), 4: (1, {'@': 37}), 5: (1, {'@': 37}), 14: (1, {'@': 37}), 15: (1, {'@': 37}), 16: (1, {'@': 37}), 17: (1, {'@': 37})}, 63: {39: (0, 35), 4: (0, 68), 15: (1, {'@': 30}), 0: (1, {'@': 30}), 14: (1, {'@': 30}), 5: (1, {'@': 30}), 16: (1, {'@': 30}), 17: (1, {'@': 30})}, 64: {0: (1, {'@': 68}), 1: (1, {'@': 68}), 2: (1, {'@': 68}), 3: (1, {'@': 68}), 4: (1, {'@': 68}), 5: (1, {'@': 68}), 6: (1, {'@': 68}), 7: (1, {'@': 68}), 8: (1, {'@': 68}), 9: (1, {'@': 68}), 16: (1, {'@': 68}), 10: (1, {'@': 68}), 17: (1, {'@': 68}), 11: (1, {'@': 68}), 12: (1, {'@': 68}), 13: (1, {'@': 68}), 14: (1, {'@': 68}), 15: (1, {'@': 68})}, 65: {30: (1, {'@': 51}), 31: (1, {'@': 51}), 7: (1, {'@': 51}), 18: (1, {'@': 51}), 28: (1, {'@': 51})}, 66: {18: (0, 38), 21: (0, 58), 19: (0, 7), 7: (0, 61), 23: (0, 69), 24: (0, 10), 25: (0, 39), 26: (0, 62), 27: (0, 63), 22: (0, 5), 28: (0, 4), 29: (0, 28), 30: (0, 18), 31: (0, 20), 32: (0, 73)}, 67: {14: (0, 3)}, 68: {18: (0, 38), 7: (0, 61), 23: (0, 69), 24: (0, 10), 25: (0, 39), 26: (0, 62), 27: (0, 27), 28: (0, 4), 30: (0, 18), 31: (0, 20), 32: (0, 73)}, 69: {40: (0, 40), 6: (0, 43), 0: (1, {'@': 43}), 1: (1, {'@': 43}), 2: (1, {'@': 43}), 3: (1, {'@': 43}), 10: (1, {'@': 43}), 4: (1, {'@': 43}), 5: (1, {'@': 43}), 7: (1, {'@': 43}), 9: (1, {'@': 43}), 11: (1, {'@': 43}), 12: (1, {'@': 43}), 13: (1, {'@': 43}), 8: (1, {'@': 43}), 14: (1, {'@': 43}), 15: (1, {'@': 43}), 16: (1, {'@': 43}), 17: (1, {'@': 43})}, 70: {18: (0, 38), 19: (0, 7), 7: (0, 61), 23: (0, 69), 24: (0, 10), 25: (0, 39), 26: (0, 62), 27: (0, 63), 22: (0, 5), 21: (0, 15), 28: (0, 4), 29: (0, 28), 30: (0, 18), 31: (0, 20), 32: (0, 73), 41: (0, 55)}, 71: {24: (0, 10), 25: (0, 39), 18: (0, 38), 28: (0, 4), 32: (0, 73), 30: (0, 18), 26: (0, 50), 23: (0, 69), 7: (0, 61), 31: (0, 20)}, 72: {0: (1, {'@': 63}), 1: (1, {'@': 63}), 4: (1, {'@': 63}), 2: (1, {'@': 63}), 5: (1, {'@': 63}), 7: (1, {'@': 63}), 8: (1, {'@': 63}), 16: (1, {'@': 63}), 9: (1, {'@': 63}), 17: (1, {'@': 63}), 11: (1, {'@': 63}), 12: (1, {'@': 63}), 13: (1, {'@': 63}), 14: (1, {'@': 63}), 15: (1, {'@': 63})}, 73: {7: (0, 8), 35: (0, 45), 42: (0, 19), 1: (0, 65), 0: (1, {'@': 39}), 2: (1, {'@': 39}), 4: (1, {'@': 39}), 5: (1, {'@': 39}), 14: (1, {'@': 39}), 11: (1, {'@': 39}), 12: (1, {'@': 39}), 13: (1, {'@': 39}), 8: (1, {'@': 39}), 9: (1, {'@': 39}), 15: (1, {'@': 39}), 16: (1, {'@': 39}), 17: (1, {'@': 39})}, 74: {24: (0, 10), 18: (0, 38), 28: (0, 4), 30: (0, 18), 23: (0, 69), 7: (0, 61), 31: (0, 20), 25: (0, 76)}, 75: {0: (1, {'@': 35}), 4: (1, {'@': 35}), 5: (1, {'@': 35}), 14: (1, {'@': 35}), 15: (1, {'@': 35}), 16: (1, {'@': 35}), 17: (1, {'@': 35})}, 76: {0: (1, {'@': 66}), 1: (1, {'@': 66}), 2: (1, {'@': 66}), 3: (1, {'@': 66}), 4: (1, {'@': 66}), 5: (1, {'@': 66}), 7: (1, {'@': 66}), 8: (1, {'@': 66}), 16: (1, {'@': 66}), 9: (1, {'@': 66}), 10: (1, {'@': 66}), 17: (1, {'@': 66}), 11: (1, {'@': 66}), 12: (1, {'@': 66}), 13: (1, {'@': 66}), 14: (1, {'@': 66}), 15: (1, {'@': 66})}}, 'start_states': {'start': 70}, 'end_states': {'start': 55}}, '__type__': 'ParsingFrontend'}, 'rules': [{'@': 23}, {'@': 24}, {'@': 25}, {'@': 26}, {'@': 27}, {'@': 28}, {'@': 29}, {'@': 30}, {'@': 31}, {'@': 32}, {'@': 33}, {'@': 34}, {'@': 35}, {'@': 36}, {'@': 37}, {'@': 38}, {'@': 39}, {'@': 40}, {'@': 41}, {'@': 42}, {'@': 43}, {'@': 44}, {'@': 45}, {'@': 46}, {'@': 47}, {'@': 48}, {'@': 49}, {'@': 50}, {'@': 51}, {'@': 52}, {'@': 53}, {'@': 54}, {'@': 55}, {'@': 56}, {'@': 57}, {'@': 58}, {'@': 59}, {'@': 60}, {'@': 61}, {'@': 62}, {'@': 63}, {'@': 64}, {'@': 65}, {'@': 66}, {'@': 67}, {'@': 68}, {'@': 69}, {'@': 70}], 'options': {'debug': False, 'strict': False, 'keep_all_tokens': False, 'tree_class': None, 'cache': False, 'cache_grammar': False, 'postlex': None, 'parser': 'lalr', 'lexer': 'contextual', 'transformer': None, 'start': ['start'], 'priority': 'normal', 'ambiguity': 'auto', 'regex': False, 'propagate_positions': False, 'lexer_callbacks': {}, 'maybe_placeholders': False, 'edit_terminals': None, 'g_regex_flags': 0, 'use_bytes': False, 'ordered_sets': True, 'import_paths': [], 'source_path': None, '_plugins': {}}, '__type__': 'Lark'}
3564
+ {'parser': {'lexer_conf': {'terminals': [{'@': 0}, {'@': 1}, {'@': 2}, {'@': 3}, {'@': 4}, {'@': 5}, {'@': 6}, {'@': 7}, {'@': 8}, {'@': 9}, {'@': 10}, {'@': 11}, {'@': 12}, {'@': 13}, {'@': 14}, {'@': 15}, {'@': 16}, {'@': 17}, {'@': 18}, {'@': 19}, {'@': 20}, {'@': 21}, {'@': 22}, {'@': 23}], 'ignore': ['WS'], 'g_regex_flags': 0, 'use_bytes': False, 'lexer_type': 'contextual', '__type__': 'LexerConf'}, 'parser_conf': {'rules': [{'@': 24}, {'@': 25}, {'@': 26}, {'@': 27}, {'@': 28}, {'@': 29}, {'@': 30}, {'@': 31}, {'@': 32}, {'@': 33}, {'@': 34}, {'@': 35}, {'@': 36}, {'@': 37}, {'@': 38}, {'@': 39}, {'@': 40}, {'@': 41}, {'@': 42}, {'@': 43}, {'@': 44}, {'@': 45}, {'@': 46}, {'@': 47}, {'@': 48}, {'@': 49}, {'@': 50}, {'@': 51}, {'@': 52}, {'@': 53}, {'@': 54}, {'@': 55}, {'@': 56}, {'@': 57}, {'@': 58}, {'@': 59}, {'@': 60}, {'@': 61}, {'@': 62}, {'@': 63}, {'@': 64}, {'@': 65}, {'@': 66}, {'@': 67}, {'@': 68}, {'@': 69}, {'@': 70}, {'@': 71}, {'@': 72}, {'@': 73}], 'start': ['start'], 'parser_type': 'lalr', '__type__': 'ParserConf'}, 'parser': {'tokens': {0: '__ANON_0', 1: 'COMMA', 2: 'QMARK', 3: 'RPAR', 4: '$END', 5: 'COLON', 6: 'atom', 7: 'sum', 8: 'func_call', 9: 'LPAR', 10: 'power', 11: 'NAME', 12: 'product', 13: 'NUMBER', 14: 'SELF', 15: 'MINUS', 16: 'add_op', 17: 'PLUS', 18: '__sum_star_2', 19: '__ANON_1', 20: '__ANON_3', 21: '__ANON_4', 22: '__ANON_5', 23: 'MORETHAN', 24: 'LESSTHAN', 25: '__ANON_2', 26: 'logical_and_expr', 27: 'comparison_expr', 28: 'DIV', 29: 'STAR', 30: '__arguments_star_5', 31: 'mul_op', 32: 'argument', 33: 'arguments', 34: 'logical_or_expr', 35: 'expression', 36: 'ternary_expr', 37: 'POWER', 38: '__logical_or_expr_star_0', 39: '__product_star_3', 40: 'DOT', 41: 'ASSIGN', 42: 'start', 43: '__logical_and_expr_star_1', 44: '__power_star_4'}, 'states': {0: {0: (0, 17), 1: (1, {'@': 28}), 2: (1, {'@': 28}), 3: (1, {'@': 28}), 4: (1, {'@': 28}), 5: (1, {'@': 28})}, 1: {6: (0, 76), 7: (0, 8), 8: (0, 63), 9: (0, 26), 10: (0, 24), 11: (0, 27), 12: (0, 2), 13: (0, 56), 14: (0, 73), 15: (0, 65)}, 2: {16: (0, 67), 17: (0, 42), 18: (0, 37), 15: (0, 80), 2: (1, {'@': 40}), 19: (1, {'@': 40}), 3: (1, {'@': 40}), 0: (1, {'@': 40}), 5: (1, {'@': 40}), 1: (1, {'@': 40}), 4: (1, {'@': 40}), 20: (1, {'@': 40}), 21: (1, {'@': 40}), 22: (1, {'@': 40}), 23: (1, {'@': 40}), 24: (1, {'@': 40}), 25: (1, {'@': 40})}, 3: {15: (0, 65), 11: (0, 27), 7: (0, 9), 9: (0, 26), 12: (0, 2), 26: (0, 19), 27: (0, 45), 8: (0, 63), 13: (0, 56), 10: (0, 24), 6: (0, 76), 14: (0, 73)}, 4: {2: (1, {'@': 68}), 21: (1, {'@': 68}), 17: (1, {'@': 68}), 22: (1, {'@': 68}), 28: (1, {'@': 68}), 19: (1, {'@': 68}), 3: (1, {'@': 68}), 5: (1, {'@': 68}), 23: (1, {'@': 68}), 1: (1, {'@': 68}), 25: (1, {'@': 68}), 20: (1, {'@': 68}), 15: (1, {'@': 68}), 0: (1, {'@': 68}), 29: (1, {'@': 68}), 24: (1, {'@': 68}), 4: (1, {'@': 68})}, 5: {30: (0, 68), 1: (0, 50), 3: (1, {'@': 59})}, 6: {2: (1, {'@': 34}), 4: (1, {'@': 34}), 1: (1, {'@': 34}), 19: (1, {'@': 34}), 0: (1, {'@': 34}), 5: (1, {'@': 34}), 3: (1, {'@': 34})}, 7: {2: (1, {'@': 69}), 21: (1, {'@': 69}), 17: (1, {'@': 69}), 22: (1, {'@': 69}), 28: (1, {'@': 69}), 19: (1, {'@': 69}), 3: (1, {'@': 69}), 5: (1, {'@': 69}), 23: (1, {'@': 69}), 1: (1, {'@': 69}), 25: (1, {'@': 69}), 20: (1, {'@': 69}), 15: (1, {'@': 69}), 0: (1, {'@': 69}), 29: (1, {'@': 69}), 24: (1, {'@': 69}), 4: (1, {'@': 69})}, 8: {2: (1, {'@': 32}), 4: (1, {'@': 32}), 1: (1, {'@': 32}), 19: (1, {'@': 32}), 0: (1, {'@': 32}), 5: (1, {'@': 32}), 3: (1, {'@': 32})}, 9: {23: (0, 58), 25: (0, 1), 21: (0, 44), 22: (0, 23), 20: (0, 28), 24: (0, 47), 2: (1, {'@': 38}), 4: (1, {'@': 38}), 1: (1, {'@': 38}), 19: (1, {'@': 38}), 0: (1, {'@': 38}), 5: (1, {'@': 38}), 3: (1, {'@': 38})}, 10: {15: (0, 65), 11: (0, 27), 7: (0, 9), 9: (0, 26), 12: (0, 2), 8: (0, 63), 27: (0, 62), 13: (0, 56), 10: (0, 24), 6: (0, 76), 14: (0, 73)}, 11: {3: (0, 29)}, 12: {2: (1, {'@': 35}), 4: (1, {'@': 35}), 1: (1, {'@': 35}), 19: (1, {'@': 35}), 0: (1, {'@': 35}), 5: (1, {'@': 35}), 3: (1, {'@': 35})}, 13: {2: (1, {'@': 36}), 4: (1, {'@': 36}), 1: (1, {'@': 36}), 19: (1, {'@': 36}), 0: (1, {'@': 36}), 5: (1, {'@': 36}), 3: (1, {'@': 36})}, 14: {31: (0, 48), 29: (0, 30), 28: (0, 54), 2: (1, {'@': 41}), 15: (1, {'@': 41}), 17: (1, {'@': 41}), 19: (1, {'@': 41}), 3: (1, {'@': 41}), 0: (1, {'@': 41}), 5: (1, {'@': 41}), 1: (1, {'@': 41}), 4: (1, {'@': 41}), 20: (1, {'@': 41}), 21: (1, {'@': 41}), 25: (1, {'@': 41}), 22: (1, {'@': 41}), 23: (1, {'@': 41}), 24: (1, {'@': 41})}, 15: {32: (0, 5), 15: (0, 65), 11: (0, 33), 33: (0, 11), 7: (0, 9), 9: (0, 26), 34: (0, 49), 12: (0, 2), 27: (0, 45), 35: (0, 57), 8: (0, 63), 3: (0, 66), 26: (0, 22), 13: (0, 56), 10: (0, 24), 6: (0, 76), 14: (0, 73), 36: (0, 61)}, 16: {1: (1, {'@': 26}), 3: (1, {'@': 26}), 4: (1, {'@': 26}), 5: (1, {'@': 26})}, 17: {15: (0, 65), 11: (0, 27), 7: (0, 9), 9: (0, 26), 12: (0, 2), 27: (0, 45), 8: (0, 63), 13: (0, 56), 10: (0, 24), 6: (0, 76), 26: (0, 55), 14: (0, 73)}, 18: {2: (1, {'@': 45}), 37: (1, {'@': 45}), 15: (1, {'@': 45}), 17: (1, {'@': 45}), 28: (1, {'@': 45}), 19: (1, {'@': 45}), 3: (1, {'@': 45}), 0: (1, {'@': 45}), 5: (1, {'@': 45}), 29: (1, {'@': 45}), 1: (1, {'@': 45}), 4: (1, {'@': 45}), 21: (1, {'@': 45}), 22: (1, {'@': 45}), 23: (1, {'@': 45}), 25: (1, {'@': 45}), 20: (1, {'@': 45}), 24: (1, {'@': 45})}, 19: {2: (1, {'@': 62}), 3: (1, {'@': 62}), 0: (1, {'@': 62}), 5: (1, {'@': 62}), 1: (1, {'@': 62}), 4: (1, {'@': 62})}, 20: {}, 21: {27: (0, 34), 15: (0, 65), 11: (0, 27), 7: (0, 9), 9: (0, 26), 12: (0, 2), 8: (0, 63), 13: (0, 56), 10: (0, 24), 6: (0, 76), 14: (0, 73)}, 22: {38: (0, 0), 0: (0, 3), 1: (1, {'@': 29}), 2: (1, {'@': 29}), 3: (1, {'@': 29}), 4: (1, {'@': 29}), 5: (1, {'@': 29})}, 23: {6: (0, 76), 7: (0, 39), 8: (0, 63), 9: (0, 26), 10: (0, 24), 11: (0, 27), 12: (0, 2), 13: (0, 56), 14: (0, 73), 15: (0, 65)}, 24: {39: (0, 14), 28: (0, 54), 31: (0, 25), 29: (0, 30), 2: (1, {'@': 42}), 15: (1, {'@': 42}), 17: (1, {'@': 42}), 19: (1, {'@': 42}), 3: (1, {'@': 42}), 0: (1, {'@': 42}), 5: (1, {'@': 42}), 1: (1, {'@': 42}), 4: (1, {'@': 42}), 20: (1, {'@': 42}), 21: (1, {'@': 42}), 25: (1, {'@': 42}), 22: (1, {'@': 42}), 23: (1, {'@': 42}), 24: (1, {'@': 42})}, 25: {6: (0, 76), 10: (0, 4), 8: (0, 63), 9: (0, 26), 11: (0, 27), 13: (0, 56), 14: (0, 73), 15: (0, 65)}, 26: {15: (0, 65), 11: (0, 27), 7: (0, 9), 9: (0, 26), 34: (0, 49), 12: (0, 2), 27: (0, 45), 8: (0, 63), 26: (0, 22), 13: (0, 56), 10: (0, 24), 6: (0, 76), 14: (0, 73), 36: (0, 61), 35: (0, 41)}, 27: {9: (0, 15), 40: (0, 51), 2: (1, {'@': 49}), 37: (1, {'@': 49}), 15: (1, {'@': 49}), 17: (1, {'@': 49}), 28: (1, {'@': 49}), 19: (1, {'@': 49}), 3: (1, {'@': 49}), 0: (1, {'@': 49}), 5: (1, {'@': 49}), 29: (1, {'@': 49}), 1: (1, {'@': 49}), 4: (1, {'@': 49}), 21: (1, {'@': 49}), 22: (1, {'@': 49}), 23: (1, {'@': 49}), 25: (1, {'@': 49}), 20: (1, {'@': 49}), 24: (1, {'@': 49})}, 28: {6: (0, 76), 8: (0, 63), 9: (0, 26), 10: (0, 24), 11: (0, 27), 12: (0, 2), 7: (0, 43), 13: (0, 56), 14: (0, 73), 15: (0, 65)}, 29: {2: (1, {'@': 56}), 37: (1, {'@': 56}), 15: (1, {'@': 56}), 17: (1, {'@': 56}), 28: (1, {'@': 56}), 19: (1, {'@': 56}), 3: (1, {'@': 56}), 0: (1, {'@': 56}), 5: (1, {'@': 56}), 29: (1, {'@': 56}), 1: (1, {'@': 56}), 4: (1, {'@': 56}), 21: (1, {'@': 56}), 22: (1, {'@': 56}), 23: (1, {'@': 56}), 25: (1, {'@': 56}), 20: (1, {'@': 56}), 24: (1, {'@': 56})}, 30: {15: (1, {'@': 54}), 9: (1, {'@': 54}), 13: (1, {'@': 54}), 14: (1, {'@': 54}), 11: (1, {'@': 54})}, 31: {8: (0, 63), 9: (0, 26), 6: (0, 46), 11: (0, 27), 13: (0, 56), 14: (0, 73), 15: (0, 65)}, 32: {2: (1, {'@': 71}), 21: (1, {'@': 71}), 17: (1, {'@': 71}), 22: (1, {'@': 71}), 28: (1, {'@': 71}), 19: (1, {'@': 71}), 3: (1, {'@': 71}), 5: (1, {'@': 71}), 23: (1, {'@': 71}), 1: (1, {'@': 71}), 25: (1, {'@': 71}), 37: (1, {'@': 71}), 20: (1, {'@': 71}), 15: (1, {'@': 71}), 0: (1, {'@': 71}), 29: (1, {'@': 71}), 24: (1, {'@': 71}), 4: (1, {'@': 71})}, 33: {9: (0, 15), 41: (0, 52), 40: (0, 51), 2: (1, {'@': 49}), 21: (1, {'@': 49}), 17: (1, {'@': 49}), 22: (1, {'@': 49}), 28: (1, {'@': 49}), 19: (1, {'@': 49}), 3: (1, {'@': 49}), 23: (1, {'@': 49}), 1: (1, {'@': 49}), 25: (1, {'@': 49}), 37: (1, {'@': 49}), 20: (1, {'@': 49}), 15: (1, {'@': 49}), 0: (1, {'@': 49}), 29: (1, {'@': 49}), 24: (1, {'@': 49})}, 34: {2: (1, {'@': 65}), 3: (1, {'@': 65}), 19: (1, {'@': 65}), 0: (1, {'@': 65}), 5: (1, {'@': 65}), 1: (1, {'@': 65}), 4: (1, {'@': 65})}, 35: {1: (1, {'@': 73}), 3: (1, {'@': 73})}, 36: {1: (1, {'@': 61}), 3: (1, {'@': 61})}, 37: {17: (0, 42), 15: (0, 80), 16: (0, 78), 2: (1, {'@': 39}), 19: (1, {'@': 39}), 3: (1, {'@': 39}), 0: (1, {'@': 39}), 5: (1, {'@': 39}), 1: (1, {'@': 39}), 4: (1, {'@': 39}), 20: (1, {'@': 39}), 21: (1, {'@': 39}), 22: (1, {'@': 39}), 23: (1, {'@': 39}), 24: (1, {'@': 39}), 25: (1, {'@': 39})}, 38: {37: (0, 64), 2: (1, {'@': 43}), 15: (1, {'@': 43}), 17: (1, {'@': 43}), 28: (1, {'@': 43}), 19: (1, {'@': 43}), 3: (1, {'@': 43}), 0: (1, {'@': 43}), 5: (1, {'@': 43}), 1: (1, {'@': 43}), 29: (1, {'@': 43}), 4: (1, {'@': 43}), 21: (1, {'@': 43}), 22: (1, {'@': 43}), 23: (1, {'@': 43}), 25: (1, {'@': 43}), 20: (1, {'@': 43}), 24: (1, {'@': 43})}, 39: {2: (1, {'@': 37}), 4: (1, {'@': 37}), 1: (1, {'@': 37}), 19: (1, {'@': 37}), 0: (1, {'@': 37}), 5: (1, {'@': 37}), 3: (1, {'@': 37})}, 40: {42: (0, 20), 15: (0, 65), 11: (0, 27), 7: (0, 9), 9: (0, 26), 34: (0, 49), 12: (0, 2), 27: (0, 45), 8: (0, 63), 26: (0, 22), 13: (0, 56), 10: (0, 24), 35: (0, 79), 6: (0, 76), 14: (0, 73), 36: (0, 61)}, 41: {3: (0, 69)}, 42: {15: (1, {'@': 52}), 9: (1, {'@': 52}), 13: (1, {'@': 52}), 14: (1, {'@': 52}), 11: (1, {'@': 52})}, 43: {2: (1, {'@': 33}), 4: (1, {'@': 33}), 1: (1, {'@': 33}), 19: (1, {'@': 33}), 0: (1, {'@': 33}), 5: (1, {'@': 33}), 3: (1, {'@': 33})}, 44: {6: (0, 76), 8: (0, 63), 9: (0, 26), 10: (0, 24), 11: (0, 27), 12: (0, 2), 13: (0, 56), 7: (0, 13), 14: (0, 73), 15: (0, 65)}, 45: {19: (0, 10), 43: (0, 77), 2: (1, {'@': 31}), 1: (1, {'@': 31}), 3: (1, {'@': 31}), 0: (1, {'@': 31}), 5: (1, {'@': 31}), 4: (1, {'@': 31})}, 46: {2: (1, {'@': 70}), 21: (1, {'@': 70}), 17: (1, {'@': 70}), 22: (1, {'@': 70}), 28: (1, {'@': 70}), 19: (1, {'@': 70}), 3: (1, {'@': 70}), 5: (1, {'@': 70}), 23: (1, {'@': 70}), 1: (1, {'@': 70}), 25: (1, {'@': 70}), 37: (1, {'@': 70}), 20: (1, {'@': 70}), 15: (1, {'@': 70}), 0: (1, {'@': 70}), 29: (1, {'@': 70}), 24: (1, {'@': 70}), 4: (1, {'@': 70})}, 47: {6: (0, 76), 8: (0, 63), 9: (0, 26), 10: (0, 24), 11: (0, 27), 12: (0, 2), 7: (0, 6), 13: (0, 56), 14: (0, 73), 15: (0, 65)}, 48: {6: (0, 76), 10: (0, 7), 8: (0, 63), 9: (0, 26), 11: (0, 27), 13: (0, 56), 14: (0, 73), 15: (0, 65)}, 49: {2: (0, 53), 1: (1, {'@': 27}), 3: (1, {'@': 27}), 4: (1, {'@': 27}), 5: (1, {'@': 27})}, 50: {32: (0, 59), 15: (0, 65), 11: (0, 33), 7: (0, 9), 9: (0, 26), 34: (0, 49), 12: (0, 2), 27: (0, 45), 35: (0, 57), 8: (0, 63), 26: (0, 22), 13: (0, 56), 10: (0, 24), 6: (0, 76), 14: (0, 73), 36: (0, 61)}, 51: {11: (0, 75)}, 52: {15: (0, 65), 11: (0, 27), 7: (0, 9), 9: (0, 26), 34: (0, 49), 12: (0, 2), 27: (0, 45), 8: (0, 63), 26: (0, 22), 13: (0, 56), 10: (0, 24), 6: (0, 76), 35: (0, 36), 14: (0, 73), 36: (0, 61)}, 53: {15: (0, 65), 11: (0, 27), 7: (0, 9), 9: (0, 26), 34: (0, 49), 12: (0, 2), 27: (0, 45), 8: (0, 63), 26: (0, 22), 13: (0, 56), 36: (0, 60), 10: (0, 24), 6: (0, 76), 14: (0, 73)}, 54: {15: (1, {'@': 55}), 9: (1, {'@': 55}), 13: (1, {'@': 55}), 14: (1, {'@': 55}), 11: (1, {'@': 55})}, 55: {2: (1, {'@': 63}), 3: (1, {'@': 63}), 0: (1, {'@': 63}), 5: (1, {'@': 63}), 1: (1, {'@': 63}), 4: (1, {'@': 63})}, 56: {2: (1, {'@': 47}), 37: (1, {'@': 47}), 15: (1, {'@': 47}), 17: (1, {'@': 47}), 28: (1, {'@': 47}), 19: (1, {'@': 47}), 3: (1, {'@': 47}), 0: (1, {'@': 47}), 5: (1, {'@': 47}), 29: (1, {'@': 47}), 1: (1, {'@': 47}), 4: (1, {'@': 47}), 21: (1, {'@': 47}), 22: (1, {'@': 47}), 23: (1, {'@': 47}), 25: (1, {'@': 47}), 20: (1, {'@': 47}), 24: (1, {'@': 47})}, 57: {1: (1, {'@': 60}), 3: (1, {'@': 60})}, 58: {6: (0, 76), 8: (0, 63), 9: (0, 26), 10: (0, 24), 11: (0, 27), 12: (0, 2), 7: (0, 12), 13: (0, 56), 14: (0, 73), 15: (0, 65)}, 59: {1: (1, {'@': 72}), 3: (1, {'@': 72})}, 60: {5: (0, 70)}, 61: {1: (1, {'@': 25}), 3: (1, {'@': 25}), 4: (1, {'@': 25})}, 62: {2: (1, {'@': 64}), 3: (1, {'@': 64}), 19: (1, {'@': 64}), 0: (1, {'@': 64}), 5: (1, {'@': 64}), 1: (1, {'@': 64}), 4: (1, {'@': 64})}, 63: {2: (1, {'@': 46}), 37: (1, {'@': 46}), 15: (1, {'@': 46}), 17: (1, {'@': 46}), 28: (1, {'@': 46}), 19: (1, {'@': 46}), 3: (1, {'@': 46}), 0: (1, {'@': 46}), 5: (1, {'@': 46}), 29: (1, {'@': 46}), 1: (1, {'@': 46}), 4: (1, {'@': 46}), 21: (1, {'@': 46}), 22: (1, {'@': 46}), 23: (1, {'@': 46}), 25: (1, {'@': 46}), 20: (1, {'@': 46}), 24: (1, {'@': 46})}, 64: {8: (0, 63), 9: (0, 26), 11: (0, 27), 13: (0, 56), 6: (0, 32), 14: (0, 73), 15: (0, 65)}, 65: {8: (0, 63), 9: (0, 26), 11: (0, 27), 6: (0, 18), 13: (0, 56), 14: (0, 73), 15: (0, 65)}, 66: {2: (1, {'@': 57}), 37: (1, {'@': 57}), 15: (1, {'@': 57}), 17: (1, {'@': 57}), 28: (1, {'@': 57}), 19: (1, {'@': 57}), 3: (1, {'@': 57}), 0: (1, {'@': 57}), 5: (1, {'@': 57}), 29: (1, {'@': 57}), 1: (1, {'@': 57}), 4: (1, {'@': 57}), 21: (1, {'@': 57}), 22: (1, {'@': 57}), 23: (1, {'@': 57}), 25: (1, {'@': 57}), 20: (1, {'@': 57}), 24: (1, {'@': 57})}, 67: {6: (0, 76), 8: (0, 63), 9: (0, 26), 10: (0, 24), 11: (0, 27), 12: (0, 74), 13: (0, 56), 14: (0, 73), 15: (0, 65)}, 68: {1: (0, 72), 3: (1, {'@': 58})}, 69: {2: (1, {'@': 51}), 37: (1, {'@': 51}), 15: (1, {'@': 51}), 17: (1, {'@': 51}), 28: (1, {'@': 51}), 19: (1, {'@': 51}), 3: (1, {'@': 51}), 0: (1, {'@': 51}), 5: (1, {'@': 51}), 29: (1, {'@': 51}), 1: (1, {'@': 51}), 4: (1, {'@': 51}), 21: (1, {'@': 51}), 22: (1, {'@': 51}), 23: (1, {'@': 51}), 25: (1, {'@': 51}), 20: (1, {'@': 51}), 24: (1, {'@': 51})}, 70: {36: (0, 16), 15: (0, 65), 11: (0, 27), 7: (0, 9), 9: (0, 26), 34: (0, 49), 12: (0, 2), 27: (0, 45), 8: (0, 63), 26: (0, 22), 13: (0, 56), 10: (0, 24), 6: (0, 76), 14: (0, 73)}, 71: {2: (1, {'@': 67}), 21: (1, {'@': 67}), 17: (1, {'@': 67}), 22: (1, {'@': 67}), 19: (1, {'@': 67}), 3: (1, {'@': 67}), 5: (1, {'@': 67}), 23: (1, {'@': 67}), 1: (1, {'@': 67}), 25: (1, {'@': 67}), 20: (1, {'@': 67}), 15: (1, {'@': 67}), 0: (1, {'@': 67}), 24: (1, {'@': 67}), 4: (1, {'@': 67})}, 72: {15: (0, 65), 11: (0, 33), 7: (0, 9), 9: (0, 26), 34: (0, 49), 12: (0, 2), 32: (0, 35), 27: (0, 45), 35: (0, 57), 8: (0, 63), 26: (0, 22), 13: (0, 56), 10: (0, 24), 6: (0, 76), 14: (0, 73), 36: (0, 61)}, 73: {2: (1, {'@': 48}), 37: (1, {'@': 48}), 15: (1, {'@': 48}), 17: (1, {'@': 48}), 28: (1, {'@': 48}), 19: (1, {'@': 48}), 3: (1, {'@': 48}), 0: (1, {'@': 48}), 5: (1, {'@': 48}), 29: (1, {'@': 48}), 1: (1, {'@': 48}), 4: (1, {'@': 48}), 21: (1, {'@': 48}), 22: (1, {'@': 48}), 23: (1, {'@': 48}), 25: (1, {'@': 48}), 20: (1, {'@': 48}), 24: (1, {'@': 48})}, 74: {2: (1, {'@': 66}), 21: (1, {'@': 66}), 17: (1, {'@': 66}), 22: (1, {'@': 66}), 19: (1, {'@': 66}), 3: (1, {'@': 66}), 5: (1, {'@': 66}), 23: (1, {'@': 66}), 1: (1, {'@': 66}), 25: (1, {'@': 66}), 20: (1, {'@': 66}), 15: (1, {'@': 66}), 0: (1, {'@': 66}), 24: (1, {'@': 66}), 4: (1, {'@': 66})}, 75: {2: (1, {'@': 50}), 37: (1, {'@': 50}), 15: (1, {'@': 50}), 17: (1, {'@': 50}), 28: (1, {'@': 50}), 19: (1, {'@': 50}), 3: (1, {'@': 50}), 0: (1, {'@': 50}), 5: (1, {'@': 50}), 29: (1, {'@': 50}), 1: (1, {'@': 50}), 4: (1, {'@': 50}), 21: (1, {'@': 50}), 22: (1, {'@': 50}), 23: (1, {'@': 50}), 25: (1, {'@': 50}), 20: (1, {'@': 50}), 24: (1, {'@': 50})}, 76: {37: (0, 31), 44: (0, 38), 2: (1, {'@': 44}), 15: (1, {'@': 44}), 17: (1, {'@': 44}), 28: (1, {'@': 44}), 19: (1, {'@': 44}), 3: (1, {'@': 44}), 0: (1, {'@': 44}), 5: (1, {'@': 44}), 1: (1, {'@': 44}), 29: (1, {'@': 44}), 4: (1, {'@': 44}), 21: (1, {'@': 44}), 22: (1, {'@': 44}), 23: (1, {'@': 44}), 25: (1, {'@': 44}), 20: (1, {'@': 44}), 24: (1, {'@': 44})}, 77: {19: (0, 21), 2: (1, {'@': 30}), 1: (1, {'@': 30}), 3: (1, {'@': 30}), 0: (1, {'@': 30}), 5: (1, {'@': 30}), 4: (1, {'@': 30})}, 78: {6: (0, 76), 8: (0, 63), 9: (0, 26), 10: (0, 24), 11: (0, 27), 13: (0, 56), 12: (0, 71), 14: (0, 73), 15: (0, 65)}, 79: {4: (1, {'@': 24})}, 80: {15: (1, {'@': 53}), 9: (1, {'@': 53}), 13: (1, {'@': 53}), 14: (1, {'@': 53}), 11: (1, {'@': 53})}}, 'start_states': {'start': 40}, 'end_states': {'start': 20}}, '__type__': 'ParsingFrontend'}, 'rules': [{'@': 24}, {'@': 25}, {'@': 26}, {'@': 27}, {'@': 28}, {'@': 29}, {'@': 30}, {'@': 31}, {'@': 32}, {'@': 33}, {'@': 34}, {'@': 35}, {'@': 36}, {'@': 37}, {'@': 38}, {'@': 39}, {'@': 40}, {'@': 41}, {'@': 42}, {'@': 43}, {'@': 44}, {'@': 45}, {'@': 46}, {'@': 47}, {'@': 48}, {'@': 49}, {'@': 50}, {'@': 51}, {'@': 52}, {'@': 53}, {'@': 54}, {'@': 55}, {'@': 56}, {'@': 57}, {'@': 58}, {'@': 59}, {'@': 60}, {'@': 61}, {'@': 62}, {'@': 63}, {'@': 64}, {'@': 65}, {'@': 66}, {'@': 67}, {'@': 68}, {'@': 69}, {'@': 70}, {'@': 71}, {'@': 72}, {'@': 73}], 'options': {'debug': False, 'strict': False, 'keep_all_tokens': False, 'tree_class': None, 'cache': False, 'cache_grammar': False, 'postlex': None, 'parser': 'lalr', 'lexer': 'contextual', 'transformer': None, 'start': ['start'], 'priority': 'normal', 'ambiguity': 'auto', 'regex': False, 'propagate_positions': False, 'lexer_callbacks': {}, 'maybe_placeholders': False, 'edit_terminals': None, 'g_regex_flags': 0, 'use_bytes': False, 'ordered_sets': True, 'import_paths': [], 'source_path': None, '_plugins': {}}, '__type__': 'Lark'}
3565
3565
  )
3566
3566
  MEMO = (
3567
- {0: {'name': 'WS', 'pattern': {'value': '(?:[ \t\x0c\r\n])+', 'flags': [], 'raw': None, '_width': [1, 18446744073709551616], '__type__': 'PatternRE'}, 'priority': 0, '__type__': 'TerminalDef'}, 1: {'name': 'SELF', 'pattern': {'value': 'SELF', 'flags': [], 'raw': '"SELF"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 2: {'name': 'PLUS', 'pattern': {'value': '+', 'flags': [], 'raw': '"+"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 3: {'name': 'MINUS', 'pattern': {'value': '-', 'flags': [], 'raw': '"-"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 4: {'name': 'STAR', 'pattern': {'value': '*', 'flags': [], 'raw': '"*"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 5: {'name': 'DIV', 'pattern': {'value': '/', 'flags': [], 'raw': '"/"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 6: {'name': 'POWER', 'pattern': {'value': '^', 'flags': [], 'raw': '"^"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 7: {'name': 'NUMBER', 'pattern': {'value': '\\d+(\\.\\d*)?|\\.\\d+', 'flags': [], 'raw': '/\\d+(\\.\\d*)?|\\.\\d+/', '_width': [1, 18446744073709551616], '__type__': 'PatternRE'}, 'priority': 0, '__type__': 'TerminalDef'}, 8: {'name': 'NAME', 'pattern': {'value': '[a-zA-Z_]\\w*', 'flags': [], 'raw': '/[a-zA-Z_]\\w*/', '_width': [1, 18446744073709551616], '__type__': 'PatternRE'}, 'priority': 0, '__type__': 'TerminalDef'}, 9: {'name': 'QMARK', 'pattern': {'value': '?', 'flags': [], 'raw': '"?"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 10: {'name': 'COLON', 'pattern': {'value': ':', 'flags': [], 'raw': '":"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 11: {'name': '__ANON_0', 'pattern': {'value': '||', 'flags': [], 'raw': '"||"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 12: {'name': '__ANON_1', 'pattern': {'value': '&&', 'flags': [], 'raw': '"&&"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 13: {'name': '__ANON_2', 'pattern': {'value': '==', 'flags': [], 'raw': '"=="', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 14: {'name': '__ANON_3', 'pattern': {'value': '!=', 'flags': [], 'raw': '"!="', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 15: {'name': 'LESSTHAN', 'pattern': {'value': '<', 'flags': [], 'raw': '"<"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 16: {'name': 'MORETHAN', 'pattern': {'value': '>', 'flags': [], 'raw': '">"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 17: {'name': '__ANON_4', 'pattern': {'value': '<=', 'flags': [], 'raw': '"<="', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 18: {'name': '__ANON_5', 'pattern': {'value': '>=', 'flags': [], 'raw': '">="', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 19: {'name': 'DOT', 'pattern': {'value': '.', 'flags': [], 'raw': '"."', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 20: {'name': 'LPAR', 'pattern': {'value': '(', 'flags': [], 'raw': '"("', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 21: {'name': 'RPAR', 'pattern': {'value': ')', 'flags': [], 'raw': '")"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 22: {'name': 'COMMA', 'pattern': {'value': ',', 'flags': [], 'raw': '","', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 23: {'origin': {'name': 'start', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'expression', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 24: {'origin': {'name': 'expression', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'ternary_expr', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 25: {'origin': {'name': 'ternary_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'logical_or_expr', '__type__': 'NonTerminal'}, {'name': 'QMARK', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'ternary_expr', '__type__': 'NonTerminal'}, {'name': 'COLON', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'ternary_expr', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 26: {'origin': {'name': 'ternary_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'logical_or_expr', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 27: {'origin': {'name': 'logical_or_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'logical_and_expr', '__type__': 'NonTerminal'}, {'name': '__logical_or_expr_star_0', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 28: {'origin': {'name': 'logical_or_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'logical_and_expr', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 29: {'origin': {'name': 'logical_and_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'comparison_expr', '__type__': 'NonTerminal'}, {'name': '__logical_and_expr_star_1', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 30: {'origin': {'name': 'logical_and_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'comparison_expr', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 31: {'origin': {'name': 'comparison_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'sum', '__type__': 'NonTerminal'}, {'name': '__ANON_2', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'sum', '__type__': 'NonTerminal'}], 'order': 0, 'alias': 'eq', 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 32: {'origin': {'name': 'comparison_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'sum', '__type__': 'NonTerminal'}, {'name': '__ANON_3', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'sum', '__type__': 'NonTerminal'}], 'order': 1, 'alias': 'ne', 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 33: {'origin': {'name': 'comparison_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'sum', '__type__': 'NonTerminal'}, {'name': 'LESSTHAN', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'sum', '__type__': 'NonTerminal'}], 'order': 2, 'alias': 'lt', 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 34: {'origin': {'name': 'comparison_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'sum', '__type__': 'NonTerminal'}, {'name': 'MORETHAN', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'sum', '__type__': 'NonTerminal'}], 'order': 3, 'alias': 'gt', 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 35: {'origin': {'name': 'comparison_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'sum', '__type__': 'NonTerminal'}, {'name': '__ANON_4', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'sum', '__type__': 'NonTerminal'}], 'order': 4, 'alias': 'le', 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 36: {'origin': {'name': 'comparison_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'sum', '__type__': 'NonTerminal'}, {'name': '__ANON_5', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'sum', '__type__': 'NonTerminal'}], 'order': 5, 'alias': 'ge', 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 37: {'origin': {'name': 'comparison_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'sum', '__type__': 'NonTerminal'}], 'order': 6, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 38: {'origin': {'name': 'sum', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'product', '__type__': 'NonTerminal'}, {'name': '__sum_star_2', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 39: {'origin': {'name': 'sum', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'product', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 40: {'origin': {'name': 'product', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'power', '__type__': 'NonTerminal'}, {'name': '__product_star_3', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 41: {'origin': {'name': 'product', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'power', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 42: {'origin': {'name': 'power', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'atom', '__type__': 'NonTerminal'}, {'name': '__power_star_4', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 43: {'origin': {'name': 'power', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'atom', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 44: {'origin': {'name': 'atom', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'MINUS', 'filter_out': False, '__type__': 'Terminal'}, {'name': 'atom', '__type__': 'NonTerminal'}], 'order': 0, 'alias': 'neg', 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 45: {'origin': {'name': 'atom', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'func_call', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 46: {'origin': {'name': 'atom', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'NUMBER', 'filter_out': False, '__type__': 'Terminal'}], 'order': 2, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 47: {'origin': {'name': 'atom', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'SELF', 'filter_out': False, '__type__': 'Terminal'}], 'order': 3, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 48: {'origin': {'name': 'atom', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'NAME', 'filter_out': False, '__type__': 'Terminal'}], 'order': 4, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 49: {'origin': {'name': 'atom', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'NAME', 'filter_out': False, '__type__': 'Terminal'}, {'name': 'DOT', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'NAME', 'filter_out': False, '__type__': 'Terminal'}], 'order': 5, 'alias': 'dotted_name', 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 50: {'origin': {'name': 'atom', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'LPAR', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'expression', '__type__': 'NonTerminal'}, {'name': 'RPAR', 'filter_out': True, '__type__': 'Terminal'}], 'order': 6, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 51: {'origin': {'name': 'add_op', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'PLUS', 'filter_out': False, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': True, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 52: {'origin': {'name': 'add_op', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'MINUS', 'filter_out': False, '__type__': 'Terminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': True, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 53: {'origin': {'name': 'mul_op', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'STAR', 'filter_out': False, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': True, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 54: {'origin': {'name': 'mul_op', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'DIV', 'filter_out': False, '__type__': 'Terminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': True, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 55: {'origin': {'name': 'func_call', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'NAME', 'filter_out': False, '__type__': 'Terminal'}, {'name': 'LPAR', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'arguments', '__type__': 'NonTerminal'}, {'name': 'RPAR', 'filter_out': True, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 56: {'origin': {'name': 'func_call', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'NAME', 'filter_out': False, '__type__': 'Terminal'}, {'name': 'LPAR', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'RPAR', 'filter_out': True, '__type__': 'Terminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (False, False, True, False), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 57: {'origin': {'name': 'arguments', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'expression', '__type__': 'NonTerminal'}, {'name': '__arguments_star_5', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 58: {'origin': {'name': 'arguments', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'expression', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 59: {'origin': {'name': '__logical_or_expr_star_0', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__ANON_0', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'logical_and_expr', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 60: {'origin': {'name': '__logical_or_expr_star_0', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__logical_or_expr_star_0', '__type__': 'NonTerminal'}, {'name': '__ANON_0', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'logical_and_expr', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 61: {'origin': {'name': '__logical_and_expr_star_1', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__ANON_1', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'comparison_expr', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 62: {'origin': {'name': '__logical_and_expr_star_1', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__logical_and_expr_star_1', '__type__': 'NonTerminal'}, {'name': '__ANON_1', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'comparison_expr', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 63: {'origin': {'name': '__sum_star_2', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'add_op', '__type__': 'NonTerminal'}, {'name': 'product', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 64: {'origin': {'name': '__sum_star_2', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__sum_star_2', '__type__': 'NonTerminal'}, {'name': 'add_op', '__type__': 'NonTerminal'}, {'name': 'product', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 65: {'origin': {'name': '__product_star_3', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'mul_op', '__type__': 'NonTerminal'}, {'name': 'power', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 66: {'origin': {'name': '__product_star_3', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__product_star_3', '__type__': 'NonTerminal'}, {'name': 'mul_op', '__type__': 'NonTerminal'}, {'name': 'power', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 67: {'origin': {'name': '__power_star_4', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'POWER', 'filter_out': False, '__type__': 'Terminal'}, {'name': 'atom', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 68: {'origin': {'name': '__power_star_4', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__power_star_4', '__type__': 'NonTerminal'}, {'name': 'POWER', 'filter_out': False, '__type__': 'Terminal'}, {'name': 'atom', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 69: {'origin': {'name': '__arguments_star_5', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'expression', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 70: {'origin': {'name': '__arguments_star_5', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__arguments_star_5', '__type__': 'NonTerminal'}, {'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'expression', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}}
3567
+ {0: {'name': 'WS', 'pattern': {'value': '(?:[ \t\x0c\r\n])+', 'flags': [], 'raw': None, '_width': [1, 18446744073709551616], '__type__': 'PatternRE'}, 'priority': 0, '__type__': 'TerminalDef'}, 1: {'name': 'SELF', 'pattern': {'value': 'SELF', 'flags': [], 'raw': '"SELF"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 2: {'name': 'PLUS', 'pattern': {'value': '+', 'flags': [], 'raw': '"+"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 3: {'name': 'MINUS', 'pattern': {'value': '-', 'flags': [], 'raw': '"-"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 4: {'name': 'STAR', 'pattern': {'value': '*', 'flags': [], 'raw': '"*"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 5: {'name': 'DIV', 'pattern': {'value': '/', 'flags': [], 'raw': '"/"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 6: {'name': 'POWER', 'pattern': {'value': '^', 'flags': [], 'raw': '"^"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 7: {'name': 'ASSIGN', 'pattern': {'value': '=', 'flags': [], 'raw': '"="', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 8: {'name': 'NUMBER', 'pattern': {'value': '\\d+(\\.\\d*)?|\\.\\d+', 'flags': [], 'raw': '/\\d+(\\.\\d*)?|\\.\\d+/', '_width': [1, 18446744073709551616], '__type__': 'PatternRE'}, 'priority': 0, '__type__': 'TerminalDef'}, 9: {'name': 'NAME', 'pattern': {'value': '[a-zA-Z_]\\w*', 'flags': [], 'raw': '/[a-zA-Z_]\\w*/', '_width': [1, 18446744073709551616], '__type__': 'PatternRE'}, 'priority': 0, '__type__': 'TerminalDef'}, 10: {'name': 'QMARK', 'pattern': {'value': '?', 'flags': [], 'raw': '"?"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 11: {'name': 'COLON', 'pattern': {'value': ':', 'flags': [], 'raw': '":"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 12: {'name': '__ANON_0', 'pattern': {'value': '||', 'flags': [], 'raw': '"||"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 13: {'name': '__ANON_1', 'pattern': {'value': '&&', 'flags': [], 'raw': '"&&"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 14: {'name': '__ANON_2', 'pattern': {'value': '==', 'flags': [], 'raw': '"=="', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 15: {'name': '__ANON_3', 'pattern': {'value': '!=', 'flags': [], 'raw': '"!="', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 16: {'name': 'LESSTHAN', 'pattern': {'value': '<', 'flags': [], 'raw': '"<"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 17: {'name': 'MORETHAN', 'pattern': {'value': '>', 'flags': [], 'raw': '">"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 18: {'name': '__ANON_4', 'pattern': {'value': '<=', 'flags': [], 'raw': '"<="', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 19: {'name': '__ANON_5', 'pattern': {'value': '>=', 'flags': [], 'raw': '">="', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 20: {'name': 'DOT', 'pattern': {'value': '.', 'flags': [], 'raw': '"."', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 21: {'name': 'LPAR', 'pattern': {'value': '(', 'flags': [], 'raw': '"("', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 22: {'name': 'RPAR', 'pattern': {'value': ')', 'flags': [], 'raw': '")"', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 23: {'name': 'COMMA', 'pattern': {'value': ',', 'flags': [], 'raw': '","', '__type__': 'PatternStr'}, 'priority': 0, '__type__': 'TerminalDef'}, 24: {'origin': {'name': 'start', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'expression', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 25: {'origin': {'name': 'expression', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'ternary_expr', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 26: {'origin': {'name': 'ternary_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'logical_or_expr', '__type__': 'NonTerminal'}, {'name': 'QMARK', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'ternary_expr', '__type__': 'NonTerminal'}, {'name': 'COLON', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'ternary_expr', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 27: {'origin': {'name': 'ternary_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'logical_or_expr', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 28: {'origin': {'name': 'logical_or_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'logical_and_expr', '__type__': 'NonTerminal'}, {'name': '__logical_or_expr_star_0', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 29: {'origin': {'name': 'logical_or_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'logical_and_expr', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 30: {'origin': {'name': 'logical_and_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'comparison_expr', '__type__': 'NonTerminal'}, {'name': '__logical_and_expr_star_1', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 31: {'origin': {'name': 'logical_and_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'comparison_expr', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 32: {'origin': {'name': 'comparison_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'sum', '__type__': 'NonTerminal'}, {'name': '__ANON_2', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'sum', '__type__': 'NonTerminal'}], 'order': 0, 'alias': 'eq', 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 33: {'origin': {'name': 'comparison_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'sum', '__type__': 'NonTerminal'}, {'name': '__ANON_3', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'sum', '__type__': 'NonTerminal'}], 'order': 1, 'alias': 'ne', 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 34: {'origin': {'name': 'comparison_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'sum', '__type__': 'NonTerminal'}, {'name': 'LESSTHAN', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'sum', '__type__': 'NonTerminal'}], 'order': 2, 'alias': 'lt', 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 35: {'origin': {'name': 'comparison_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'sum', '__type__': 'NonTerminal'}, {'name': 'MORETHAN', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'sum', '__type__': 'NonTerminal'}], 'order': 3, 'alias': 'gt', 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 36: {'origin': {'name': 'comparison_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'sum', '__type__': 'NonTerminal'}, {'name': '__ANON_4', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'sum', '__type__': 'NonTerminal'}], 'order': 4, 'alias': 'le', 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 37: {'origin': {'name': 'comparison_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'sum', '__type__': 'NonTerminal'}, {'name': '__ANON_5', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'sum', '__type__': 'NonTerminal'}], 'order': 5, 'alias': 'ge', 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 38: {'origin': {'name': 'comparison_expr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'sum', '__type__': 'NonTerminal'}], 'order': 6, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 39: {'origin': {'name': 'sum', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'product', '__type__': 'NonTerminal'}, {'name': '__sum_star_2', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 40: {'origin': {'name': 'sum', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'product', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 41: {'origin': {'name': 'product', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'power', '__type__': 'NonTerminal'}, {'name': '__product_star_3', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 42: {'origin': {'name': 'product', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'power', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 43: {'origin': {'name': 'power', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'atom', '__type__': 'NonTerminal'}, {'name': '__power_star_4', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 44: {'origin': {'name': 'power', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'atom', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 45: {'origin': {'name': 'atom', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'MINUS', 'filter_out': False, '__type__': 'Terminal'}, {'name': 'atom', '__type__': 'NonTerminal'}], 'order': 0, 'alias': 'neg', 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 46: {'origin': {'name': 'atom', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'func_call', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 47: {'origin': {'name': 'atom', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'NUMBER', 'filter_out': False, '__type__': 'Terminal'}], 'order': 2, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 48: {'origin': {'name': 'atom', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'SELF', 'filter_out': False, '__type__': 'Terminal'}], 'order': 3, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 49: {'origin': {'name': 'atom', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'NAME', 'filter_out': False, '__type__': 'Terminal'}], 'order': 4, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 50: {'origin': {'name': 'atom', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'NAME', 'filter_out': False, '__type__': 'Terminal'}, {'name': 'DOT', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'NAME', 'filter_out': False, '__type__': 'Terminal'}], 'order': 5, 'alias': 'dotted_name', 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 51: {'origin': {'name': 'atom', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'LPAR', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'expression', '__type__': 'NonTerminal'}, {'name': 'RPAR', 'filter_out': True, '__type__': 'Terminal'}], 'order': 6, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 52: {'origin': {'name': 'add_op', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'PLUS', 'filter_out': False, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': True, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 53: {'origin': {'name': 'add_op', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'MINUS', 'filter_out': False, '__type__': 'Terminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': True, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 54: {'origin': {'name': 'mul_op', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'STAR', 'filter_out': False, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': True, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 55: {'origin': {'name': 'mul_op', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'DIV', 'filter_out': False, '__type__': 'Terminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': True, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 56: {'origin': {'name': 'func_call', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'NAME', 'filter_out': False, '__type__': 'Terminal'}, {'name': 'LPAR', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'arguments', '__type__': 'NonTerminal'}, {'name': 'RPAR', 'filter_out': True, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 57: {'origin': {'name': 'func_call', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'NAME', 'filter_out': False, '__type__': 'Terminal'}, {'name': 'LPAR', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'RPAR', 'filter_out': True, '__type__': 'Terminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (False, False, True, False), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 58: {'origin': {'name': 'arguments', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'argument', '__type__': 'NonTerminal'}, {'name': '__arguments_star_5', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 59: {'origin': {'name': 'arguments', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'argument', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 60: {'origin': {'name': 'argument', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'expression', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 61: {'origin': {'name': 'argument', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'NAME', 'filter_out': False, '__type__': 'Terminal'}, {'name': 'ASSIGN', 'filter_out': False, '__type__': 'Terminal'}, {'name': 'expression', '__type__': 'NonTerminal'}], 'order': 1, 'alias': 'named_argument', 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 62: {'origin': {'name': '__logical_or_expr_star_0', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__ANON_0', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'logical_and_expr', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 63: {'origin': {'name': '__logical_or_expr_star_0', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__logical_or_expr_star_0', '__type__': 'NonTerminal'}, {'name': '__ANON_0', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'logical_and_expr', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 64: {'origin': {'name': '__logical_and_expr_star_1', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__ANON_1', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'comparison_expr', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 65: {'origin': {'name': '__logical_and_expr_star_1', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__logical_and_expr_star_1', '__type__': 'NonTerminal'}, {'name': '__ANON_1', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'comparison_expr', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 66: {'origin': {'name': '__sum_star_2', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'add_op', '__type__': 'NonTerminal'}, {'name': 'product', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 67: {'origin': {'name': '__sum_star_2', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__sum_star_2', '__type__': 'NonTerminal'}, {'name': 'add_op', '__type__': 'NonTerminal'}, {'name': 'product', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 68: {'origin': {'name': '__product_star_3', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'mul_op', '__type__': 'NonTerminal'}, {'name': 'power', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 69: {'origin': {'name': '__product_star_3', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__product_star_3', '__type__': 'NonTerminal'}, {'name': 'mul_op', '__type__': 'NonTerminal'}, {'name': 'power', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 70: {'origin': {'name': '__power_star_4', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'POWER', 'filter_out': False, '__type__': 'Terminal'}, {'name': 'atom', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 71: {'origin': {'name': '__power_star_4', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__power_star_4', '__type__': 'NonTerminal'}, {'name': 'POWER', 'filter_out': False, '__type__': 'Terminal'}, {'name': 'atom', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 72: {'origin': {'name': '__arguments_star_5', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'argument', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 73: {'origin': {'name': '__arguments_star_5', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__arguments_star_5', '__type__': 'NonTerminal'}, {'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'argument', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}}
3568
3568
  )
3569
3569
  Shift = 0
3570
3570
  Reduce = 1
@@ -117,15 +117,25 @@ class AlphaTransformer(Transformer):
117
117
  def arguments(self, *args):
118
118
  rounded = []
119
119
  for arg in args:
120
- try:
121
- val = float(arg)
122
- if '.' in arg and val == val:
123
- arg = str(round(val))
124
- except (ValueError, TypeError):
125
- pass
126
- rounded.append(arg)
120
+ if isinstance(arg, tuple):
121
+ name, val = arg
122
+ rounded.append(f"{name}={val}")
123
+ else:
124
+ try:
125
+ val = float(arg)
126
+ if '.' in arg and val == arg:
127
+ arg = str(round(val))
128
+ except (ValueError, TypeError):
129
+ pass
130
+ rounded.append(arg)
127
131
  return ", ".join(rounded)
128
132
 
133
+ def named_argument(self, name, assign, value):
134
+ name_str = str(name)
135
+ if name_str.startswith("ctx('") and name_str.endswith("')"):
136
+ name_str = name_str[5:-2]
137
+ return (name_str, value)
138
+
129
139
  def NAME(self, name):
130
140
  name = str(name)
131
141
  if self.name_convertor: