mavlink/mavlink — pull request #127 by johnboiles (2013-07-17 08:25:52+00:00)
Title: Fix template bug that occurs when variable is used at the end of a repetition

Currently, when a template contains a repetition that ends with a variable, template generation fails with `mavparse.MAVParseError: missing end of variable`. This occurs because the default end_var_token `}` is the same character as the default end_rep_token `}}`.

For example, when generating a list of parameters to pass a function

my_function(self, ${{parameters:, ${value}}});

The end_var_token is then mistaken for the first `}` of end_rep_token causing mavtemplate to later try to parse `, ${value`

This commit fixes the issue by incrementing the index of the matching end_rep_token (`idx2`) by `len(end_var_token)` if the match is the same as the concatenation of end_var_token and end_rep_token.