Method: rich.highlighter.JSONHighlighter.highlight
Calls: 13, Exceptions: 0, Paths: 5Back
Path 1: 3 calls (0.23)
Text (3)
1def highlight(self, text: Text) -> None:
2 super().highlight(text)
3
4 # Additional work to handle highlighting JSON keys
5 plain = text.plain
6 append = text.spans.append
7 whitespace = self.JSON_WHITESPACE
8 for match in re.finditer(self.JSON_STR, plain):
9 start, end = match.span()
10 cursor = end
11 while cursor < len(plain):
12 char = plain[cursor]
13 cursor += 1
14 if char == ":":
15 append(Span(start, end, "json.key"))
16 elif char in whitespace:
17 continue
18 break
Path 2: 3 calls (0.23)
Text (3)
1def highlight(self, text: Text) -> None:
2 super().highlight(text)
3
4 # Additional work to handle highlighting JSON keys
5 plain = text.plain
6 append = text.spans.append
7 whitespace = self.JSON_WHITESPACE
8 for match in re.finditer(self.JSON_STR, plain):
9 start, end = match.span()
10 cursor = end
11 while cursor < len(plain):
12 char = plain[cursor]
13 cursor += 1
14 if char == ":":
15 append(Span(start, end, "json.key"))
16 elif char in whitespace:
17 continue
18 break
Path 3: 3 calls (0.23)
Text (3)
1def highlight(self, text: Text) -> None:
2 super().highlight(text)
3
4 # Additional work to handle highlighting JSON keys
5 plain = text.plain
6 append = text.spans.append
7 whitespace = self.JSON_WHITESPACE
8 for match in re.finditer(self.JSON_STR, plain):
9 start, end = match.span()
10 cursor = end
11 while cursor < len(plain):
12 char = plain[cursor]
13 cursor += 1
14 if char == ":":
15 append(Span(start, end, "json.key"))
16 elif char in whitespace:
17 continue
18 break
Path 4: 2 calls (0.15)
Text (2)
1def highlight(self, text: Text) -> None:
2 super().highlight(text)
3
4 # Additional work to handle highlighting JSON keys
5 plain = text.plain
6 append = text.spans.append
7 whitespace = self.JSON_WHITESPACE
8 for match in re.finditer(self.JSON_STR, plain):
9 start, end = match.span()
10 cursor = end
11 while cursor < len(plain):
12 char = plain[cursor]
13 cursor += 1
14 if char == ":":
15 append(Span(start, end, "json.key"))
16 elif char in whitespace:
17 continue
18 break
Path 5: 2 calls (0.15)
Text (2)
1def highlight(self, text: Text) -> None:
2 super().highlight(text)
3
4 # Additional work to handle highlighting JSON keys
5 plain = text.plain
6 append = text.spans.append
7 whitespace = self.JSON_WHITESPACE
8 for match in re.finditer(self.JSON_STR, plain):
9 start, end = match.span()
10 cursor = end
11 while cursor < len(plain):
12 char = plain[cursor]
13 cursor += 1
14 if char == ":":
15 append(Span(start, end, "json.key"))
16 elif char in whitespace:
17 continue
18 break