Exemple #1
0
 def __str__(self):
     cpp = f"[{self.capture}]({self.parameters})"
     if self.return_type is not None:
         cpp += f" -> {self.return_type}"
     cpp += " {\n"
     if self.source is not None:
         cpp += f"{self.source.as_line_directive}\n"
     cpp += f"{self.content}\n}}"
     return indent_all_but_first_and_last(cpp)
Exemple #2
0
 def __str__(self):
     cpp = f'[{self.capture}]({self.parameters})'
     if self.return_type is not None:
         cpp += f' -> {self.return_type}'
     cpp += ' {\n'
     if self.source is not None:
         cpp += f'{self.source.as_line_directive}\n'
     cpp += f'{self.content}\n}}'
     return indent_all_but_first_and_last(cpp)
Exemple #3
0
 def __str__(self):
     text = ", ".join(str(x) for x in self.args)
     return indent_all_but_first_and_last(text)
 def __str__(self):
     cpp = u'[{}]({})'.format(self.capture, self.parameters)
     if self.return_type is not None:
         cpp += u' -> {}'.format(self.return_type)
     cpp += u' {{\n{}\n}}'.format(self.content)
     return indent_all_but_first_and_last(cpp)
Exemple #5
0
def test_indent_all_but_first_and_last(text, expected):
    actual = helpers.indent_all_but_first_and_last(text)

    assert actual == expected
 def __str__(self):
     cpp = f'[{self.capture}]({self.parameters})'
     if self.return_type is not None:
         cpp += f' -> {self.return_type}'
     cpp += f' {{\n{self.content}\n}}'
     return indent_all_but_first_and_last(cpp)