
# xtc - The eXTensible Compiler
# Copyright (C) 2006 New York University
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.

#Ensure that all If, While, and For Statements have braces

#add ifStatement blocks
for $i in //IfStatement differ //IfStatement[ Block ] return
   replace $i with IfStatement< $i/*[1], Block< $i/*[2] > >,

#add missing While statement braces
for $w in //WhileStatement differ //WhileStatement[ Block ] return
   replace $w with WhileStatement< $w/*[1], Block< $w/*[2] > >,

#add missing forStatement braces
for $f in //ForStatement differ //ForStatement[ Block ] return
   replace $f with ForStatement< subsequence( $f/*, 1, 3 ), Block< $f/*[4] > >

