#!/usr/bin/python
# PYTHON_ARGCOMPLETE_OK
#
#   This is the Robotics Language compiler
#
#   Created on: June 22, 2017
#       Author: Gabriel A. D. Lopes
#      Licence: Apache 2.0
#    Copyright: 2014-2017 Robot Care Systems BV, The Hague, The Netherlands. All rights reserved.
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

from RoboticsLanguage.Base import Initialise, CommandLine, Inputs, Transformations, Outputs
import sys

if __name__ == "__main__":

  # initialise compiler, and check if it should remove the cache
  parameters = Initialise.Initialise('--remove-cache' in sys.argv)

  # process command line arguments
  file_name , file_type, outputs, parameters = CommandLine.ProcessArguments(sys.argv, parameters)

  # parse input file
  xml_code, parameters = Inputs.Parse(file_name, file_type, parameters)

  # Apply transformers
  xml_code, parameters = Transformations.Apply(xml_code, parameters)

  # Generate outputs
  Outputs.Generate(outputs, xml_code, parameters)
