Blame vvfst/filter_lexc.py

Packit 1f3717
# -*- coding: utf-8 -*-
Packit 1f3717
Packit 1f3717
# Copyright 2015 Harri Pitkänen (hatapitk@iki.fi)
Packit 1f3717
# Program for removing comments and optionally disabled entries from
Packit 1f3717
# LEXC files.
Packit 1f3717
Packit 1f3717
# This program is free software; you can redistribute it and/or modify
Packit 1f3717
# it under the terms of the GNU General Public License as published by
Packit 1f3717
# the Free Software Foundation; either version 2 of the License, or
Packit 1f3717
# (at your option) any later version.
Packit 1f3717
#
Packit 1f3717
# This program is distributed in the hope that it will be useful,
Packit 1f3717
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 1f3717
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 1f3717
# GNU General Public License for more details.
Packit 1f3717
#
Packit 1f3717
# You should have received a copy of the GNU General Public License
Packit 1f3717
# along with this program; if not, write to the Free Software
Packit 1f3717
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
Packit 1f3717
Packit 1f3717
import sys
Packit 1f3717
sys.path.append("common")
Packit 1f3717
import fileinput
Packit 1f3717
import generate_lex_common
Packit 1f3717
Packit 1f3717
files = [f for f in sys.argv[1:] if not f.startswith("--")]
Packit 1f3717
Packit 1f3717
OPTIONS = generate_lex_common.get_options()
Packit 1f3717
Packit 1f3717
for line_orig in fileinput.input(files):
Packit 1f3717
	line = generate_lex_common.filterVfstInput(unicode(line_orig, 'UTF-8'), OPTIONS)
Packit 1f3717
	if line is None:
Packit 1f3717
		continue
Packit 1f3717
	print line.encode('UTF-8')