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

support no space between spoken form and parens? #21

Closed
pokey opened this issue Apr 30, 2023 · 8 comments
Closed

support no space between spoken form and parens? #21

pokey opened this issue Apr 30, 2023 · 8 comments

Comments

@pokey
Copy link
Contributor

pokey commented Apr 30, 2023

Talon supports hello(world): bar to map a spoken form equivalent to hello world: bar. Do we want to support this?

@wenkokke
Copy link
Owner

No, because that would clash with the special syntax key(...): and such, and would make parsing a mess.

@pokey
Copy link
Contributor Author

pokey commented Apr 30, 2023

I don't think it actually clashes with that syntax, and it appears you have special cases for all the functions anyway, so I'm not sure I see a problem

Fwiw, note that on the converse, key (a): foo is treated by Talon as equivalent to key a: foo (ie it matches someone saying the literal phrase "key a"). Not arguing we want to support that either, but we are introducing inconsistencies with the Talon parser

@wenkokke
Copy link
Owner

wenkokke commented Apr 30, 2023

Inconsistencies are unfortunately difficult to avoid because the Talon syntax is ambiguous.

@wenkokke
Copy link
Owner

wenkokke commented Apr 30, 2023

In my experience, using higher precedence for key(..) as a key binding over a command makes the error correcting behavior of the tree sitter parser act up.

Therefore this is probably best solved with lookahead in the lexer.

@pokey
Copy link
Contributor Author

pokey commented May 2, 2023

Ok so just to make sure we're on the same page, how do you want to parse the following:

hello(world): bar
key (a): bar

And does today's parsing of this program match your desired parsing? If the answer to that last question is "yes", then we can close this issue, but just wanted to make it all explicit

To be clear, Talon parses it as equivalent to the following:

hello world: bar
key a: bar

If we do parse them the same way Talon does, I'd argue the autoformatter should transform them to the second form above, but that's obv out of scope for this repo

@wenkokke
Copy link
Owner

wenkokke commented May 2, 2023

I agree with these parsings. The cases I'm unsure about are:

key(not-a-valid-key-name): bar

Do you know what Talon parses these as?

@AndreasArvidsson
Copy link
Contributor

Pretty sure the parser doesn't care about valid key names. The content inside the parentheses is just a string. That would probably generate a unknown key error when Talon tries to utilize the key value.

@wenkokke
Copy link
Owner

wenkokke commented Aug 6, 2023

Closing in favour of meta issue #33

@wenkokke wenkokke closed this as completed Aug 6, 2023
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

3 participants