Skip to content

Commit e536cca

Browse files
committed
Fixes
1 parent aede51e commit e536cca

File tree

3 files changed

+7
-25
lines changed

3 files changed

+7
-25
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## What is CEDARScript?
88

9-
[CEDARScript](/CEDARScript/cedarscript-grammar#readme) (Concise Examination, Development, And Refactoring Script) is a domain-specific language that
9+
[CEDARScript](https://github.com/CEDARScript/cedarscript-grammar#readme) (Concise Examination, Development, And Refactoring Script) is a domain-specific language that
1010
aims to improve how AI coding assistants interact with codebases and communicate their code modification intentions.
1111
It provides a standardized way to express complex code modification and analysis operations, making it easier for
1212
AI-assisted development tools to understand and execute these tasks.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "cedarscript_ast_parser"
7-
version = "0.1.0"
7+
version = "0.1.2"
88
description = "A library for parsing and interpreting CEDARScript, a SQL-like language for code analysis and transformations"
99
readme = "README.md"
1010
authors = [{ name = "Elifarley", email = "[email protected]" }]
@@ -22,7 +22,7 @@ classifiers = [
2222
]
2323
keywords = ["parser", "ast", "cedarscript", "code-editing", "refactoring", "code-analysis", "sql-like", "ai-assisted-development"]
2424
dependencies = [
25-
"tree-sitter>=0.20.1",
25+
"cedarscript_grammar>=0.0.3",
2626
]
2727
requires-python = ">=3.12"
2828

src/cedarscript_ast_parser.py

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
import logging
2-
import os
3-
import sys
41
from enum import StrEnum, auto
52
from typing import TypeAlias, NamedTuple, Union
63

7-
from tree_sitter import Language, Parser
8-
4+
from tree_sitter import Parser
5+
import cedarscript_grammar
96
from dataclasses import dataclass
107

118
__all__ = ['CEDARScriptASTParser', 'ParseError', 'Command']
@@ -240,25 +237,10 @@ def _generate_suggestion(error_node, code_text) -> str:
240237

241238
class _CEDARScriptASTParserBase:
242239
def __init__(self):
243-
"""Set up the logger, load the Cedar language, and initialize the parser.
240+
"""Load the CEDARScript language, and initialize the parser.
244241
"""
245-
246-
self.logger = logging.getLogger(__name__)
247-
self.logger.setLevel("DEBUG")
248-
249-
# Determine the appropriate library file based on the current architecture
250-
if sys.platform.startswith('darwin'):
251-
lib_name = 'libtree-sitter-cedar.dylib'
252-
elif sys.platform.startswith('linux'):
253-
lib_name = 'libtree-sitter-cedar.so'
254-
else:
255-
raise OSError(f"Unsupported platform: {sys.platform}")
256-
257-
cedar_language_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'vendor', lib_name))
258242
self.parser = Parser()
259-
self.logger.warning(f"[{self.__class__}] Loading native CEDARScript parsing library from {cedar_language_path}")
260-
self.language = Language(cedar_language_path, 'CEDARScript')
261-
self.parser.set_language(self.language)
243+
self.parser.set_language(cedarscript_grammar.language())
262244

263245

264246
class CEDARScriptASTParser(_CEDARScriptASTParserBase):

0 commit comments

Comments
 (0)