     constructor: (pattern1, pattern2) ->
       @pattern1 = getPattern pattern1
       @pattern2 = getPattern pattern2
-    startTagOpenDeriv: (node) =>
+    startTagOpenDeriv: (node) ->
       f1 = new Flip(builder.interleave, @pattern2)
       p1 = applyAfter(f1, @pattern1.startTagOpenDeriv(node))
       f2 = new notFlip(builder.interleave, @pattern1)
       p2 = applyAfter(f2, @pattern2.startTagOpenDeriv(node))
       builder.choice(p1, p2)
-    startTagCloseDeriv: (node) =>
+    startTagCloseDeriv: (node) ->
       builder.interleave(@pattern1.startTagCloseDeriv(node), @pattern2.startTagCloseDeriv(node))
-    attDeriv: (attribute) =>
+    attDeriv: (attribute) ->
       p1 = builder.interleave(@pattern1.attDeriv(attribute), @pattern2)
       p2 = builder.interleave(@pattern1, @pattern2.attDeriv(attribute))
       builder.choice(p1, p2)
-    toString: =>
+    toString: ->
       "(#{@pattern1} & #{@pattern2})"
-    _nullable: =>
+    _nullable: ->
       @pattern1.nullable() and @pattern2.nullable()
 
 

        patt = nextPatt
      return patt

    textDeriv: (node) =>
      return new NotAllowed("#{this}", this, node)
    toString: =>
      "<UNDEFINED PATTERN>"

    valueMatch: (value) =>
      if @nullable() and h.isNodeWhitespace(value)
        return new Empty()
      deriv = @textDeriv(value)

  class Ref extends Pattern
    constructor: (@refname, @defines) ->
      @dereference()
    startTagOpenDeriv: (node) ->
      @dereference()
      if @pattern?
        return @pattern.startTagOpenDeriv(node)
      return new NotAllowed("cannot find reference '#{@refname}'", this, node)
    endTagDeriv: (node) ->
      @dereference()
      if @pattern?
        return @pattern.endTagDeriv(node)
      return new NotAllowed("cannot find reference '#{@refname}'", this, node)
    attDeriv: (attribute) ->
      @dereference()
      if @pattern?
        return @pattern.attDeriv(attribute)
      return new NotAllowed("cannot find reference '#{@refname}'", this, node)

    toString: ->
      @refname
    dereference: ->
      return @pattern if @pattern?
      if @defines and @defines[@refname]?
        @pattern = @defines[@refname]
