Parsing Directive Parameters

Learn how to look to the next non-whitespace character and jump to its location.

We'll cover the following

Parsing Blade directive parameters will be very similar to how we parse the directives themselves. The main difference is that we need a simple way to look to the next non-whitespace character and jump to its location. We can also implement this using a cursor; it will simply break when it encounters a non-whitespace character. Once we have located the first instance of a non-whitespace character, we can check if it is the ( character. If it is, we can make use of our existing PairedBracketCursor cursor to scan to the end of the directive’s argument group:

Get hands-on with 1400+ tech skills courses.