Skip to main content

Module templates

Module templates 

Source
Expand description

Template-injection scan matchers ported from guard_core/handlers/_suspatterns_templates.py (spec 4.0.2).

Region scan between opening/closing delimiters ({{ }}, ${ }, {% %}, <% %>, #{ }), not naive regex: an indicator must appear strictly inside the region, and {{/#{ forms skip regions dominated by a date.

The indicator sources embed a (?<!\d) guard in front of the literal arithmetic branch; the guard is enforced with a char check on the candidate start (a candidate beginning mid-number is rejected, mirroring the lookbehind exactly because every inner start of a digit run is also digit-preceded).

Structs§

TemplateKind
TemplateRegion

Constants§

KIND_ASP
KIND_CURLY_CALL
KIND_CURLY_KEYWORD
KIND_DOLLAR
KIND_HASH
KIND_PERCENT_KEYWORD

Functions§

template_expression_matches
_template_expression_matches: indicator inside the region, with the date-dominance restart for {{/#{ forms.
template_keyword_matches
_template_keyword_matches: an indicator keyword must appear strictly inside the region (excluding the first char after the opening delimiter).
template_regions
_template_regions: opening/closing delimiter pairs with the reference’s cursor advance (cursor = max(body_start, barrier - len(opening) + 1)).