vex-ast 0.2.5__py3-none-any.whl → 0.2.7__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.
Files changed (63) hide show
  1. vex_ast/README.md +101 -51
  2. vex_ast/READMEAPI.md +133 -318
  3. vex_ast/__init__.py +81 -81
  4. vex_ast/ast/README.md +87 -87
  5. vex_ast/ast/__init__.py +74 -74
  6. vex_ast/ast/core.py +71 -71
  7. vex_ast/ast/expressions.py +276 -276
  8. vex_ast/ast/interfaces.py +208 -208
  9. vex_ast/ast/literals.py +80 -80
  10. vex_ast/ast/navigator.py +241 -225
  11. vex_ast/ast/operators.py +135 -135
  12. vex_ast/ast/statements.py +351 -351
  13. vex_ast/ast/validators.py +121 -121
  14. vex_ast/ast/vex_nodes.py +279 -279
  15. vex_ast/parser/README.md +47 -47
  16. vex_ast/parser/__init__.py +26 -26
  17. vex_ast/parser/factory.py +190 -190
  18. vex_ast/parser/interfaces.py +34 -34
  19. vex_ast/parser/python_parser.py +831 -831
  20. vex_ast/registry/README.md +107 -29
  21. vex_ast/registry/__init__.py +51 -51
  22. vex_ast/registry/api.py +190 -155
  23. vex_ast/registry/categories.py +179 -136
  24. vex_ast/registry/functions/__init__.py +10 -10
  25. vex_ast/registry/functions/constructors.py +71 -35
  26. vex_ast/registry/functions/display.py +146 -146
  27. vex_ast/registry/functions/drivetrain.py +163 -163
  28. vex_ast/registry/functions/initialize.py +31 -31
  29. vex_ast/registry/functions/motor.py +140 -140
  30. vex_ast/registry/functions/sensors.py +194 -194
  31. vex_ast/registry/functions/timing.py +103 -103
  32. vex_ast/registry/language_map.py +77 -77
  33. vex_ast/registry/registry.py +164 -153
  34. vex_ast/registry/signature.py +269 -191
  35. vex_ast/registry/simulation_behavior.py +8 -8
  36. vex_ast/registry/validation.py +43 -43
  37. vex_ast/serialization/__init__.py +37 -37
  38. vex_ast/serialization/json_deserializer.py +284 -284
  39. vex_ast/serialization/json_serializer.py +148 -148
  40. vex_ast/serialization/schema.py +492 -492
  41. vex_ast/types/README.md +78 -26
  42. vex_ast/types/__init__.py +140 -140
  43. vex_ast/types/base.py +83 -83
  44. vex_ast/types/enums.py +122 -122
  45. vex_ast/types/objects.py +64 -64
  46. vex_ast/types/primitives.py +68 -68
  47. vex_ast/types/type_checker.py +31 -31
  48. vex_ast/utils/README.md +39 -39
  49. vex_ast/utils/__init__.py +37 -37
  50. vex_ast/utils/errors.py +112 -112
  51. vex_ast/utils/source_location.py +38 -38
  52. vex_ast/utils/type_definitions.py +8 -8
  53. vex_ast/visitors/README.md +49 -49
  54. vex_ast/visitors/__init__.py +27 -27
  55. vex_ast/visitors/analyzer.py +102 -102
  56. vex_ast/visitors/base.py +133 -133
  57. vex_ast/visitors/printer.py +196 -196
  58. {vex_ast-0.2.5.dist-info → vex_ast-0.2.7.dist-info}/METADATA +206 -174
  59. vex_ast-0.2.7.dist-info/RECORD +64 -0
  60. vex_ast-0.2.5.dist-info/RECORD +0 -64
  61. {vex_ast-0.2.5.dist-info → vex_ast-0.2.7.dist-info}/WHEEL +0 -0
  62. {vex_ast-0.2.5.dist-info → vex_ast-0.2.7.dist-info}/licenses/LICENSE +0 -0
  63. {vex_ast-0.2.5.dist-info → vex_ast-0.2.7.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()