family markup

# The only transition we need: when we see a "@", move to TPL, process the
# keyword, and transition to PHP

state IN_M_DEFAULT:
'@' paint(upto, M_DEFAULT) => IN_TPL_DEFAULT

family tpl
sublanguage LaravelBlade

# If the language has keywords, specify which style needs to be transformed
keyword_style TPL_IDENTIFIER => TPL_WORD
keywords [
        # Keywords
        "@break",
        "@can",
        "@continue",
        "@each",
        "@else",
        "@elseif",
        "@empty",
        "@endcan",
        "@endfor",
        "@endforeach",
        "@endforelse",
        "@endif",
        "@endpush",
        "@endsection",
        "@endunless",
        "@endwhile",
        "@extends",
        "@for",
        "@foreach",
        "@forelse",
        "@hasSection",
        "@if",
        "@include",
        "@inject",
        "@layout",
        "@parent",
        "@push",
        "@render",
        "@section",
        "@stack",
        "@unless",
        "@while",
        "@yield",
        "@yield_section"
        ]

state IN_TPL_DEFAULT:
/\w+/: paint(include, TPL_IDENTIFIER), at_eol(IN_M_DEFAULT) => IN_SSL_DEFAULT
# We shouldn't see non-alpha after '@', so go back to default.
/./: redo, => IN_M_DEFAULT

# Let the Python language-service handle indentation.

state IN_TPL_COMMENT:
'--}}': paint(include, TPL_COMMENT), spop_check, => IN_M_DEFAULT

