boucher / tdparsekit

A non-deterministic recursive descent parser written in Objective-J (ported from Obj-C, created by Tod Ditchendorf)

This URL has Read+Write access

tdparsekit / TDAlternation.j
100644 24 lines (17 sloc) 0.425 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
@import "TDCollectionParser.j"
@import "TDAssembly.j"
 
@implementation TDAlternation : TDCollectionParser
{
}
 
+ (id)alternation
{
    return [[self alloc] init];
}
 
- (CPSet)allMatchesFor:(CPSet)inAssemblies
{
    var outAssemblies = [CPSet set];
 
    for (var i=0, count=[subparsers count]; i<count; i++)
        [outAssemblies unionSet:[subparsers[i] matchAndAssemble:inAssemblies]];
 
    return outAssemblies;
}
 
@end