(self, match)
Handle an expression. At this point we're at a string like:
            {{ 1 + 2 }}
            ^ right here

        And the match contains "{{ "

        We expect to find a `}}`, but we might find one in a string before
        that. Imagine the case of `{{ 2 * "}}" }}`...

        You're not allowed to have blocks or comments inside an expr so it is
        pretty straightforward, I hope: only strings can get in the way.
Handle an expression. At this point we're at a string like:
            {{ 1 + 2 }}
            ^ right here
Handle an expression . At this point we re at a string like : {{ 1 + 2 }} ^ right here
def handle_expr(self, match):
        """Handle an expression. At this point we're at a string like:
            {{ 1 + 2 }}
            ^ right here

        And the match contains "{{ "

        We expect to find a `}}`, but we might find one in a string before
        that. Imagine the case of `{{ 2 * "}}" }}`...

        You're not allowed to have blocks or comments inside an expr so it is
        pretty straightforward, I hope: only strings can get in the way.
        """
        self.advance(match.end())
        while True:
            match = self._expect_match('}}',
                                       EXPR_END_PATTERN,
                                       QUOTE_START_PATTERN)
            if match.groupdict().get('expr_end') is not None:
                break
            else:
                # it's a quote. we haven't advanced for this match yet, so
                # just slurp up the whole string, no need to rewind.
                match = self._expect_match('string', STRING_PATTERN)
                self.advance(match.end())

        self.advance(match.end())
def handle_expr ( self , match ) : self . advance ( match . end ( ) ) while True : match = self . _expect_match ( '}}' , EXPR_END_PATTERN , QUOTE_START_PATTERN ) if match . groupdict ( ) . get ( 'expr_end' ) is not None : break else : # it's a quote. we haven't advanced for this match yet, so # just slurp up the whole string, no need to rewind. match = self . _expect_match ( 'string' , STRING_PATTERN ) self . advance ( match . end ( ) ) self . advance ( match . end ( ) )