         return p1
       if p2 instanceof Empty and p1 instanceof Empty
         return p1
+      if p1 instanceof NotAllowed and @pattern1 instanceof Empty
+        return new Choice(@pattern1, p2)
+      if p2 instanceof NotAllowed and @pattern2 instanceof Empty
+        return new Choice(p1, @pattern2)
       return new Choice(p1, p2)
     attrCheck: (node) =>
       if @pattern1 instanceof NotAllowed or @pattern2 instanceof Empty

  class Pattern
    check: (node, descend) =>
      unless node?
        console.log "missing node", node, this
        throw new Error("ack node missing")
      console.log "checking", this, "against", node
      res = @_check(node, descend)
      console.log "result for", this, "against", node, "is", res
      return res

    _check: (node, descend) =>

    constructor: (@message, @pattern, @childNode, @priority) ->
    toString: =>
      if @message
        "missingContent /* # #{@message} */"
      else
        "missingContent"

