Exemple #1
0
 def test_parenthesisComplicated(self):
     tested = tokenize.Tokenize(
         'void func( int a[], std::function< void () > drek ) override')
     self.assertEquals(tested.splitByParenthesis()[0], 'void func(')
     self.assertEquals(tested.splitByParenthesis()[1],
                       'int a[], std::function< void () > drek')
     self.assertEquals(tested.splitByParenthesis()[2], ') override')
Exemple #2
0
 def rows( self ):
     params = tokenize.Tokenize( self._parameters ).splitByZeroParenLevel()
     withCommas = [ p + "," for p in params[ : -1 ] ] + [ params[ -1 ] ]
     return [ ( p, ) for p in withCommas ]
Exemple #3
0
 def __init__( self, input ):
     self._input = input
     self._lead, self._parameters, self._tail = tokenize.Tokenize( input ).splitByParenthesis()
Exemple #4
0
 def test_splitByCommasWithZeroLevelParenthesis_Complicated(self):
     tested = tokenize.Tokenize(
         'int a[,], std::function< , void ( , ) > drek')
     self.assertEquals(tested.splitByZeroParenLevel()[0], 'int a[,]')
     self.assertEquals(tested.splitByZeroParenLevel()[1],
                       'std::function< , void ( , ) > drek')
Exemple #5
0
 def test_parenthesis(self):
     tested = tokenize.Tokenize('void func();')
     self.assertEquals(tested.splitByParenthesis()[0], 'void func(')
     self.assertEquals(tested.splitByParenthesis()[1], '')
     self.assertEquals(tested.splitByParenthesis()[2], ');')
 def _argumentsExpressions(self):
     return tokenize.Tokenize(self._parameters).splitByZeroParenLevel()