Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +4 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/__pycache__/__init__.cpython-310.pyc +0 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/__pycache__/_build_autolev_antlr.cpython-310.pyc +0 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/__pycache__/_listener_autolev_antlr.cpython-310.pyc +0 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/_antlr/__init__.py +5 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/_antlr/__pycache__/__init__.cpython-310.pyc +0 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/_antlr/__pycache__/autolevlexer.cpython-310.pyc +0 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/_antlr/__pycache__/autolevparser.cpython-310.pyc +0 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/_antlr/autolevlexer.py +253 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/_antlr/autolevlistener.py +421 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/_antlr/autolevparser.py +0 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/__pycache__/ruletest12.cpython-310.pyc +0 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/__pycache__/ruletest6.cpython-310.pyc +0 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/pydy-example-repo/__pycache__/chaos_pendulum.cpython-310.pyc +0 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/pydy-example-repo/__pycache__/double_pendulum.cpython-310.pyc +0 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/pydy-example-repo/__pycache__/mass_spring_damper.cpython-310.pyc +0 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/pydy-example-repo/__pycache__/non_min_pendulum.cpython-310.pyc +0 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/pydy-example-repo/chaos_pendulum.py +55 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/pydy-example-repo/mass_spring_damper.py +31 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/pydy-example-repo/non_min_pendulum.al +20 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/pydy-example-repo/non_min_pendulum.py +36 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/ruletest10.al +58 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/ruletest10.py +64 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/ruletest12.py +14 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/ruletest3.al +25 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/ruletest3.py +37 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/ruletest4.al +20 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/ruletest4.py +20 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/ruletest5.al +32 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/ruletest6.py +36 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/ruletest8.al +38 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/c/c_parser.py +1058 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/latex/__pycache__/__init__.cpython-310.pyc +0 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/latex/__pycache__/_build_latex_antlr.cpython-310.pyc +0 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/latex/__pycache__/_parse_latex_antlr.cpython-310.pyc +0 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/latex/__pycache__/errors.cpython-310.pyc +0 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/latex/_antlr/__init__.py +9 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/latex/_antlr/__pycache__/__init__.cpython-310.pyc +0 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/latex/_antlr/latexlexer.py +512 -0
- evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/latex/_antlr/latexparser.py +0 -0
- evalkit_internvl/lib/python3.10/site-packages/transformers/__pycache__/__init__.cpython-310.pyc +3 -0
- evalkit_internvl/lib/python3.10/site-packages/transformers/__pycache__/modeling_outputs.cpython-310.pyc +3 -0
- evalkit_internvl/lib/python3.10/site-packages/transformers/utils/__pycache__/dummy_pt_objects.cpython-310.pyc +3 -0
- evalkit_tf437/lib/python3.10/site-packages/diffusers/models/autoencoders/__pycache__/vae.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/diffusers/models/transformers/__init__.py +9 -0
- evalkit_tf437/lib/python3.10/site-packages/diffusers/models/transformers/__pycache__/__init__.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/diffusers/models/transformers/__pycache__/prior_transformer.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/diffusers/models/transformers/__pycache__/t5_film_transformer.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/diffusers/models/transformers/__pycache__/transformer_2d.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/diffusers/models/transformers/dual_transformer_2d.py +155 -0
.gitattributes
CHANGED
|
@@ -597,3 +597,7 @@ evalkit_internvl/lib/python3.10/site-packages/transformers/utils/__pycache__/dum
|
|
| 597 |
evalkit_internvl/lib/python3.10/site-packages/transformers/__pycache__/modeling_utils.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
| 598 |
evalkit_internvl/lib/python3.10/site-packages/transformers/__pycache__/training_args.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
| 599 |
evalkit_internvl/lib/python3.10/site-packages/transformers/__pycache__/modeling_tf_utils.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 597 |
evalkit_internvl/lib/python3.10/site-packages/transformers/__pycache__/modeling_utils.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
| 598 |
evalkit_internvl/lib/python3.10/site-packages/transformers/__pycache__/training_args.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
| 599 |
evalkit_internvl/lib/python3.10/site-packages/transformers/__pycache__/modeling_tf_utils.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
| 600 |
+
evalkit_internvl/lib/python3.10/site-packages/transformers/__pycache__/__init__.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
| 601 |
+
evalkit_tf449/lib/python3.10/site-packages/triton/backends/nvidia/lib/cupti/libnvperf_host.so filter=lfs diff=lfs merge=lfs -text
|
| 602 |
+
evalkit_internvl/lib/python3.10/site-packages/transformers/utils/__pycache__/dummy_pt_objects.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
| 603 |
+
evalkit_internvl/lib/python3.10/site-packages/transformers/__pycache__/modeling_outputs.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (3.8 kB). View file
|
|
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/__pycache__/_build_autolev_antlr.cpython-310.pyc
ADDED
|
Binary file (2.49 kB). View file
|
|
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/__pycache__/_listener_autolev_antlr.cpython-310.pyc
ADDED
|
Binary file (50.4 kB). View file
|
|
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/_antlr/__init__.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# *** GENERATED BY `setup.py antlr`, DO NOT EDIT BY HAND ***
|
| 2 |
+
#
|
| 3 |
+
# Generated with antlr4
|
| 4 |
+
# antlr4 is licensed under the BSD-3-Clause License
|
| 5 |
+
# https://github.com/antlr/antlr4/blob/master/LICENSE.txt
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/_antlr/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (190 Bytes). View file
|
|
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/_antlr/__pycache__/autolevlexer.cpython-310.pyc
ADDED
|
Binary file (20.8 kB). View file
|
|
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/_antlr/__pycache__/autolevparser.cpython-310.pyc
ADDED
|
Binary file (94.5 kB). View file
|
|
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/_antlr/autolevlexer.py
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# *** GENERATED BY `setup.py antlr`, DO NOT EDIT BY HAND ***
|
| 2 |
+
#
|
| 3 |
+
# Generated with antlr4
|
| 4 |
+
# antlr4 is licensed under the BSD-3-Clause License
|
| 5 |
+
# https://github.com/antlr/antlr4/blob/master/LICENSE.txt
|
| 6 |
+
from antlr4 import *
|
| 7 |
+
from io import StringIO
|
| 8 |
+
import sys
|
| 9 |
+
if sys.version_info[1] > 5:
|
| 10 |
+
from typing import TextIO
|
| 11 |
+
else:
|
| 12 |
+
from typing.io import TextIO
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def serializedATN():
|
| 16 |
+
return [
|
| 17 |
+
4,0,49,393,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,
|
| 18 |
+
2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,
|
| 19 |
+
13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,
|
| 20 |
+
19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,
|
| 21 |
+
26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,
|
| 22 |
+
32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,
|
| 23 |
+
39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,
|
| 24 |
+
45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,1,0,1,0,1,1,
|
| 25 |
+
1,1,1,2,1,2,1,3,1,3,1,3,1,4,1,4,1,4,1,5,1,5,1,5,1,6,1,6,1,6,1,7,
|
| 26 |
+
1,7,1,7,1,8,1,8,1,8,1,9,1,9,1,10,1,10,1,11,1,11,1,12,1,12,1,13,1,
|
| 27 |
+
13,1,14,1,14,1,15,1,15,1,16,1,16,1,17,1,17,1,18,1,18,1,19,1,19,1,
|
| 28 |
+
20,1,20,1,21,1,21,1,21,1,22,1,22,1,22,1,22,1,23,1,23,1,24,1,24,1,
|
| 29 |
+
25,1,25,1,26,1,26,1,26,1,26,1,26,1,27,1,27,1,27,1,27,1,27,1,27,1,
|
| 30 |
+
27,1,27,1,28,1,28,1,28,1,28,1,28,1,28,3,28,184,8,28,1,29,1,29,1,
|
| 31 |
+
29,1,29,1,29,1,29,1,29,1,30,1,30,1,30,1,30,1,30,1,31,1,31,1,31,1,
|
| 32 |
+
31,1,31,1,31,1,31,1,31,1,31,1,31,1,31,1,32,1,32,1,32,1,32,1,32,1,
|
| 33 |
+
32,1,32,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,34,1,
|
| 34 |
+
34,1,34,1,34,1,34,1,34,3,34,232,8,34,1,35,1,35,1,35,1,35,1,35,1,
|
| 35 |
+
35,3,35,240,8,35,1,36,1,36,1,36,1,36,1,36,1,36,1,36,1,36,1,36,3,
|
| 36 |
+
36,251,8,36,1,37,1,37,1,37,1,37,1,37,1,37,3,37,259,8,37,1,38,1,38,
|
| 37 |
+
1,38,1,38,1,38,1,38,1,38,1,38,1,38,3,38,270,8,38,1,39,1,39,1,39,
|
| 38 |
+
1,39,1,39,1,39,1,39,1,39,1,39,1,39,3,39,282,8,39,1,40,1,40,1,40,
|
| 39 |
+
1,40,1,40,1,40,1,40,1,40,1,40,1,40,1,41,1,41,1,41,1,41,1,41,1,41,
|
| 40 |
+
1,41,1,41,1,41,3,41,303,8,41,1,42,1,42,1,42,1,42,1,42,1,42,1,42,
|
| 41 |
+
1,42,1,42,1,42,1,42,1,42,1,42,1,42,1,42,3,42,320,8,42,1,43,5,43,
|
| 42 |
+
323,8,43,10,43,12,43,326,9,43,1,44,1,44,1,45,4,45,331,8,45,11,45,
|
| 43 |
+
12,45,332,1,46,4,46,336,8,46,11,46,12,46,337,1,46,1,46,5,46,342,
|
| 44 |
+
8,46,10,46,12,46,345,9,46,1,46,1,46,4,46,349,8,46,11,46,12,46,350,
|
| 45 |
+
3,46,353,8,46,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,3,47,
|
| 46 |
+
364,8,47,1,48,1,48,5,48,368,8,48,10,48,12,48,371,9,48,1,48,3,48,
|
| 47 |
+
374,8,48,1,48,1,48,1,48,1,48,1,49,1,49,5,49,382,8,49,10,49,12,49,
|
| 48 |
+
385,9,49,1,50,4,50,388,8,50,11,50,12,50,389,1,50,1,50,1,369,0,51,
|
| 49 |
+
1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,
|
| 50 |
+
27,14,29,15,31,16,33,17,35,18,37,19,39,20,41,21,43,22,45,23,47,24,
|
| 51 |
+
49,25,51,26,53,27,55,28,57,29,59,30,61,31,63,32,65,33,67,34,69,35,
|
| 52 |
+
71,36,73,37,75,38,77,39,79,40,81,41,83,42,85,43,87,0,89,0,91,44,
|
| 53 |
+
93,45,95,46,97,47,99,48,101,49,1,0,24,2,0,77,77,109,109,2,0,65,65,
|
| 54 |
+
97,97,2,0,83,83,115,115,2,0,73,73,105,105,2,0,78,78,110,110,2,0,
|
| 55 |
+
69,69,101,101,2,0,82,82,114,114,2,0,84,84,116,116,2,0,80,80,112,
|
| 56 |
+
112,2,0,85,85,117,117,2,0,79,79,111,111,2,0,86,86,118,118,2,0,89,
|
| 57 |
+
89,121,121,2,0,67,67,99,99,2,0,68,68,100,100,2,0,87,87,119,119,2,
|
| 58 |
+
0,70,70,102,102,2,0,66,66,98,98,2,0,76,76,108,108,2,0,71,71,103,
|
| 59 |
+
103,1,0,48,57,2,0,65,90,97,122,4,0,48,57,65,90,95,95,97,122,4,0,
|
| 60 |
+
9,10,13,13,32,32,38,38,410,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,0,
|
| 61 |
+
7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,17,
|
| 62 |
+
1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,27,
|
| 63 |
+
1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,37,
|
| 64 |
+
1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,47,
|
| 65 |
+
1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0,57,
|
| 66 |
+
1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0,67,
|
| 67 |
+
1,0,0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75,1,0,0,0,0,77,
|
| 68 |
+
1,0,0,0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85,1,0,0,0,0,91,
|
| 69 |
+
1,0,0,0,0,93,1,0,0,0,0,95,1,0,0,0,0,97,1,0,0,0,0,99,1,0,0,0,0,101,
|
| 70 |
+
1,0,0,0,1,103,1,0,0,0,3,105,1,0,0,0,5,107,1,0,0,0,7,109,1,0,0,0,
|
| 71 |
+
9,112,1,0,0,0,11,115,1,0,0,0,13,118,1,0,0,0,15,121,1,0,0,0,17,124,
|
| 72 |
+
1,0,0,0,19,127,1,0,0,0,21,129,1,0,0,0,23,131,1,0,0,0,25,133,1,0,
|
| 73 |
+
0,0,27,135,1,0,0,0,29,137,1,0,0,0,31,139,1,0,0,0,33,141,1,0,0,0,
|
| 74 |
+
35,143,1,0,0,0,37,145,1,0,0,0,39,147,1,0,0,0,41,149,1,0,0,0,43,151,
|
| 75 |
+
1,0,0,0,45,154,1,0,0,0,47,158,1,0,0,0,49,160,1,0,0,0,51,162,1,0,
|
| 76 |
+
0,0,53,164,1,0,0,0,55,169,1,0,0,0,57,177,1,0,0,0,59,185,1,0,0,0,
|
| 77 |
+
61,192,1,0,0,0,63,197,1,0,0,0,65,208,1,0,0,0,67,215,1,0,0,0,69,225,
|
| 78 |
+
1,0,0,0,71,233,1,0,0,0,73,241,1,0,0,0,75,252,1,0,0,0,77,260,1,0,
|
| 79 |
+
0,0,79,271,1,0,0,0,81,283,1,0,0,0,83,293,1,0,0,0,85,304,1,0,0,0,
|
| 80 |
+
87,324,1,0,0,0,89,327,1,0,0,0,91,330,1,0,0,0,93,352,1,0,0,0,95,363,
|
| 81 |
+
1,0,0,0,97,365,1,0,0,0,99,379,1,0,0,0,101,387,1,0,0,0,103,104,5,
|
| 82 |
+
91,0,0,104,2,1,0,0,0,105,106,5,93,0,0,106,4,1,0,0,0,107,108,5,61,
|
| 83 |
+
0,0,108,6,1,0,0,0,109,110,5,43,0,0,110,111,5,61,0,0,111,8,1,0,0,
|
| 84 |
+
0,112,113,5,45,0,0,113,114,5,61,0,0,114,10,1,0,0,0,115,116,5,58,
|
| 85 |
+
0,0,116,117,5,61,0,0,117,12,1,0,0,0,118,119,5,42,0,0,119,120,5,61,
|
| 86 |
+
0,0,120,14,1,0,0,0,121,122,5,47,0,0,122,123,5,61,0,0,123,16,1,0,
|
| 87 |
+
0,0,124,125,5,94,0,0,125,126,5,61,0,0,126,18,1,0,0,0,127,128,5,44,
|
| 88 |
+
0,0,128,20,1,0,0,0,129,130,5,39,0,0,130,22,1,0,0,0,131,132,5,40,
|
| 89 |
+
0,0,132,24,1,0,0,0,133,134,5,41,0,0,134,26,1,0,0,0,135,136,5,123,
|
| 90 |
+
0,0,136,28,1,0,0,0,137,138,5,125,0,0,138,30,1,0,0,0,139,140,5,58,
|
| 91 |
+
0,0,140,32,1,0,0,0,141,142,5,43,0,0,142,34,1,0,0,0,143,144,5,45,
|
| 92 |
+
0,0,144,36,1,0,0,0,145,146,5,59,0,0,146,38,1,0,0,0,147,148,5,46,
|
| 93 |
+
0,0,148,40,1,0,0,0,149,150,5,62,0,0,150,42,1,0,0,0,151,152,5,48,
|
| 94 |
+
0,0,152,153,5,62,0,0,153,44,1,0,0,0,154,155,5,49,0,0,155,156,5,62,
|
| 95 |
+
0,0,156,157,5,62,0,0,157,46,1,0,0,0,158,159,5,94,0,0,159,48,1,0,
|
| 96 |
+
0,0,160,161,5,42,0,0,161,50,1,0,0,0,162,163,5,47,0,0,163,52,1,0,
|
| 97 |
+
0,0,164,165,7,0,0,0,165,166,7,1,0,0,166,167,7,2,0,0,167,168,7,2,
|
| 98 |
+
0,0,168,54,1,0,0,0,169,170,7,3,0,0,170,171,7,4,0,0,171,172,7,5,0,
|
| 99 |
+
0,172,173,7,6,0,0,173,174,7,7,0,0,174,175,7,3,0,0,175,176,7,1,0,
|
| 100 |
+
0,176,56,1,0,0,0,177,178,7,3,0,0,178,179,7,4,0,0,179,180,7,8,0,0,
|
| 101 |
+
180,181,7,9,0,0,181,183,7,7,0,0,182,184,7,2,0,0,183,182,1,0,0,0,
|
| 102 |
+
183,184,1,0,0,0,184,58,1,0,0,0,185,186,7,10,0,0,186,187,7,9,0,0,
|
| 103 |
+
187,188,7,7,0,0,188,189,7,8,0,0,189,190,7,9,0,0,190,191,7,7,0,0,
|
| 104 |
+
191,60,1,0,0,0,192,193,7,2,0,0,193,194,7,1,0,0,194,195,7,11,0,0,
|
| 105 |
+
195,196,7,5,0,0,196,62,1,0,0,0,197,198,7,9,0,0,198,199,7,4,0,0,199,
|
| 106 |
+
200,7,3,0,0,200,201,7,7,0,0,201,202,7,2,0,0,202,203,7,12,0,0,203,
|
| 107 |
+
204,7,2,0,0,204,205,7,7,0,0,205,206,7,5,0,0,206,207,7,0,0,0,207,
|
| 108 |
+
64,1,0,0,0,208,209,7,5,0,0,209,210,7,4,0,0,210,211,7,13,0,0,211,
|
| 109 |
+
212,7,10,0,0,212,213,7,14,0,0,213,214,7,5,0,0,214,66,1,0,0,0,215,
|
| 110 |
+
216,7,4,0,0,216,217,7,5,0,0,217,218,7,15,0,0,218,219,7,7,0,0,219,
|
| 111 |
+
220,7,10,0,0,220,221,7,4,0,0,221,222,7,3,0,0,222,223,7,1,0,0,223,
|
| 112 |
+
224,7,4,0,0,224,68,1,0,0,0,225,226,7,16,0,0,226,227,7,6,0,0,227,
|
| 113 |
+
228,7,1,0,0,228,229,7,0,0,0,229,231,7,5,0,0,230,232,7,2,0,0,231,
|
| 114 |
+
230,1,0,0,0,231,232,1,0,0,0,232,70,1,0,0,0,233,234,7,17,0,0,234,
|
| 115 |
+
235,7,10,0,0,235,236,7,14,0,0,236,237,7,3,0,0,237,239,7,5,0,0,238,
|
| 116 |
+
240,7,2,0,0,239,238,1,0,0,0,239,240,1,0,0,0,240,72,1,0,0,0,241,242,
|
| 117 |
+
7,8,0,0,242,243,7,1,0,0,243,244,7,6,0,0,244,245,7,7,0,0,245,246,
|
| 118 |
+
7,3,0,0,246,247,7,13,0,0,247,248,7,18,0,0,248,250,7,5,0,0,249,251,
|
| 119 |
+
7,2,0,0,250,249,1,0,0,0,250,251,1,0,0,0,251,74,1,0,0,0,252,253,7,
|
| 120 |
+
8,0,0,253,254,7,10,0,0,254,255,7,3,0,0,255,256,7,4,0,0,256,258,7,
|
| 121 |
+
7,0,0,257,259,7,2,0,0,258,257,1,0,0,0,258,259,1,0,0,0,259,76,1,0,
|
| 122 |
+
0,0,260,261,7,13,0,0,261,262,7,10,0,0,262,263,7,4,0,0,263,264,7,
|
| 123 |
+
2,0,0,264,265,7,7,0,0,265,266,7,1,0,0,266,267,7,4,0,0,267,269,7,
|
| 124 |
+
7,0,0,268,270,7,2,0,0,269,268,1,0,0,0,269,270,1,0,0,0,270,78,1,0,
|
| 125 |
+
0,0,271,272,7,2,0,0,272,273,7,8,0,0,273,274,7,5,0,0,274,275,7,13,
|
| 126 |
+
0,0,275,276,7,3,0,0,276,277,7,16,0,0,277,278,7,3,0,0,278,279,7,5,
|
| 127 |
+
0,0,279,281,7,14,0,0,280,282,7,2,0,0,281,280,1,0,0,0,281,282,1,0,
|
| 128 |
+
0,0,282,80,1,0,0,0,283,284,7,3,0,0,284,285,7,0,0,0,285,286,7,1,0,
|
| 129 |
+
0,286,287,7,19,0,0,287,288,7,3,0,0,288,289,7,4,0,0,289,290,7,1,0,
|
| 130 |
+
0,290,291,7,6,0,0,291,292,7,12,0,0,292,82,1,0,0,0,293,294,7,11,0,
|
| 131 |
+
0,294,295,7,1,0,0,295,296,7,6,0,0,296,297,7,3,0,0,297,298,7,1,0,
|
| 132 |
+
0,298,299,7,17,0,0,299,300,7,18,0,0,300,302,7,5,0,0,301,303,7,2,
|
| 133 |
+
0,0,302,301,1,0,0,0,302,303,1,0,0,0,303,84,1,0,0,0,304,305,7,0,0,
|
| 134 |
+
0,305,306,7,10,0,0,306,307,7,7,0,0,307,308,7,3,0,0,308,309,7,10,
|
| 135 |
+
0,0,309,310,7,4,0,0,310,311,7,11,0,0,311,312,7,1,0,0,312,313,7,6,
|
| 136 |
+
0,0,313,314,7,3,0,0,314,315,7,1,0,0,315,316,7,17,0,0,316,317,7,18,
|
| 137 |
+
0,0,317,319,7,5,0,0,318,320,7,2,0,0,319,318,1,0,0,0,319,320,1,0,
|
| 138 |
+
0,0,320,86,1,0,0,0,321,323,5,39,0,0,322,321,1,0,0,0,323,326,1,0,
|
| 139 |
+
0,0,324,322,1,0,0,0,324,325,1,0,0,0,325,88,1,0,0,0,326,324,1,0,0,
|
| 140 |
+
0,327,328,7,20,0,0,328,90,1,0,0,0,329,331,7,20,0,0,330,329,1,0,0,
|
| 141 |
+
0,331,332,1,0,0,0,332,330,1,0,0,0,332,333,1,0,0,0,333,92,1,0,0,0,
|
| 142 |
+
334,336,3,89,44,0,335,334,1,0,0,0,336,337,1,0,0,0,337,335,1,0,0,
|
| 143 |
+
0,337,338,1,0,0,0,338,339,1,0,0,0,339,343,5,46,0,0,340,342,3,89,
|
| 144 |
+
44,0,341,340,1,0,0,0,342,345,1,0,0,0,343,341,1,0,0,0,343,344,1,0,
|
| 145 |
+
0,0,344,353,1,0,0,0,345,343,1,0,0,0,346,348,5,46,0,0,347,349,3,89,
|
| 146 |
+
44,0,348,347,1,0,0,0,349,350,1,0,0,0,350,348,1,0,0,0,350,351,1,0,
|
| 147 |
+
0,0,351,353,1,0,0,0,352,335,1,0,0,0,352,346,1,0,0,0,353,94,1,0,0,
|
| 148 |
+
0,354,355,3,93,46,0,355,356,5,69,0,0,356,357,3,91,45,0,357,364,1,
|
| 149 |
+
0,0,0,358,359,3,93,46,0,359,360,5,69,0,0,360,361,5,45,0,0,361,362,
|
| 150 |
+
3,91,45,0,362,364,1,0,0,0,363,354,1,0,0,0,363,358,1,0,0,0,364,96,
|
| 151 |
+
1,0,0,0,365,369,5,37,0,0,366,368,9,0,0,0,367,366,1,0,0,0,368,371,
|
| 152 |
+
1,0,0,0,369,370,1,0,0,0,369,367,1,0,0,0,370,373,1,0,0,0,371,369,
|
| 153 |
+
1,0,0,0,372,374,5,13,0,0,373,372,1,0,0,0,373,374,1,0,0,0,374,375,
|
| 154 |
+
1,0,0,0,375,376,5,10,0,0,376,377,1,0,0,0,377,378,6,48,0,0,378,98,
|
| 155 |
+
1,0,0,0,379,383,7,21,0,0,380,382,7,22,0,0,381,380,1,0,0,0,382,385,
|
| 156 |
+
1,0,0,0,383,381,1,0,0,0,383,384,1,0,0,0,384,100,1,0,0,0,385,383,
|
| 157 |
+
1,0,0,0,386,388,7,23,0,0,387,386,1,0,0,0,388,389,1,0,0,0,389,387,
|
| 158 |
+
1,0,0,0,389,390,1,0,0,0,390,391,1,0,0,0,391,392,6,50,0,0,392,102,
|
| 159 |
+
1,0,0,0,21,0,183,231,239,250,258,269,281,302,319,324,332,337,343,
|
| 160 |
+
350,352,363,369,373,383,389,1,6,0,0
|
| 161 |
+
]
|
| 162 |
+
|
| 163 |
+
class AutolevLexer(Lexer):
|
| 164 |
+
|
| 165 |
+
atn = ATNDeserializer().deserialize(serializedATN())
|
| 166 |
+
|
| 167 |
+
decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]
|
| 168 |
+
|
| 169 |
+
T__0 = 1
|
| 170 |
+
T__1 = 2
|
| 171 |
+
T__2 = 3
|
| 172 |
+
T__3 = 4
|
| 173 |
+
T__4 = 5
|
| 174 |
+
T__5 = 6
|
| 175 |
+
T__6 = 7
|
| 176 |
+
T__7 = 8
|
| 177 |
+
T__8 = 9
|
| 178 |
+
T__9 = 10
|
| 179 |
+
T__10 = 11
|
| 180 |
+
T__11 = 12
|
| 181 |
+
T__12 = 13
|
| 182 |
+
T__13 = 14
|
| 183 |
+
T__14 = 15
|
| 184 |
+
T__15 = 16
|
| 185 |
+
T__16 = 17
|
| 186 |
+
T__17 = 18
|
| 187 |
+
T__18 = 19
|
| 188 |
+
T__19 = 20
|
| 189 |
+
T__20 = 21
|
| 190 |
+
T__21 = 22
|
| 191 |
+
T__22 = 23
|
| 192 |
+
T__23 = 24
|
| 193 |
+
T__24 = 25
|
| 194 |
+
T__25 = 26
|
| 195 |
+
Mass = 27
|
| 196 |
+
Inertia = 28
|
| 197 |
+
Input = 29
|
| 198 |
+
Output = 30
|
| 199 |
+
Save = 31
|
| 200 |
+
UnitSystem = 32
|
| 201 |
+
Encode = 33
|
| 202 |
+
Newtonian = 34
|
| 203 |
+
Frames = 35
|
| 204 |
+
Bodies = 36
|
| 205 |
+
Particles = 37
|
| 206 |
+
Points = 38
|
| 207 |
+
Constants = 39
|
| 208 |
+
Specifieds = 40
|
| 209 |
+
Imaginary = 41
|
| 210 |
+
Variables = 42
|
| 211 |
+
MotionVariables = 43
|
| 212 |
+
INT = 44
|
| 213 |
+
FLOAT = 45
|
| 214 |
+
EXP = 46
|
| 215 |
+
LINE_COMMENT = 47
|
| 216 |
+
ID = 48
|
| 217 |
+
WS = 49
|
| 218 |
+
|
| 219 |
+
channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ]
|
| 220 |
+
|
| 221 |
+
modeNames = [ "DEFAULT_MODE" ]
|
| 222 |
+
|
| 223 |
+
literalNames = [ "<INVALID>",
|
| 224 |
+
"'['", "']'", "'='", "'+='", "'-='", "':='", "'*='", "'/='",
|
| 225 |
+
"'^='", "','", "'''", "'('", "')'", "'{'", "'}'", "':'", "'+'",
|
| 226 |
+
"'-'", "';'", "'.'", "'>'", "'0>'", "'1>>'", "'^'", "'*'", "'/'" ]
|
| 227 |
+
|
| 228 |
+
symbolicNames = [ "<INVALID>",
|
| 229 |
+
"Mass", "Inertia", "Input", "Output", "Save", "UnitSystem",
|
| 230 |
+
"Encode", "Newtonian", "Frames", "Bodies", "Particles", "Points",
|
| 231 |
+
"Constants", "Specifieds", "Imaginary", "Variables", "MotionVariables",
|
| 232 |
+
"INT", "FLOAT", "EXP", "LINE_COMMENT", "ID", "WS" ]
|
| 233 |
+
|
| 234 |
+
ruleNames = [ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6",
|
| 235 |
+
"T__7", "T__8", "T__9", "T__10", "T__11", "T__12", "T__13",
|
| 236 |
+
"T__14", "T__15", "T__16", "T__17", "T__18", "T__19",
|
| 237 |
+
"T__20", "T__21", "T__22", "T__23", "T__24", "T__25",
|
| 238 |
+
"Mass", "Inertia", "Input", "Output", "Save", "UnitSystem",
|
| 239 |
+
"Encode", "Newtonian", "Frames", "Bodies", "Particles",
|
| 240 |
+
"Points", "Constants", "Specifieds", "Imaginary", "Variables",
|
| 241 |
+
"MotionVariables", "DIFF", "DIGIT", "INT", "FLOAT", "EXP",
|
| 242 |
+
"LINE_COMMENT", "ID", "WS" ]
|
| 243 |
+
|
| 244 |
+
grammarFileName = "Autolev.g4"
|
| 245 |
+
|
| 246 |
+
def __init__(self, input=None, output:TextIO = sys.stdout):
|
| 247 |
+
super().__init__(input, output)
|
| 248 |
+
self.checkVersion("4.11.1")
|
| 249 |
+
self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache())
|
| 250 |
+
self._actions = None
|
| 251 |
+
self._predicates = None
|
| 252 |
+
|
| 253 |
+
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/_antlr/autolevlistener.py
ADDED
|
@@ -0,0 +1,421 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# *** GENERATED BY `setup.py antlr`, DO NOT EDIT BY HAND ***
|
| 2 |
+
#
|
| 3 |
+
# Generated with antlr4
|
| 4 |
+
# antlr4 is licensed under the BSD-3-Clause License
|
| 5 |
+
# https://github.com/antlr/antlr4/blob/master/LICENSE.txt
|
| 6 |
+
from antlr4 import *
|
| 7 |
+
if __name__ is not None and "." in __name__:
|
| 8 |
+
from .autolevparser import AutolevParser
|
| 9 |
+
else:
|
| 10 |
+
from autolevparser import AutolevParser
|
| 11 |
+
|
| 12 |
+
# This class defines a complete listener for a parse tree produced by AutolevParser.
|
| 13 |
+
class AutolevListener(ParseTreeListener):
|
| 14 |
+
|
| 15 |
+
# Enter a parse tree produced by AutolevParser#prog.
|
| 16 |
+
def enterProg(self, ctx:AutolevParser.ProgContext):
|
| 17 |
+
pass
|
| 18 |
+
|
| 19 |
+
# Exit a parse tree produced by AutolevParser#prog.
|
| 20 |
+
def exitProg(self, ctx:AutolevParser.ProgContext):
|
| 21 |
+
pass
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
# Enter a parse tree produced by AutolevParser#stat.
|
| 25 |
+
def enterStat(self, ctx:AutolevParser.StatContext):
|
| 26 |
+
pass
|
| 27 |
+
|
| 28 |
+
# Exit a parse tree produced by AutolevParser#stat.
|
| 29 |
+
def exitStat(self, ctx:AutolevParser.StatContext):
|
| 30 |
+
pass
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
# Enter a parse tree produced by AutolevParser#vecAssign.
|
| 34 |
+
def enterVecAssign(self, ctx:AutolevParser.VecAssignContext):
|
| 35 |
+
pass
|
| 36 |
+
|
| 37 |
+
# Exit a parse tree produced by AutolevParser#vecAssign.
|
| 38 |
+
def exitVecAssign(self, ctx:AutolevParser.VecAssignContext):
|
| 39 |
+
pass
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
# Enter a parse tree produced by AutolevParser#indexAssign.
|
| 43 |
+
def enterIndexAssign(self, ctx:AutolevParser.IndexAssignContext):
|
| 44 |
+
pass
|
| 45 |
+
|
| 46 |
+
# Exit a parse tree produced by AutolevParser#indexAssign.
|
| 47 |
+
def exitIndexAssign(self, ctx:AutolevParser.IndexAssignContext):
|
| 48 |
+
pass
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
# Enter a parse tree produced by AutolevParser#regularAssign.
|
| 52 |
+
def enterRegularAssign(self, ctx:AutolevParser.RegularAssignContext):
|
| 53 |
+
pass
|
| 54 |
+
|
| 55 |
+
# Exit a parse tree produced by AutolevParser#regularAssign.
|
| 56 |
+
def exitRegularAssign(self, ctx:AutolevParser.RegularAssignContext):
|
| 57 |
+
pass
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
# Enter a parse tree produced by AutolevParser#equals.
|
| 61 |
+
def enterEquals(self, ctx:AutolevParser.EqualsContext):
|
| 62 |
+
pass
|
| 63 |
+
|
| 64 |
+
# Exit a parse tree produced by AutolevParser#equals.
|
| 65 |
+
def exitEquals(self, ctx:AutolevParser.EqualsContext):
|
| 66 |
+
pass
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
# Enter a parse tree produced by AutolevParser#index.
|
| 70 |
+
def enterIndex(self, ctx:AutolevParser.IndexContext):
|
| 71 |
+
pass
|
| 72 |
+
|
| 73 |
+
# Exit a parse tree produced by AutolevParser#index.
|
| 74 |
+
def exitIndex(self, ctx:AutolevParser.IndexContext):
|
| 75 |
+
pass
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
# Enter a parse tree produced by AutolevParser#diff.
|
| 79 |
+
def enterDiff(self, ctx:AutolevParser.DiffContext):
|
| 80 |
+
pass
|
| 81 |
+
|
| 82 |
+
# Exit a parse tree produced by AutolevParser#diff.
|
| 83 |
+
def exitDiff(self, ctx:AutolevParser.DiffContext):
|
| 84 |
+
pass
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
# Enter a parse tree produced by AutolevParser#functionCall.
|
| 88 |
+
def enterFunctionCall(self, ctx:AutolevParser.FunctionCallContext):
|
| 89 |
+
pass
|
| 90 |
+
|
| 91 |
+
# Exit a parse tree produced by AutolevParser#functionCall.
|
| 92 |
+
def exitFunctionCall(self, ctx:AutolevParser.FunctionCallContext):
|
| 93 |
+
pass
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
# Enter a parse tree produced by AutolevParser#varDecl.
|
| 97 |
+
def enterVarDecl(self, ctx:AutolevParser.VarDeclContext):
|
| 98 |
+
pass
|
| 99 |
+
|
| 100 |
+
# Exit a parse tree produced by AutolevParser#varDecl.
|
| 101 |
+
def exitVarDecl(self, ctx:AutolevParser.VarDeclContext):
|
| 102 |
+
pass
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
# Enter a parse tree produced by AutolevParser#varType.
|
| 106 |
+
def enterVarType(self, ctx:AutolevParser.VarTypeContext):
|
| 107 |
+
pass
|
| 108 |
+
|
| 109 |
+
# Exit a parse tree produced by AutolevParser#varType.
|
| 110 |
+
def exitVarType(self, ctx:AutolevParser.VarTypeContext):
|
| 111 |
+
pass
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
# Enter a parse tree produced by AutolevParser#varDecl2.
|
| 115 |
+
def enterVarDecl2(self, ctx:AutolevParser.VarDecl2Context):
|
| 116 |
+
pass
|
| 117 |
+
|
| 118 |
+
# Exit a parse tree produced by AutolevParser#varDecl2.
|
| 119 |
+
def exitVarDecl2(self, ctx:AutolevParser.VarDecl2Context):
|
| 120 |
+
pass
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
# Enter a parse tree produced by AutolevParser#ranges.
|
| 124 |
+
def enterRanges(self, ctx:AutolevParser.RangesContext):
|
| 125 |
+
pass
|
| 126 |
+
|
| 127 |
+
# Exit a parse tree produced by AutolevParser#ranges.
|
| 128 |
+
def exitRanges(self, ctx:AutolevParser.RangesContext):
|
| 129 |
+
pass
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
# Enter a parse tree produced by AutolevParser#massDecl.
|
| 133 |
+
def enterMassDecl(self, ctx:AutolevParser.MassDeclContext):
|
| 134 |
+
pass
|
| 135 |
+
|
| 136 |
+
# Exit a parse tree produced by AutolevParser#massDecl.
|
| 137 |
+
def exitMassDecl(self, ctx:AutolevParser.MassDeclContext):
|
| 138 |
+
pass
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
# Enter a parse tree produced by AutolevParser#massDecl2.
|
| 142 |
+
def enterMassDecl2(self, ctx:AutolevParser.MassDecl2Context):
|
| 143 |
+
pass
|
| 144 |
+
|
| 145 |
+
# Exit a parse tree produced by AutolevParser#massDecl2.
|
| 146 |
+
def exitMassDecl2(self, ctx:AutolevParser.MassDecl2Context):
|
| 147 |
+
pass
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
# Enter a parse tree produced by AutolevParser#inertiaDecl.
|
| 151 |
+
def enterInertiaDecl(self, ctx:AutolevParser.InertiaDeclContext):
|
| 152 |
+
pass
|
| 153 |
+
|
| 154 |
+
# Exit a parse tree produced by AutolevParser#inertiaDecl.
|
| 155 |
+
def exitInertiaDecl(self, ctx:AutolevParser.InertiaDeclContext):
|
| 156 |
+
pass
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
# Enter a parse tree produced by AutolevParser#matrix.
|
| 160 |
+
def enterMatrix(self, ctx:AutolevParser.MatrixContext):
|
| 161 |
+
pass
|
| 162 |
+
|
| 163 |
+
# Exit a parse tree produced by AutolevParser#matrix.
|
| 164 |
+
def exitMatrix(self, ctx:AutolevParser.MatrixContext):
|
| 165 |
+
pass
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
# Enter a parse tree produced by AutolevParser#matrixInOutput.
|
| 169 |
+
def enterMatrixInOutput(self, ctx:AutolevParser.MatrixInOutputContext):
|
| 170 |
+
pass
|
| 171 |
+
|
| 172 |
+
# Exit a parse tree produced by AutolevParser#matrixInOutput.
|
| 173 |
+
def exitMatrixInOutput(self, ctx:AutolevParser.MatrixInOutputContext):
|
| 174 |
+
pass
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
# Enter a parse tree produced by AutolevParser#codeCommands.
|
| 178 |
+
def enterCodeCommands(self, ctx:AutolevParser.CodeCommandsContext):
|
| 179 |
+
pass
|
| 180 |
+
|
| 181 |
+
# Exit a parse tree produced by AutolevParser#codeCommands.
|
| 182 |
+
def exitCodeCommands(self, ctx:AutolevParser.CodeCommandsContext):
|
| 183 |
+
pass
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
# Enter a parse tree produced by AutolevParser#settings.
|
| 187 |
+
def enterSettings(self, ctx:AutolevParser.SettingsContext):
|
| 188 |
+
pass
|
| 189 |
+
|
| 190 |
+
# Exit a parse tree produced by AutolevParser#settings.
|
| 191 |
+
def exitSettings(self, ctx:AutolevParser.SettingsContext):
|
| 192 |
+
pass
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
# Enter a parse tree produced by AutolevParser#units.
|
| 196 |
+
def enterUnits(self, ctx:AutolevParser.UnitsContext):
|
| 197 |
+
pass
|
| 198 |
+
|
| 199 |
+
# Exit a parse tree produced by AutolevParser#units.
|
| 200 |
+
def exitUnits(self, ctx:AutolevParser.UnitsContext):
|
| 201 |
+
pass
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
# Enter a parse tree produced by AutolevParser#inputs.
|
| 205 |
+
def enterInputs(self, ctx:AutolevParser.InputsContext):
|
| 206 |
+
pass
|
| 207 |
+
|
| 208 |
+
# Exit a parse tree produced by AutolevParser#inputs.
|
| 209 |
+
def exitInputs(self, ctx:AutolevParser.InputsContext):
|
| 210 |
+
pass
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
# Enter a parse tree produced by AutolevParser#id_diff.
|
| 214 |
+
def enterId_diff(self, ctx:AutolevParser.Id_diffContext):
|
| 215 |
+
pass
|
| 216 |
+
|
| 217 |
+
# Exit a parse tree produced by AutolevParser#id_diff.
|
| 218 |
+
def exitId_diff(self, ctx:AutolevParser.Id_diffContext):
|
| 219 |
+
pass
|
| 220 |
+
|
| 221 |
+
|
| 222 |
+
# Enter a parse tree produced by AutolevParser#inputs2.
|
| 223 |
+
def enterInputs2(self, ctx:AutolevParser.Inputs2Context):
|
| 224 |
+
pass
|
| 225 |
+
|
| 226 |
+
# Exit a parse tree produced by AutolevParser#inputs2.
|
| 227 |
+
def exitInputs2(self, ctx:AutolevParser.Inputs2Context):
|
| 228 |
+
pass
|
| 229 |
+
|
| 230 |
+
|
| 231 |
+
# Enter a parse tree produced by AutolevParser#outputs.
|
| 232 |
+
def enterOutputs(self, ctx:AutolevParser.OutputsContext):
|
| 233 |
+
pass
|
| 234 |
+
|
| 235 |
+
# Exit a parse tree produced by AutolevParser#outputs.
|
| 236 |
+
def exitOutputs(self, ctx:AutolevParser.OutputsContext):
|
| 237 |
+
pass
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
# Enter a parse tree produced by AutolevParser#outputs2.
|
| 241 |
+
def enterOutputs2(self, ctx:AutolevParser.Outputs2Context):
|
| 242 |
+
pass
|
| 243 |
+
|
| 244 |
+
# Exit a parse tree produced by AutolevParser#outputs2.
|
| 245 |
+
def exitOutputs2(self, ctx:AutolevParser.Outputs2Context):
|
| 246 |
+
pass
|
| 247 |
+
|
| 248 |
+
|
| 249 |
+
# Enter a parse tree produced by AutolevParser#codegen.
|
| 250 |
+
def enterCodegen(self, ctx:AutolevParser.CodegenContext):
|
| 251 |
+
pass
|
| 252 |
+
|
| 253 |
+
# Exit a parse tree produced by AutolevParser#codegen.
|
| 254 |
+
def exitCodegen(self, ctx:AutolevParser.CodegenContext):
|
| 255 |
+
pass
|
| 256 |
+
|
| 257 |
+
|
| 258 |
+
# Enter a parse tree produced by AutolevParser#commands.
|
| 259 |
+
def enterCommands(self, ctx:AutolevParser.CommandsContext):
|
| 260 |
+
pass
|
| 261 |
+
|
| 262 |
+
# Exit a parse tree produced by AutolevParser#commands.
|
| 263 |
+
def exitCommands(self, ctx:AutolevParser.CommandsContext):
|
| 264 |
+
pass
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
# Enter a parse tree produced by AutolevParser#vec.
|
| 268 |
+
def enterVec(self, ctx:AutolevParser.VecContext):
|
| 269 |
+
pass
|
| 270 |
+
|
| 271 |
+
# Exit a parse tree produced by AutolevParser#vec.
|
| 272 |
+
def exitVec(self, ctx:AutolevParser.VecContext):
|
| 273 |
+
pass
|
| 274 |
+
|
| 275 |
+
|
| 276 |
+
# Enter a parse tree produced by AutolevParser#parens.
|
| 277 |
+
def enterParens(self, ctx:AutolevParser.ParensContext):
|
| 278 |
+
pass
|
| 279 |
+
|
| 280 |
+
# Exit a parse tree produced by AutolevParser#parens.
|
| 281 |
+
def exitParens(self, ctx:AutolevParser.ParensContext):
|
| 282 |
+
pass
|
| 283 |
+
|
| 284 |
+
|
| 285 |
+
# Enter a parse tree produced by AutolevParser#VectorOrDyadic.
|
| 286 |
+
def enterVectorOrDyadic(self, ctx:AutolevParser.VectorOrDyadicContext):
|
| 287 |
+
pass
|
| 288 |
+
|
| 289 |
+
# Exit a parse tree produced by AutolevParser#VectorOrDyadic.
|
| 290 |
+
def exitVectorOrDyadic(self, ctx:AutolevParser.VectorOrDyadicContext):
|
| 291 |
+
pass
|
| 292 |
+
|
| 293 |
+
|
| 294 |
+
# Enter a parse tree produced by AutolevParser#Exponent.
|
| 295 |
+
def enterExponent(self, ctx:AutolevParser.ExponentContext):
|
| 296 |
+
pass
|
| 297 |
+
|
| 298 |
+
# Exit a parse tree produced by AutolevParser#Exponent.
|
| 299 |
+
def exitExponent(self, ctx:AutolevParser.ExponentContext):
|
| 300 |
+
pass
|
| 301 |
+
|
| 302 |
+
|
| 303 |
+
# Enter a parse tree produced by AutolevParser#MulDiv.
|
| 304 |
+
def enterMulDiv(self, ctx:AutolevParser.MulDivContext):
|
| 305 |
+
pass
|
| 306 |
+
|
| 307 |
+
# Exit a parse tree produced by AutolevParser#MulDiv.
|
| 308 |
+
def exitMulDiv(self, ctx:AutolevParser.MulDivContext):
|
| 309 |
+
pass
|
| 310 |
+
|
| 311 |
+
|
| 312 |
+
# Enter a parse tree produced by AutolevParser#AddSub.
|
| 313 |
+
def enterAddSub(self, ctx:AutolevParser.AddSubContext):
|
| 314 |
+
pass
|
| 315 |
+
|
| 316 |
+
# Exit a parse tree produced by AutolevParser#AddSub.
|
| 317 |
+
def exitAddSub(self, ctx:AutolevParser.AddSubContext):
|
| 318 |
+
pass
|
| 319 |
+
|
| 320 |
+
|
| 321 |
+
# Enter a parse tree produced by AutolevParser#float.
|
| 322 |
+
def enterFloat(self, ctx:AutolevParser.FloatContext):
|
| 323 |
+
pass
|
| 324 |
+
|
| 325 |
+
# Exit a parse tree produced by AutolevParser#float.
|
| 326 |
+
def exitFloat(self, ctx:AutolevParser.FloatContext):
|
| 327 |
+
pass
|
| 328 |
+
|
| 329 |
+
|
| 330 |
+
# Enter a parse tree produced by AutolevParser#int.
|
| 331 |
+
def enterInt(self, ctx:AutolevParser.IntContext):
|
| 332 |
+
pass
|
| 333 |
+
|
| 334 |
+
# Exit a parse tree produced by AutolevParser#int.
|
| 335 |
+
def exitInt(self, ctx:AutolevParser.IntContext):
|
| 336 |
+
pass
|
| 337 |
+
|
| 338 |
+
|
| 339 |
+
# Enter a parse tree produced by AutolevParser#idEqualsExpr.
|
| 340 |
+
def enterIdEqualsExpr(self, ctx:AutolevParser.IdEqualsExprContext):
|
| 341 |
+
pass
|
| 342 |
+
|
| 343 |
+
# Exit a parse tree produced by AutolevParser#idEqualsExpr.
|
| 344 |
+
def exitIdEqualsExpr(self, ctx:AutolevParser.IdEqualsExprContext):
|
| 345 |
+
pass
|
| 346 |
+
|
| 347 |
+
|
| 348 |
+
# Enter a parse tree produced by AutolevParser#negativeOne.
|
| 349 |
+
def enterNegativeOne(self, ctx:AutolevParser.NegativeOneContext):
|
| 350 |
+
pass
|
| 351 |
+
|
| 352 |
+
# Exit a parse tree produced by AutolevParser#negativeOne.
|
| 353 |
+
def exitNegativeOne(self, ctx:AutolevParser.NegativeOneContext):
|
| 354 |
+
pass
|
| 355 |
+
|
| 356 |
+
|
| 357 |
+
# Enter a parse tree produced by AutolevParser#function.
|
| 358 |
+
def enterFunction(self, ctx:AutolevParser.FunctionContext):
|
| 359 |
+
pass
|
| 360 |
+
|
| 361 |
+
# Exit a parse tree produced by AutolevParser#function.
|
| 362 |
+
def exitFunction(self, ctx:AutolevParser.FunctionContext):
|
| 363 |
+
pass
|
| 364 |
+
|
| 365 |
+
|
| 366 |
+
# Enter a parse tree produced by AutolevParser#rangess.
|
| 367 |
+
def enterRangess(self, ctx:AutolevParser.RangessContext):
|
| 368 |
+
pass
|
| 369 |
+
|
| 370 |
+
# Exit a parse tree produced by AutolevParser#rangess.
|
| 371 |
+
def exitRangess(self, ctx:AutolevParser.RangessContext):
|
| 372 |
+
pass
|
| 373 |
+
|
| 374 |
+
|
| 375 |
+
# Enter a parse tree produced by AutolevParser#colon.
|
| 376 |
+
def enterColon(self, ctx:AutolevParser.ColonContext):
|
| 377 |
+
pass
|
| 378 |
+
|
| 379 |
+
# Exit a parse tree produced by AutolevParser#colon.
|
| 380 |
+
def exitColon(self, ctx:AutolevParser.ColonContext):
|
| 381 |
+
pass
|
| 382 |
+
|
| 383 |
+
|
| 384 |
+
# Enter a parse tree produced by AutolevParser#id.
|
| 385 |
+
def enterId(self, ctx:AutolevParser.IdContext):
|
| 386 |
+
pass
|
| 387 |
+
|
| 388 |
+
# Exit a parse tree produced by AutolevParser#id.
|
| 389 |
+
def exitId(self, ctx:AutolevParser.IdContext):
|
| 390 |
+
pass
|
| 391 |
+
|
| 392 |
+
|
| 393 |
+
# Enter a parse tree produced by AutolevParser#exp.
|
| 394 |
+
def enterExp(self, ctx:AutolevParser.ExpContext):
|
| 395 |
+
pass
|
| 396 |
+
|
| 397 |
+
# Exit a parse tree produced by AutolevParser#exp.
|
| 398 |
+
def exitExp(self, ctx:AutolevParser.ExpContext):
|
| 399 |
+
pass
|
| 400 |
+
|
| 401 |
+
|
| 402 |
+
# Enter a parse tree produced by AutolevParser#matrices.
|
| 403 |
+
def enterMatrices(self, ctx:AutolevParser.MatricesContext):
|
| 404 |
+
pass
|
| 405 |
+
|
| 406 |
+
# Exit a parse tree produced by AutolevParser#matrices.
|
| 407 |
+
def exitMatrices(self, ctx:AutolevParser.MatricesContext):
|
| 408 |
+
pass
|
| 409 |
+
|
| 410 |
+
|
| 411 |
+
# Enter a parse tree produced by AutolevParser#Indexing.
|
| 412 |
+
def enterIndexing(self, ctx:AutolevParser.IndexingContext):
|
| 413 |
+
pass
|
| 414 |
+
|
| 415 |
+
# Exit a parse tree produced by AutolevParser#Indexing.
|
| 416 |
+
def exitIndexing(self, ctx:AutolevParser.IndexingContext):
|
| 417 |
+
pass
|
| 418 |
+
|
| 419 |
+
|
| 420 |
+
|
| 421 |
+
del AutolevParser
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/_antlr/autolevparser.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/__pycache__/ruletest12.cpython-310.pyc
ADDED
|
Binary file (803 Bytes). View file
|
|
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/__pycache__/ruletest6.cpython-310.pyc
ADDED
|
Binary file (2.19 kB). View file
|
|
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/pydy-example-repo/__pycache__/chaos_pendulum.cpython-310.pyc
ADDED
|
Binary file (2.11 kB). View file
|
|
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/pydy-example-repo/__pycache__/double_pendulum.cpython-310.pyc
ADDED
|
Binary file (1.58 kB). View file
|
|
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/pydy-example-repo/__pycache__/mass_spring_damper.cpython-310.pyc
ADDED
|
Binary file (1.54 kB). View file
|
|
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/pydy-example-repo/__pycache__/non_min_pendulum.cpython-310.pyc
ADDED
|
Binary file (1.6 kB). View file
|
|
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/pydy-example-repo/chaos_pendulum.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sympy.physics.mechanics as _me
|
| 2 |
+
import sympy as _sm
|
| 3 |
+
import math as m
|
| 4 |
+
import numpy as _np
|
| 5 |
+
|
| 6 |
+
g, lb, w, h = _sm.symbols('g lb w h', real=True)
|
| 7 |
+
theta, phi, omega, alpha = _me.dynamicsymbols('theta phi omega alpha')
|
| 8 |
+
theta_d, phi_d, omega_d, alpha_d = _me.dynamicsymbols('theta_ phi_ omega_ alpha_', 1)
|
| 9 |
+
theta_dd, phi_dd = _me.dynamicsymbols('theta_ phi_', 2)
|
| 10 |
+
frame_n = _me.ReferenceFrame('n')
|
| 11 |
+
body_a_cm = _me.Point('a_cm')
|
| 12 |
+
body_a_cm.set_vel(frame_n, 0)
|
| 13 |
+
body_a_f = _me.ReferenceFrame('a_f')
|
| 14 |
+
body_a = _me.RigidBody('a', body_a_cm, body_a_f, _sm.symbols('m'), (_me.outer(body_a_f.x,body_a_f.x),body_a_cm))
|
| 15 |
+
body_b_cm = _me.Point('b_cm')
|
| 16 |
+
body_b_cm.set_vel(frame_n, 0)
|
| 17 |
+
body_b_f = _me.ReferenceFrame('b_f')
|
| 18 |
+
body_b = _me.RigidBody('b', body_b_cm, body_b_f, _sm.symbols('m'), (_me.outer(body_b_f.x,body_b_f.x),body_b_cm))
|
| 19 |
+
body_a_f.orient(frame_n, 'Axis', [theta, frame_n.y])
|
| 20 |
+
body_b_f.orient(body_a_f, 'Axis', [phi, body_a_f.z])
|
| 21 |
+
point_o = _me.Point('o')
|
| 22 |
+
la = (lb-h/2)/2
|
| 23 |
+
body_a_cm.set_pos(point_o, la*body_a_f.z)
|
| 24 |
+
body_b_cm.set_pos(point_o, lb*body_a_f.z)
|
| 25 |
+
body_a_f.set_ang_vel(frame_n, omega*frame_n.y)
|
| 26 |
+
body_b_f.set_ang_vel(body_a_f, alpha*body_a_f.z)
|
| 27 |
+
point_o.set_vel(frame_n, 0)
|
| 28 |
+
body_a_cm.v2pt_theory(point_o,frame_n,body_a_f)
|
| 29 |
+
body_b_cm.v2pt_theory(point_o,frame_n,body_a_f)
|
| 30 |
+
ma = _sm.symbols('ma')
|
| 31 |
+
body_a.mass = ma
|
| 32 |
+
mb = _sm.symbols('mb')
|
| 33 |
+
body_b.mass = mb
|
| 34 |
+
iaxx = 1/12*ma*(2*la)**2
|
| 35 |
+
iayy = iaxx
|
| 36 |
+
iazz = 0
|
| 37 |
+
ibxx = 1/12*mb*h**2
|
| 38 |
+
ibyy = 1/12*mb*(w**2+h**2)
|
| 39 |
+
ibzz = 1/12*mb*w**2
|
| 40 |
+
body_a.inertia = (_me.inertia(body_a_f, iaxx, iayy, iazz, 0, 0, 0), body_a_cm)
|
| 41 |
+
body_b.inertia = (_me.inertia(body_b_f, ibxx, ibyy, ibzz, 0, 0, 0), body_b_cm)
|
| 42 |
+
force_a = body_a.mass*(g*frame_n.z)
|
| 43 |
+
force_b = body_b.mass*(g*frame_n.z)
|
| 44 |
+
kd_eqs = [theta_d - omega, phi_d - alpha]
|
| 45 |
+
forceList = [(body_a.masscenter,body_a.mass*(g*frame_n.z)), (body_b.masscenter,body_b.mass*(g*frame_n.z))]
|
| 46 |
+
kane = _me.KanesMethod(frame_n, q_ind=[theta,phi], u_ind=[omega, alpha], kd_eqs = kd_eqs)
|
| 47 |
+
fr, frstar = kane.kanes_equations([body_a, body_b], forceList)
|
| 48 |
+
zero = fr+frstar
|
| 49 |
+
from pydy.system import System
|
| 50 |
+
sys = System(kane, constants = {g:9.81, lb:0.2, w:0.2, h:0.1, ma:0.01, mb:0.1},
|
| 51 |
+
specifieds={},
|
| 52 |
+
initial_conditions={theta:_np.deg2rad(90), phi:_np.deg2rad(0.5), omega:0, alpha:0},
|
| 53 |
+
times = _np.linspace(0.0, 10, 10/0.02))
|
| 54 |
+
|
| 55 |
+
y=sys.integrate()
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/pydy-example-repo/mass_spring_damper.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sympy.physics.mechanics as _me
|
| 2 |
+
import sympy as _sm
|
| 3 |
+
import math as m
|
| 4 |
+
import numpy as _np
|
| 5 |
+
|
| 6 |
+
m, k, b, g = _sm.symbols('m k b g', real=True)
|
| 7 |
+
position, speed = _me.dynamicsymbols('position speed')
|
| 8 |
+
position_d, speed_d = _me.dynamicsymbols('position_ speed_', 1)
|
| 9 |
+
o = _me.dynamicsymbols('o')
|
| 10 |
+
force = o*_sm.sin(_me.dynamicsymbols._t)
|
| 11 |
+
frame_ceiling = _me.ReferenceFrame('ceiling')
|
| 12 |
+
point_origin = _me.Point('origin')
|
| 13 |
+
point_origin.set_vel(frame_ceiling, 0)
|
| 14 |
+
particle_block = _me.Particle('block', _me.Point('block_pt'), _sm.Symbol('m'))
|
| 15 |
+
particle_block.point.set_pos(point_origin, position*frame_ceiling.x)
|
| 16 |
+
particle_block.mass = m
|
| 17 |
+
particle_block.point.set_vel(frame_ceiling, speed*frame_ceiling.x)
|
| 18 |
+
force_magnitude = m*g-k*position-b*speed+force
|
| 19 |
+
force_block = (force_magnitude*frame_ceiling.x).subs({position_d:speed})
|
| 20 |
+
kd_eqs = [position_d - speed]
|
| 21 |
+
forceList = [(particle_block.point,(force_magnitude*frame_ceiling.x).subs({position_d:speed}))]
|
| 22 |
+
kane = _me.KanesMethod(frame_ceiling, q_ind=[position], u_ind=[speed], kd_eqs = kd_eqs)
|
| 23 |
+
fr, frstar = kane.kanes_equations([particle_block], forceList)
|
| 24 |
+
zero = fr+frstar
|
| 25 |
+
from pydy.system import System
|
| 26 |
+
sys = System(kane, constants = {m:1.0, k:1.0, b:0.2, g:9.8},
|
| 27 |
+
specifieds={_me.dynamicsymbols('t'):lambda x, t: t, o:2},
|
| 28 |
+
initial_conditions={position:0.1, speed:-1*1.0},
|
| 29 |
+
times = _np.linspace(0.0, 10.0, 10.0/0.01))
|
| 30 |
+
|
| 31 |
+
y=sys.integrate()
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/pydy-example-repo/non_min_pendulum.al
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MOTIONVARIABLES' Q{2}''
|
| 2 |
+
CONSTANTS L,M,G
|
| 3 |
+
NEWTONIAN N
|
| 4 |
+
POINT PN
|
| 5 |
+
V_PN_N> = 0>
|
| 6 |
+
THETA1 = ATAN(Q2/Q1)
|
| 7 |
+
FRAMES A
|
| 8 |
+
SIMPROT(N, A, 3, THETA1)
|
| 9 |
+
PARTICLES P
|
| 10 |
+
P_PN_P> = Q1*N1>+Q2*N2>
|
| 11 |
+
MASS P=M
|
| 12 |
+
V_P_N>=DT(P_P_PN>, N)
|
| 13 |
+
F_V = DOT(EXPRESS(V_P_N>,A), A1>)
|
| 14 |
+
GRAVITY(G*N1>)
|
| 15 |
+
DEPENDENT[1] = F_V
|
| 16 |
+
CONSTRAIN(DEPENDENT[Q1'])
|
| 17 |
+
ZERO=FR()+FRSTAR()
|
| 18 |
+
F_C = MAG(P_P_PN>)-L
|
| 19 |
+
CONFIG[1]=F_C
|
| 20 |
+
ZERO[2]=CONFIG[1]
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/pydy-example-repo/non_min_pendulum.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sympy.physics.mechanics as _me
|
| 2 |
+
import sympy as _sm
|
| 3 |
+
import math as m
|
| 4 |
+
import numpy as _np
|
| 5 |
+
|
| 6 |
+
q1, q2 = _me.dynamicsymbols('q1 q2')
|
| 7 |
+
q1_d, q2_d = _me.dynamicsymbols('q1_ q2_', 1)
|
| 8 |
+
q1_dd, q2_dd = _me.dynamicsymbols('q1_ q2_', 2)
|
| 9 |
+
l, m, g = _sm.symbols('l m g', real=True)
|
| 10 |
+
frame_n = _me.ReferenceFrame('n')
|
| 11 |
+
point_pn = _me.Point('pn')
|
| 12 |
+
point_pn.set_vel(frame_n, 0)
|
| 13 |
+
theta1 = _sm.atan(q2/q1)
|
| 14 |
+
frame_a = _me.ReferenceFrame('a')
|
| 15 |
+
frame_a.orient(frame_n, 'Axis', [theta1, frame_n.z])
|
| 16 |
+
particle_p = _me.Particle('p', _me.Point('p_pt'), _sm.Symbol('m'))
|
| 17 |
+
particle_p.point.set_pos(point_pn, q1*frame_n.x+q2*frame_n.y)
|
| 18 |
+
particle_p.mass = m
|
| 19 |
+
particle_p.point.set_vel(frame_n, (point_pn.pos_from(particle_p.point)).dt(frame_n))
|
| 20 |
+
f_v = _me.dot((particle_p.point.vel(frame_n)).express(frame_a), frame_a.x)
|
| 21 |
+
force_p = particle_p.mass*(g*frame_n.x)
|
| 22 |
+
dependent = _sm.Matrix([[0]])
|
| 23 |
+
dependent[0] = f_v
|
| 24 |
+
velocity_constraints = [i for i in dependent]
|
| 25 |
+
u_q1_d = _me.dynamicsymbols('u_q1_d')
|
| 26 |
+
u_q2_d = _me.dynamicsymbols('u_q2_d')
|
| 27 |
+
kd_eqs = [q1_d-u_q1_d, q2_d-u_q2_d]
|
| 28 |
+
forceList = [(particle_p.point,particle_p.mass*(g*frame_n.x))]
|
| 29 |
+
kane = _me.KanesMethod(frame_n, q_ind=[q1,q2], u_ind=[u_q2_d], u_dependent=[u_q1_d], kd_eqs = kd_eqs, velocity_constraints = velocity_constraints)
|
| 30 |
+
fr, frstar = kane.kanes_equations([particle_p], forceList)
|
| 31 |
+
zero = fr+frstar
|
| 32 |
+
f_c = point_pn.pos_from(particle_p.point).magnitude()-l
|
| 33 |
+
config = _sm.Matrix([[0]])
|
| 34 |
+
config[0] = f_c
|
| 35 |
+
zero = zero.row_insert(zero.shape[0], _sm.Matrix([[0]]))
|
| 36 |
+
zero[zero.shape[0]-1] = config[0]
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/ruletest10.al
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
% ruletest10.al
|
| 2 |
+
|
| 3 |
+
VARIABLES X,Y
|
| 4 |
+
COMPLEX ON
|
| 5 |
+
CONSTANTS A,B
|
| 6 |
+
E = A*(B*X+Y)^2
|
| 7 |
+
M = [E;E]
|
| 8 |
+
EXPAND(E)
|
| 9 |
+
EXPAND(M)
|
| 10 |
+
FACTOR(E,X)
|
| 11 |
+
FACTOR(M,X)
|
| 12 |
+
|
| 13 |
+
EQN[1] = A*X + B*Y
|
| 14 |
+
EQN[2] = 2*A*X - 3*B*Y
|
| 15 |
+
SOLVE(EQN, X, Y)
|
| 16 |
+
RHS_Y = RHS(Y)
|
| 17 |
+
E = (X+Y)^2 + 2*X^2
|
| 18 |
+
ARRANGE(E, 2, X)
|
| 19 |
+
|
| 20 |
+
CONSTANTS A,B,C
|
| 21 |
+
M = [A,B;C,0]
|
| 22 |
+
M2 = EVALUATE(M,A=1,B=2,C=3)
|
| 23 |
+
EIG(M2, EIGVALUE, EIGVEC)
|
| 24 |
+
|
| 25 |
+
NEWTONIAN N
|
| 26 |
+
FRAMES A
|
| 27 |
+
SIMPROT(N, A, N1>, X)
|
| 28 |
+
DEGREES OFF
|
| 29 |
+
SIMPROT(N, A, N1>, PI/2)
|
| 30 |
+
|
| 31 |
+
CONSTANTS C{3}
|
| 32 |
+
V> = C1*A1> + C2*A2> + C3*A3>
|
| 33 |
+
POINTS O, P
|
| 34 |
+
P_P_O> = C1*A1>
|
| 35 |
+
EXPRESS(V>,N)
|
| 36 |
+
EXPRESS(P_P_O>,N)
|
| 37 |
+
W_A_N> = C3*A3>
|
| 38 |
+
ANGVEL(A,N)
|
| 39 |
+
|
| 40 |
+
V2PTS(N,A,O,P)
|
| 41 |
+
PARTICLES P{2}
|
| 42 |
+
V2PTS(N,A,P1,P2)
|
| 43 |
+
A2PTS(N,A,P1,P)
|
| 44 |
+
|
| 45 |
+
BODIES B{2}
|
| 46 |
+
CONSTANT G
|
| 47 |
+
GRAVITY(G*N1>)
|
| 48 |
+
|
| 49 |
+
VARIABLE Z
|
| 50 |
+
V> = X*A1> + Y*A3>
|
| 51 |
+
P_P_O> = X*A1> + Y*A2>
|
| 52 |
+
X = 2*Z
|
| 53 |
+
Y = Z
|
| 54 |
+
EXPLICIT(V>)
|
| 55 |
+
EXPLICIT(P_P_O>)
|
| 56 |
+
|
| 57 |
+
FORCE(O/P1, X*Y*A1>)
|
| 58 |
+
FORCE(P2, X*Y*A1>)
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/ruletest10.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sympy.physics.mechanics as _me
|
| 2 |
+
import sympy as _sm
|
| 3 |
+
import math as m
|
| 4 |
+
import numpy as _np
|
| 5 |
+
|
| 6 |
+
x, y = _me.dynamicsymbols('x y')
|
| 7 |
+
a, b = _sm.symbols('a b', real=True)
|
| 8 |
+
e = a*(b*x+y)**2
|
| 9 |
+
m = _sm.Matrix([e,e]).reshape(2, 1)
|
| 10 |
+
e = e.expand()
|
| 11 |
+
m = _sm.Matrix([i.expand() for i in m]).reshape((m).shape[0], (m).shape[1])
|
| 12 |
+
e = _sm.factor(e, x)
|
| 13 |
+
m = _sm.Matrix([_sm.factor(i,x) for i in m]).reshape((m).shape[0], (m).shape[1])
|
| 14 |
+
eqn = _sm.Matrix([[0]])
|
| 15 |
+
eqn[0] = a*x+b*y
|
| 16 |
+
eqn = eqn.row_insert(eqn.shape[0], _sm.Matrix([[0]]))
|
| 17 |
+
eqn[eqn.shape[0]-1] = 2*a*x-3*b*y
|
| 18 |
+
print(_sm.solve(eqn,x,y))
|
| 19 |
+
rhs_y = _sm.solve(eqn,x,y)[y]
|
| 20 |
+
e = (x+y)**2+2*x**2
|
| 21 |
+
e.collect(x)
|
| 22 |
+
a, b, c = _sm.symbols('a b c', real=True)
|
| 23 |
+
m = _sm.Matrix([a,b,c,0]).reshape(2, 2)
|
| 24 |
+
m2 = _sm.Matrix([i.subs({a:1,b:2,c:3}) for i in m]).reshape((m).shape[0], (m).shape[1])
|
| 25 |
+
eigvalue = _sm.Matrix([i.evalf() for i in (m2).eigenvals().keys()])
|
| 26 |
+
eigvec = _sm.Matrix([i[2][0].evalf() for i in (m2).eigenvects()]).reshape(m2.shape[0], m2.shape[1])
|
| 27 |
+
frame_n = _me.ReferenceFrame('n')
|
| 28 |
+
frame_a = _me.ReferenceFrame('a')
|
| 29 |
+
frame_a.orient(frame_n, 'Axis', [x, frame_n.x])
|
| 30 |
+
frame_a.orient(frame_n, 'Axis', [_sm.pi/2, frame_n.x])
|
| 31 |
+
c1, c2, c3 = _sm.symbols('c1 c2 c3', real=True)
|
| 32 |
+
v = c1*frame_a.x+c2*frame_a.y+c3*frame_a.z
|
| 33 |
+
point_o = _me.Point('o')
|
| 34 |
+
point_p = _me.Point('p')
|
| 35 |
+
point_o.set_pos(point_p, c1*frame_a.x)
|
| 36 |
+
v = (v).express(frame_n)
|
| 37 |
+
point_o.set_pos(point_p, (point_o.pos_from(point_p)).express(frame_n))
|
| 38 |
+
frame_a.set_ang_vel(frame_n, c3*frame_a.z)
|
| 39 |
+
print(frame_n.ang_vel_in(frame_a))
|
| 40 |
+
point_p.v2pt_theory(point_o,frame_n,frame_a)
|
| 41 |
+
particle_p1 = _me.Particle('p1', _me.Point('p1_pt'), _sm.Symbol('m'))
|
| 42 |
+
particle_p2 = _me.Particle('p2', _me.Point('p2_pt'), _sm.Symbol('m'))
|
| 43 |
+
particle_p2.point.v2pt_theory(particle_p1.point,frame_n,frame_a)
|
| 44 |
+
point_p.a2pt_theory(particle_p1.point,frame_n,frame_a)
|
| 45 |
+
body_b1_cm = _me.Point('b1_cm')
|
| 46 |
+
body_b1_cm.set_vel(frame_n, 0)
|
| 47 |
+
body_b1_f = _me.ReferenceFrame('b1_f')
|
| 48 |
+
body_b1 = _me.RigidBody('b1', body_b1_cm, body_b1_f, _sm.symbols('m'), (_me.outer(body_b1_f.x,body_b1_f.x),body_b1_cm))
|
| 49 |
+
body_b2_cm = _me.Point('b2_cm')
|
| 50 |
+
body_b2_cm.set_vel(frame_n, 0)
|
| 51 |
+
body_b2_f = _me.ReferenceFrame('b2_f')
|
| 52 |
+
body_b2 = _me.RigidBody('b2', body_b2_cm, body_b2_f, _sm.symbols('m'), (_me.outer(body_b2_f.x,body_b2_f.x),body_b2_cm))
|
| 53 |
+
g = _sm.symbols('g', real=True)
|
| 54 |
+
force_p1 = particle_p1.mass*(g*frame_n.x)
|
| 55 |
+
force_p2 = particle_p2.mass*(g*frame_n.x)
|
| 56 |
+
force_b1 = body_b1.mass*(g*frame_n.x)
|
| 57 |
+
force_b2 = body_b2.mass*(g*frame_n.x)
|
| 58 |
+
z = _me.dynamicsymbols('z')
|
| 59 |
+
v = x*frame_a.x+y*frame_a.z
|
| 60 |
+
point_o.set_pos(point_p, x*frame_a.x+y*frame_a.y)
|
| 61 |
+
v = (v).subs({x:2*z, y:z})
|
| 62 |
+
point_o.set_pos(point_p, (point_o.pos_from(point_p)).subs({x:2*z, y:z}))
|
| 63 |
+
force_o = -1*(x*y*frame_a.x)
|
| 64 |
+
force_p1 = particle_p1.mass*(g*frame_n.x)+ x*y*frame_a.x
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/ruletest12.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sympy.physics.mechanics as _me
|
| 2 |
+
import sympy as _sm
|
| 3 |
+
import math as m
|
| 4 |
+
import numpy as _np
|
| 5 |
+
|
| 6 |
+
x, y = _me.dynamicsymbols('x y')
|
| 7 |
+
a, b, r = _sm.symbols('a b r', real=True)
|
| 8 |
+
eqn = _sm.Matrix([[0]])
|
| 9 |
+
eqn[0] = a*x**3+b*y**2-r
|
| 10 |
+
eqn = eqn.row_insert(eqn.shape[0], _sm.Matrix([[0]]))
|
| 11 |
+
eqn[eqn.shape[0]-1] = a*_sm.sin(x)**2+b*_sm.cos(2*y)-r**2
|
| 12 |
+
matrix_list = []
|
| 13 |
+
for i in eqn:matrix_list.append(i.subs({a:2.0, b:3.0, r:1.0}))
|
| 14 |
+
print(_sm.nsolve(matrix_list,(x,y),(_np.deg2rad(30),3.14)))
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/ruletest3.al
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
% ruletest3.al
|
| 2 |
+
FRAMES A, B
|
| 3 |
+
NEWTONIAN N
|
| 4 |
+
|
| 5 |
+
VARIABLES X{3}
|
| 6 |
+
CONSTANTS L
|
| 7 |
+
|
| 8 |
+
V1> = X1*A1> + X2*A2> + X3*A3>
|
| 9 |
+
V2> = X1*B1> + X2*B2> + X3*B3>
|
| 10 |
+
V3> = X1*N1> + X2*N2> + X3*N3>
|
| 11 |
+
|
| 12 |
+
V> = V1> + V2> + V3>
|
| 13 |
+
|
| 14 |
+
POINTS C, D
|
| 15 |
+
POINTS PO{3}
|
| 16 |
+
|
| 17 |
+
PARTICLES L
|
| 18 |
+
PARTICLES P{3}
|
| 19 |
+
|
| 20 |
+
BODIES S
|
| 21 |
+
BODIES R{2}
|
| 22 |
+
|
| 23 |
+
V4> = X1*S1> + X2*S2> + X3*S3>
|
| 24 |
+
|
| 25 |
+
P_C_SO> = L*N1>
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/ruletest3.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sympy.physics.mechanics as _me
|
| 2 |
+
import sympy as _sm
|
| 3 |
+
import math as m
|
| 4 |
+
import numpy as _np
|
| 5 |
+
|
| 6 |
+
frame_a = _me.ReferenceFrame('a')
|
| 7 |
+
frame_b = _me.ReferenceFrame('b')
|
| 8 |
+
frame_n = _me.ReferenceFrame('n')
|
| 9 |
+
x1, x2, x3 = _me.dynamicsymbols('x1 x2 x3')
|
| 10 |
+
l = _sm.symbols('l', real=True)
|
| 11 |
+
v1 = x1*frame_a.x+x2*frame_a.y+x3*frame_a.z
|
| 12 |
+
v2 = x1*frame_b.x+x2*frame_b.y+x3*frame_b.z
|
| 13 |
+
v3 = x1*frame_n.x+x2*frame_n.y+x3*frame_n.z
|
| 14 |
+
v = v1+v2+v3
|
| 15 |
+
point_c = _me.Point('c')
|
| 16 |
+
point_d = _me.Point('d')
|
| 17 |
+
point_po1 = _me.Point('po1')
|
| 18 |
+
point_po2 = _me.Point('po2')
|
| 19 |
+
point_po3 = _me.Point('po3')
|
| 20 |
+
particle_l = _me.Particle('l', _me.Point('l_pt'), _sm.Symbol('m'))
|
| 21 |
+
particle_p1 = _me.Particle('p1', _me.Point('p1_pt'), _sm.Symbol('m'))
|
| 22 |
+
particle_p2 = _me.Particle('p2', _me.Point('p2_pt'), _sm.Symbol('m'))
|
| 23 |
+
particle_p3 = _me.Particle('p3', _me.Point('p3_pt'), _sm.Symbol('m'))
|
| 24 |
+
body_s_cm = _me.Point('s_cm')
|
| 25 |
+
body_s_cm.set_vel(frame_n, 0)
|
| 26 |
+
body_s_f = _me.ReferenceFrame('s_f')
|
| 27 |
+
body_s = _me.RigidBody('s', body_s_cm, body_s_f, _sm.symbols('m'), (_me.outer(body_s_f.x,body_s_f.x),body_s_cm))
|
| 28 |
+
body_r1_cm = _me.Point('r1_cm')
|
| 29 |
+
body_r1_cm.set_vel(frame_n, 0)
|
| 30 |
+
body_r1_f = _me.ReferenceFrame('r1_f')
|
| 31 |
+
body_r1 = _me.RigidBody('r1', body_r1_cm, body_r1_f, _sm.symbols('m'), (_me.outer(body_r1_f.x,body_r1_f.x),body_r1_cm))
|
| 32 |
+
body_r2_cm = _me.Point('r2_cm')
|
| 33 |
+
body_r2_cm.set_vel(frame_n, 0)
|
| 34 |
+
body_r2_f = _me.ReferenceFrame('r2_f')
|
| 35 |
+
body_r2 = _me.RigidBody('r2', body_r2_cm, body_r2_f, _sm.symbols('m'), (_me.outer(body_r2_f.x,body_r2_f.x),body_r2_cm))
|
| 36 |
+
v4 = x1*body_s_f.x+x2*body_s_f.y+x3*body_s_f.z
|
| 37 |
+
body_s_cm.set_pos(point_c, l*frame_n.x)
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/ruletest4.al
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
% ruletest4.al
|
| 2 |
+
|
| 3 |
+
FRAMES A, B
|
| 4 |
+
MOTIONVARIABLES Q{3}
|
| 5 |
+
SIMPROT(A, B, 1, Q3)
|
| 6 |
+
DCM = A_B
|
| 7 |
+
M = DCM*3 - A_B
|
| 8 |
+
|
| 9 |
+
VARIABLES R
|
| 10 |
+
CIRCLE_AREA = PI*R^2
|
| 11 |
+
|
| 12 |
+
VARIABLES U, A
|
| 13 |
+
VARIABLES X, Y
|
| 14 |
+
S = U*T - 1/2*A*T^2
|
| 15 |
+
|
| 16 |
+
EXPR1 = 2*A*0.5 - 1.25 + 0.25
|
| 17 |
+
EXPR2 = -X^2 + Y^2 + 0.25*(X+Y)^2
|
| 18 |
+
EXPR3 = 0.5E-10
|
| 19 |
+
|
| 20 |
+
DYADIC>> = A1>*A1> + A2>*A2> + A3>*A3>
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/ruletest4.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sympy.physics.mechanics as _me
|
| 2 |
+
import sympy as _sm
|
| 3 |
+
import math as m
|
| 4 |
+
import numpy as _np
|
| 5 |
+
|
| 6 |
+
frame_a = _me.ReferenceFrame('a')
|
| 7 |
+
frame_b = _me.ReferenceFrame('b')
|
| 8 |
+
q1, q2, q3 = _me.dynamicsymbols('q1 q2 q3')
|
| 9 |
+
frame_b.orient(frame_a, 'Axis', [q3, frame_a.x])
|
| 10 |
+
dcm = frame_a.dcm(frame_b)
|
| 11 |
+
m = dcm*3-frame_a.dcm(frame_b)
|
| 12 |
+
r = _me.dynamicsymbols('r')
|
| 13 |
+
circle_area = _sm.pi*r**2
|
| 14 |
+
u, a = _me.dynamicsymbols('u a')
|
| 15 |
+
x, y = _me.dynamicsymbols('x y')
|
| 16 |
+
s = u*_me.dynamicsymbols._t-1/2*a*_me.dynamicsymbols._t**2
|
| 17 |
+
expr1 = 2*a*0.5-1.25+0.25
|
| 18 |
+
expr2 = -1*x**2+y**2+0.25*(x+y)**2
|
| 19 |
+
expr3 = 0.5*10**(-10)
|
| 20 |
+
dyadic = _me.outer(frame_a.x, frame_a.x)+_me.outer(frame_a.y, frame_a.y)+_me.outer(frame_a.z, frame_a.z)
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/ruletest5.al
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
% ruletest5.al
|
| 2 |
+
VARIABLES X', Y'
|
| 3 |
+
|
| 4 |
+
E1 = (X+Y)^2 + (X-Y)^3
|
| 5 |
+
E2 = (X-Y)^2
|
| 6 |
+
E3 = X^2 + Y^2 + 2*X*Y
|
| 7 |
+
|
| 8 |
+
M1 = [E1;E2]
|
| 9 |
+
M2 = [(X+Y)^2,(X-Y)^2]
|
| 10 |
+
M3 = M1 + [X;Y]
|
| 11 |
+
|
| 12 |
+
AM = EXPAND(M1)
|
| 13 |
+
CM = EXPAND([(X+Y)^2,(X-Y)^2])
|
| 14 |
+
EM = EXPAND(M1 + [X;Y])
|
| 15 |
+
F = EXPAND(E1)
|
| 16 |
+
G = EXPAND(E2)
|
| 17 |
+
|
| 18 |
+
A = FACTOR(E3, X)
|
| 19 |
+
BM = FACTOR(M1, X)
|
| 20 |
+
CM = FACTOR(M1 + [X;Y], X)
|
| 21 |
+
|
| 22 |
+
A = D(E3, X)
|
| 23 |
+
B = D(E3, Y)
|
| 24 |
+
CM = D(M2, X)
|
| 25 |
+
DM = D(M1 + [X;Y], X)
|
| 26 |
+
FRAMES A, B
|
| 27 |
+
A_B = [1,0,0;1,0,0;1,0,0]
|
| 28 |
+
V1> = X*A1> + Y*A2> + X*Y*A3>
|
| 29 |
+
E> = D(V1>, X, B)
|
| 30 |
+
FM = DT(M1)
|
| 31 |
+
GM = DT([(X+Y)^2,(X-Y)^2])
|
| 32 |
+
H> = DT(V1>, B)
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/ruletest6.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sympy.physics.mechanics as _me
|
| 2 |
+
import sympy as _sm
|
| 3 |
+
import math as m
|
| 4 |
+
import numpy as _np
|
| 5 |
+
|
| 6 |
+
q1, q2 = _me.dynamicsymbols('q1 q2')
|
| 7 |
+
x, y, z = _me.dynamicsymbols('x y z')
|
| 8 |
+
e = q1+q2
|
| 9 |
+
a = (e).subs({q1:x**2+y**2, q2:x-y})
|
| 10 |
+
e2 = _sm.cos(x)
|
| 11 |
+
e3 = _sm.cos(x*y)
|
| 12 |
+
a = (e2).series(x, 0, 2).removeO()
|
| 13 |
+
b = (e3).series(x, 0, 2).removeO().series(y, 0, 2).removeO()
|
| 14 |
+
e = ((x+y)**2).expand()
|
| 15 |
+
a = (e).subs({q1:x**2+y**2,q2:x-y}).subs({x:1,y:z})
|
| 16 |
+
bm = _sm.Matrix([i.subs({x:1,y:z}) for i in _sm.Matrix([e,2*e]).reshape(2, 1)]).reshape((_sm.Matrix([e,2*e]).reshape(2, 1)).shape[0], (_sm.Matrix([e,2*e]).reshape(2, 1)).shape[1])
|
| 17 |
+
e = q1+q2
|
| 18 |
+
a = (e).subs({q1:x**2+y**2,q2:x-y}).subs({x:2,y:z**2})
|
| 19 |
+
j, k, l = _sm.symbols('j k l', real=True)
|
| 20 |
+
p1 = _sm.Poly(_sm.Matrix([j,k,l]).reshape(1, 3), x)
|
| 21 |
+
p2 = _sm.Poly(j*x+k, x)
|
| 22 |
+
root1 = [i.evalf() for i in _sm.solve(p1, x)]
|
| 23 |
+
root2 = [i.evalf() for i in _sm.solve(_sm.Poly(_sm.Matrix([1,2,3]).reshape(3, 1), x),x)]
|
| 24 |
+
m = _sm.Matrix([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]).reshape(4, 4)
|
| 25 |
+
am = (m).T+m
|
| 26 |
+
bm = _sm.Matrix([i.evalf() for i in (m).eigenvals().keys()])
|
| 27 |
+
c1 = _sm.diag(1,1,1,1)
|
| 28 |
+
c2 = _sm.Matrix([2 if i==j else 0 for i in range(3) for j in range(4)]).reshape(3, 4)
|
| 29 |
+
dm = (m+c1)**(-1)
|
| 30 |
+
e = (m+c1).det()+(_sm.Matrix([1,0,0,1]).reshape(2, 2)).trace()
|
| 31 |
+
f = (m)[1,2]
|
| 32 |
+
a = (m).cols
|
| 33 |
+
bm = (m).col(0)
|
| 34 |
+
cm = _sm.Matrix([(m).T.row(0),(m).T.row(1),(m).T.row(2),(m).T.row(3),(m).T.row(2)])
|
| 35 |
+
dm = (m).row(0)
|
| 36 |
+
em = _sm.Matrix([(m).row(0),(m).row(1),(m).row(2),(m).row(3),(m).row(2)])
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/autolev/test-examples/ruletest8.al
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
% ruletest8.al
|
| 2 |
+
FRAMES A
|
| 3 |
+
CONSTANTS C{3}
|
| 4 |
+
A>> = EXPRESS(1>>,A)
|
| 5 |
+
PARTICLES P1, P2
|
| 6 |
+
BODIES R
|
| 7 |
+
R_A = [1,1,1;1,1,0;0,0,1]
|
| 8 |
+
POINT O
|
| 9 |
+
MASS P1=M1, P2=M2, R=MR
|
| 10 |
+
INERTIA R, I1, I2, I3
|
| 11 |
+
P_P1_O> = C1*A1>
|
| 12 |
+
P_P2_O> = C2*A2>
|
| 13 |
+
P_RO_O> = C3*A3>
|
| 14 |
+
A>> = EXPRESS(I_P1_O>>, A)
|
| 15 |
+
A>> = EXPRESS(I_P2_O>>, A)
|
| 16 |
+
A>> = EXPRESS(I_R_O>>, A)
|
| 17 |
+
A>> = EXPRESS(INERTIA(O), A)
|
| 18 |
+
A>> = EXPRESS(INERTIA(O, P1, R), A)
|
| 19 |
+
A>> = EXPRESS(I_R_O>>, A)
|
| 20 |
+
A>> = EXPRESS(I_R_RO>>, A)
|
| 21 |
+
|
| 22 |
+
P_P1_P2> = C1*A1> + C2*A2>
|
| 23 |
+
P_P1_RO> = C3*A1>
|
| 24 |
+
P_P2_RO> = C3*A2>
|
| 25 |
+
|
| 26 |
+
B> = CM(O)
|
| 27 |
+
B> = CM(O, P1, R)
|
| 28 |
+
B> = CM(P1)
|
| 29 |
+
|
| 30 |
+
MOTIONVARIABLES U{3}
|
| 31 |
+
V> = U1*A1> + U2*A2> + U3*A3>
|
| 32 |
+
U> = UNITVEC(V> + C1*A1>)
|
| 33 |
+
V_P1_A> = U1*A1>
|
| 34 |
+
A> = PARTIALS(V_P1_A>, U1)
|
| 35 |
+
|
| 36 |
+
M = MASS(P1,R)
|
| 37 |
+
M = MASS(P2)
|
| 38 |
+
M = MASS()
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/c/c_parser.py
ADDED
|
@@ -0,0 +1,1058 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from sympy.external import import_module
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
cin = import_module('clang.cindex', import_kwargs = {'fromlist': ['cindex']})
|
| 5 |
+
|
| 6 |
+
"""
|
| 7 |
+
This module contains all the necessary Classes and Function used to Parse C and
|
| 8 |
+
C++ code into SymPy expression
|
| 9 |
+
The module serves as a backend for SymPyExpression to parse C code
|
| 10 |
+
It is also dependent on Clang's AST and SymPy's Codegen AST.
|
| 11 |
+
The module only supports the features currently supported by the Clang and
|
| 12 |
+
codegen AST which will be updated as the development of codegen AST and this
|
| 13 |
+
module progresses.
|
| 14 |
+
You might find unexpected bugs and exceptions while using the module, feel free
|
| 15 |
+
to report them to the SymPy Issue Tracker
|
| 16 |
+
|
| 17 |
+
Features Supported
|
| 18 |
+
==================
|
| 19 |
+
|
| 20 |
+
- Variable Declarations (integers and reals)
|
| 21 |
+
- Assignment (using integer & floating literal and function calls)
|
| 22 |
+
- Function Definitions and Declaration
|
| 23 |
+
- Function Calls
|
| 24 |
+
- Compound statements, Return statements
|
| 25 |
+
|
| 26 |
+
Notes
|
| 27 |
+
=====
|
| 28 |
+
|
| 29 |
+
The module is dependent on an external dependency which needs to be installed
|
| 30 |
+
to use the features of this module.
|
| 31 |
+
|
| 32 |
+
Clang: The C and C++ compiler which is used to extract an AST from the provided
|
| 33 |
+
C source code.
|
| 34 |
+
|
| 35 |
+
References
|
| 36 |
+
==========
|
| 37 |
+
|
| 38 |
+
.. [1] https://github.com/sympy/sympy/issues
|
| 39 |
+
.. [2] https://clang.llvm.org/docs/
|
| 40 |
+
.. [3] https://clang.llvm.org/docs/IntroductionToTheClangAST.html
|
| 41 |
+
|
| 42 |
+
"""
|
| 43 |
+
|
| 44 |
+
if cin:
|
| 45 |
+
from sympy.codegen.ast import (Variable, Integer, Float,
|
| 46 |
+
FunctionPrototype, FunctionDefinition, FunctionCall,
|
| 47 |
+
none, Return, Assignment, intc, int8, int16, int64,
|
| 48 |
+
uint8, uint16, uint32, uint64, float32, float64, float80,
|
| 49 |
+
aug_assign, bool_, While, CodeBlock)
|
| 50 |
+
from sympy.codegen.cnodes import (PreDecrement, PostDecrement,
|
| 51 |
+
PreIncrement, PostIncrement)
|
| 52 |
+
from sympy.core import Add, Mod, Mul, Pow, Rel
|
| 53 |
+
from sympy.logic.boolalg import And, as_Boolean, Not, Or
|
| 54 |
+
from sympy.core.symbol import Symbol
|
| 55 |
+
from sympy.core.sympify import sympify
|
| 56 |
+
from sympy.logic.boolalg import (false, true)
|
| 57 |
+
import sys
|
| 58 |
+
import tempfile
|
| 59 |
+
|
| 60 |
+
class BaseParser:
|
| 61 |
+
"""Base Class for the C parser"""
|
| 62 |
+
|
| 63 |
+
def __init__(self):
|
| 64 |
+
"""Initializes the Base parser creating a Clang AST index"""
|
| 65 |
+
self.index = cin.Index.create()
|
| 66 |
+
|
| 67 |
+
def diagnostics(self, out):
|
| 68 |
+
"""Diagostics function for the Clang AST"""
|
| 69 |
+
for diag in self.tu.diagnostics:
|
| 70 |
+
# tu = translation unit
|
| 71 |
+
print('%s %s (line %s, col %s) %s' % (
|
| 72 |
+
{
|
| 73 |
+
4: 'FATAL',
|
| 74 |
+
3: 'ERROR',
|
| 75 |
+
2: 'WARNING',
|
| 76 |
+
1: 'NOTE',
|
| 77 |
+
0: 'IGNORED',
|
| 78 |
+
}[diag.severity],
|
| 79 |
+
diag.location.file,
|
| 80 |
+
diag.location.line,
|
| 81 |
+
diag.location.column,
|
| 82 |
+
diag.spelling
|
| 83 |
+
), file=out)
|
| 84 |
+
|
| 85 |
+
class CCodeConverter(BaseParser):
|
| 86 |
+
"""The Code Convereter for Clang AST
|
| 87 |
+
|
| 88 |
+
The converter object takes the C source code or file as input and
|
| 89 |
+
converts them to SymPy Expressions.
|
| 90 |
+
"""
|
| 91 |
+
|
| 92 |
+
def __init__(self):
|
| 93 |
+
"""Initializes the code converter"""
|
| 94 |
+
super().__init__()
|
| 95 |
+
self._py_nodes = []
|
| 96 |
+
self._data_types = {
|
| 97 |
+
"void": {
|
| 98 |
+
cin.TypeKind.VOID: none
|
| 99 |
+
},
|
| 100 |
+
"bool": {
|
| 101 |
+
cin.TypeKind.BOOL: bool_
|
| 102 |
+
},
|
| 103 |
+
"int": {
|
| 104 |
+
cin.TypeKind.SCHAR: int8,
|
| 105 |
+
cin.TypeKind.SHORT: int16,
|
| 106 |
+
cin.TypeKind.INT: intc,
|
| 107 |
+
cin.TypeKind.LONG: int64,
|
| 108 |
+
cin.TypeKind.UCHAR: uint8,
|
| 109 |
+
cin.TypeKind.USHORT: uint16,
|
| 110 |
+
cin.TypeKind.UINT: uint32,
|
| 111 |
+
cin.TypeKind.ULONG: uint64
|
| 112 |
+
},
|
| 113 |
+
"float": {
|
| 114 |
+
cin.TypeKind.FLOAT: float32,
|
| 115 |
+
cin.TypeKind.DOUBLE: float64,
|
| 116 |
+
cin.TypeKind.LONGDOUBLE: float80
|
| 117 |
+
}
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
def parse(self, filename, flags):
|
| 121 |
+
"""Function to parse a file with C source code
|
| 122 |
+
|
| 123 |
+
It takes the filename as an attribute and creates a Clang AST
|
| 124 |
+
Translation Unit parsing the file.
|
| 125 |
+
Then the transformation function is called on the translation unit,
|
| 126 |
+
whose reults are collected into a list which is returned by the
|
| 127 |
+
function.
|
| 128 |
+
|
| 129 |
+
Parameters
|
| 130 |
+
==========
|
| 131 |
+
|
| 132 |
+
filename : string
|
| 133 |
+
Path to the C file to be parsed
|
| 134 |
+
|
| 135 |
+
flags: list
|
| 136 |
+
Arguments to be passed to Clang while parsing the C code
|
| 137 |
+
|
| 138 |
+
Returns
|
| 139 |
+
=======
|
| 140 |
+
|
| 141 |
+
py_nodes: list
|
| 142 |
+
A list of SymPy AST nodes
|
| 143 |
+
|
| 144 |
+
"""
|
| 145 |
+
filepath = os.path.abspath(filename)
|
| 146 |
+
self.tu = self.index.parse(
|
| 147 |
+
filepath,
|
| 148 |
+
args=flags,
|
| 149 |
+
options=cin.TranslationUnit.PARSE_DETAILED_PROCESSING_RECORD
|
| 150 |
+
)
|
| 151 |
+
for child in self.tu.cursor.get_children():
|
| 152 |
+
if child.kind == cin.CursorKind.VAR_DECL or child.kind == cin.CursorKind.FUNCTION_DECL:
|
| 153 |
+
self._py_nodes.append(self.transform(child))
|
| 154 |
+
return self._py_nodes
|
| 155 |
+
|
| 156 |
+
def parse_str(self, source, flags):
|
| 157 |
+
"""Function to parse a string with C source code
|
| 158 |
+
|
| 159 |
+
It takes the source code as an attribute, stores it in a temporary
|
| 160 |
+
file and creates a Clang AST Translation Unit parsing the file.
|
| 161 |
+
Then the transformation function is called on the translation unit,
|
| 162 |
+
whose reults are collected into a list which is returned by the
|
| 163 |
+
function.
|
| 164 |
+
|
| 165 |
+
Parameters
|
| 166 |
+
==========
|
| 167 |
+
|
| 168 |
+
source : string
|
| 169 |
+
A string containing the C source code to be parsed
|
| 170 |
+
|
| 171 |
+
flags: list
|
| 172 |
+
Arguments to be passed to Clang while parsing the C code
|
| 173 |
+
|
| 174 |
+
Returns
|
| 175 |
+
=======
|
| 176 |
+
|
| 177 |
+
py_nodes: list
|
| 178 |
+
A list of SymPy AST nodes
|
| 179 |
+
|
| 180 |
+
"""
|
| 181 |
+
file = tempfile.NamedTemporaryFile(mode = 'w+', suffix = '.cpp')
|
| 182 |
+
file.write(source)
|
| 183 |
+
file.seek(0)
|
| 184 |
+
self.tu = self.index.parse(
|
| 185 |
+
file.name,
|
| 186 |
+
args=flags,
|
| 187 |
+
options=cin.TranslationUnit.PARSE_DETAILED_PROCESSING_RECORD
|
| 188 |
+
)
|
| 189 |
+
file.close()
|
| 190 |
+
for child in self.tu.cursor.get_children():
|
| 191 |
+
if child.kind == cin.CursorKind.VAR_DECL or child.kind == cin.CursorKind.FUNCTION_DECL:
|
| 192 |
+
self._py_nodes.append(self.transform(child))
|
| 193 |
+
return self._py_nodes
|
| 194 |
+
|
| 195 |
+
def transform(self, node):
|
| 196 |
+
"""Transformation Function for Clang AST nodes
|
| 197 |
+
|
| 198 |
+
It determines the kind of node and calls the respective
|
| 199 |
+
transformation function for that node.
|
| 200 |
+
|
| 201 |
+
Raises
|
| 202 |
+
======
|
| 203 |
+
|
| 204 |
+
NotImplementedError : if the transformation for the provided node
|
| 205 |
+
is not implemented
|
| 206 |
+
|
| 207 |
+
"""
|
| 208 |
+
handler = getattr(self, 'transform_%s' % node.kind.name.lower(), None)
|
| 209 |
+
|
| 210 |
+
if handler is None:
|
| 211 |
+
print(
|
| 212 |
+
"Ignoring node of type %s (%s)" % (
|
| 213 |
+
node.kind,
|
| 214 |
+
' '.join(
|
| 215 |
+
t.spelling for t in node.get_tokens())
|
| 216 |
+
),
|
| 217 |
+
file=sys.stderr
|
| 218 |
+
)
|
| 219 |
+
|
| 220 |
+
return handler(node)
|
| 221 |
+
|
| 222 |
+
def transform_var_decl(self, node):
|
| 223 |
+
"""Transformation Function for Variable Declaration
|
| 224 |
+
|
| 225 |
+
Used to create nodes for variable declarations and assignments with
|
| 226 |
+
values or function call for the respective nodes in the clang AST
|
| 227 |
+
|
| 228 |
+
Returns
|
| 229 |
+
=======
|
| 230 |
+
|
| 231 |
+
A variable node as Declaration, with the initial value if given
|
| 232 |
+
|
| 233 |
+
Raises
|
| 234 |
+
======
|
| 235 |
+
|
| 236 |
+
NotImplementedError : if called for data types not currently
|
| 237 |
+
implemented
|
| 238 |
+
|
| 239 |
+
Notes
|
| 240 |
+
=====
|
| 241 |
+
|
| 242 |
+
The function currently supports following data types:
|
| 243 |
+
|
| 244 |
+
Boolean:
|
| 245 |
+
bool, _Bool
|
| 246 |
+
|
| 247 |
+
Integer:
|
| 248 |
+
8-bit: signed char and unsigned char
|
| 249 |
+
16-bit: short, short int, signed short,
|
| 250 |
+
signed short int, unsigned short, unsigned short int
|
| 251 |
+
32-bit: int, signed int, unsigned int
|
| 252 |
+
64-bit: long, long int, signed long,
|
| 253 |
+
signed long int, unsigned long, unsigned long int
|
| 254 |
+
|
| 255 |
+
Floating point:
|
| 256 |
+
Single Precision: float
|
| 257 |
+
Double Precision: double
|
| 258 |
+
Extended Precision: long double
|
| 259 |
+
|
| 260 |
+
"""
|
| 261 |
+
if node.type.kind in self._data_types["int"]:
|
| 262 |
+
type = self._data_types["int"][node.type.kind]
|
| 263 |
+
elif node.type.kind in self._data_types["float"]:
|
| 264 |
+
type = self._data_types["float"][node.type.kind]
|
| 265 |
+
elif node.type.kind in self._data_types["bool"]:
|
| 266 |
+
type = self._data_types["bool"][node.type.kind]
|
| 267 |
+
else:
|
| 268 |
+
raise NotImplementedError("Only bool, int "
|
| 269 |
+
"and float are supported")
|
| 270 |
+
try:
|
| 271 |
+
children = node.get_children()
|
| 272 |
+
child = next(children)
|
| 273 |
+
|
| 274 |
+
#ignoring namespace and type details for the variable
|
| 275 |
+
while child.kind == cin.CursorKind.NAMESPACE_REF or child.kind == cin.CursorKind.TYPE_REF:
|
| 276 |
+
child = next(children)
|
| 277 |
+
|
| 278 |
+
val = self.transform(child)
|
| 279 |
+
|
| 280 |
+
supported_rhs = [
|
| 281 |
+
cin.CursorKind.INTEGER_LITERAL,
|
| 282 |
+
cin.CursorKind.FLOATING_LITERAL,
|
| 283 |
+
cin.CursorKind.UNEXPOSED_EXPR,
|
| 284 |
+
cin.CursorKind.BINARY_OPERATOR,
|
| 285 |
+
cin.CursorKind.PAREN_EXPR,
|
| 286 |
+
cin.CursorKind.UNARY_OPERATOR,
|
| 287 |
+
cin.CursorKind.CXX_BOOL_LITERAL_EXPR
|
| 288 |
+
]
|
| 289 |
+
|
| 290 |
+
if child.kind in supported_rhs:
|
| 291 |
+
if isinstance(val, str):
|
| 292 |
+
value = Symbol(val)
|
| 293 |
+
elif isinstance(val, bool):
|
| 294 |
+
if node.type.kind in self._data_types["int"]:
|
| 295 |
+
value = Integer(0) if val == False else Integer(1)
|
| 296 |
+
elif node.type.kind in self._data_types["float"]:
|
| 297 |
+
value = Float(0.0) if val == False else Float(1.0)
|
| 298 |
+
elif node.type.kind in self._data_types["bool"]:
|
| 299 |
+
value = sympify(val)
|
| 300 |
+
elif isinstance(val, (Integer, int, Float, float)):
|
| 301 |
+
if node.type.kind in self._data_types["int"]:
|
| 302 |
+
value = Integer(val)
|
| 303 |
+
elif node.type.kind in self._data_types["float"]:
|
| 304 |
+
value = Float(val)
|
| 305 |
+
elif node.type.kind in self._data_types["bool"]:
|
| 306 |
+
value = sympify(bool(val))
|
| 307 |
+
else:
|
| 308 |
+
value = val
|
| 309 |
+
|
| 310 |
+
return Variable(
|
| 311 |
+
node.spelling
|
| 312 |
+
).as_Declaration(
|
| 313 |
+
type = type,
|
| 314 |
+
value = value
|
| 315 |
+
)
|
| 316 |
+
|
| 317 |
+
elif child.kind == cin.CursorKind.CALL_EXPR:
|
| 318 |
+
return Variable(
|
| 319 |
+
node.spelling
|
| 320 |
+
).as_Declaration(
|
| 321 |
+
value = val
|
| 322 |
+
)
|
| 323 |
+
|
| 324 |
+
else:
|
| 325 |
+
raise NotImplementedError("Given "
|
| 326 |
+
"variable declaration \"{}\" "
|
| 327 |
+
"is not possible to parse yet!"
|
| 328 |
+
.format(" ".join(
|
| 329 |
+
t.spelling for t in node.get_tokens()
|
| 330 |
+
)
|
| 331 |
+
))
|
| 332 |
+
|
| 333 |
+
except StopIteration:
|
| 334 |
+
return Variable(
|
| 335 |
+
node.spelling
|
| 336 |
+
).as_Declaration(
|
| 337 |
+
type = type
|
| 338 |
+
)
|
| 339 |
+
|
| 340 |
+
def transform_function_decl(self, node):
|
| 341 |
+
"""Transformation Function For Function Declaration
|
| 342 |
+
|
| 343 |
+
Used to create nodes for function declarations and definitions for
|
| 344 |
+
the respective nodes in the clang AST
|
| 345 |
+
|
| 346 |
+
Returns
|
| 347 |
+
=======
|
| 348 |
+
|
| 349 |
+
function : Codegen AST node
|
| 350 |
+
- FunctionPrototype node if function body is not present
|
| 351 |
+
- FunctionDefinition node if the function body is present
|
| 352 |
+
|
| 353 |
+
|
| 354 |
+
"""
|
| 355 |
+
|
| 356 |
+
if node.result_type.kind in self._data_types["int"]:
|
| 357 |
+
ret_type = self._data_types["int"][node.result_type.kind]
|
| 358 |
+
elif node.result_type.kind in self._data_types["float"]:
|
| 359 |
+
ret_type = self._data_types["float"][node.result_type.kind]
|
| 360 |
+
elif node.result_type.kind in self._data_types["bool"]:
|
| 361 |
+
ret_type = self._data_types["bool"][node.result_type.kind]
|
| 362 |
+
elif node.result_type.kind in self._data_types["void"]:
|
| 363 |
+
ret_type = self._data_types["void"][node.result_type.kind]
|
| 364 |
+
else:
|
| 365 |
+
raise NotImplementedError("Only void, bool, int "
|
| 366 |
+
"and float are supported")
|
| 367 |
+
body = []
|
| 368 |
+
param = []
|
| 369 |
+
|
| 370 |
+
# Subsequent nodes will be the parameters for the function.
|
| 371 |
+
for child in node.get_children():
|
| 372 |
+
decl = self.transform(child)
|
| 373 |
+
if child.kind == cin.CursorKind.PARM_DECL:
|
| 374 |
+
param.append(decl)
|
| 375 |
+
elif child.kind == cin.CursorKind.COMPOUND_STMT:
|
| 376 |
+
for val in decl:
|
| 377 |
+
body.append(val)
|
| 378 |
+
else:
|
| 379 |
+
body.append(decl)
|
| 380 |
+
|
| 381 |
+
if body == []:
|
| 382 |
+
function = FunctionPrototype(
|
| 383 |
+
return_type = ret_type,
|
| 384 |
+
name = node.spelling,
|
| 385 |
+
parameters = param
|
| 386 |
+
)
|
| 387 |
+
else:
|
| 388 |
+
function = FunctionDefinition(
|
| 389 |
+
return_type = ret_type,
|
| 390 |
+
name = node.spelling,
|
| 391 |
+
parameters = param,
|
| 392 |
+
body = body
|
| 393 |
+
)
|
| 394 |
+
return function
|
| 395 |
+
|
| 396 |
+
def transform_parm_decl(self, node):
|
| 397 |
+
"""Transformation function for Parameter Declaration
|
| 398 |
+
|
| 399 |
+
Used to create parameter nodes for the required functions for the
|
| 400 |
+
respective nodes in the clang AST
|
| 401 |
+
|
| 402 |
+
Returns
|
| 403 |
+
=======
|
| 404 |
+
|
| 405 |
+
param : Codegen AST Node
|
| 406 |
+
Variable node with the value and type of the variable
|
| 407 |
+
|
| 408 |
+
Raises
|
| 409 |
+
======
|
| 410 |
+
|
| 411 |
+
ValueError if multiple children encountered in the parameter node
|
| 412 |
+
|
| 413 |
+
"""
|
| 414 |
+
if node.type.kind in self._data_types["int"]:
|
| 415 |
+
type = self._data_types["int"][node.type.kind]
|
| 416 |
+
elif node.type.kind in self._data_types["float"]:
|
| 417 |
+
type = self._data_types["float"][node.type.kind]
|
| 418 |
+
elif node.type.kind in self._data_types["bool"]:
|
| 419 |
+
type = self._data_types["bool"][node.type.kind]
|
| 420 |
+
else:
|
| 421 |
+
raise NotImplementedError("Only bool, int "
|
| 422 |
+
"and float are supported")
|
| 423 |
+
try:
|
| 424 |
+
children = node.get_children()
|
| 425 |
+
child = next(children)
|
| 426 |
+
|
| 427 |
+
# Any namespace nodes can be ignored
|
| 428 |
+
while child.kind in [cin.CursorKind.NAMESPACE_REF,
|
| 429 |
+
cin.CursorKind.TYPE_REF,
|
| 430 |
+
cin.CursorKind.TEMPLATE_REF]:
|
| 431 |
+
child = next(children)
|
| 432 |
+
|
| 433 |
+
# If there is a child, it is the default value of the parameter.
|
| 434 |
+
lit = self.transform(child)
|
| 435 |
+
if node.type.kind in self._data_types["int"]:
|
| 436 |
+
val = Integer(lit)
|
| 437 |
+
elif node.type.kind in self._data_types["float"]:
|
| 438 |
+
val = Float(lit)
|
| 439 |
+
elif node.type.kind in self._data_types["bool"]:
|
| 440 |
+
val = sympify(bool(lit))
|
| 441 |
+
else:
|
| 442 |
+
raise NotImplementedError("Only bool, int "
|
| 443 |
+
"and float are supported")
|
| 444 |
+
|
| 445 |
+
param = Variable(
|
| 446 |
+
node.spelling
|
| 447 |
+
).as_Declaration(
|
| 448 |
+
type = type,
|
| 449 |
+
value = val
|
| 450 |
+
)
|
| 451 |
+
except StopIteration:
|
| 452 |
+
param = Variable(
|
| 453 |
+
node.spelling
|
| 454 |
+
).as_Declaration(
|
| 455 |
+
type = type
|
| 456 |
+
)
|
| 457 |
+
|
| 458 |
+
try:
|
| 459 |
+
self.transform(next(children))
|
| 460 |
+
raise ValueError("Can't handle multiple children on parameter")
|
| 461 |
+
except StopIteration:
|
| 462 |
+
pass
|
| 463 |
+
|
| 464 |
+
return param
|
| 465 |
+
|
| 466 |
+
def transform_integer_literal(self, node):
|
| 467 |
+
"""Transformation function for integer literal
|
| 468 |
+
|
| 469 |
+
Used to get the value and type of the given integer literal.
|
| 470 |
+
|
| 471 |
+
Returns
|
| 472 |
+
=======
|
| 473 |
+
|
| 474 |
+
val : list
|
| 475 |
+
List with two arguments type and Value
|
| 476 |
+
type contains the type of the integer
|
| 477 |
+
value contains the value stored in the variable
|
| 478 |
+
|
| 479 |
+
Notes
|
| 480 |
+
=====
|
| 481 |
+
|
| 482 |
+
Only Base Integer type supported for now
|
| 483 |
+
|
| 484 |
+
"""
|
| 485 |
+
try:
|
| 486 |
+
value = next(node.get_tokens()).spelling
|
| 487 |
+
except StopIteration:
|
| 488 |
+
# No tokens
|
| 489 |
+
value = node.literal
|
| 490 |
+
return int(value)
|
| 491 |
+
|
| 492 |
+
def transform_floating_literal(self, node):
|
| 493 |
+
"""Transformation function for floating literal
|
| 494 |
+
|
| 495 |
+
Used to get the value and type of the given floating literal.
|
| 496 |
+
|
| 497 |
+
Returns
|
| 498 |
+
=======
|
| 499 |
+
|
| 500 |
+
val : list
|
| 501 |
+
List with two arguments type and Value
|
| 502 |
+
type contains the type of float
|
| 503 |
+
value contains the value stored in the variable
|
| 504 |
+
|
| 505 |
+
Notes
|
| 506 |
+
=====
|
| 507 |
+
|
| 508 |
+
Only Base Float type supported for now
|
| 509 |
+
|
| 510 |
+
"""
|
| 511 |
+
try:
|
| 512 |
+
value = next(node.get_tokens()).spelling
|
| 513 |
+
except (StopIteration, ValueError):
|
| 514 |
+
# No tokens
|
| 515 |
+
value = node.literal
|
| 516 |
+
return float(value)
|
| 517 |
+
|
| 518 |
+
def transform_string_literal(self, node):
|
| 519 |
+
#TODO: No string type in AST
|
| 520 |
+
#type =
|
| 521 |
+
#try:
|
| 522 |
+
# value = next(node.get_tokens()).spelling
|
| 523 |
+
#except (StopIteration, ValueError):
|
| 524 |
+
# No tokens
|
| 525 |
+
# value = node.literal
|
| 526 |
+
#val = [type, value]
|
| 527 |
+
#return val
|
| 528 |
+
pass
|
| 529 |
+
|
| 530 |
+
def transform_character_literal(self, node):
|
| 531 |
+
"""Transformation function for character literal
|
| 532 |
+
|
| 533 |
+
Used to get the value of the given character literal.
|
| 534 |
+
|
| 535 |
+
Returns
|
| 536 |
+
=======
|
| 537 |
+
|
| 538 |
+
val : int
|
| 539 |
+
val contains the ascii value of the character literal
|
| 540 |
+
|
| 541 |
+
Notes
|
| 542 |
+
=====
|
| 543 |
+
|
| 544 |
+
Only for cases where character is assigned to a integer value,
|
| 545 |
+
since character literal is not in SymPy AST
|
| 546 |
+
|
| 547 |
+
"""
|
| 548 |
+
try:
|
| 549 |
+
value = next(node.get_tokens()).spelling
|
| 550 |
+
except (StopIteration, ValueError):
|
| 551 |
+
# No tokens
|
| 552 |
+
value = node.literal
|
| 553 |
+
return ord(str(value[1]))
|
| 554 |
+
|
| 555 |
+
def transform_cxx_bool_literal_expr(self, node):
|
| 556 |
+
"""Transformation function for boolean literal
|
| 557 |
+
|
| 558 |
+
Used to get the value of the given boolean literal.
|
| 559 |
+
|
| 560 |
+
Returns
|
| 561 |
+
=======
|
| 562 |
+
|
| 563 |
+
value : bool
|
| 564 |
+
value contains the boolean value of the variable
|
| 565 |
+
|
| 566 |
+
"""
|
| 567 |
+
try:
|
| 568 |
+
value = next(node.get_tokens()).spelling
|
| 569 |
+
except (StopIteration, ValueError):
|
| 570 |
+
value = node.literal
|
| 571 |
+
return True if value == 'true' else False
|
| 572 |
+
|
| 573 |
+
def transform_unexposed_decl(self,node):
|
| 574 |
+
"""Transformation function for unexposed declarations"""
|
| 575 |
+
pass
|
| 576 |
+
|
| 577 |
+
def transform_unexposed_expr(self, node):
|
| 578 |
+
"""Transformation function for unexposed expression
|
| 579 |
+
|
| 580 |
+
Unexposed expressions are used to wrap float, double literals and
|
| 581 |
+
expressions
|
| 582 |
+
|
| 583 |
+
Returns
|
| 584 |
+
=======
|
| 585 |
+
|
| 586 |
+
expr : Codegen AST Node
|
| 587 |
+
the result from the wrapped expression
|
| 588 |
+
|
| 589 |
+
None : NoneType
|
| 590 |
+
No childs are found for the node
|
| 591 |
+
|
| 592 |
+
Raises
|
| 593 |
+
======
|
| 594 |
+
|
| 595 |
+
ValueError if the expression contains multiple children
|
| 596 |
+
|
| 597 |
+
"""
|
| 598 |
+
# Ignore unexposed nodes; pass whatever is the first
|
| 599 |
+
# (and should be only) child unaltered.
|
| 600 |
+
try:
|
| 601 |
+
children = node.get_children()
|
| 602 |
+
expr = self.transform(next(children))
|
| 603 |
+
except StopIteration:
|
| 604 |
+
return None
|
| 605 |
+
|
| 606 |
+
try:
|
| 607 |
+
next(children)
|
| 608 |
+
raise ValueError("Unexposed expression has > 1 children.")
|
| 609 |
+
except StopIteration:
|
| 610 |
+
pass
|
| 611 |
+
|
| 612 |
+
return expr
|
| 613 |
+
|
| 614 |
+
def transform_decl_ref_expr(self, node):
|
| 615 |
+
"""Returns the name of the declaration reference"""
|
| 616 |
+
return node.spelling
|
| 617 |
+
|
| 618 |
+
def transform_call_expr(self, node):
|
| 619 |
+
"""Transformation function for a call expression
|
| 620 |
+
|
| 621 |
+
Used to create function call nodes for the function calls present
|
| 622 |
+
in the C code
|
| 623 |
+
|
| 624 |
+
Returns
|
| 625 |
+
=======
|
| 626 |
+
|
| 627 |
+
FunctionCall : Codegen AST Node
|
| 628 |
+
FunctionCall node with parameters if any parameters are present
|
| 629 |
+
|
| 630 |
+
"""
|
| 631 |
+
param = []
|
| 632 |
+
children = node.get_children()
|
| 633 |
+
child = next(children)
|
| 634 |
+
|
| 635 |
+
while child.kind == cin.CursorKind.NAMESPACE_REF:
|
| 636 |
+
child = next(children)
|
| 637 |
+
while child.kind == cin.CursorKind.TYPE_REF:
|
| 638 |
+
child = next(children)
|
| 639 |
+
|
| 640 |
+
first_child = self.transform(child)
|
| 641 |
+
try:
|
| 642 |
+
for child in children:
|
| 643 |
+
arg = self.transform(child)
|
| 644 |
+
if child.kind == cin.CursorKind.INTEGER_LITERAL:
|
| 645 |
+
param.append(Integer(arg))
|
| 646 |
+
elif child.kind == cin.CursorKind.FLOATING_LITERAL:
|
| 647 |
+
param.append(Float(arg))
|
| 648 |
+
else:
|
| 649 |
+
param.append(arg)
|
| 650 |
+
return FunctionCall(first_child, param)
|
| 651 |
+
|
| 652 |
+
except StopIteration:
|
| 653 |
+
return FunctionCall(first_child)
|
| 654 |
+
|
| 655 |
+
def transform_return_stmt(self, node):
|
| 656 |
+
"""Returns the Return Node for a return statement"""
|
| 657 |
+
return Return(next(node.get_children()).spelling)
|
| 658 |
+
|
| 659 |
+
def transform_compound_stmt(self, node):
|
| 660 |
+
"""Transformation function for compond statemets
|
| 661 |
+
|
| 662 |
+
Returns
|
| 663 |
+
=======
|
| 664 |
+
|
| 665 |
+
expr : list
|
| 666 |
+
list of Nodes for the expressions present in the statement
|
| 667 |
+
|
| 668 |
+
None : NoneType
|
| 669 |
+
if the compound statement is empty
|
| 670 |
+
|
| 671 |
+
"""
|
| 672 |
+
expr = []
|
| 673 |
+
children = node.get_children()
|
| 674 |
+
|
| 675 |
+
for child in children:
|
| 676 |
+
expr.append(self.transform(child))
|
| 677 |
+
return expr
|
| 678 |
+
|
| 679 |
+
def transform_decl_stmt(self, node):
|
| 680 |
+
"""Transformation function for declaration statements
|
| 681 |
+
|
| 682 |
+
These statements are used to wrap different kinds of declararions
|
| 683 |
+
like variable or function declaration
|
| 684 |
+
The function calls the transformer function for the child of the
|
| 685 |
+
given node
|
| 686 |
+
|
| 687 |
+
Returns
|
| 688 |
+
=======
|
| 689 |
+
|
| 690 |
+
statement : Codegen AST Node
|
| 691 |
+
contains the node returned by the children node for the type of
|
| 692 |
+
declaration
|
| 693 |
+
|
| 694 |
+
Raises
|
| 695 |
+
======
|
| 696 |
+
|
| 697 |
+
ValueError if multiple children present
|
| 698 |
+
|
| 699 |
+
"""
|
| 700 |
+
try:
|
| 701 |
+
children = node.get_children()
|
| 702 |
+
statement = self.transform(next(children))
|
| 703 |
+
except StopIteration:
|
| 704 |
+
pass
|
| 705 |
+
|
| 706 |
+
try:
|
| 707 |
+
self.transform(next(children))
|
| 708 |
+
raise ValueError("Don't know how to handle multiple statements")
|
| 709 |
+
except StopIteration:
|
| 710 |
+
pass
|
| 711 |
+
|
| 712 |
+
return statement
|
| 713 |
+
|
| 714 |
+
def transform_paren_expr(self, node):
|
| 715 |
+
"""Transformation function for Parenthesized expressions
|
| 716 |
+
|
| 717 |
+
Returns the result from its children nodes
|
| 718 |
+
|
| 719 |
+
"""
|
| 720 |
+
return self.transform(next(node.get_children()))
|
| 721 |
+
|
| 722 |
+
def transform_compound_assignment_operator(self, node):
|
| 723 |
+
"""Transformation function for handling shorthand operators
|
| 724 |
+
|
| 725 |
+
Returns
|
| 726 |
+
=======
|
| 727 |
+
|
| 728 |
+
augmented_assignment_expression: Codegen AST node
|
| 729 |
+
shorthand assignment expression represented as Codegen AST
|
| 730 |
+
|
| 731 |
+
Raises
|
| 732 |
+
======
|
| 733 |
+
|
| 734 |
+
NotImplementedError
|
| 735 |
+
If the shorthand operator for bitwise operators
|
| 736 |
+
(~=, ^=, &=, |=, <<=, >>=) is encountered
|
| 737 |
+
|
| 738 |
+
"""
|
| 739 |
+
return self.transform_binary_operator(node)
|
| 740 |
+
|
| 741 |
+
def transform_unary_operator(self, node):
|
| 742 |
+
"""Transformation function for handling unary operators
|
| 743 |
+
|
| 744 |
+
Returns
|
| 745 |
+
=======
|
| 746 |
+
|
| 747 |
+
unary_expression: Codegen AST node
|
| 748 |
+
simplified unary expression represented as Codegen AST
|
| 749 |
+
|
| 750 |
+
Raises
|
| 751 |
+
======
|
| 752 |
+
|
| 753 |
+
NotImplementedError
|
| 754 |
+
If dereferencing operator(*), address operator(&) or
|
| 755 |
+
bitwise NOT operator(~) is encountered
|
| 756 |
+
|
| 757 |
+
"""
|
| 758 |
+
# supported operators list
|
| 759 |
+
operators_list = ['+', '-', '++', '--', '!']
|
| 760 |
+
tokens = list(node.get_tokens())
|
| 761 |
+
|
| 762 |
+
# it can be either pre increment/decrement or any other operator from the list
|
| 763 |
+
if tokens[0].spelling in operators_list:
|
| 764 |
+
child = self.transform(next(node.get_children()))
|
| 765 |
+
# (decl_ref) e.g.; int a = ++b; or simply ++b;
|
| 766 |
+
if isinstance(child, str):
|
| 767 |
+
if tokens[0].spelling == '+':
|
| 768 |
+
return Symbol(child)
|
| 769 |
+
if tokens[0].spelling == '-':
|
| 770 |
+
return Mul(Symbol(child), -1)
|
| 771 |
+
if tokens[0].spelling == '++':
|
| 772 |
+
return PreIncrement(Symbol(child))
|
| 773 |
+
if tokens[0].spelling == '--':
|
| 774 |
+
return PreDecrement(Symbol(child))
|
| 775 |
+
if tokens[0].spelling == '!':
|
| 776 |
+
return Not(Symbol(child))
|
| 777 |
+
# e.g.; int a = -1; or int b = -(1 + 2);
|
| 778 |
+
else:
|
| 779 |
+
if tokens[0].spelling == '+':
|
| 780 |
+
return child
|
| 781 |
+
if tokens[0].spelling == '-':
|
| 782 |
+
return Mul(child, -1)
|
| 783 |
+
if tokens[0].spelling == '!':
|
| 784 |
+
return Not(sympify(bool(child)))
|
| 785 |
+
|
| 786 |
+
# it can be either post increment/decrement
|
| 787 |
+
# since variable name is obtained in token[0].spelling
|
| 788 |
+
elif tokens[1].spelling in ['++', '--']:
|
| 789 |
+
child = self.transform(next(node.get_children()))
|
| 790 |
+
if tokens[1].spelling == '++':
|
| 791 |
+
return PostIncrement(Symbol(child))
|
| 792 |
+
if tokens[1].spelling == '--':
|
| 793 |
+
return PostDecrement(Symbol(child))
|
| 794 |
+
else:
|
| 795 |
+
raise NotImplementedError("Dereferencing operator, "
|
| 796 |
+
"Address operator and bitwise NOT operator "
|
| 797 |
+
"have not been implemented yet!")
|
| 798 |
+
|
| 799 |
+
def transform_binary_operator(self, node):
|
| 800 |
+
"""Transformation function for handling binary operators
|
| 801 |
+
|
| 802 |
+
Returns
|
| 803 |
+
=======
|
| 804 |
+
|
| 805 |
+
binary_expression: Codegen AST node
|
| 806 |
+
simplified binary expression represented as Codegen AST
|
| 807 |
+
|
| 808 |
+
Raises
|
| 809 |
+
======
|
| 810 |
+
|
| 811 |
+
NotImplementedError
|
| 812 |
+
If a bitwise operator or
|
| 813 |
+
unary operator(which is a child of any binary
|
| 814 |
+
operator in Clang AST) is encountered
|
| 815 |
+
|
| 816 |
+
"""
|
| 817 |
+
# get all the tokens of assignment
|
| 818 |
+
# and store it in the tokens list
|
| 819 |
+
tokens = list(node.get_tokens())
|
| 820 |
+
|
| 821 |
+
# supported operators list
|
| 822 |
+
operators_list = ['+', '-', '*', '/', '%','=',
|
| 823 |
+
'>', '>=', '<', '<=', '==', '!=', '&&', '||', '+=', '-=',
|
| 824 |
+
'*=', '/=', '%=']
|
| 825 |
+
|
| 826 |
+
# this stack will contain variable content
|
| 827 |
+
# and type of variable in the rhs
|
| 828 |
+
combined_variables_stack = []
|
| 829 |
+
|
| 830 |
+
# this stack will contain operators
|
| 831 |
+
# to be processed in the rhs
|
| 832 |
+
operators_stack = []
|
| 833 |
+
|
| 834 |
+
# iterate through every token
|
| 835 |
+
for token in tokens:
|
| 836 |
+
# token is either '(', ')' or
|
| 837 |
+
# any of the supported operators from the operator list
|
| 838 |
+
if token.kind == cin.TokenKind.PUNCTUATION:
|
| 839 |
+
|
| 840 |
+
# push '(' to the operators stack
|
| 841 |
+
if token.spelling == '(':
|
| 842 |
+
operators_stack.append('(')
|
| 843 |
+
|
| 844 |
+
elif token.spelling == ')':
|
| 845 |
+
# keep adding the expression to the
|
| 846 |
+
# combined variables stack unless
|
| 847 |
+
# '(' is found
|
| 848 |
+
while (operators_stack
|
| 849 |
+
and operators_stack[-1] != '('):
|
| 850 |
+
if len(combined_variables_stack) < 2:
|
| 851 |
+
raise NotImplementedError(
|
| 852 |
+
"Unary operators as a part of "
|
| 853 |
+
"binary operators is not "
|
| 854 |
+
"supported yet!")
|
| 855 |
+
rhs = combined_variables_stack.pop()
|
| 856 |
+
lhs = combined_variables_stack.pop()
|
| 857 |
+
operator = operators_stack.pop()
|
| 858 |
+
combined_variables_stack.append(
|
| 859 |
+
self.perform_operation(
|
| 860 |
+
lhs, rhs, operator))
|
| 861 |
+
|
| 862 |
+
# pop '('
|
| 863 |
+
operators_stack.pop()
|
| 864 |
+
|
| 865 |
+
# token is an operator (supported)
|
| 866 |
+
elif token.spelling in operators_list:
|
| 867 |
+
while (operators_stack
|
| 868 |
+
and self.priority_of(token.spelling)
|
| 869 |
+
<= self.priority_of(
|
| 870 |
+
operators_stack[-1])):
|
| 871 |
+
if len(combined_variables_stack) < 2:
|
| 872 |
+
raise NotImplementedError(
|
| 873 |
+
"Unary operators as a part of "
|
| 874 |
+
"binary operators is not "
|
| 875 |
+
"supported yet!")
|
| 876 |
+
rhs = combined_variables_stack.pop()
|
| 877 |
+
lhs = combined_variables_stack.pop()
|
| 878 |
+
operator = operators_stack.pop()
|
| 879 |
+
combined_variables_stack.append(
|
| 880 |
+
self.perform_operation(
|
| 881 |
+
lhs, rhs, operator))
|
| 882 |
+
|
| 883 |
+
# push current operator
|
| 884 |
+
operators_stack.append(token.spelling)
|
| 885 |
+
|
| 886 |
+
# token is a bitwise operator
|
| 887 |
+
elif token.spelling in ['&', '|', '^', '<<', '>>']:
|
| 888 |
+
raise NotImplementedError(
|
| 889 |
+
"Bitwise operator has not been "
|
| 890 |
+
"implemented yet!")
|
| 891 |
+
|
| 892 |
+
# token is a shorthand bitwise operator
|
| 893 |
+
elif token.spelling in ['&=', '|=', '^=', '<<=',
|
| 894 |
+
'>>=']:
|
| 895 |
+
raise NotImplementedError(
|
| 896 |
+
"Shorthand bitwise operator has not been "
|
| 897 |
+
"implemented yet!")
|
| 898 |
+
else:
|
| 899 |
+
raise NotImplementedError(
|
| 900 |
+
"Given token {} is not implemented yet!"
|
| 901 |
+
.format(token.spelling))
|
| 902 |
+
|
| 903 |
+
# token is an identifier(variable)
|
| 904 |
+
elif token.kind == cin.TokenKind.IDENTIFIER:
|
| 905 |
+
combined_variables_stack.append(
|
| 906 |
+
[token.spelling, 'identifier'])
|
| 907 |
+
|
| 908 |
+
# token is a literal
|
| 909 |
+
elif token.kind == cin.TokenKind.LITERAL:
|
| 910 |
+
combined_variables_stack.append(
|
| 911 |
+
[token.spelling, 'literal'])
|
| 912 |
+
|
| 913 |
+
# token is a keyword, either true or false
|
| 914 |
+
elif (token.kind == cin.TokenKind.KEYWORD
|
| 915 |
+
and token.spelling in ['true', 'false']):
|
| 916 |
+
combined_variables_stack.append(
|
| 917 |
+
[token.spelling, 'boolean'])
|
| 918 |
+
else:
|
| 919 |
+
raise NotImplementedError(
|
| 920 |
+
"Given token {} is not implemented yet!"
|
| 921 |
+
.format(token.spelling))
|
| 922 |
+
|
| 923 |
+
# process remaining operators
|
| 924 |
+
while operators_stack:
|
| 925 |
+
if len(combined_variables_stack) < 2:
|
| 926 |
+
raise NotImplementedError(
|
| 927 |
+
"Unary operators as a part of "
|
| 928 |
+
"binary operators is not "
|
| 929 |
+
"supported yet!")
|
| 930 |
+
rhs = combined_variables_stack.pop()
|
| 931 |
+
lhs = combined_variables_stack.pop()
|
| 932 |
+
operator = operators_stack.pop()
|
| 933 |
+
combined_variables_stack.append(
|
| 934 |
+
self.perform_operation(lhs, rhs, operator))
|
| 935 |
+
|
| 936 |
+
return combined_variables_stack[-1][0]
|
| 937 |
+
|
| 938 |
+
def priority_of(self, op):
|
| 939 |
+
"""To get the priority of given operator"""
|
| 940 |
+
if op in ['=', '+=', '-=', '*=', '/=', '%=']:
|
| 941 |
+
return 1
|
| 942 |
+
if op in ['&&', '||']:
|
| 943 |
+
return 2
|
| 944 |
+
if op in ['<', '<=', '>', '>=', '==', '!=']:
|
| 945 |
+
return 3
|
| 946 |
+
if op in ['+', '-']:
|
| 947 |
+
return 4
|
| 948 |
+
if op in ['*', '/', '%']:
|
| 949 |
+
return 5
|
| 950 |
+
return 0
|
| 951 |
+
|
| 952 |
+
def perform_operation(self, lhs, rhs, op):
|
| 953 |
+
"""Performs operation supported by the SymPy core
|
| 954 |
+
|
| 955 |
+
Returns
|
| 956 |
+
=======
|
| 957 |
+
|
| 958 |
+
combined_variable: list
|
| 959 |
+
contains variable content and type of variable
|
| 960 |
+
|
| 961 |
+
"""
|
| 962 |
+
lhs_value = self.get_expr_for_operand(lhs)
|
| 963 |
+
rhs_value = self.get_expr_for_operand(rhs)
|
| 964 |
+
if op == '+':
|
| 965 |
+
return [Add(lhs_value, rhs_value), 'expr']
|
| 966 |
+
if op == '-':
|
| 967 |
+
return [Add(lhs_value, -rhs_value), 'expr']
|
| 968 |
+
if op == '*':
|
| 969 |
+
return [Mul(lhs_value, rhs_value), 'expr']
|
| 970 |
+
if op == '/':
|
| 971 |
+
return [Mul(lhs_value, Pow(rhs_value, Integer(-1))), 'expr']
|
| 972 |
+
if op == '%':
|
| 973 |
+
return [Mod(lhs_value, rhs_value), 'expr']
|
| 974 |
+
if op in ['<', '<=', '>', '>=', '==', '!=']:
|
| 975 |
+
return [Rel(lhs_value, rhs_value, op), 'expr']
|
| 976 |
+
if op == '&&':
|
| 977 |
+
return [And(as_Boolean(lhs_value), as_Boolean(rhs_value)), 'expr']
|
| 978 |
+
if op == '||':
|
| 979 |
+
return [Or(as_Boolean(lhs_value), as_Boolean(rhs_value)), 'expr']
|
| 980 |
+
if op == '=':
|
| 981 |
+
return [Assignment(Variable(lhs_value), rhs_value), 'expr']
|
| 982 |
+
if op in ['+=', '-=', '*=', '/=', '%=']:
|
| 983 |
+
return [aug_assign(Variable(lhs_value), op[0], rhs_value), 'expr']
|
| 984 |
+
|
| 985 |
+
def get_expr_for_operand(self, combined_variable):
|
| 986 |
+
"""Gives out SymPy Codegen AST node
|
| 987 |
+
|
| 988 |
+
AST node returned is corresponding to
|
| 989 |
+
combined variable passed.Combined variable contains
|
| 990 |
+
variable content and type of variable
|
| 991 |
+
|
| 992 |
+
"""
|
| 993 |
+
if combined_variable[1] == 'identifier':
|
| 994 |
+
return Symbol(combined_variable[0])
|
| 995 |
+
if combined_variable[1] == 'literal':
|
| 996 |
+
if '.' in combined_variable[0]:
|
| 997 |
+
return Float(float(combined_variable[0]))
|
| 998 |
+
else:
|
| 999 |
+
return Integer(int(combined_variable[0]))
|
| 1000 |
+
if combined_variable[1] == 'expr':
|
| 1001 |
+
return combined_variable[0]
|
| 1002 |
+
if combined_variable[1] == 'boolean':
|
| 1003 |
+
return true if combined_variable[0] == 'true' else false
|
| 1004 |
+
|
| 1005 |
+
def transform_null_stmt(self, node):
|
| 1006 |
+
"""Handles Null Statement and returns None"""
|
| 1007 |
+
return none
|
| 1008 |
+
|
| 1009 |
+
def transform_while_stmt(self, node):
|
| 1010 |
+
"""Transformation function for handling while statement
|
| 1011 |
+
|
| 1012 |
+
Returns
|
| 1013 |
+
=======
|
| 1014 |
+
|
| 1015 |
+
while statement : Codegen AST Node
|
| 1016 |
+
contains the while statement node having condition and
|
| 1017 |
+
statement block
|
| 1018 |
+
|
| 1019 |
+
"""
|
| 1020 |
+
children = node.get_children()
|
| 1021 |
+
|
| 1022 |
+
condition = self.transform(next(children))
|
| 1023 |
+
statements = self.transform(next(children))
|
| 1024 |
+
|
| 1025 |
+
if isinstance(statements, list):
|
| 1026 |
+
statement_block = CodeBlock(*statements)
|
| 1027 |
+
else:
|
| 1028 |
+
statement_block = CodeBlock(statements)
|
| 1029 |
+
|
| 1030 |
+
return While(condition, statement_block)
|
| 1031 |
+
|
| 1032 |
+
|
| 1033 |
+
|
| 1034 |
+
else:
|
| 1035 |
+
class CCodeConverter(): # type: ignore
|
| 1036 |
+
def __init__(self, *args, **kwargs):
|
| 1037 |
+
raise ImportError("Module not Installed")
|
| 1038 |
+
|
| 1039 |
+
|
| 1040 |
+
def parse_c(source):
|
| 1041 |
+
"""Function for converting a C source code
|
| 1042 |
+
|
| 1043 |
+
The function reads the source code present in the given file and parses it
|
| 1044 |
+
to give out SymPy Expressions
|
| 1045 |
+
|
| 1046 |
+
Returns
|
| 1047 |
+
=======
|
| 1048 |
+
|
| 1049 |
+
src : list
|
| 1050 |
+
List of Python expression strings
|
| 1051 |
+
|
| 1052 |
+
"""
|
| 1053 |
+
converter = CCodeConverter()
|
| 1054 |
+
if os.path.exists(source):
|
| 1055 |
+
src = converter.parse(source, flags = [])
|
| 1056 |
+
else:
|
| 1057 |
+
src = converter.parse_str(source, flags = [])
|
| 1058 |
+
return src
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/latex/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (2.4 kB). View file
|
|
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/latex/__pycache__/_build_latex_antlr.cpython-310.pyc
ADDED
|
Binary file (2.61 kB). View file
|
|
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/latex/__pycache__/_parse_latex_antlr.cpython-310.pyc
ADDED
|
Binary file (13.7 kB). View file
|
|
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/latex/__pycache__/errors.cpython-310.pyc
ADDED
|
Binary file (353 Bytes). View file
|
|
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/latex/_antlr/__init__.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# *** GENERATED BY `setup.py antlr`, DO NOT EDIT BY HAND ***
|
| 2 |
+
#
|
| 3 |
+
# Generated from ../LaTeX.g4, derived from latex2sympy
|
| 4 |
+
# latex2sympy is licensed under the MIT license
|
| 5 |
+
# https://github.com/augustt198/latex2sympy/blob/master/LICENSE.txt
|
| 6 |
+
#
|
| 7 |
+
# Generated with antlr4
|
| 8 |
+
# antlr4 is licensed under the BSD-3-Clause License
|
| 9 |
+
# https://github.com/antlr/antlr4/blob/master/LICENSE.txt
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/latex/_antlr/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (188 Bytes). View file
|
|
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/latex/_antlr/latexlexer.py
ADDED
|
@@ -0,0 +1,512 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# *** GENERATED BY `setup.py antlr`, DO NOT EDIT BY HAND ***
|
| 2 |
+
#
|
| 3 |
+
# Generated from ../LaTeX.g4, derived from latex2sympy
|
| 4 |
+
# latex2sympy is licensed under the MIT license
|
| 5 |
+
# https://github.com/augustt198/latex2sympy/blob/master/LICENSE.txt
|
| 6 |
+
#
|
| 7 |
+
# Generated with antlr4
|
| 8 |
+
# antlr4 is licensed under the BSD-3-Clause License
|
| 9 |
+
# https://github.com/antlr/antlr4/blob/master/LICENSE.txt
|
| 10 |
+
from antlr4 import *
|
| 11 |
+
from io import StringIO
|
| 12 |
+
import sys
|
| 13 |
+
if sys.version_info[1] > 5:
|
| 14 |
+
from typing import TextIO
|
| 15 |
+
else:
|
| 16 |
+
from typing.io import TextIO
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def serializedATN():
|
| 20 |
+
return [
|
| 21 |
+
4,0,91,911,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,
|
| 22 |
+
2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,
|
| 23 |
+
13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,
|
| 24 |
+
19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,
|
| 25 |
+
26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,
|
| 26 |
+
32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,
|
| 27 |
+
39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,
|
| 28 |
+
45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2,
|
| 29 |
+
52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2,56,7,56,2,57,7,57,2,58,7,
|
| 30 |
+
58,2,59,7,59,2,60,7,60,2,61,7,61,2,62,7,62,2,63,7,63,2,64,7,64,2,
|
| 31 |
+
65,7,65,2,66,7,66,2,67,7,67,2,68,7,68,2,69,7,69,2,70,7,70,2,71,7,
|
| 32 |
+
71,2,72,7,72,2,73,7,73,2,74,7,74,2,75,7,75,2,76,7,76,2,77,7,77,2,
|
| 33 |
+
78,7,78,2,79,7,79,2,80,7,80,2,81,7,81,2,82,7,82,2,83,7,83,2,84,7,
|
| 34 |
+
84,2,85,7,85,2,86,7,86,2,87,7,87,2,88,7,88,2,89,7,89,2,90,7,90,2,
|
| 35 |
+
91,7,91,1,0,1,0,1,1,1,1,1,2,4,2,191,8,2,11,2,12,2,192,1,2,1,2,1,
|
| 36 |
+
3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,3,3,209,8,3,1,3,1,
|
| 37 |
+
3,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,1,4,3,4,224,8,4,1,4,1,
|
| 38 |
+
4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,5,3,5,241,8,
|
| 39 |
+
5,1,5,1,5,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,7,1,7,1,7,1,7,1,7,1,
|
| 40 |
+
7,1,7,1,7,1,7,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,8,1,
|
| 41 |
+
8,1,8,1,8,3,8,277,8,8,1,8,1,8,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,9,1,
|
| 42 |
+
9,1,9,1,9,1,9,1,9,1,9,1,9,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,
|
| 43 |
+
1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,10,1,11,1,11,1,11,1,11,
|
| 44 |
+
1,11,1,11,1,11,1,11,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,1,12,
|
| 45 |
+
1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,
|
| 46 |
+
1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,
|
| 47 |
+
1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,
|
| 48 |
+
1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,1,13,3,13,
|
| 49 |
+
381,8,13,1,13,1,13,1,14,1,14,1,15,1,15,1,16,1,16,1,17,1,17,1,18,
|
| 50 |
+
1,18,1,19,1,19,1,20,1,20,1,21,1,21,1,22,1,22,1,22,1,23,1,23,1,23,
|
| 51 |
+
1,24,1,24,1,25,1,25,1,26,1,26,1,27,1,27,1,27,1,27,1,27,1,27,1,27,
|
| 52 |
+
1,27,1,28,1,28,1,28,1,28,1,28,1,28,1,28,1,29,1,29,1,29,1,29,1,29,
|
| 53 |
+
1,29,1,29,1,29,1,30,1,30,1,30,1,30,1,30,1,30,1,30,1,30,1,31,1,31,
|
| 54 |
+
1,31,1,31,1,31,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,
|
| 55 |
+
1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,
|
| 56 |
+
1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,
|
| 57 |
+
1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,1,32,
|
| 58 |
+
1,32,1,32,1,32,1,32,1,32,1,32,3,32,504,8,32,1,33,1,33,1,33,1,33,
|
| 59 |
+
1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,3,33,521,
|
| 60 |
+
8,33,1,34,1,34,1,34,1,34,1,34,1,35,1,35,1,35,1,35,1,35,1,35,1,36,
|
| 61 |
+
1,36,1,36,1,36,1,36,1,37,1,37,1,37,1,37,1,37,1,38,1,38,1,38,1,38,
|
| 62 |
+
1,39,1,39,1,39,1,39,1,40,1,40,1,40,1,40,1,40,1,41,1,41,1,41,1,41,
|
| 63 |
+
1,41,1,42,1,42,1,42,1,42,1,42,1,43,1,43,1,43,1,43,1,43,1,44,1,44,
|
| 64 |
+
1,44,1,44,1,44,1,45,1,45,1,45,1,45,1,45,1,46,1,46,1,46,1,46,1,46,
|
| 65 |
+
1,46,1,46,1,46,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,47,1,48,1,48,
|
| 66 |
+
1,48,1,48,1,48,1,48,1,48,1,48,1,49,1,49,1,49,1,49,1,49,1,49,1,49,
|
| 67 |
+
1,49,1,50,1,50,1,50,1,50,1,50,1,50,1,50,1,50,1,51,1,51,1,51,1,51,
|
| 68 |
+
1,51,1,51,1,51,1,51,1,52,1,52,1,52,1,52,1,52,1,52,1,53,1,53,1,53,
|
| 69 |
+
1,53,1,53,1,53,1,54,1,54,1,54,1,54,1,54,1,54,1,55,1,55,1,55,1,55,
|
| 70 |
+
1,55,1,55,1,55,1,55,1,56,1,56,1,56,1,56,1,56,1,56,1,56,1,56,1,57,
|
| 71 |
+
1,57,1,57,1,57,1,57,1,57,1,57,1,57,1,58,1,58,1,58,1,58,1,58,1,58,
|
| 72 |
+
1,58,1,58,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,59,1,60,1,60,1,60,
|
| 73 |
+
1,60,1,60,1,60,1,60,1,61,1,61,1,61,1,61,1,61,1,61,1,61,1,62,1,62,
|
| 74 |
+
1,62,1,62,1,62,1,62,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,1,63,
|
| 75 |
+
1,63,1,64,1,64,1,64,1,64,1,64,1,64,1,64,1,65,1,65,1,65,1,65,1,65,
|
| 76 |
+
1,65,1,66,1,66,1,66,1,66,1,66,1,67,1,67,1,67,1,67,1,67,1,67,1,67,
|
| 77 |
+
1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,1,67,3,67,753,8,67,
|
| 78 |
+
1,68,1,68,1,68,1,68,1,68,1,68,1,68,1,69,1,69,1,69,1,69,1,69,1,69,
|
| 79 |
+
1,69,1,69,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,70,1,71,1,71,1,71,
|
| 80 |
+
1,71,1,71,1,71,1,71,1,71,1,72,1,72,1,73,1,73,1,74,1,74,1,75,1,75,
|
| 81 |
+
1,76,1,76,5,76,796,8,76,10,76,12,76,799,9,76,1,76,1,76,1,76,4,76,
|
| 82 |
+
804,8,76,11,76,12,76,805,3,76,808,8,76,1,77,1,77,1,78,1,78,1,79,
|
| 83 |
+
1,79,5,79,816,8,79,10,79,12,79,819,9,79,3,79,821,8,79,1,79,1,79,
|
| 84 |
+
1,79,5,79,826,8,79,10,79,12,79,829,9,79,1,79,3,79,832,8,79,3,79,
|
| 85 |
+
834,8,79,1,80,1,80,1,80,1,80,1,80,1,81,1,81,1,82,1,82,1,82,1,82,
|
| 86 |
+
1,82,1,82,1,82,1,82,1,82,3,82,852,8,82,1,83,1,83,1,83,1,83,1,83,
|
| 87 |
+
1,83,1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,84,1,85,1,85,
|
| 88 |
+
1,86,1,86,1,86,1,86,1,86,1,86,1,86,1,86,1,86,3,86,881,8,86,1,87,
|
| 89 |
+
1,87,1,87,1,87,1,87,1,87,1,88,1,88,1,88,1,88,1,88,1,88,1,88,1,88,
|
| 90 |
+
1,88,1,88,1,89,1,89,1,90,4,90,902,8,90,11,90,12,90,903,1,91,1,91,
|
| 91 |
+
4,91,908,8,91,11,91,12,91,909,3,797,817,827,0,92,1,1,3,2,5,3,7,4,
|
| 92 |
+
9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14,29,15,31,16,
|
| 93 |
+
33,17,35,18,37,19,39,20,41,21,43,22,45,23,47,24,49,25,51,26,53,27,
|
| 94 |
+
55,28,57,29,59,30,61,31,63,32,65,33,67,34,69,35,71,36,73,37,75,38,
|
| 95 |
+
77,39,79,40,81,41,83,42,85,43,87,44,89,45,91,46,93,47,95,48,97,49,
|
| 96 |
+
99,50,101,51,103,52,105,53,107,54,109,55,111,56,113,57,115,58,117,
|
| 97 |
+
59,119,60,121,61,123,62,125,63,127,64,129,65,131,66,133,67,135,68,
|
| 98 |
+
137,69,139,70,141,71,143,72,145,73,147,74,149,75,151,0,153,76,155,
|
| 99 |
+
77,157,78,159,79,161,80,163,81,165,82,167,83,169,84,171,85,173,86,
|
| 100 |
+
175,87,177,88,179,89,181,90,183,91,1,0,3,3,0,9,10,13,13,32,32,2,
|
| 101 |
+
0,65,90,97,122,1,0,48,57,949,0,1,1,0,0,0,0,3,1,0,0,0,0,5,1,0,0,0,
|
| 102 |
+
0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0,15,1,0,0,0,0,
|
| 103 |
+
17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,1,0,0,0,0,
|
| 104 |
+
27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,0,0,
|
| 105 |
+
37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,
|
| 106 |
+
47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0,
|
| 107 |
+
57,1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0,
|
| 108 |
+
67,1,0,0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75,1,0,0,0,0,
|
| 109 |
+
77,1,0,0,0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0,85,1,0,0,0,0,
|
| 110 |
+
87,1,0,0,0,0,89,1,0,0,0,0,91,1,0,0,0,0,93,1,0,0,0,0,95,1,0,0,0,0,
|
| 111 |
+
97,1,0,0,0,0,99,1,0,0,0,0,101,1,0,0,0,0,103,1,0,0,0,0,105,1,0,0,
|
| 112 |
+
0,0,107,1,0,0,0,0,109,1,0,0,0,0,111,1,0,0,0,0,113,1,0,0,0,0,115,
|
| 113 |
+
1,0,0,0,0,117,1,0,0,0,0,119,1,0,0,0,0,121,1,0,0,0,0,123,1,0,0,0,
|
| 114 |
+
0,125,1,0,0,0,0,127,1,0,0,0,0,129,1,0,0,0,0,131,1,0,0,0,0,133,1,
|
| 115 |
+
0,0,0,0,135,1,0,0,0,0,137,1,0,0,0,0,139,1,0,0,0,0,141,1,0,0,0,0,
|
| 116 |
+
143,1,0,0,0,0,145,1,0,0,0,0,147,1,0,0,0,0,149,1,0,0,0,0,153,1,0,
|
| 117 |
+
0,0,0,155,1,0,0,0,0,157,1,0,0,0,0,159,1,0,0,0,0,161,1,0,0,0,0,163,
|
| 118 |
+
1,0,0,0,0,165,1,0,0,0,0,167,1,0,0,0,0,169,1,0,0,0,0,171,1,0,0,0,
|
| 119 |
+
0,173,1,0,0,0,0,175,1,0,0,0,0,177,1,0,0,0,0,179,1,0,0,0,0,181,1,
|
| 120 |
+
0,0,0,0,183,1,0,0,0,1,185,1,0,0,0,3,187,1,0,0,0,5,190,1,0,0,0,7,
|
| 121 |
+
208,1,0,0,0,9,223,1,0,0,0,11,240,1,0,0,0,13,244,1,0,0,0,15,252,1,
|
| 122 |
+
0,0,0,17,276,1,0,0,0,19,280,1,0,0,0,21,295,1,0,0,0,23,312,1,0,0,
|
| 123 |
+
0,25,320,1,0,0,0,27,380,1,0,0,0,29,384,1,0,0,0,31,386,1,0,0,0,33,
|
| 124 |
+
388,1,0,0,0,35,390,1,0,0,0,37,392,1,0,0,0,39,394,1,0,0,0,41,396,
|
| 125 |
+
1,0,0,0,43,398,1,0,0,0,45,400,1,0,0,0,47,403,1,0,0,0,49,406,1,0,
|
| 126 |
+
0,0,51,408,1,0,0,0,53,410,1,0,0,0,55,412,1,0,0,0,57,420,1,0,0,0,
|
| 127 |
+
59,427,1,0,0,0,61,435,1,0,0,0,63,443,1,0,0,0,65,503,1,0,0,0,67,520,
|
| 128 |
+
1,0,0,0,69,522,1,0,0,0,71,527,1,0,0,0,73,533,1,0,0,0,75,538,1,0,
|
| 129 |
+
0,0,77,543,1,0,0,0,79,547,1,0,0,0,81,551,1,0,0,0,83,556,1,0,0,0,
|
| 130 |
+
85,561,1,0,0,0,87,566,1,0,0,0,89,571,1,0,0,0,91,576,1,0,0,0,93,581,
|
| 131 |
+
1,0,0,0,95,589,1,0,0,0,97,597,1,0,0,0,99,605,1,0,0,0,101,613,1,0,
|
| 132 |
+
0,0,103,621,1,0,0,0,105,629,1,0,0,0,107,635,1,0,0,0,109,641,1,0,
|
| 133 |
+
0,0,111,647,1,0,0,0,113,655,1,0,0,0,115,663,1,0,0,0,117,671,1,0,
|
| 134 |
+
0,0,119,679,1,0,0,0,121,687,1,0,0,0,123,694,1,0,0,0,125,701,1,0,
|
| 135 |
+
0,0,127,707,1,0,0,0,129,717,1,0,0,0,131,724,1,0,0,0,133,730,1,0,
|
| 136 |
+
0,0,135,752,1,0,0,0,137,754,1,0,0,0,139,761,1,0,0,0,141,769,1,0,
|
| 137 |
+
0,0,143,777,1,0,0,0,145,785,1,0,0,0,147,787,1,0,0,0,149,789,1,0,
|
| 138 |
+
0,0,151,791,1,0,0,0,153,793,1,0,0,0,155,809,1,0,0,0,157,811,1,0,
|
| 139 |
+
0,0,159,833,1,0,0,0,161,835,1,0,0,0,163,840,1,0,0,0,165,851,1,0,
|
| 140 |
+
0,0,167,853,1,0,0,0,169,859,1,0,0,0,171,869,1,0,0,0,173,880,1,0,
|
| 141 |
+
0,0,175,882,1,0,0,0,177,888,1,0,0,0,179,898,1,0,0,0,181,901,1,0,
|
| 142 |
+
0,0,183,905,1,0,0,0,185,186,5,44,0,0,186,2,1,0,0,0,187,188,5,46,
|
| 143 |
+
0,0,188,4,1,0,0,0,189,191,7,0,0,0,190,189,1,0,0,0,191,192,1,0,0,
|
| 144 |
+
0,192,190,1,0,0,0,192,193,1,0,0,0,193,194,1,0,0,0,194,195,6,2,0,
|
| 145 |
+
0,195,6,1,0,0,0,196,197,5,92,0,0,197,209,5,44,0,0,198,199,5,92,0,
|
| 146 |
+
0,199,200,5,116,0,0,200,201,5,104,0,0,201,202,5,105,0,0,202,203,
|
| 147 |
+
5,110,0,0,203,204,5,115,0,0,204,205,5,112,0,0,205,206,5,97,0,0,206,
|
| 148 |
+
207,5,99,0,0,207,209,5,101,0,0,208,196,1,0,0,0,208,198,1,0,0,0,209,
|
| 149 |
+
210,1,0,0,0,210,211,6,3,0,0,211,8,1,0,0,0,212,213,5,92,0,0,213,224,
|
| 150 |
+
5,58,0,0,214,215,5,92,0,0,215,216,5,109,0,0,216,217,5,101,0,0,217,
|
| 151 |
+
218,5,100,0,0,218,219,5,115,0,0,219,220,5,112,0,0,220,221,5,97,0,
|
| 152 |
+
0,221,222,5,99,0,0,222,224,5,101,0,0,223,212,1,0,0,0,223,214,1,0,
|
| 153 |
+
0,0,224,225,1,0,0,0,225,226,6,4,0,0,226,10,1,0,0,0,227,228,5,92,
|
| 154 |
+
0,0,228,241,5,59,0,0,229,230,5,92,0,0,230,231,5,116,0,0,231,232,
|
| 155 |
+
5,104,0,0,232,233,5,105,0,0,233,234,5,99,0,0,234,235,5,107,0,0,235,
|
| 156 |
+
236,5,115,0,0,236,237,5,112,0,0,237,238,5,97,0,0,238,239,5,99,0,
|
| 157 |
+
0,239,241,5,101,0,0,240,227,1,0,0,0,240,229,1,0,0,0,241,242,1,0,
|
| 158 |
+
0,0,242,243,6,5,0,0,243,12,1,0,0,0,244,245,5,92,0,0,245,246,5,113,
|
| 159 |
+
0,0,246,247,5,117,0,0,247,248,5,97,0,0,248,249,5,100,0,0,249,250,
|
| 160 |
+
1,0,0,0,250,251,6,6,0,0,251,14,1,0,0,0,252,253,5,92,0,0,253,254,
|
| 161 |
+
5,113,0,0,254,255,5,113,0,0,255,256,5,117,0,0,256,257,5,97,0,0,257,
|
| 162 |
+
258,5,100,0,0,258,259,1,0,0,0,259,260,6,7,0,0,260,16,1,0,0,0,261,
|
| 163 |
+
262,5,92,0,0,262,277,5,33,0,0,263,264,5,92,0,0,264,265,5,110,0,0,
|
| 164 |
+
265,266,5,101,0,0,266,267,5,103,0,0,267,268,5,116,0,0,268,269,5,
|
| 165 |
+
104,0,0,269,270,5,105,0,0,270,271,5,110,0,0,271,272,5,115,0,0,272,
|
| 166 |
+
273,5,112,0,0,273,274,5,97,0,0,274,275,5,99,0,0,275,277,5,101,0,
|
| 167 |
+
0,276,261,1,0,0,0,276,263,1,0,0,0,277,278,1,0,0,0,278,279,6,8,0,
|
| 168 |
+
0,279,18,1,0,0,0,280,281,5,92,0,0,281,282,5,110,0,0,282,283,5,101,
|
| 169 |
+
0,0,283,284,5,103,0,0,284,285,5,109,0,0,285,286,5,101,0,0,286,287,
|
| 170 |
+
5,100,0,0,287,288,5,115,0,0,288,289,5,112,0,0,289,290,5,97,0,0,290,
|
| 171 |
+
291,5,99,0,0,291,292,5,101,0,0,292,293,1,0,0,0,293,294,6,9,0,0,294,
|
| 172 |
+
20,1,0,0,0,295,296,5,92,0,0,296,297,5,110,0,0,297,298,5,101,0,0,
|
| 173 |
+
298,299,5,103,0,0,299,300,5,116,0,0,300,301,5,104,0,0,301,302,5,
|
| 174 |
+
105,0,0,302,303,5,99,0,0,303,304,5,107,0,0,304,305,5,115,0,0,305,
|
| 175 |
+
306,5,112,0,0,306,307,5,97,0,0,307,308,5,99,0,0,308,309,5,101,0,
|
| 176 |
+
0,309,310,1,0,0,0,310,311,6,10,0,0,311,22,1,0,0,0,312,313,5,92,0,
|
| 177 |
+
0,313,314,5,108,0,0,314,315,5,101,0,0,315,316,5,102,0,0,316,317,
|
| 178 |
+
5,116,0,0,317,318,1,0,0,0,318,319,6,11,0,0,319,24,1,0,0,0,320,321,
|
| 179 |
+
5,92,0,0,321,322,5,114,0,0,322,323,5,105,0,0,323,324,5,103,0,0,324,
|
| 180 |
+
325,5,104,0,0,325,326,5,116,0,0,326,327,1,0,0,0,327,328,6,12,0,0,
|
| 181 |
+
328,26,1,0,0,0,329,330,5,92,0,0,330,331,5,118,0,0,331,332,5,114,
|
| 182 |
+
0,0,332,333,5,117,0,0,333,334,5,108,0,0,334,381,5,101,0,0,335,336,
|
| 183 |
+
5,92,0,0,336,337,5,118,0,0,337,338,5,99,0,0,338,339,5,101,0,0,339,
|
| 184 |
+
340,5,110,0,0,340,341,5,116,0,0,341,342,5,101,0,0,342,381,5,114,
|
| 185 |
+
0,0,343,344,5,92,0,0,344,345,5,118,0,0,345,346,5,98,0,0,346,347,
|
| 186 |
+
5,111,0,0,347,381,5,120,0,0,348,349,5,92,0,0,349,350,5,118,0,0,350,
|
| 187 |
+
351,5,115,0,0,351,352,5,107,0,0,352,353,5,105,0,0,353,381,5,112,
|
| 188 |
+
0,0,354,355,5,92,0,0,355,356,5,118,0,0,356,357,5,115,0,0,357,358,
|
| 189 |
+
5,112,0,0,358,359,5,97,0,0,359,360,5,99,0,0,360,381,5,101,0,0,361,
|
| 190 |
+
362,5,92,0,0,362,363,5,104,0,0,363,364,5,102,0,0,364,365,5,105,0,
|
| 191 |
+
0,365,381,5,108,0,0,366,367,5,92,0,0,367,381,5,42,0,0,368,369,5,
|
| 192 |
+
92,0,0,369,381,5,45,0,0,370,371,5,92,0,0,371,381,5,46,0,0,372,373,
|
| 193 |
+
5,92,0,0,373,381,5,47,0,0,374,375,5,92,0,0,375,381,5,34,0,0,376,
|
| 194 |
+
377,5,92,0,0,377,381,5,40,0,0,378,379,5,92,0,0,379,381,5,61,0,0,
|
| 195 |
+
380,329,1,0,0,0,380,335,1,0,0,0,380,343,1,0,0,0,380,348,1,0,0,0,
|
| 196 |
+
380,354,1,0,0,0,380,361,1,0,0,0,380,366,1,0,0,0,380,368,1,0,0,0,
|
| 197 |
+
380,370,1,0,0,0,380,372,1,0,0,0,380,374,1,0,0,0,380,376,1,0,0,0,
|
| 198 |
+
380,378,1,0,0,0,381,382,1,0,0,0,382,383,6,13,0,0,383,28,1,0,0,0,
|
| 199 |
+
384,385,5,43,0,0,385,30,1,0,0,0,386,387,5,45,0,0,387,32,1,0,0,0,
|
| 200 |
+
388,389,5,42,0,0,389,34,1,0,0,0,390,391,5,47,0,0,391,36,1,0,0,0,
|
| 201 |
+
392,393,5,40,0,0,393,38,1,0,0,0,394,395,5,41,0,0,395,40,1,0,0,0,
|
| 202 |
+
396,397,5,123,0,0,397,42,1,0,0,0,398,399,5,125,0,0,399,44,1,0,0,
|
| 203 |
+
0,400,401,5,92,0,0,401,402,5,123,0,0,402,46,1,0,0,0,403,404,5,92,
|
| 204 |
+
0,0,404,405,5,125,0,0,405,48,1,0,0,0,406,407,5,91,0,0,407,50,1,0,
|
| 205 |
+
0,0,408,409,5,93,0,0,409,52,1,0,0,0,410,411,5,124,0,0,411,54,1,0,
|
| 206 |
+
0,0,412,413,5,92,0,0,413,414,5,114,0,0,414,415,5,105,0,0,415,416,
|
| 207 |
+
5,103,0,0,416,417,5,104,0,0,417,418,5,116,0,0,418,419,5,124,0,0,
|
| 208 |
+
419,56,1,0,0,0,420,421,5,92,0,0,421,422,5,108,0,0,422,423,5,101,
|
| 209 |
+
0,0,423,424,5,102,0,0,424,425,5,116,0,0,425,426,5,124,0,0,426,58,
|
| 210 |
+
1,0,0,0,427,428,5,92,0,0,428,429,5,108,0,0,429,430,5,97,0,0,430,
|
| 211 |
+
431,5,110,0,0,431,432,5,103,0,0,432,433,5,108,0,0,433,434,5,101,
|
| 212 |
+
0,0,434,60,1,0,0,0,435,436,5,92,0,0,436,437,5,114,0,0,437,438,5,
|
| 213 |
+
97,0,0,438,439,5,110,0,0,439,440,5,103,0,0,440,441,5,108,0,0,441,
|
| 214 |
+
442,5,101,0,0,442,62,1,0,0,0,443,444,5,92,0,0,444,445,5,108,0,0,
|
| 215 |
+
445,446,5,105,0,0,446,447,5,109,0,0,447,64,1,0,0,0,448,449,5,92,
|
| 216 |
+
0,0,449,450,5,116,0,0,450,504,5,111,0,0,451,452,5,92,0,0,452,453,
|
| 217 |
+
5,114,0,0,453,454,5,105,0,0,454,455,5,103,0,0,455,456,5,104,0,0,
|
| 218 |
+
456,457,5,116,0,0,457,458,5,97,0,0,458,459,5,114,0,0,459,460,5,114,
|
| 219 |
+
0,0,460,461,5,111,0,0,461,504,5,119,0,0,462,463,5,92,0,0,463,464,
|
| 220 |
+
5,82,0,0,464,465,5,105,0,0,465,466,5,103,0,0,466,467,5,104,0,0,467,
|
| 221 |
+
468,5,116,0,0,468,469,5,97,0,0,469,470,5,114,0,0,470,471,5,114,0,
|
| 222 |
+
0,471,472,5,111,0,0,472,504,5,119,0,0,473,474,5,92,0,0,474,475,5,
|
| 223 |
+
108,0,0,475,476,5,111,0,0,476,477,5,110,0,0,477,478,5,103,0,0,478,
|
| 224 |
+
479,5,114,0,0,479,480,5,105,0,0,480,481,5,103,0,0,481,482,5,104,
|
| 225 |
+
0,0,482,483,5,116,0,0,483,484,5,97,0,0,484,485,5,114,0,0,485,486,
|
| 226 |
+
5,114,0,0,486,487,5,111,0,0,487,504,5,119,0,0,488,489,5,92,0,0,489,
|
| 227 |
+
490,5,76,0,0,490,491,5,111,0,0,491,492,5,110,0,0,492,493,5,103,0,
|
| 228 |
+
0,493,494,5,114,0,0,494,495,5,105,0,0,495,496,5,103,0,0,496,497,
|
| 229 |
+
5,104,0,0,497,498,5,116,0,0,498,499,5,97,0,0,499,500,5,114,0,0,500,
|
| 230 |
+
501,5,114,0,0,501,502,5,111,0,0,502,504,5,119,0,0,503,448,1,0,0,
|
| 231 |
+
0,503,451,1,0,0,0,503,462,1,0,0,0,503,473,1,0,0,0,503,488,1,0,0,
|
| 232 |
+
0,504,66,1,0,0,0,505,506,5,92,0,0,506,507,5,105,0,0,507,508,5,110,
|
| 233 |
+
0,0,508,521,5,116,0,0,509,510,5,92,0,0,510,511,5,105,0,0,511,512,
|
| 234 |
+
5,110,0,0,512,513,5,116,0,0,513,514,5,92,0,0,514,515,5,108,0,0,515,
|
| 235 |
+
516,5,105,0,0,516,517,5,109,0,0,517,518,5,105,0,0,518,519,5,116,
|
| 236 |
+
0,0,519,521,5,115,0,0,520,505,1,0,0,0,520,509,1,0,0,0,521,68,1,0,
|
| 237 |
+
0,0,522,523,5,92,0,0,523,524,5,115,0,0,524,525,5,117,0,0,525,526,
|
| 238 |
+
5,109,0,0,526,70,1,0,0,0,527,528,5,92,0,0,528,529,5,112,0,0,529,
|
| 239 |
+
530,5,114,0,0,530,531,5,111,0,0,531,532,5,100,0,0,532,72,1,0,0,0,
|
| 240 |
+
533,534,5,92,0,0,534,535,5,101,0,0,535,536,5,120,0,0,536,537,5,112,
|
| 241 |
+
0,0,537,74,1,0,0,0,538,539,5,92,0,0,539,540,5,108,0,0,540,541,5,
|
| 242 |
+
111,0,0,541,542,5,103,0,0,542,76,1,0,0,0,543,544,5,92,0,0,544,545,
|
| 243 |
+
5,108,0,0,545,546,5,103,0,0,546,78,1,0,0,0,547,548,5,92,0,0,548,
|
| 244 |
+
549,5,108,0,0,549,550,5,110,0,0,550,80,1,0,0,0,551,552,5,92,0,0,
|
| 245 |
+
552,553,5,115,0,0,553,554,5,105,0,0,554,555,5,110,0,0,555,82,1,0,
|
| 246 |
+
0,0,556,557,5,92,0,0,557,558,5,99,0,0,558,559,5,111,0,0,559,560,
|
| 247 |
+
5,115,0,0,560,84,1,0,0,0,561,562,5,92,0,0,562,563,5,116,0,0,563,
|
| 248 |
+
564,5,97,0,0,564,565,5,110,0,0,565,86,1,0,0,0,566,567,5,92,0,0,567,
|
| 249 |
+
568,5,99,0,0,568,569,5,115,0,0,569,570,5,99,0,0,570,88,1,0,0,0,571,
|
| 250 |
+
572,5,92,0,0,572,573,5,115,0,0,573,574,5,101,0,0,574,575,5,99,0,
|
| 251 |
+
0,575,90,1,0,0,0,576,577,5,92,0,0,577,578,5,99,0,0,578,579,5,111,
|
| 252 |
+
0,0,579,580,5,116,0,0,580,92,1,0,0,0,581,582,5,92,0,0,582,583,5,
|
| 253 |
+
97,0,0,583,584,5,114,0,0,584,585,5,99,0,0,585,586,5,115,0,0,586,
|
| 254 |
+
587,5,105,0,0,587,588,5,110,0,0,588,94,1,0,0,0,589,590,5,92,0,0,
|
| 255 |
+
590,591,5,97,0,0,591,592,5,114,0,0,592,593,5,99,0,0,593,594,5,99,
|
| 256 |
+
0,0,594,595,5,111,0,0,595,596,5,115,0,0,596,96,1,0,0,0,597,598,5,
|
| 257 |
+
92,0,0,598,599,5,97,0,0,599,600,5,114,0,0,600,601,5,99,0,0,601,602,
|
| 258 |
+
5,116,0,0,602,603,5,97,0,0,603,604,5,110,0,0,604,98,1,0,0,0,605,
|
| 259 |
+
606,5,92,0,0,606,607,5,97,0,0,607,608,5,114,0,0,608,609,5,99,0,0,
|
| 260 |
+
609,610,5,99,0,0,610,611,5,115,0,0,611,612,5,99,0,0,612,100,1,0,
|
| 261 |
+
0,0,613,614,5,92,0,0,614,615,5,97,0,0,615,616,5,114,0,0,616,617,
|
| 262 |
+
5,99,0,0,617,618,5,115,0,0,618,619,5,101,0,0,619,620,5,99,0,0,620,
|
| 263 |
+
102,1,0,0,0,621,622,5,92,0,0,622,623,5,97,0,0,623,624,5,114,0,0,
|
| 264 |
+
624,625,5,99,0,0,625,626,5,99,0,0,626,627,5,111,0,0,627,628,5,116,
|
| 265 |
+
0,0,628,104,1,0,0,0,629,630,5,92,0,0,630,631,5,115,0,0,631,632,5,
|
| 266 |
+
105,0,0,632,633,5,110,0,0,633,634,5,104,0,0,634,106,1,0,0,0,635,
|
| 267 |
+
636,5,92,0,0,636,637,5,99,0,0,637,638,5,111,0,0,638,639,5,115,0,
|
| 268 |
+
0,639,640,5,104,0,0,640,108,1,0,0,0,641,642,5,92,0,0,642,643,5,116,
|
| 269 |
+
0,0,643,644,5,97,0,0,644,645,5,110,0,0,645,646,5,104,0,0,646,110,
|
| 270 |
+
1,0,0,0,647,648,5,92,0,0,648,649,5,97,0,0,649,650,5,114,0,0,650,
|
| 271 |
+
651,5,115,0,0,651,652,5,105,0,0,652,653,5,110,0,0,653,654,5,104,
|
| 272 |
+
0,0,654,112,1,0,0,0,655,656,5,92,0,0,656,657,5,97,0,0,657,658,5,
|
| 273 |
+
114,0,0,658,659,5,99,0,0,659,660,5,111,0,0,660,661,5,115,0,0,661,
|
| 274 |
+
662,5,104,0,0,662,114,1,0,0,0,663,664,5,92,0,0,664,665,5,97,0,0,
|
| 275 |
+
665,666,5,114,0,0,666,667,5,116,0,0,667,668,5,97,0,0,668,669,5,110,
|
| 276 |
+
0,0,669,670,5,104,0,0,670,116,1,0,0,0,671,672,5,92,0,0,672,673,5,
|
| 277 |
+
108,0,0,673,674,5,102,0,0,674,675,5,108,0,0,675,676,5,111,0,0,676,
|
| 278 |
+
677,5,111,0,0,677,678,5,114,0,0,678,118,1,0,0,0,679,680,5,92,0,0,
|
| 279 |
+
680,681,5,114,0,0,681,682,5,102,0,0,682,683,5,108,0,0,683,684,5,
|
| 280 |
+
111,0,0,684,685,5,111,0,0,685,686,5,114,0,0,686,120,1,0,0,0,687,
|
| 281 |
+
688,5,92,0,0,688,689,5,108,0,0,689,690,5,99,0,0,690,691,5,101,0,
|
| 282 |
+
0,691,692,5,105,0,0,692,693,5,108,0,0,693,122,1,0,0,0,694,695,5,
|
| 283 |
+
92,0,0,695,696,5,114,0,0,696,697,5,99,0,0,697,698,5,101,0,0,698,
|
| 284 |
+
699,5,105,0,0,699,700,5,108,0,0,700,124,1,0,0,0,701,702,5,92,0,0,
|
| 285 |
+
702,703,5,115,0,0,703,704,5,113,0,0,704,705,5,114,0,0,705,706,5,
|
| 286 |
+
116,0,0,706,126,1,0,0,0,707,708,5,92,0,0,708,709,5,111,0,0,709,710,
|
| 287 |
+
5,118,0,0,710,711,5,101,0,0,711,712,5,114,0,0,712,713,5,108,0,0,
|
| 288 |
+
713,714,5,105,0,0,714,715,5,110,0,0,715,716,5,101,0,0,716,128,1,
|
| 289 |
+
0,0,0,717,718,5,92,0,0,718,719,5,116,0,0,719,720,5,105,0,0,720,721,
|
| 290 |
+
5,109,0,0,721,722,5,101,0,0,722,723,5,115,0,0,723,130,1,0,0,0,724,
|
| 291 |
+
725,5,92,0,0,725,726,5,99,0,0,726,727,5,100,0,0,727,728,5,111,0,
|
| 292 |
+
0,728,729,5,116,0,0,729,132,1,0,0,0,730,731,5,92,0,0,731,732,5,100,
|
| 293 |
+
0,0,732,733,5,105,0,0,733,734,5,118,0,0,734,134,1,0,0,0,735,736,
|
| 294 |
+
5,92,0,0,736,737,5,102,0,0,737,738,5,114,0,0,738,739,5,97,0,0,739,
|
| 295 |
+
753,5,99,0,0,740,741,5,92,0,0,741,742,5,100,0,0,742,743,5,102,0,
|
| 296 |
+
0,743,744,5,114,0,0,744,745,5,97,0,0,745,753,5,99,0,0,746,747,5,
|
| 297 |
+
92,0,0,747,748,5,116,0,0,748,749,5,102,0,0,749,750,5,114,0,0,750,
|
| 298 |
+
751,5,97,0,0,751,753,5,99,0,0,752,735,1,0,0,0,752,740,1,0,0,0,752,
|
| 299 |
+
746,1,0,0,0,753,136,1,0,0,0,754,755,5,92,0,0,755,756,5,98,0,0,756,
|
| 300 |
+
757,5,105,0,0,757,758,5,110,0,0,758,759,5,111,0,0,759,760,5,109,
|
| 301 |
+
0,0,760,138,1,0,0,0,761,762,5,92,0,0,762,763,5,100,0,0,763,764,5,
|
| 302 |
+
98,0,0,764,765,5,105,0,0,765,766,5,110,0,0,766,767,5,111,0,0,767,
|
| 303 |
+
768,5,109,0,0,768,140,1,0,0,0,769,770,5,92,0,0,770,771,5,116,0,0,
|
| 304 |
+
771,772,5,98,0,0,772,773,5,105,0,0,773,774,5,110,0,0,774,775,5,111,
|
| 305 |
+
0,0,775,776,5,109,0,0,776,142,1,0,0,0,777,778,5,92,0,0,778,779,5,
|
| 306 |
+
109,0,0,779,780,5,97,0,0,780,781,5,116,0,0,781,782,5,104,0,0,782,
|
| 307 |
+
783,5,105,0,0,783,784,5,116,0,0,784,144,1,0,0,0,785,786,5,95,0,0,
|
| 308 |
+
786,146,1,0,0,0,787,788,5,94,0,0,788,148,1,0,0,0,789,790,5,58,0,
|
| 309 |
+
0,790,150,1,0,0,0,791,792,7,0,0,0,792,152,1,0,0,0,793,797,5,100,
|
| 310 |
+
0,0,794,796,3,151,75,0,795,794,1,0,0,0,796,799,1,0,0,0,797,798,1,
|
| 311 |
+
0,0,0,797,795,1,0,0,0,798,807,1,0,0,0,799,797,1,0,0,0,800,808,7,
|
| 312 |
+
1,0,0,801,803,5,92,0,0,802,804,7,1,0,0,803,802,1,0,0,0,804,805,1,
|
| 313 |
+
0,0,0,805,803,1,0,0,0,805,806,1,0,0,0,806,808,1,0,0,0,807,800,1,
|
| 314 |
+
0,0,0,807,801,1,0,0,0,808,154,1,0,0,0,809,810,7,1,0,0,810,156,1,
|
| 315 |
+
0,0,0,811,812,7,2,0,0,812,158,1,0,0,0,813,817,5,38,0,0,814,816,3,
|
| 316 |
+
151,75,0,815,814,1,0,0,0,816,819,1,0,0,0,817,818,1,0,0,0,817,815,
|
| 317 |
+
1,0,0,0,818,821,1,0,0,0,819,817,1,0,0,0,820,813,1,0,0,0,820,821,
|
| 318 |
+
1,0,0,0,821,822,1,0,0,0,822,834,5,61,0,0,823,831,5,61,0,0,824,826,
|
| 319 |
+
3,151,75,0,825,824,1,0,0,0,826,829,1,0,0,0,827,828,1,0,0,0,827,825,
|
| 320 |
+
1,0,0,0,828,830,1,0,0,0,829,827,1,0,0,0,830,832,5,38,0,0,831,827,
|
| 321 |
+
1,0,0,0,831,832,1,0,0,0,832,834,1,0,0,0,833,820,1,0,0,0,833,823,
|
| 322 |
+
1,0,0,0,834,160,1,0,0,0,835,836,5,92,0,0,836,837,5,110,0,0,837,838,
|
| 323 |
+
5,101,0,0,838,839,5,113,0,0,839,162,1,0,0,0,840,841,5,60,0,0,841,
|
| 324 |
+
164,1,0,0,0,842,843,5,92,0,0,843,844,5,108,0,0,844,845,5,101,0,0,
|
| 325 |
+
845,852,5,113,0,0,846,847,5,92,0,0,847,848,5,108,0,0,848,852,5,101,
|
| 326 |
+
0,0,849,852,3,167,83,0,850,852,3,169,84,0,851,842,1,0,0,0,851,846,
|
| 327 |
+
1,0,0,0,851,849,1,0,0,0,851,850,1,0,0,0,852,166,1,0,0,0,853,854,
|
| 328 |
+
5,92,0,0,854,855,5,108,0,0,855,856,5,101,0,0,856,857,5,113,0,0,857,
|
| 329 |
+
858,5,113,0,0,858,168,1,0,0,0,859,860,5,92,0,0,860,861,5,108,0,0,
|
| 330 |
+
861,862,5,101,0,0,862,863,5,113,0,0,863,864,5,115,0,0,864,865,5,
|
| 331 |
+
108,0,0,865,866,5,97,0,0,866,867,5,110,0,0,867,868,5,116,0,0,868,
|
| 332 |
+
170,1,0,0,0,869,870,5,62,0,0,870,172,1,0,0,0,871,872,5,92,0,0,872,
|
| 333 |
+
873,5,103,0,0,873,874,5,101,0,0,874,881,5,113,0,0,875,876,5,92,0,
|
| 334 |
+
0,876,877,5,103,0,0,877,881,5,101,0,0,878,881,3,175,87,0,879,881,
|
| 335 |
+
3,177,88,0,880,871,1,0,0,0,880,875,1,0,0,0,880,878,1,0,0,0,880,879,
|
| 336 |
+
1,0,0,0,881,174,1,0,0,0,882,883,5,92,0,0,883,884,5,103,0,0,884,885,
|
| 337 |
+
5,101,0,0,885,886,5,113,0,0,886,887,5,113,0,0,887,176,1,0,0,0,888,
|
| 338 |
+
889,5,92,0,0,889,890,5,103,0,0,890,891,5,101,0,0,891,892,5,113,0,
|
| 339 |
+
0,892,893,5,115,0,0,893,894,5,108,0,0,894,895,5,97,0,0,895,896,5,
|
| 340 |
+
110,0,0,896,897,5,116,0,0,897,178,1,0,0,0,898,899,5,33,0,0,899,180,
|
| 341 |
+
1,0,0,0,900,902,5,39,0,0,901,900,1,0,0,0,902,903,1,0,0,0,903,901,
|
| 342 |
+
1,0,0,0,903,904,1,0,0,0,904,182,1,0,0,0,905,907,5,92,0,0,906,908,
|
| 343 |
+
7,1,0,0,907,906,1,0,0,0,908,909,1,0,0,0,909,907,1,0,0,0,909,910,
|
| 344 |
+
1,0,0,0,910,184,1,0,0,0,22,0,192,208,223,240,276,380,503,520,752,
|
| 345 |
+
797,805,807,817,820,827,831,833,851,880,903,909,1,6,0,0
|
| 346 |
+
]
|
| 347 |
+
|
| 348 |
+
class LaTeXLexer(Lexer):
|
| 349 |
+
|
| 350 |
+
atn = ATNDeserializer().deserialize(serializedATN())
|
| 351 |
+
|
| 352 |
+
decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]
|
| 353 |
+
|
| 354 |
+
T__0 = 1
|
| 355 |
+
T__1 = 2
|
| 356 |
+
WS = 3
|
| 357 |
+
THINSPACE = 4
|
| 358 |
+
MEDSPACE = 5
|
| 359 |
+
THICKSPACE = 6
|
| 360 |
+
QUAD = 7
|
| 361 |
+
QQUAD = 8
|
| 362 |
+
NEGTHINSPACE = 9
|
| 363 |
+
NEGMEDSPACE = 10
|
| 364 |
+
NEGTHICKSPACE = 11
|
| 365 |
+
CMD_LEFT = 12
|
| 366 |
+
CMD_RIGHT = 13
|
| 367 |
+
IGNORE = 14
|
| 368 |
+
ADD = 15
|
| 369 |
+
SUB = 16
|
| 370 |
+
MUL = 17
|
| 371 |
+
DIV = 18
|
| 372 |
+
L_PAREN = 19
|
| 373 |
+
R_PAREN = 20
|
| 374 |
+
L_BRACE = 21
|
| 375 |
+
R_BRACE = 22
|
| 376 |
+
L_BRACE_LITERAL = 23
|
| 377 |
+
R_BRACE_LITERAL = 24
|
| 378 |
+
L_BRACKET = 25
|
| 379 |
+
R_BRACKET = 26
|
| 380 |
+
BAR = 27
|
| 381 |
+
R_BAR = 28
|
| 382 |
+
L_BAR = 29
|
| 383 |
+
L_ANGLE = 30
|
| 384 |
+
R_ANGLE = 31
|
| 385 |
+
FUNC_LIM = 32
|
| 386 |
+
LIM_APPROACH_SYM = 33
|
| 387 |
+
FUNC_INT = 34
|
| 388 |
+
FUNC_SUM = 35
|
| 389 |
+
FUNC_PROD = 36
|
| 390 |
+
FUNC_EXP = 37
|
| 391 |
+
FUNC_LOG = 38
|
| 392 |
+
FUNC_LG = 39
|
| 393 |
+
FUNC_LN = 40
|
| 394 |
+
FUNC_SIN = 41
|
| 395 |
+
FUNC_COS = 42
|
| 396 |
+
FUNC_TAN = 43
|
| 397 |
+
FUNC_CSC = 44
|
| 398 |
+
FUNC_SEC = 45
|
| 399 |
+
FUNC_COT = 46
|
| 400 |
+
FUNC_ARCSIN = 47
|
| 401 |
+
FUNC_ARCCOS = 48
|
| 402 |
+
FUNC_ARCTAN = 49
|
| 403 |
+
FUNC_ARCCSC = 50
|
| 404 |
+
FUNC_ARCSEC = 51
|
| 405 |
+
FUNC_ARCCOT = 52
|
| 406 |
+
FUNC_SINH = 53
|
| 407 |
+
FUNC_COSH = 54
|
| 408 |
+
FUNC_TANH = 55
|
| 409 |
+
FUNC_ARSINH = 56
|
| 410 |
+
FUNC_ARCOSH = 57
|
| 411 |
+
FUNC_ARTANH = 58
|
| 412 |
+
L_FLOOR = 59
|
| 413 |
+
R_FLOOR = 60
|
| 414 |
+
L_CEIL = 61
|
| 415 |
+
R_CEIL = 62
|
| 416 |
+
FUNC_SQRT = 63
|
| 417 |
+
FUNC_OVERLINE = 64
|
| 418 |
+
CMD_TIMES = 65
|
| 419 |
+
CMD_CDOT = 66
|
| 420 |
+
CMD_DIV = 67
|
| 421 |
+
CMD_FRAC = 68
|
| 422 |
+
CMD_BINOM = 69
|
| 423 |
+
CMD_DBINOM = 70
|
| 424 |
+
CMD_TBINOM = 71
|
| 425 |
+
CMD_MATHIT = 72
|
| 426 |
+
UNDERSCORE = 73
|
| 427 |
+
CARET = 74
|
| 428 |
+
COLON = 75
|
| 429 |
+
DIFFERENTIAL = 76
|
| 430 |
+
LETTER = 77
|
| 431 |
+
DIGIT = 78
|
| 432 |
+
EQUAL = 79
|
| 433 |
+
NEQ = 80
|
| 434 |
+
LT = 81
|
| 435 |
+
LTE = 82
|
| 436 |
+
LTE_Q = 83
|
| 437 |
+
LTE_S = 84
|
| 438 |
+
GT = 85
|
| 439 |
+
GTE = 86
|
| 440 |
+
GTE_Q = 87
|
| 441 |
+
GTE_S = 88
|
| 442 |
+
BANG = 89
|
| 443 |
+
SINGLE_QUOTES = 90
|
| 444 |
+
SYMBOL = 91
|
| 445 |
+
|
| 446 |
+
channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ]
|
| 447 |
+
|
| 448 |
+
modeNames = [ "DEFAULT_MODE" ]
|
| 449 |
+
|
| 450 |
+
literalNames = [ "<INVALID>",
|
| 451 |
+
"','", "'.'", "'\\quad'", "'\\qquad'", "'\\negmedspace'", "'\\negthickspace'",
|
| 452 |
+
"'\\left'", "'\\right'", "'+'", "'-'", "'*'", "'/'", "'('",
|
| 453 |
+
"')'", "'{'", "'}'", "'\\{'", "'\\}'", "'['", "']'", "'|'",
|
| 454 |
+
"'\\right|'", "'\\left|'", "'\\langle'", "'\\rangle'", "'\\lim'",
|
| 455 |
+
"'\\sum'", "'\\prod'", "'\\exp'", "'\\log'", "'\\lg'", "'\\ln'",
|
| 456 |
+
"'\\sin'", "'\\cos'", "'\\tan'", "'\\csc'", "'\\sec'", "'\\cot'",
|
| 457 |
+
"'\\arcsin'", "'\\arccos'", "'\\arctan'", "'\\arccsc'", "'\\arcsec'",
|
| 458 |
+
"'\\arccot'", "'\\sinh'", "'\\cosh'", "'\\tanh'", "'\\arsinh'",
|
| 459 |
+
"'\\arcosh'", "'\\artanh'", "'\\lfloor'", "'\\rfloor'", "'\\lceil'",
|
| 460 |
+
"'\\rceil'", "'\\sqrt'", "'\\overline'", "'\\times'", "'\\cdot'",
|
| 461 |
+
"'\\div'", "'\\binom'", "'\\dbinom'", "'\\tbinom'", "'\\mathit'",
|
| 462 |
+
"'_'", "'^'", "':'", "'\\neq'", "'<'", "'\\leqq'", "'\\leqslant'",
|
| 463 |
+
"'>'", "'\\geqq'", "'\\geqslant'", "'!'" ]
|
| 464 |
+
|
| 465 |
+
symbolicNames = [ "<INVALID>",
|
| 466 |
+
"WS", "THINSPACE", "MEDSPACE", "THICKSPACE", "QUAD", "QQUAD",
|
| 467 |
+
"NEGTHINSPACE", "NEGMEDSPACE", "NEGTHICKSPACE", "CMD_LEFT",
|
| 468 |
+
"CMD_RIGHT", "IGNORE", "ADD", "SUB", "MUL", "DIV", "L_PAREN",
|
| 469 |
+
"R_PAREN", "L_BRACE", "R_BRACE", "L_BRACE_LITERAL", "R_BRACE_LITERAL",
|
| 470 |
+
"L_BRACKET", "R_BRACKET", "BAR", "R_BAR", "L_BAR", "L_ANGLE",
|
| 471 |
+
"R_ANGLE", "FUNC_LIM", "LIM_APPROACH_SYM", "FUNC_INT", "FUNC_SUM",
|
| 472 |
+
"FUNC_PROD", "FUNC_EXP", "FUNC_LOG", "FUNC_LG", "FUNC_LN", "FUNC_SIN",
|
| 473 |
+
"FUNC_COS", "FUNC_TAN", "FUNC_CSC", "FUNC_SEC", "FUNC_COT",
|
| 474 |
+
"FUNC_ARCSIN", "FUNC_ARCCOS", "FUNC_ARCTAN", "FUNC_ARCCSC",
|
| 475 |
+
"FUNC_ARCSEC", "FUNC_ARCCOT", "FUNC_SINH", "FUNC_COSH", "FUNC_TANH",
|
| 476 |
+
"FUNC_ARSINH", "FUNC_ARCOSH", "FUNC_ARTANH", "L_FLOOR", "R_FLOOR",
|
| 477 |
+
"L_CEIL", "R_CEIL", "FUNC_SQRT", "FUNC_OVERLINE", "CMD_TIMES",
|
| 478 |
+
"CMD_CDOT", "CMD_DIV", "CMD_FRAC", "CMD_BINOM", "CMD_DBINOM",
|
| 479 |
+
"CMD_TBINOM", "CMD_MATHIT", "UNDERSCORE", "CARET", "COLON",
|
| 480 |
+
"DIFFERENTIAL", "LETTER", "DIGIT", "EQUAL", "NEQ", "LT", "LTE",
|
| 481 |
+
"LTE_Q", "LTE_S", "GT", "GTE", "GTE_Q", "GTE_S", "BANG", "SINGLE_QUOTES",
|
| 482 |
+
"SYMBOL" ]
|
| 483 |
+
|
| 484 |
+
ruleNames = [ "T__0", "T__1", "WS", "THINSPACE", "MEDSPACE", "THICKSPACE",
|
| 485 |
+
"QUAD", "QQUAD", "NEGTHINSPACE", "NEGMEDSPACE", "NEGTHICKSPACE",
|
| 486 |
+
"CMD_LEFT", "CMD_RIGHT", "IGNORE", "ADD", "SUB", "MUL",
|
| 487 |
+
"DIV", "L_PAREN", "R_PAREN", "L_BRACE", "R_BRACE", "L_BRACE_LITERAL",
|
| 488 |
+
"R_BRACE_LITERAL", "L_BRACKET", "R_BRACKET", "BAR", "R_BAR",
|
| 489 |
+
"L_BAR", "L_ANGLE", "R_ANGLE", "FUNC_LIM", "LIM_APPROACH_SYM",
|
| 490 |
+
"FUNC_INT", "FUNC_SUM", "FUNC_PROD", "FUNC_EXP", "FUNC_LOG",
|
| 491 |
+
"FUNC_LG", "FUNC_LN", "FUNC_SIN", "FUNC_COS", "FUNC_TAN",
|
| 492 |
+
"FUNC_CSC", "FUNC_SEC", "FUNC_COT", "FUNC_ARCSIN", "FUNC_ARCCOS",
|
| 493 |
+
"FUNC_ARCTAN", "FUNC_ARCCSC", "FUNC_ARCSEC", "FUNC_ARCCOT",
|
| 494 |
+
"FUNC_SINH", "FUNC_COSH", "FUNC_TANH", "FUNC_ARSINH",
|
| 495 |
+
"FUNC_ARCOSH", "FUNC_ARTANH", "L_FLOOR", "R_FLOOR", "L_CEIL",
|
| 496 |
+
"R_CEIL", "FUNC_SQRT", "FUNC_OVERLINE", "CMD_TIMES", "CMD_CDOT",
|
| 497 |
+
"CMD_DIV", "CMD_FRAC", "CMD_BINOM", "CMD_DBINOM", "CMD_TBINOM",
|
| 498 |
+
"CMD_MATHIT", "UNDERSCORE", "CARET", "COLON", "WS_CHAR",
|
| 499 |
+
"DIFFERENTIAL", "LETTER", "DIGIT", "EQUAL", "NEQ", "LT",
|
| 500 |
+
"LTE", "LTE_Q", "LTE_S", "GT", "GTE", "GTE_Q", "GTE_S",
|
| 501 |
+
"BANG", "SINGLE_QUOTES", "SYMBOL" ]
|
| 502 |
+
|
| 503 |
+
grammarFileName = "LaTeX.g4"
|
| 504 |
+
|
| 505 |
+
def __init__(self, input=None, output:TextIO = sys.stdout):
|
| 506 |
+
super().__init__(input, output)
|
| 507 |
+
self.checkVersion("4.11.1")
|
| 508 |
+
self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache())
|
| 509 |
+
self._actions = None
|
| 510 |
+
self._predicates = None
|
| 511 |
+
|
| 512 |
+
|
evalkit_internvl/lib/python3.10/site-packages/sympy/parsing/latex/_antlr/latexparser.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
evalkit_internvl/lib/python3.10/site-packages/transformers/__pycache__/__init__.cpython-310.pyc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c2b88ae98be21d7f90d10394434830bd0c1070167ab8f88d34e8ef604c743fea
|
| 3 |
+
size 175048
|
evalkit_internvl/lib/python3.10/site-packages/transformers/__pycache__/modeling_outputs.cpython-310.pyc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b5fb7039846a84f9bee26fe87a21a18ae6cda877744bde6cb9091e82627bae77
|
| 3 |
+
size 109267
|
evalkit_internvl/lib/python3.10/site-packages/transformers/utils/__pycache__/dummy_pt_objects.cpython-310.pyc
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:993980ac00572085bbbfa10f423cd91774b243e7bdc953d36780170f129d85b7
|
| 3 |
+
size 318856
|
evalkit_tf437/lib/python3.10/site-packages/diffusers/models/autoencoders/__pycache__/vae.cpython-310.pyc
ADDED
|
Binary file (24.9 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/diffusers/models/transformers/__init__.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from ...utils import is_torch_available
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
if is_torch_available():
|
| 5 |
+
from .dual_transformer_2d import DualTransformer2DModel
|
| 6 |
+
from .prior_transformer import PriorTransformer
|
| 7 |
+
from .t5_film_transformer import T5FilmDecoder
|
| 8 |
+
from .transformer_2d import Transformer2DModel
|
| 9 |
+
from .transformer_temporal import TransformerTemporalModel
|
evalkit_tf437/lib/python3.10/site-packages/diffusers/models/transformers/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (562 Bytes). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/diffusers/models/transformers/__pycache__/prior_transformer.cpython-310.pyc
ADDED
|
Binary file (13.2 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/diffusers/models/transformers/__pycache__/t5_film_transformer.cpython-310.pyc
ADDED
|
Binary file (13.8 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/diffusers/models/transformers/__pycache__/transformer_2d.cpython-310.pyc
ADDED
|
Binary file (14.6 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/diffusers/models/transformers/dual_transformer_2d.py
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Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
from typing import Optional
|
| 15 |
+
|
| 16 |
+
from torch import nn
|
| 17 |
+
|
| 18 |
+
from .transformer_2d import Transformer2DModel, Transformer2DModelOutput
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class DualTransformer2DModel(nn.Module):
|
| 22 |
+
"""
|
| 23 |
+
Dual transformer wrapper that combines two `Transformer2DModel`s for mixed inference.
|
| 24 |
+
|
| 25 |
+
Parameters:
|
| 26 |
+
num_attention_heads (`int`, *optional*, defaults to 16): The number of heads to use for multi-head attention.
|
| 27 |
+
attention_head_dim (`int`, *optional*, defaults to 88): The number of channels in each head.
|
| 28 |
+
in_channels (`int`, *optional*):
|
| 29 |
+
Pass if the input is continuous. The number of channels in the input and output.
|
| 30 |
+
num_layers (`int`, *optional*, defaults to 1): The number of layers of Transformer blocks to use.
|
| 31 |
+
dropout (`float`, *optional*, defaults to 0.1): The dropout probability to use.
|
| 32 |
+
cross_attention_dim (`int`, *optional*): The number of encoder_hidden_states dimensions to use.
|
| 33 |
+
sample_size (`int`, *optional*): Pass if the input is discrete. The width of the latent images.
|
| 34 |
+
Note that this is fixed at training time as it is used for learning a number of position embeddings. See
|
| 35 |
+
`ImagePositionalEmbeddings`.
|
| 36 |
+
num_vector_embeds (`int`, *optional*):
|
| 37 |
+
Pass if the input is discrete. The number of classes of the vector embeddings of the latent pixels.
|
| 38 |
+
Includes the class for the masked latent pixel.
|
| 39 |
+
activation_fn (`str`, *optional*, defaults to `"geglu"`): Activation function to be used in feed-forward.
|
| 40 |
+
num_embeds_ada_norm ( `int`, *optional*): Pass if at least one of the norm_layers is `AdaLayerNorm`.
|
| 41 |
+
The number of diffusion steps used during training. Note that this is fixed at training time as it is used
|
| 42 |
+
to learn a number of embeddings that are added to the hidden states. During inference, you can denoise for
|
| 43 |
+
up to but not more than steps than `num_embeds_ada_norm`.
|
| 44 |
+
attention_bias (`bool`, *optional*):
|
| 45 |
+
Configure if the TransformerBlocks' attention should contain a bias parameter.
|
| 46 |
+
"""
|
| 47 |
+
|
| 48 |
+
def __init__(
|
| 49 |
+
self,
|
| 50 |
+
num_attention_heads: int = 16,
|
| 51 |
+
attention_head_dim: int = 88,
|
| 52 |
+
in_channels: Optional[int] = None,
|
| 53 |
+
num_layers: int = 1,
|
| 54 |
+
dropout: float = 0.0,
|
| 55 |
+
norm_num_groups: int = 32,
|
| 56 |
+
cross_attention_dim: Optional[int] = None,
|
| 57 |
+
attention_bias: bool = False,
|
| 58 |
+
sample_size: Optional[int] = None,
|
| 59 |
+
num_vector_embeds: Optional[int] = None,
|
| 60 |
+
activation_fn: str = "geglu",
|
| 61 |
+
num_embeds_ada_norm: Optional[int] = None,
|
| 62 |
+
):
|
| 63 |
+
super().__init__()
|
| 64 |
+
self.transformers = nn.ModuleList(
|
| 65 |
+
[
|
| 66 |
+
Transformer2DModel(
|
| 67 |
+
num_attention_heads=num_attention_heads,
|
| 68 |
+
attention_head_dim=attention_head_dim,
|
| 69 |
+
in_channels=in_channels,
|
| 70 |
+
num_layers=num_layers,
|
| 71 |
+
dropout=dropout,
|
| 72 |
+
norm_num_groups=norm_num_groups,
|
| 73 |
+
cross_attention_dim=cross_attention_dim,
|
| 74 |
+
attention_bias=attention_bias,
|
| 75 |
+
sample_size=sample_size,
|
| 76 |
+
num_vector_embeds=num_vector_embeds,
|
| 77 |
+
activation_fn=activation_fn,
|
| 78 |
+
num_embeds_ada_norm=num_embeds_ada_norm,
|
| 79 |
+
)
|
| 80 |
+
for _ in range(2)
|
| 81 |
+
]
|
| 82 |
+
)
|
| 83 |
+
|
| 84 |
+
# Variables that can be set by a pipeline:
|
| 85 |
+
|
| 86 |
+
# The ratio of transformer1 to transformer2's output states to be combined during inference
|
| 87 |
+
self.mix_ratio = 0.5
|
| 88 |
+
|
| 89 |
+
# The shape of `encoder_hidden_states` is expected to be
|
| 90 |
+
# `(batch_size, condition_lengths[0]+condition_lengths[1], num_features)`
|
| 91 |
+
self.condition_lengths = [77, 257]
|
| 92 |
+
|
| 93 |
+
# Which transformer to use to encode which condition.
|
| 94 |
+
# E.g. `(1, 0)` means that we'll use `transformers[1](conditions[0])` and `transformers[0](conditions[1])`
|
| 95 |
+
self.transformer_index_for_condition = [1, 0]
|
| 96 |
+
|
| 97 |
+
def forward(
|
| 98 |
+
self,
|
| 99 |
+
hidden_states,
|
| 100 |
+
encoder_hidden_states,
|
| 101 |
+
timestep=None,
|
| 102 |
+
attention_mask=None,
|
| 103 |
+
cross_attention_kwargs=None,
|
| 104 |
+
return_dict: bool = True,
|
| 105 |
+
):
|
| 106 |
+
"""
|
| 107 |
+
Args:
|
| 108 |
+
hidden_states ( When discrete, `torch.LongTensor` of shape `(batch size, num latent pixels)`.
|
| 109 |
+
When continuous, `torch.FloatTensor` of shape `(batch size, channel, height, width)`): Input
|
| 110 |
+
hidden_states.
|
| 111 |
+
encoder_hidden_states ( `torch.LongTensor` of shape `(batch size, encoder_hidden_states dim)`, *optional*):
|
| 112 |
+
Conditional embeddings for cross attention layer. If not given, cross-attention defaults to
|
| 113 |
+
self-attention.
|
| 114 |
+
timestep ( `torch.long`, *optional*):
|
| 115 |
+
Optional timestep to be applied as an embedding in AdaLayerNorm's. Used to indicate denoising step.
|
| 116 |
+
attention_mask (`torch.FloatTensor`, *optional*):
|
| 117 |
+
Optional attention mask to be applied in Attention.
|
| 118 |
+
cross_attention_kwargs (`dict`, *optional*):
|
| 119 |
+
A kwargs dictionary that if specified is passed along to the `AttentionProcessor` as defined under
|
| 120 |
+
`self.processor` in
|
| 121 |
+
[diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
|
| 122 |
+
return_dict (`bool`, *optional*, defaults to `True`):
|
| 123 |
+
Whether or not to return a [`models.unets.unet_2d_condition.UNet2DConditionOutput`] instead of a plain tuple.
|
| 124 |
+
|
| 125 |
+
Returns:
|
| 126 |
+
[`~models.transformer_2d.Transformer2DModelOutput`] or `tuple`:
|
| 127 |
+
[`~models.transformer_2d.Transformer2DModelOutput`] if `return_dict` is True, otherwise a `tuple`. When
|
| 128 |
+
returning a tuple, the first element is the sample tensor.
|
| 129 |
+
"""
|
| 130 |
+
input_states = hidden_states
|
| 131 |
+
|
| 132 |
+
encoded_states = []
|
| 133 |
+
tokens_start = 0
|
| 134 |
+
# attention_mask is not used yet
|
| 135 |
+
for i in range(2):
|
| 136 |
+
# for each of the two transformers, pass the corresponding condition tokens
|
| 137 |
+
condition_state = encoder_hidden_states[:, tokens_start : tokens_start + self.condition_lengths[i]]
|
| 138 |
+
transformer_index = self.transformer_index_for_condition[i]
|
| 139 |
+
encoded_state = self.transformers[transformer_index](
|
| 140 |
+
input_states,
|
| 141 |
+
encoder_hidden_states=condition_state,
|
| 142 |
+
timestep=timestep,
|
| 143 |
+
cross_attention_kwargs=cross_attention_kwargs,
|
| 144 |
+
return_dict=False,
|
| 145 |
+
)[0]
|
| 146 |
+
encoded_states.append(encoded_state - input_states)
|
| 147 |
+
tokens_start += self.condition_lengths[i]
|
| 148 |
+
|
| 149 |
+
output_states = encoded_states[0] * self.mix_ratio + encoded_states[1] * (1 - self.mix_ratio)
|
| 150 |
+
output_states = output_states + input_states
|
| 151 |
+
|
| 152 |
+
if not return_dict:
|
| 153 |
+
return (output_states,)
|
| 154 |
+
|
| 155 |
+
return Transformer2DModelOutput(sample=output_states)
|