 }
 
 public extension Token {
+    /**
+     Creates a rule which will generate this token if matched
+     
+     - Parameter rule:The rule which must be matched in order to generate the tokekn
+     - Returns: An instance of the rule
+     */
     func `if`(_ rule:BehaviouralRule)->BehaviouralRule{
         if rule.behaviour.cardinality == .one {
             return rule.instanceWith(behaviour: Behaviour(.structural(token: self), cardinality: rule.behaviour.cardinality, negated: rule.behaviour.negate, lookahead: rule.behaviour.lookahead), annotations: rule.annotations)


// Extends collections of terminals to support creation of Choice scanners
extension Array where Element == BehaviouralRule {
    public func token(_ token: Token, from cardinality: Cardinality = .one) -> BehaviouralRule {
        return sequence.newBehaviour(.structural(token:token), cardinality: cardinality)
    }
    
    public func scan(_ cardinality: Cardinality) -> BehaviouralRule {
        return sequence.newBehaviour(.scanning, cardinality: cardinality)
    }
    
    public func skip(_ cardinality: Cardinality) -> BehaviouralRule {
        return sequence.newBehaviour(.skipping, cardinality: cardinality)
    }
    
    public var oneOf : BehaviouralRule{
        return ChoiceRule(Behaviour(.scanning), and: [:], for: self)
    }
    
    public var sequence : BehaviouralRule{
        return SequenceRule(Behaviour(.scanning), and: [:], for: self)
    }

        return Precidence.annotation(annotations).modify(self)
    }
    
    /**
     An instance of the rule with a cardinality of one
     */
    public var one : BehaviouralRule{
        return newBehaviour(cardinality: 1...1)
    }

    /**
     An instance of the rule with a cardinality of one or more
     */
    public var oneOrMore : BehaviouralRule{
        return newBehaviour(cardinality: 1...)
    }

    /**
     An instance of the rule with a cardinality of zero or more
     */
    public var zeroOrMore : BehaviouralRule{
        return newBehaviour(cardinality: 0...)
    }

    /**
     An instance of the rule with a cardinality of zero or one
     */
    public var optional : BehaviouralRule {
        return newBehaviour(cardinality: 0...1)
    }
}

/**
 Creates a new instance of the rule set to have lookahead behaviour
 
    // Creates a lookahead version of of the rule
    let lookahead = >>CharacterSet.letters.skip()
 
 - Parameter rule:The rule to apply to
 - Returns: A new version of the rule
 */
public prefix func >>(rule:BehaviouralRule)->BehaviouralRule{
    if rule.behaviour.cardinality == .one {
        return rule.newBehaviour(nil, negated: nil, lookahead: true)
