Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 24 lines (16 sloc) 0.508 kb
#!/usr/bin/env python
import sys
import string
import re
s = string.join( sys.stdin.readlines(), '' )
# remove comments
s = re.sub( r'/\*[^*]*\*+([^/][^*]*\*+)*/', '', s )
# remove newlines and white space at the beginning and at the end of lines
s = re.sub( r'[\t ]*[\r\n]+[\t ]*', '', s )
# condense tabs and blanks
s = re.sub( r'[\t ]+', ' ', s )
# remove unnecessary blanks
s = re.sub( r'[ ]+\{', '{', s )
s = re.sub( r'([:\(\{,;])[ ]+', r'\1', s )
s = re.sub( r'[ ]+([\)\}])', r'\1', s )
print s
Jump to Line
Something went wrong with that request. Please try again.