MCPcopy Index your code
hub / github.com/nodejs/node / postprocess

Function postprocess

deps/v8/tools/torque/format-torque.py:105–152  ·  view source on GitHub ↗
(output)

Source from the content-addressed store, hash-verified

103 return input
104
105def postprocess(output):
106 output = re.sub(
107 r'^(\s*)//@eXpOrT\b', r'\1@export', output, flags=re.MULTILINE)
108 output = re.sub(
109 r'^(\s*)//@([a-zA-Z]+)(\([^)]*\))?\n',
110 r"\1@\2\3\n",
111 output,
112 flags=re.MULTILINE)
113
114 output = re.sub(r'\/\*COxp\*\/', r'constexpr', output)
115 output = re.sub(r'(\S+)\s*: type([,>])', r'\1: type\2', output)
116 output = re.sub(r'(\n\s*)labels( [A-Z])', r'\1 labels\2', output)
117 output = re.sub(r'\bif\s*\/\*tPsW\*\/', r'typeswitch', output)
118 output = re.sub(r'\bif\s*\/\*cA\*\/\s*(\([^{]*\))\s*{', r'case \1: {', output)
119 output = re.sub(r'\bif\s*\/\*cAsEdEfF\*\/\s*(\([^{]*\))\s*{', r'case \1: deferred {', output)
120 output = re.sub(r'\n_GeNeRaT_\s*\/\*([^@]+)@\*\/', r"\n generates '\1'",
121 output)
122 output = re.sub(r'_GeNeRaT_\s*\/\*([^@]+)@\*\/', r"generates '\1'", output)
123 output = re.sub(r'\n_CoNsExP_\s*\/\*([^@]+)@\*\/', r"\n constexpr '\1'",
124 output)
125 output = re.sub(r'_CoNsExP_\s*\/\*([^@]+)@\*\/', r"constexpr '\1'", output)
126 output = re.sub(r'// !!torqueclass (.*)\n\s*class(?:\s*/\*-*\*/)?', r"\1",
127 output)
128 output = re.sub(r'// !!torquefunc (.*)\n\s*function(?:\s*/\*-*\*/)?', r"\1",
129 output)
130 output = re.sub(r'\n(\s+)otherwise', r"\n\1 otherwise", output)
131 output = re.sub(r'\n(\s+)_OtheSaLi', r"\n\1otherwise", output)
132 output = re.sub(r'_OtheSaLi', r"otherwise", output)
133 output = re.sub(r'if\s*/\*!if(not)?\*/\s*\(', r'@if\1(', output)
134 output = re.sub(
135 r'/\*\s*(js-)?ImPl\s*\*/\s*([^Ǝ]*?)Ǝ\s*\)',
136 r'\1implicit \2)()',
137 output,
138 flags=re.DOTALL)
139 output = re.sub(
140 r'/\*\s*(js-)?ImPl\s*\*/\s*([^Ǝ]*?)Ǝ\s*, *',
141 r'\1implicit \2)(',
142 output,
143 flags=re.DOTALL)
144 output = re.sub(r'}\n *label ', r'} label ', output);
145
146 output = re.sub(kPercentEscape, r'%', output)
147 output = re.sub(kDerefEscape, r'*', output)
148 output = re.sub(kAddressofEscape, r'&', output)
149
150 output = re.sub( r'^// InClUdE',r'#include', output, flags=re.MULTILINE)
151
152 return output
153
154def process(filename, lint, should_format):
155 with open(filename, 'r') as content_file:

Callers 3

attrgetterFunction · 0.85
processFunction · 0.85
attrgetterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected