//---------------------------------------------------------------------
 private bool ReadVariable(InputVariable var,
     bool          optional)
 {
     if (var == null)
         throw new System.ArgumentNullException();
     if (VariableNameMatches(var.Name, optional)) {
         //  Read the variable's value
         StringReader strReader = new StringReader(textAfterName);
         try {
             var.ReadValue(strReader);
         }
         catch (InputVariableException exc) {
             throw new LineReaderException(reader, exc);
         }
         TextReader.SkipWhitespace(strReader);
         string textAfterValue = strReader.ReadToEnd();
         if (textAfterValue.Length == 0)
             return true;
         string message = string.Format("Extra text after the value for \"{0}\"",
                                        var.Name);
         throw ExtraTextException(message, textAfterValue);
     }
     return false;
 }