MCPcopy Create free account
hub / github.com/SIPp/sipp / FindEndOfExpressionInLine

Function FindEndOfExpressionInLine

cpplint.py:1031–1051  ·  view source on GitHub ↗

Find the position just after the matching endchar. Args: line: a CleansedLines line. startpos: start searching at this position. depth: nesting level at startpos. startchar: expression opening character. endchar: expression closing character. Returns: Index just after e

(line, startpos, depth, startchar, endchar)

Source from the content-addressed store, hash-verified

1029
1030
1031def FindEndOfExpressionInLine(line, startpos, depth, startchar, endchar):
1032 """Find the position just after the matching endchar.
1033
1034 Args:
1035 line: a CleansedLines line.
1036 startpos: start searching at this position.
1037 depth: nesting level at startpos.
1038 startchar: expression opening character.
1039 endchar: expression closing character.
1040
1041 Returns:
1042 Index just after endchar.
1043 """
1044 for i in xrange(startpos, len(line)):
1045 if line[i] == startchar:
1046 depth += 1
1047 elif line[i] == endchar:
1048 depth -= 1
1049 if depth == 0:
1050 return i + 1
1051 return -1
1052
1053
1054def CloseExpression(clean_lines, linenum, pos):

Callers 1

CloseExpressionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected