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.
Files changed (82) hide show
  1. {vex_ast-0.2.1/vex_ast.egg-info → vex_ast-0.2.2}/PKG-INFO +1 -1
  2. {vex_ast-0.2.1 → vex_ast-0.2.2}/pyproject.toml +1 -1
  3. {vex_ast-0.2.1 → vex_ast-0.2.2}/setup.py +1 -1
  4. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/__init__.py +6 -2
  5. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/ast/validators.py +9 -3
  6. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/ast/vex_nodes.py +25 -0
  7. {vex_ast-0.2.1 → vex_ast-0.2.2/vex_ast.egg-info}/PKG-INFO +1 -1
  8. {vex_ast-0.2.1 → vex_ast-0.2.2}/LICENSE +0 -0
  9. {vex_ast-0.2.1 → vex_ast-0.2.2}/MANIFEST.in +0 -0
  10. {vex_ast-0.2.1 → vex_ast-0.2.2}/README.md +0 -0
  11. {vex_ast-0.2.1 → vex_ast-0.2.2}/pytest.ini +0 -0
  12. {vex_ast-0.2.1 → vex_ast-0.2.2}/requirements.txt +0 -0
  13. {vex_ast-0.2.1 → vex_ast-0.2.2}/setup.cfg +0 -0
  14. {vex_ast-0.2.1 → vex_ast-0.2.2}/tests/conftest.py +0 -0
  15. {vex_ast-0.2.1 → vex_ast-0.2.2}/tests/test_core.py +0 -0
  16. {vex_ast-0.2.1 → vex_ast-0.2.2}/tests/test_integration.py +0 -0
  17. {vex_ast-0.2.1 → vex_ast-0.2.2}/tests/test_literals.py +0 -0
  18. {vex_ast-0.2.1 → vex_ast-0.2.2}/tests/test_navigator.py +0 -0
  19. {vex_ast-0.2.1 → vex_ast-0.2.2}/tests/test_parser.py +0 -0
  20. {vex_ast-0.2.1 → vex_ast-0.2.2}/tests/test_registry.py +0 -0
  21. {vex_ast-0.2.1 → vex_ast-0.2.2}/tests/test_serialization.py +0 -0
  22. {vex_ast-0.2.1 → vex_ast-0.2.2}/tests/test_statements.py +0 -0
  23. {vex_ast-0.2.1 → vex_ast-0.2.2}/tests/test_vex_nodes.py +0 -0
  24. {vex_ast-0.2.1 → vex_ast-0.2.2}/tests/test_visitors.py +0 -0
  25. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/README.md +0 -0
  26. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/READMEAPI.md +0 -0
  27. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/ast/README.md +0 -0
  28. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/ast/__init__.py +0 -0
  29. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/ast/core.py +0 -0
  30. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/ast/expressions.py +0 -0
  31. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/ast/interfaces.py +0 -0
  32. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/ast/literals.py +0 -0
  33. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/ast/navigator.py +0 -0
  34. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/ast/operators.py +0 -0
  35. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/ast/statements.py +0 -0
  36. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/parser/README.md +0 -0
  37. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/parser/__init__.py +0 -0
  38. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/parser/factory.py +0 -0
  39. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/parser/interfaces.py +0 -0
  40. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/parser/python_parser.py +0 -0
  41. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/parser/strategies.py +0 -0
  42. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/README.md +0 -0
  43. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/__init__.py +0 -0
  44. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/api.py +0 -0
  45. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/categories.py +0 -0
  46. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/functions/__init__.py +0 -0
  47. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/functions/display.py +0 -0
  48. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/functions/drivetrain.py +0 -0
  49. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/functions/initialize.py +0 -0
  50. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/functions/motor.py +0 -0
  51. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/functions/sensors.py +0 -0
  52. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/functions/timing.py +0 -0
  53. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/language_map.py +0 -0
  54. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/registry.py +0 -0
  55. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/signature.py +0 -0
  56. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/simulation_behavior.py +0 -0
  57. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/registry/validation.py +0 -0
  58. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/serialization/__init__.py +0 -0
  59. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/serialization/json_deserializer.py +0 -0
  60. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/serialization/json_serializer.py +0 -0
  61. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/serialization/schema.py +0 -0
  62. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/types/README.md +0 -0
  63. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/types/__init__.py +0 -0
  64. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/types/base.py +0 -0
  65. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/types/enums.py +0 -0
  66. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/types/objects.py +0 -0
  67. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/types/primitives.py +0 -0
  68. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/types/type_checker.py +0 -0
  69. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/utils/README.md +0 -0
  70. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/utils/__init__.py +0 -0
  71. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/utils/errors.py +0 -0
  72. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/utils/source_location.py +0 -0
  73. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/utils/type_definitions.py +0 -0
  74. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/visitors/README.md +0 -0
  75. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/visitors/__init__.py +0 -0
  76. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/visitors/analyzer.py +0 -0
  77. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/visitors/base.py +0 -0
  78. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/visitors/printer.py +0 -0
  79. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast/visitors/transformer.py +0 -0
  80. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast.egg-info/SOURCES.txt +0 -0
  81. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast.egg-info/dependency_links.txt +0 -0
  82. {vex_ast-0.2.1 → vex_ast-0.2.2}/vex_ast.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vex_ast
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: A Python package for generating Abstract Syntax Trees for VEX V5 code.
5
5
  Home-page: https://github.com/heartx2/vex_ast
6
6
  Author: Chaze
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "vex_ast"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  description = "A Python package for generating Abstract Syntax Trees for VEX V5 code."
9
9
  readme = "README.md"
10
10
  authors = [
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='vex_ast',
5
- version='0.2.1',
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
- initialize()
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
- # For method calls, we need to check if the method exists for any object type
85
- # since we don't know the actual type of the object at validation time
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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vex_ast
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: A Python package for generating Abstract Syntax Trees for VEX V5 code.
5
5
  Home-page: https://github.com/heartx2/vex_ast
6
6
  Author: Chaze
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