Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom functions support #116

Closed
phodal opened this issue Oct 5, 2024 · 0 comments
Closed

Custom functions support #116

phodal opened this issue Oct 5, 2024 · 0 comments

Comments

@phodal
Copy link
Owner

phodal commented Oct 5, 2024

Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like

A new DSL about functions in project

---
functions:
  aFunc: "defaultOutput.py"(string)
  aFunc: "multipleOutput.py"(type) -> content, size
  bFunc: "path/access.py"(string, string) -> analysisResult
  cFunc: "accessFunctionIfSupport.py"::resize(string, number, number) -> image
---

Describe alternatives you've considered

No, user can only call system functions

Additional context
Build a new function support or expression

phodal added a commit that referenced this issue Oct 6, 2024
…d parser #116

This commit introduces support for custom functions in Shire language. It modifies the lexer and parser to recognize and process new syntax related to function declarations and calls. It also updates the documentation and adds a new test case for custom functions.
phodal added a commit that referenced this issue Oct 6, 2024
…ting #116

Update the function parameters in the Shire documentation and test data to use more generic types. Enhance the Shire syntax highlighter to support new keywords. Modify the HobbitHoleParser and ShireParser to accommodate these changes.
phodal added a commit that referenced this issue Oct 7, 2024
Add the ability to handle foreign functions within the Shirelang compiler. This includes:

- New data class `ForeignFunction` to encapsulate foreign function properties.
- Refactoring of the `ShireSyntaxHighlighter` to accommodate the new `FOREIGN_TYPE`.
- Addition of a `HobbitHoleParserTest` to validate parsing of foreign functions.
- Changes to the `HobbitHoleParser` to parse and process foreign functions.
- Introduction of `ForeignFunctionStmt` in the `ShireExpression` to represent foreign function statements.
- Incorporation of foreign functions into the `HobbitHole` model.
- Grammar adjustments in `ShireParser.bnf` to include foreign function syntax.
phodal added a commit that referenced this issue Oct 7, 2024
…onHandler #116

Remove hardcoded function names and enum from WiremockFunctionProvider, and instead, import the updated valid function names from the appropriate definitions. This change ensures consistency and maintainability in the ShireGotoDeclarationHandler. Additionally, a new WiremockFunction enum class is created to support this refactoring.
phodal added a commit that referenced this issue Oct 7, 2024
Update the PatternFuncProcessor to allow execution of user-defined foreign functions. This includes checking for custom functions in the hole's function map and executing them using the ForeignFunctionProcessor.
phodal added a commit that referenced this issue Oct 7, 2024
Update the Shirelang foreign function processor to use the 'findFile' method and refine the related test case. This change ensures a more accurate error message is provided when a run service for a JavaScript file is not found, replacing the outdated 'lookupFile' method and removing the redundant Python file handling from the test.
phodal added a commit that referenced this issue Oct 7, 2024
This commit enhances the file running services by simplifying code, improving readability, and adding support for ECMAScript 6. It modifies the auto-testing service for Python, adds working directory and node options for JavaScript files, and refactors the file run service to include a new `runInCli` function for running files from the command line.
phodal added a commit that referenced this issue Oct 7, 2024
Add support and examples for Node.js, Shell, Python, and Kotlin Script in Shire foreign function documentation. Additionally, update the `FileRunService.kt` to include support for new languages and throw an exception for unsupported languages.
@phodal phodal closed this as completed Oct 7, 2024
phodal added a commit that referenced this issue Oct 7, 2024
…eferences #116

Update the compiler to use the term 'foreignFunctions' instead of 'functions' to accurately represent external functions. This involves changing the variable names, method signatures, and test cases to reflect the new naming convention. Additionally, improve error handling by logging a warning for unsupported languages in the FileRunService.
phodal added a commit that referenced this issue Oct 8, 2024
… function support #116

Enhance the navigation feature by updating the `ShireGotoDeclarationHandler` to handle goto declarations for foreign functions. This includes utilizing new import statements and modifying the `getGotoDeclarationTarget` method logic to properly identify and return foreign function declarations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant