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

Add function call argument parsing. #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

benji-york
Copy link

I was doing some work that needs the ability to inspect individual arguments, so I added that to the grammar.

This is my first foray into tree-sitter, so I'll happily take any feedback on the approach. In particular, I appear to have broken something around the error, warning, and info call parsing.

Comment on lines -272 to -303
================================================================================
Rule, recipe, single line, custom .RECIPEPREFIX I (TODO)
================================================================================
.RECIPEPREFIX = >

target:
>echo "foobar"

--------------------------------------------------------------------------------


================================================================================
Rule, recipe, single line, custom .RECIPEPREFIX II (TODO)
================================================================================
.RECIPEPREFIX = a

target:
aecho "foobar"

--------------------------------------------------------------------------------


================================================================================
Rule, recipe, single line, custom .RECIPEPREFIX III (TODO)
================================================================================
.RECIPEPREFIX = >

target: ;
>echo "foobar"

--------------------------------------------------------------------------------

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed these since they are known-failing. This isn't integral to my changes.

@milahu
Copy link

milahu commented Feb 27, 2023

i did some work in my fork

i added an external scanner for RECIPEPREFIX, so now this works

# indent with angles
.RECIPEPREFIX := >
all:
> @echo hello
# indent with spaces
.RECIPEPREFIX := $() $()
all:
  @echo hello

parsing arguments requires more work ...

ideally we parse the correct number of arguments for each function
for example, subst has 3 arguments

ideally we delegate parsing:
delegate $(shell ...) and $$(...) to https://github.com/tree-sitter/tree-sitter-bash
delegate $(guile ...) to https://github.com/6cdh/tree-sitter-scheme

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

Successfully merging this pull request may close these issues.

2 participants