vex-ast 0.2.1__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {vex_ast-0.2.1/vex_ast.egg-info → vex_ast-0.2.2}/PKG-INFO +1 -1
- {vex_ast-0.2.1 → vex_ast-0.2.2}/pyproject.toml +1 -1
- {vex_ast-0.2.1 → vex_ast-0.2.2}/setup.py +1 -1
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/__init__.py +6 -2
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/ast/validators.py +9 -3
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/ast/vex_nodes.py +25 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2/vex_ast.egg-info}/PKG-INFO +1 -1
- {vex_ast-0.2.1 → vex_ast-0.2.2}/LICENSE +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/MANIFEST.in +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/README.md +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/pytest.ini +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/requirements.txt +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/setup.cfg +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/tests/conftest.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/tests/test_core.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/tests/test_integration.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/tests/test_literals.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/tests/test_navigator.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/tests/test_parser.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/tests/test_registry.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/tests/test_serialization.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/tests/test_statements.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/tests/test_vex_nodes.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/tests/test_visitors.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/README.md +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/READMEAPI.md +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/ast/README.md +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/ast/__init__.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/ast/core.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/ast/expressions.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/ast/interfaces.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/ast/literals.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/ast/navigator.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/ast/operators.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/ast/statements.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/parser/README.md +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/parser/__init__.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/parser/factory.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/parser/interfaces.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/parser/python_parser.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/parser/strategies.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/README.md +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/__init__.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/api.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/categories.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/functions/__init__.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/functions/display.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/functions/drivetrain.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/functions/initialize.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/functions/motor.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/functions/sensors.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/functions/timing.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/language_map.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/registry.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/signature.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/simulation_behavior.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/validation.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/serialization/__init__.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/serialization/json_deserializer.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/serialization/json_serializer.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/serialization/schema.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/types/README.md +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/types/__init__.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/types/base.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/types/enums.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/types/objects.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/types/primitives.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/types/type_checker.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/utils/README.md +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/utils/__init__.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/utils/errors.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/utils/source_location.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/utils/type_definitions.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/visitors/README.md +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/visitors/__init__.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/visitors/analyzer.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/visitors/base.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/visitors/printer.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/visitors/transformer.py +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast.egg-info/SOURCES.txt +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast.egg-info/dependency_links.txt +0 -0
- {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast.egg-info/top_level.txt +0 -0
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
2
2
|
|
3
3
|
setup(
|
4
4
|
name='vex_ast',
|
5
|
-
version='0.2.
|
5
|
+
version='0.2.2',
|
6
6
|
description='A Python package for generating Abstract Syntax Trees for VEX V5 code.',
|
7
7
|
long_description=open('README.md').read(),
|
8
8
|
long_description_content_type='text/markdown',
|
@@ -30,7 +30,11 @@ from .serialization.schema import generate_ast_schema, export_schema_to_file
|
|
30
30
|
__version__ = "0.2.0"
|
31
31
|
|
32
32
|
# Initialize the registry with default functions
|
33
|
-
|
33
|
+
try:
|
34
|
+
initialize()
|
35
|
+
print("VEX function registry initialized successfully")
|
36
|
+
except Exception as e:
|
37
|
+
print(f"Error initializing VEX function registry: {e}")
|
34
38
|
|
35
39
|
__all__ = [
|
36
40
|
# Core functionality
|
@@ -65,4 +69,4 @@ __all__ = [
|
|
65
69
|
"deserialize_ast_from_json",
|
66
70
|
"generate_ast_schema",
|
67
71
|
"export_schema_to_file"
|
68
|
-
]
|
72
|
+
]
|
@@ -81,11 +81,17 @@ class VexFunctionValidator(AstVisitor[List[Tuple[VexAPICall, str]]]):
|
|
81
81
|
# Check if this is a method call on a known object type
|
82
82
|
if '.' in function_name:
|
83
83
|
obj_name, method_name = function_name.split('.', 1)
|
84
|
-
|
85
|
-
#
|
86
|
-
# Just check if the method name exists in the registry API
|
84
|
+
|
85
|
+
# First check if the method exists in the registry
|
87
86
|
if registry_api.get_function(method_name):
|
88
87
|
is_vex_function = True
|
88
|
+
else:
|
89
|
+
# Try to check if it's a method on any known object type
|
90
|
+
from ..types.objects import MOTOR, TIMER, BRAIN, CONTROLLER
|
91
|
+
for obj_type in [MOTOR, TIMER, BRAIN, CONTROLLER]:
|
92
|
+
if registry_api.get_method(obj_type, method_name):
|
93
|
+
is_vex_function = True
|
94
|
+
break
|
89
95
|
# Or check if it's a direct function
|
90
96
|
elif registry_api.get_function(function_name):
|
91
97
|
is_vex_function = True
|
@@ -59,7 +59,20 @@ class VexAPICall(FunctionCall):
|
|
59
59
|
if '.' in function_name:
|
60
60
|
# For method calls like "motor1.spin", extract the method name
|
61
61
|
obj_name, method_name = function_name.split('.', 1)
|
62
|
+
|
63
|
+
# First try to get the method signature directly
|
62
64
|
self._signature = registry_api.get_function(method_name)
|
65
|
+
|
66
|
+
# If that fails, try to get it as a method of a specific object type
|
67
|
+
# This is a fallback since we don't know the actual type at parse time
|
68
|
+
if not self._signature:
|
69
|
+
# Try common object types
|
70
|
+
from ..types.objects import MOTOR, TIMER, BRAIN, CONTROLLER
|
71
|
+
for obj_type in [MOTOR, TIMER, BRAIN, CONTROLLER]:
|
72
|
+
method_sig = registry_api.get_method(obj_type, method_name)
|
73
|
+
if method_sig:
|
74
|
+
self._signature = method_sig
|
75
|
+
break
|
63
76
|
else:
|
64
77
|
# For direct function calls
|
65
78
|
self._signature = registry_api.get_function(function_name)
|
@@ -205,7 +218,19 @@ def create_vex_api_call(function: IExpression, args: List[IExpression],
|
|
205
218
|
if '.' in function_name:
|
206
219
|
# For method calls like "motor1.spin", extract the method name
|
207
220
|
obj_name, method_name = function_name.split('.', 1)
|
221
|
+
|
222
|
+
# First try to get the method signature directly
|
208
223
|
signature = registry_api.get_function(method_name)
|
224
|
+
|
225
|
+
# If that fails, try to get it as a method of a specific object type
|
226
|
+
if not signature:
|
227
|
+
# Try common object types
|
228
|
+
from ..types.objects import MOTOR, TIMER, BRAIN, CONTROLLER
|
229
|
+
for obj_type in [MOTOR, TIMER, BRAIN, CONTROLLER]:
|
230
|
+
method_sig = registry_api.get_method(obj_type, method_name)
|
231
|
+
if method_sig:
|
232
|
+
signature = method_sig
|
233
|
+
break
|
209
234
|
else:
|
210
235
|
# For direct function calls
|
211
236
|
signature = registry_api.get_function(function_name)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|