a3353da846
An overview of motivation behind Torque and some of its principles can be found here: https://bit.ly/2qAI5Ep Note that there is quite a bit of work left to do in order to get Torque production-ready for any non-trivial amount of code, but landing the prototype as-is will allow for much faster iteration. Bugs will be filed for all of the big-ticket items that are not landing blockers but called out in this patch as important to fix. Cq-Include-Trybots: luci.v8.try:v8_linux_nosnap_rel;luci.v8.try:v8_linux_noi18n_rel_ng Change-Id: Ib07af70966d5133dc57344928885478b9c6b8b73 Reviewed-on: https://chromium-review.googlesource.com/845682 Commit-Queue: Daniel Clifford <danno@chromium.org> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org> Cr-Commit-Position: refs/heads/master@{#52618}
37 lines
995 B
Python
Executable File
37 lines
995 B
Python
Executable File
#!/usr/bin/env python
|
|
# Copyright 2014 the V8 project authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
"""This program either generates the parser files for Torque, generating
|
|
the source and header files directly in V8's src directory."""
|
|
|
|
import subprocess
|
|
import sys
|
|
import re
|
|
from subprocess import Popen, PIPE
|
|
|
|
if len(sys.argv) < 2 or len(sys.argv) > 3:
|
|
print "invalid number of arguments"
|
|
sys.exit(-1)
|
|
|
|
use_stdout = True
|
|
if len(sys.argv) == 3 and sys.argv[1] == '-i':
|
|
use_stdout = False
|
|
|
|
filename = sys.argv[len(sys.argv) - 1]
|
|
|
|
with open(filename, 'r') as content_file:
|
|
content = content_file.read()
|
|
p = Popen(['clang-format', '-assume-filename=.ts'], stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
|
output, err = p.communicate(content)
|
|
rc = p.returncode
|
|
if (rc <> 0):
|
|
sys.exit(rc);
|
|
if use_stdout:
|
|
print output
|
|
else:
|
|
output_file = open(filename, 'w')
|
|
output_file.write(output);
|
|
output_file.close()
|