home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Source / MiscMergeKit / _MiscMergeSetCommand.m < prev    next >
Encoding:
Text File  |  1995-07-11  |  1.4 KB  |  51 lines

  1. //
  2. //    _MiscMergeSetCommand.m -- "set" merge command implementation
  3. //        Written by Don Yacktman Copyright (c) 1995 by Don Yacktman.
  4. //                Version 1.0.  All rights reserved.
  5. //        This notice may not be removed from this source code.
  6. //
  7. //    This object is included in the MiscKit by permission from the author
  8. //    and its use is governed by the MiscKit license, found in the file
  9. //    "LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
  10. //    for a list of all applicable permissions and restrictions.
  11. //    
  12.  
  13.  
  14. #import <misckit/miscmerge.h>
  15. #import "_MiscMergeSetCommand.h"
  16.  
  17. @implementation _MiscMergeSetCommand
  18.  
  19. static MiscString *myKey = nil;
  20.  
  21. - parseFromString:(MiscString *)aString
  22. {
  23.     MISC_Merge_Cond_Op operator;
  24.     if (!myKey) {
  25.         myKey = [MiscString new];
  26.         [myKey setStringValue:"set"];
  27.     }
  28.     [self eatKeyWord:myKey from:aString isOptional:NO];
  29.     value1 = [self getArgumentStringFrom:aString toEnd:NO];
  30.     operator = [self getConditionalFrom:aString];
  31.     if (operator != MISC_MCO_EQUAL) {
  32.         id tempString = [MiscString
  33.                 newWithString:"Set requires operator to be an =."];
  34.         [self error_conditional:tempString];
  35.         [tempString free];
  36.         value2 = [MiscString new];
  37.     }
  38.     value2 = [self getArgumentStringFrom:aString toEnd:YES];
  39.     [value1 trimWhiteSpaces];
  40.     return self;
  41. }
  42.  
  43.  
  44. - executeForMerge:(MiscMergeEngine *)aMerger
  45. {
  46.     [[aMerger class] setGlobalSymbol:value1 toValue:value2];
  47.     return self;
  48. }
  49.  
  50. @end
  51.