h2olog: apply code formatter (autopep8)
# In this case, `payload1` and `payload2` are annotated as application data,
# which h2olog does not emit by default.
-from json import encoder
import re
import sys
import json
@@ -125,6 +124,7 @@ struct st_quicly_conn_t {
re_xms = re.X | re.M | re.S
comment = r'/\*.*?\*/'
+
class Lexer:
def __init__(self, src: str, filename: Optional[str] = None):
@@ -159,7 +159,6 @@ class Lexer:
% (pattern, self.src[self.pos], self.position_hint()))
return m
-
def peek(self, pattern):
return re.match(pattern, self.src[self.pos:], re_xms)
@@ -173,6 +172,7 @@ class Lexer:
lines = re.split(r'\n', self.src[:self.pos])
return "%d:%d" % (len(lines), len(lines[-1]))
+
def parse_dscript(path: Path):
lexer = Lexer(path.read_text(), path.name)
@@ -275,6 +275,7 @@ def parse_dscript(path: Path):
"appdata": appdata,
}
+
def parse_and_analyze(context: dict, path: Path, block_probes: set = None):
dscript = parse_dscript(path)
@@ -349,7 +350,6 @@ def parse_and_analyze(context: dict, path: Path, block_probes: set = None):
sys.exit(1)
-
def strip_typename(t):
return t.replace("*", "").replace("struct", "").replace("const", "").replace("strict", "").strip()
