Exemple #1
0
 public void AddParameter(CLParameter parameter)
 {
     _parameters.Add(parameter);
 }
Exemple #2
0
 private void StoreParameter(CLParameter parameter, String argument = null)
 {
     if (parameter.IsUnique)
     {
         if (_uniqueParameters.Keys.Contains(parameter.ShortName))
         {
             DuplicatedUniqueParameterError(parameter);
         }
         _uniqueParameters.Add(parameter.ShortName, argument);
     }
     else
     {
         List<String> argumentList = null;
         if (_multipleParameters.Keys.Contains(parameter.ShortName))
         {
             argumentList = _multipleParameters[parameter.ShortName];
             if (!argumentList.Contains(argument))
             {
                 argumentList.Add(argument);
             }
             else
             {
                 DuplicatedArgumentError(parameter, argument);
             }
         }
         else
         {
             argumentList = new List<String>();
             argumentList.Add(argument);
             _multipleParameters.Add(parameter.ShortName, argumentList);
         }
     }
 }
Exemple #3
0
 private void DuplicatedUniqueParameterError(CLParameter parameter)
 {
     var message = String.Format("Duplication of parameter '{0}' that must be unique", parameter.ShortName);
     throw new CLParseException(message);
 }
Exemple #4
0
 //todo: add calculation and output of error's position in line: "error bla-bla-nla (position 16)"
 private void MandatoryArgumentMissedError(CLParameter parameter)
 {
     var message = String.Format("Mandatory argument for parameter '{0}' missed", parameter.ShortName);
     throw new CLParseException(message);
 }
Exemple #5
0
 //todo: investigate the possibility to make a warning from this error
 private void DuplicatedArgumentError(CLParameter parameter, String argument)
 {
     var message = String.Format("Duplication of argument '{0}' ralated to parameter '{1}'", argument, parameter.ShortName);
     throw new CLParseException(message);
 }