Closed EmranMR closed 1 year ago
Forcing start and end directives to match will not work for everything:
Hi @CalebDW all the built-in ones, including directives such as @section
with unusual oddities are hardcoded. They also get higher lexical precedence for that same reason when the engine parses the blade.
Now as far as I am aware looking at the docs, the Custom If Statements follow the @start
and @endstart
convention? 🤔
Can the Laravel devs do stuff like the @hasSection
; writing their own unconventional @endtag
?? If so could you please drop in an example or a link to the docs/implementation?
All and all, I might close this issue in the future as unresolved. I am not sure if it is worth the hassle? I will see if any bugs or issues arises from people who use the custom directive in the coming months/year. 😊 So far it seem to have been ok as it is? 🤞, again I am not sure how many users are using this repo? so we shall see!
@EmranMR, yes you're right, the custom if
statements have their own @end*
tag. As long as the non-standard blade tags are supported then this issue can probably be closed.
I am not sure if this is possible using
external scanners
but it would be nice to be able to match thestart_directive
andend_directive
dynamically.This could even help with #8This would allow parser to give errors if the directives dont match such:
currently the regex will match the whatever that follows the
@end[a-z]
which is not very explicit but it works.You could possibly maybe improve this so that your editor signals you that there is a matching error using the predicates when highlighting if your editor supports them such as
#match?
. Basically only highlight when the capture fromdirective_start
matches thedirective_end
regex