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

Parse method calls more leniently #26

Merged
merged 1 commit into from
Nov 7, 2022
Merged

Parse method calls more leniently #26

merged 1 commit into from
Nov 7, 2022

Conversation

lucaswerkmeister
Copy link
Member

Allow the expression in the single argument to be anything at all, as long as there’s a matching closing parenthesis at the end. Because we don’t support binary operators or multiple arguments, we don’t need to worry about counting balanced parentheses or anything like that: if the close-paren at the very end of the string doesn’t belong to the open-paren at the beginning of the method call, then there must be a syntax error (or unsupported syntax) somewhere.

Allow the expression in the single argument to be anything at all, as
long as there’s a matching closing parenthesis at the end. Because we
don’t support binary operators or multiple arguments, we don’t need to
worry about counting balanced parentheses or anything like that: if the
close-paren at the very end of the string doesn’t belong to the
open-paren at the beginning of the method call, then there must be a
syntax error (or unsupported syntax) somewhere.
@lucaswerkmeister
Copy link
Member Author

I’d noticed while writing the tests for #25 that strtoupper('abc') wasn’t actually supported because it didn’t match the regex, but thought that should be changed in a separate pull request.

@lucaswerkmeister
Copy link
Member Author

I’d noticed while writing the tests for #25 that strtoupper('abc') wasn’t actually supported because it didn’t match the regex, but thought that should be changed in a separate pull request.

Hang on, or maybe I just did it wrong and had actually tried strtoupper("abc"), which didn’t work because we don’t support double-quoted strings in general?

@lucaswerkmeister
Copy link
Member Author

Yeah, that’s it – the old regex did support single-quoted strings inside.

But still, this adds support for nested method calls at least.

Copy link
Collaborator

@micgro42 micgro42 left a comment

Choose a reason for hiding this comment

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

If we continue like that, then we might be writing our own full-fledged vue3-php template parser after all...

@lucaswerkmeister
Copy link
Member Author

I don’t plan to continue any further – I think we can tag the 2.0.0 after merging this and then probably not look at this repo again in quite a while (unless we want to move a way from Travis CI, maybe).

@lucaswerkmeister lucaswerkmeister merged commit 6db5bd0 into master Nov 7, 2022
@lucaswerkmeister lucaswerkmeister deleted the method branch November 7, 2022 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants