-
Notifications
You must be signed in to change notification settings - Fork 4
/
_MiscMergeDelayedParseCommand.m
executable file
·71 lines (59 loc) · 2.02 KB
/
_MiscMergeDelayedParseCommand.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//
// _MiscMergeDelayedParseCommand.m
//
// Written by Don Yacktman and Carl Lindberg
//
// Copyright 2001-2004 by Don Yacktman and Carl Lindberg.
// All rights reserved.
//
// This notice may not be removed from this source code.
//
// This header is included in the MiscKit by permission from the author
// and its use is governed by the MiscKit license, found in the file
// "License.rtf" in the MiscKit distribution. Please refer to that file
// for a list of all applicable permissions and restrictions.
//
#import "_MiscMergeDelayedParseCommand.h"
#import <Foundation/NSString.h>
#import "MiscMergeEngine.h"
#import "MiscMergeTemplate.h"
#import "MiscMergeCommand.h"
@implementation _MiscMergeDelayedParseCommand
- (void)dealloc
{
[unparsedCommand release];
[super dealloc];
}
- (BOOL)parseFromString:(NSString *)aString template:(MiscMergeTemplate *)template
{
unparsedCommand = [aString copy];
return YES;
}
- (MiscMergeCommandExitType)executeForMerge:(MiscMergeEngine *)aMerger
{
MiscMergeTemplate *myTemplate = [aMerger template];
Class templateClass = [myTemplate class];
Class mergerClass = [aMerger class];
Class commandClass;
MiscMergeTemplate *newTemplate = [[templateClass alloc] init];
MiscMergeEngine *newEngine = [[mergerClass alloc] init];
MiscMergeCommand *newCommand;
NSString *result;
[newTemplate setStartDelimiter:[myTemplate startDelimiter]
endDelimiter:[myTemplate endDelimiter]];
[newTemplate parseString:unparsedCommand];
[newEngine setTemplate:newTemplate];
[newEngine setParentMerge:aMerger];
[newEngine setMainObject:[aMerger mainObject]];
result = [newEngine execute:self];
/* Hrm. */
commandClass = [myTemplate classForCommand:result];
newCommand = [[commandClass alloc] init];
[newCommand parseFromString:result template:myTemplate];
[aMerger executeCommand:newCommand];
[newCommand release];
[newTemplate release];
[newEngine release];
return MiscMergeCommandExitNormal;
}
@end