vex-ast 0.2.5__py3-none-any.whl → 0.2.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vex_ast/README.md +101 -51
- vex_ast/READMEAPI.md +133 -318
- vex_ast/__init__.py +81 -81
- vex_ast/ast/README.md +87 -87
- vex_ast/ast/__init__.py +74 -74
- vex_ast/ast/core.py +71 -71
- vex_ast/ast/expressions.py +276 -276
- vex_ast/ast/interfaces.py +208 -208
- vex_ast/ast/literals.py +80 -80
- vex_ast/ast/navigator.py +225 -225
- vex_ast/ast/operators.py +135 -135
- vex_ast/ast/statements.py +351 -351
- vex_ast/ast/validators.py +121 -121
- vex_ast/ast/vex_nodes.py +279 -279
- vex_ast/parser/README.md +47 -47
- vex_ast/parser/__init__.py +26 -26
- vex_ast/parser/factory.py +190 -190
- vex_ast/parser/interfaces.py +34 -34
- vex_ast/parser/python_parser.py +831 -831
- vex_ast/registry/README.md +107 -29
- vex_ast/registry/__init__.py +51 -51
- vex_ast/registry/api.py +190 -155
- vex_ast/registry/categories.py +179 -136
- vex_ast/registry/functions/__init__.py +10 -10
- vex_ast/registry/functions/constructors.py +71 -35
- vex_ast/registry/functions/display.py +146 -146
- vex_ast/registry/functions/drivetrain.py +163 -163
- vex_ast/registry/functions/initialize.py +31 -31
- vex_ast/registry/functions/motor.py +140 -140
- vex_ast/registry/functions/sensors.py +194 -194
- vex_ast/registry/functions/timing.py +103 -103
- vex_ast/registry/language_map.py +77 -77
- vex_ast/registry/registry.py +164 -153
- vex_ast/registry/signature.py +269 -191
- vex_ast/registry/simulation_behavior.py +8 -8
- vex_ast/registry/validation.py +43 -43
- vex_ast/serialization/__init__.py +37 -37
- vex_ast/serialization/json_deserializer.py +284 -284
- vex_ast/serialization/json_serializer.py +148 -148
- vex_ast/serialization/schema.py +492 -492
- vex_ast/types/README.md +78 -26
- vex_ast/types/__init__.py +140 -140
- vex_ast/types/base.py +83 -83
- vex_ast/types/enums.py +122 -122
- vex_ast/types/objects.py +64 -64
- vex_ast/types/primitives.py +68 -68
- vex_ast/types/type_checker.py +31 -31
- vex_ast/utils/README.md +39 -39
- vex_ast/utils/__init__.py +37 -37
- vex_ast/utils/errors.py +112 -112
- vex_ast/utils/source_location.py +38 -38
- vex_ast/utils/type_definitions.py +8 -8
- vex_ast/visitors/README.md +49 -49
- vex_ast/visitors/__init__.py +27 -27
- vex_ast/visitors/analyzer.py +102 -102
- vex_ast/visitors/base.py +133 -133
- vex_ast/visitors/printer.py +196 -196
- {vex_ast-0.2.5.dist-info → vex_ast-0.2.6.dist-info}/METADATA +206 -174
- vex_ast-0.2.6.dist-info/RECORD +64 -0
- vex_ast-0.2.5.dist-info/RECORD +0 -64
- {vex_ast-0.2.5.dist-info → vex_ast-0.2.6.dist-info}/WHEEL +0 -0
- {vex_ast-0.2.5.dist-info → vex_ast-0.2.6.dist-info}/licenses/LICENSE +0 -0
- {vex_ast-0.2.5.dist-info → vex_ast-0.2.6.dist-info}/top_level.txt +0 -0
@@ -1,31 +1,31 @@
|
|
1
|
-
"""Initialize all VEX function definitions in the registry"""
|
2
|
-
|
3
|
-
from . import motor, drivetrain, sensors, timing, display, constructors
|
4
|
-
# Import other function modules as they are added
|
5
|
-
|
6
|
-
def initialize_registry():
|
7
|
-
"""Initialize the registry with all VEX functions"""
|
8
|
-
# Constructor functions
|
9
|
-
constructors.register_constructor_functions()
|
10
|
-
|
11
|
-
# Motor functions
|
12
|
-
motor.register_motor_functions()
|
13
|
-
|
14
|
-
# Drivetrain functions
|
15
|
-
drivetrain.register_drivetrain_functions()
|
16
|
-
|
17
|
-
# Sensor functions
|
18
|
-
sensors.register_sensor_functions()
|
19
|
-
|
20
|
-
# Timing functions
|
21
|
-
timing.register_timing_functions()
|
22
|
-
|
23
|
-
# Display functions
|
24
|
-
display.register_display_functions()
|
25
|
-
|
26
|
-
# Add other function registration calls as modules are added
|
27
|
-
|
28
|
-
print("VEX function registry initialized successfully")
|
29
|
-
|
30
|
-
if __name__ == "__main__":
|
31
|
-
initialize_registry()
|
1
|
+
"""Initialize all VEX function definitions in the registry"""
|
2
|
+
|
3
|
+
from . import motor, drivetrain, sensors, timing, display, constructors
|
4
|
+
# Import other function modules as they are added
|
5
|
+
|
6
|
+
def initialize_registry():
|
7
|
+
"""Initialize the registry with all VEX functions"""
|
8
|
+
# Constructor functions
|
9
|
+
constructors.register_constructor_functions()
|
10
|
+
|
11
|
+
# Motor functions
|
12
|
+
motor.register_motor_functions()
|
13
|
+
|
14
|
+
# Drivetrain functions
|
15
|
+
drivetrain.register_drivetrain_functions()
|
16
|
+
|
17
|
+
# Sensor functions
|
18
|
+
sensors.register_sensor_functions()
|
19
|
+
|
20
|
+
# Timing functions
|
21
|
+
timing.register_timing_functions()
|
22
|
+
|
23
|
+
# Display functions
|
24
|
+
display.register_display_functions()
|
25
|
+
|
26
|
+
# Add other function registration calls as modules are added
|
27
|
+
|
28
|
+
print("VEX function registry initialized successfully")
|
29
|
+
|
30
|
+
if __name__ == "__main__":
|
31
|
+
initialize_registry()
|
@@ -1,140 +1,140 @@
|
|
1
|
-
from ..registry import registry
|
2
|
-
from ..signature import VexFunctionSignature, VexFunctionParameter, ParameterMode, SimulationCategory
|
3
|
-
from ...types.base import VOID
|
4
|
-
from ...types.primitives import INT, FLOAT, BOOL
|
5
|
-
from ...types.enums import DIRECTION_TYPE, VELOCITY_UNITS, ROTATION_UNITS, BRAKE_TYPE
|
6
|
-
from ...types.objects import MOTOR
|
7
|
-
|
8
|
-
def register_motor_functions():
|
9
|
-
"""Register motor-related functions in the registry"""
|
10
|
-
|
11
|
-
# Motor.spin() method
|
12
|
-
spin_params = [
|
13
|
-
VexFunctionParameter("direction", DIRECTION_TYPE, description="Direction to spin the motor"),
|
14
|
-
VexFunctionParameter("velocity", FLOAT, 50.0, description="Velocity to spin at"),
|
15
|
-
VexFunctionParameter("units", VELOCITY_UNITS, "RPM", description="Velocity units")
|
16
|
-
]
|
17
|
-
|
18
|
-
spin_signature = VexFunctionSignature(
|
19
|
-
name="spin",
|
20
|
-
return_type=VOID,
|
21
|
-
parameters=spin_params,
|
22
|
-
description="Spin the motor in the specified direction",
|
23
|
-
category=SimulationCategory.MOTOR_CONTROL,
|
24
|
-
python_name="spin",
|
25
|
-
cpp_name="spin",
|
26
|
-
object_type=MOTOR,
|
27
|
-
method_name="spin"
|
28
|
-
)
|
29
|
-
|
30
|
-
registry.register_function(spin_signature)
|
31
|
-
|
32
|
-
# Motor.stop() method
|
33
|
-
stop_params = [
|
34
|
-
VexFunctionParameter("mode", BRAKE_TYPE, "COAST", description="Stopping mode (coast, brake, hold)")
|
35
|
-
]
|
36
|
-
|
37
|
-
stop_signature = VexFunctionSignature(
|
38
|
-
name="stop",
|
39
|
-
return_type=VOID,
|
40
|
-
parameters=stop_params,
|
41
|
-
description="Stop the motor",
|
42
|
-
category=SimulationCategory.MOTOR_CONTROL,
|
43
|
-
python_name="stop",
|
44
|
-
cpp_name="stop",
|
45
|
-
object_type=MOTOR,
|
46
|
-
method_name="stop"
|
47
|
-
)
|
48
|
-
|
49
|
-
registry.register_function(stop_signature)
|
50
|
-
|
51
|
-
# Motor.spin_to_position() method
|
52
|
-
spin_to_position_params = [
|
53
|
-
VexFunctionParameter("position", FLOAT, description="Position to spin to"),
|
54
|
-
VexFunctionParameter("units", ROTATION_UNITS, "DEGREES", description="Rotation units"),
|
55
|
-
VexFunctionParameter("velocity", FLOAT, 50.0, description="Velocity to spin at"),
|
56
|
-
VexFunctionParameter("units_v", VELOCITY_UNITS, "RPM", description="Velocity units"),
|
57
|
-
VexFunctionParameter("wait", BOOL, True, description="Whether to wait for completion")
|
58
|
-
]
|
59
|
-
|
60
|
-
spin_to_position_signature = VexFunctionSignature(
|
61
|
-
name="spin_to_position",
|
62
|
-
return_type=VOID,
|
63
|
-
parameters=spin_to_position_params,
|
64
|
-
description="Spin the motor to an absolute position",
|
65
|
-
category=SimulationCategory.MOTOR_CONTROL,
|
66
|
-
python_name="spin_to_position",
|
67
|
-
cpp_name="spinToPosition",
|
68
|
-
object_type=MOTOR,
|
69
|
-
method_name="spin_to_position"
|
70
|
-
)
|
71
|
-
|
72
|
-
registry.register_function(spin_to_position_signature)
|
73
|
-
|
74
|
-
# Motor.spin_for() method
|
75
|
-
spin_for_params = [
|
76
|
-
VexFunctionParameter("direction", DIRECTION_TYPE, description="Direction to spin"),
|
77
|
-
VexFunctionParameter("amount", FLOAT, description="Amount to spin"),
|
78
|
-
VexFunctionParameter("units", ROTATION_UNITS, "DEGREES", description="Rotation units"),
|
79
|
-
VexFunctionParameter("velocity", FLOAT, 50.0, description="Velocity to spin at"),
|
80
|
-
VexFunctionParameter("units_v", VELOCITY_UNITS, "RPM", description="Velocity units"),
|
81
|
-
VexFunctionParameter("wait", BOOL, True, description="Whether to wait for completion")
|
82
|
-
]
|
83
|
-
|
84
|
-
spin_for_signature = VexFunctionSignature(
|
85
|
-
name="spin_for",
|
86
|
-
return_type=VOID,
|
87
|
-
parameters=spin_for_params,
|
88
|
-
description="Spin the motor for a relative amount",
|
89
|
-
category=SimulationCategory.MOTOR_CONTROL,
|
90
|
-
python_name="spin_for",
|
91
|
-
cpp_name="spinFor",
|
92
|
-
object_type=MOTOR,
|
93
|
-
method_name="spin_for"
|
94
|
-
)
|
95
|
-
|
96
|
-
registry.register_function(spin_for_signature)
|
97
|
-
|
98
|
-
# Motor.set_velocity() method
|
99
|
-
set_velocity_params = [
|
100
|
-
VexFunctionParameter("velocity", FLOAT, description="Velocity to set"),
|
101
|
-
VexFunctionParameter("units", VELOCITY_UNITS, "RPM", description="Velocity units")
|
102
|
-
]
|
103
|
-
|
104
|
-
set_velocity_signature = VexFunctionSignature(
|
105
|
-
name="set_velocity",
|
106
|
-
return_type=VOID,
|
107
|
-
parameters=set_velocity_params,
|
108
|
-
description="Set the velocity of the motor",
|
109
|
-
category=SimulationCategory.MOTOR_CONTROL,
|
110
|
-
python_name="set_velocity",
|
111
|
-
cpp_name="setVelocity",
|
112
|
-
object_type=MOTOR,
|
113
|
-
method_name="set_velocity"
|
114
|
-
)
|
115
|
-
|
116
|
-
registry.register_function(set_velocity_signature)
|
117
|
-
|
118
|
-
# Motor.set_stopping() method
|
119
|
-
set_stopping_params = [
|
120
|
-
VexFunctionParameter("mode", BRAKE_TYPE, description="Stopping mode (coast, brake, hold)")
|
121
|
-
]
|
122
|
-
|
123
|
-
set_stopping_signature = VexFunctionSignature(
|
124
|
-
name="set_stopping",
|
125
|
-
return_type=VOID,
|
126
|
-
parameters=set_stopping_params,
|
127
|
-
description="Set the stopping mode of the motor",
|
128
|
-
category=SimulationCategory.MOTOR_CONTROL,
|
129
|
-
python_name="set_stopping",
|
130
|
-
cpp_name="setStopping",
|
131
|
-
object_type=MOTOR,
|
132
|
-
method_name="set_stopping"
|
133
|
-
)
|
134
|
-
|
135
|
-
registry.register_function(set_stopping_signature)
|
136
|
-
|
137
|
-
# Add more motor functions as needed...
|
138
|
-
|
139
|
-
if __name__ == "__main__":
|
140
|
-
register_motor_functions()
|
1
|
+
from ..registry import registry
|
2
|
+
from ..signature import VexFunctionSignature, VexFunctionParameter, ParameterMode, SimulationCategory
|
3
|
+
from ...types.base import VOID
|
4
|
+
from ...types.primitives import INT, FLOAT, BOOL
|
5
|
+
from ...types.enums import DIRECTION_TYPE, VELOCITY_UNITS, ROTATION_UNITS, BRAKE_TYPE
|
6
|
+
from ...types.objects import MOTOR
|
7
|
+
|
8
|
+
def register_motor_functions():
|
9
|
+
"""Register motor-related functions in the registry"""
|
10
|
+
|
11
|
+
# Motor.spin() method
|
12
|
+
spin_params = [
|
13
|
+
VexFunctionParameter("direction", DIRECTION_TYPE, description="Direction to spin the motor"),
|
14
|
+
VexFunctionParameter("velocity", FLOAT, 50.0, description="Velocity to spin at"),
|
15
|
+
VexFunctionParameter("units", VELOCITY_UNITS, "RPM", description="Velocity units")
|
16
|
+
]
|
17
|
+
|
18
|
+
spin_signature = VexFunctionSignature(
|
19
|
+
name="spin",
|
20
|
+
return_type=VOID,
|
21
|
+
parameters=spin_params,
|
22
|
+
description="Spin the motor in the specified direction",
|
23
|
+
category=SimulationCategory.MOTOR_CONTROL,
|
24
|
+
python_name="spin",
|
25
|
+
cpp_name="spin",
|
26
|
+
object_type=MOTOR,
|
27
|
+
method_name="spin"
|
28
|
+
)
|
29
|
+
|
30
|
+
registry.register_function(spin_signature)
|
31
|
+
|
32
|
+
# Motor.stop() method
|
33
|
+
stop_params = [
|
34
|
+
VexFunctionParameter("mode", BRAKE_TYPE, "COAST", description="Stopping mode (coast, brake, hold)")
|
35
|
+
]
|
36
|
+
|
37
|
+
stop_signature = VexFunctionSignature(
|
38
|
+
name="stop",
|
39
|
+
return_type=VOID,
|
40
|
+
parameters=stop_params,
|
41
|
+
description="Stop the motor",
|
42
|
+
category=SimulationCategory.MOTOR_CONTROL,
|
43
|
+
python_name="stop",
|
44
|
+
cpp_name="stop",
|
45
|
+
object_type=MOTOR,
|
46
|
+
method_name="stop"
|
47
|
+
)
|
48
|
+
|
49
|
+
registry.register_function(stop_signature)
|
50
|
+
|
51
|
+
# Motor.spin_to_position() method
|
52
|
+
spin_to_position_params = [
|
53
|
+
VexFunctionParameter("position", FLOAT, description="Position to spin to"),
|
54
|
+
VexFunctionParameter("units", ROTATION_UNITS, "DEGREES", description="Rotation units"),
|
55
|
+
VexFunctionParameter("velocity", FLOAT, 50.0, description="Velocity to spin at"),
|
56
|
+
VexFunctionParameter("units_v", VELOCITY_UNITS, "RPM", description="Velocity units"),
|
57
|
+
VexFunctionParameter("wait", BOOL, True, description="Whether to wait for completion")
|
58
|
+
]
|
59
|
+
|
60
|
+
spin_to_position_signature = VexFunctionSignature(
|
61
|
+
name="spin_to_position",
|
62
|
+
return_type=VOID,
|
63
|
+
parameters=spin_to_position_params,
|
64
|
+
description="Spin the motor to an absolute position",
|
65
|
+
category=SimulationCategory.MOTOR_CONTROL,
|
66
|
+
python_name="spin_to_position",
|
67
|
+
cpp_name="spinToPosition",
|
68
|
+
object_type=MOTOR,
|
69
|
+
method_name="spin_to_position"
|
70
|
+
)
|
71
|
+
|
72
|
+
registry.register_function(spin_to_position_signature)
|
73
|
+
|
74
|
+
# Motor.spin_for() method
|
75
|
+
spin_for_params = [
|
76
|
+
VexFunctionParameter("direction", DIRECTION_TYPE, description="Direction to spin"),
|
77
|
+
VexFunctionParameter("amount", FLOAT, description="Amount to spin"),
|
78
|
+
VexFunctionParameter("units", ROTATION_UNITS, "DEGREES", description="Rotation units"),
|
79
|
+
VexFunctionParameter("velocity", FLOAT, 50.0, description="Velocity to spin at"),
|
80
|
+
VexFunctionParameter("units_v", VELOCITY_UNITS, "RPM", description="Velocity units"),
|
81
|
+
VexFunctionParameter("wait", BOOL, True, description="Whether to wait for completion")
|
82
|
+
]
|
83
|
+
|
84
|
+
spin_for_signature = VexFunctionSignature(
|
85
|
+
name="spin_for",
|
86
|
+
return_type=VOID,
|
87
|
+
parameters=spin_for_params,
|
88
|
+
description="Spin the motor for a relative amount",
|
89
|
+
category=SimulationCategory.MOTOR_CONTROL,
|
90
|
+
python_name="spin_for",
|
91
|
+
cpp_name="spinFor",
|
92
|
+
object_type=MOTOR,
|
93
|
+
method_name="spin_for"
|
94
|
+
)
|
95
|
+
|
96
|
+
registry.register_function(spin_for_signature)
|
97
|
+
|
98
|
+
# Motor.set_velocity() method
|
99
|
+
set_velocity_params = [
|
100
|
+
VexFunctionParameter("velocity", FLOAT, description="Velocity to set"),
|
101
|
+
VexFunctionParameter("units", VELOCITY_UNITS, "RPM", description="Velocity units")
|
102
|
+
]
|
103
|
+
|
104
|
+
set_velocity_signature = VexFunctionSignature(
|
105
|
+
name="set_velocity",
|
106
|
+
return_type=VOID,
|
107
|
+
parameters=set_velocity_params,
|
108
|
+
description="Set the velocity of the motor",
|
109
|
+
category=SimulationCategory.MOTOR_CONTROL,
|
110
|
+
python_name="set_velocity",
|
111
|
+
cpp_name="setVelocity",
|
112
|
+
object_type=MOTOR,
|
113
|
+
method_name="set_velocity"
|
114
|
+
)
|
115
|
+
|
116
|
+
registry.register_function(set_velocity_signature)
|
117
|
+
|
118
|
+
# Motor.set_stopping() method
|
119
|
+
set_stopping_params = [
|
120
|
+
VexFunctionParameter("mode", BRAKE_TYPE, description="Stopping mode (coast, brake, hold)")
|
121
|
+
]
|
122
|
+
|
123
|
+
set_stopping_signature = VexFunctionSignature(
|
124
|
+
name="set_stopping",
|
125
|
+
return_type=VOID,
|
126
|
+
parameters=set_stopping_params,
|
127
|
+
description="Set the stopping mode of the motor",
|
128
|
+
category=SimulationCategory.MOTOR_CONTROL,
|
129
|
+
python_name="set_stopping",
|
130
|
+
cpp_name="setStopping",
|
131
|
+
object_type=MOTOR,
|
132
|
+
method_name="set_stopping"
|
133
|
+
)
|
134
|
+
|
135
|
+
registry.register_function(set_stopping_signature)
|
136
|
+
|
137
|
+
# Add more motor functions as needed...
|
138
|
+
|
139
|
+
if __name__ == "__main__":
|
140
|
+
register_motor_functions()
|