anchor.diff:    end.
   
   parse_optional(State0) ->
  -  ct:pal("parse optional ~p", [State0]),
  +  debug("parse optional ~p", [State0]),
     {Expr, State} = parse_expr(State0),
  -  ct:pal("parse optional after parse_expr ~p\n~p", [Expr, State]),
  +  debug("parse optional after parse_expr ~p\n~p", [Expr, State]),
     case current(State) of
       "]" -> {[#optional{children=Expr}], move(State)};
       _   -> throw("Unmatched '['")
     end.
   
   parse_required(State0) ->
  -  ct:pal("parse required ~p", [tokens(State0)]),
  +  debug("parse required ~p", [tokens(State0)]),
     {Expr, State} = parse_expr(State0),
  -  ct:pal("parse required after parse_expr ~p, ~p", [tokens(State), Expr]),
  +  debug("parse required after parse_expr ~p, ~p", [tokens(State), Expr]),
     case current(State) of
       ")" -> {[#required{children=Expr}], move(State)};
       Res -> throw({"Unmatched '(':", Res})
  
positive.code:   end.
  
  parse_expr(State0, Acc)                 ->
    ct:pal("in parse_expr: ~p, ~p", [tokens(State0), Acc]),
    {Seq, State} = parse_seq(State0),
    ct:pal("in parse_expr after parse_seq: ~p, ~p", [tokens(State), Seq]),
    case current(State) of
      "|" -> parse_expr(move(State), [maybe_required_seq(Seq)|Acc]);
      _   ->
  
negative.code:     0 -> {Str, ""};
      I -> {string:substr(Str, 1, I - 1), string:substr(Str, I + length(Delim))}
    end.
  
  -ifdef(DEBUG).
  debug(Fmt, Args) -> ct:pal(Fmt, Args).
  -else.
  debug(_Fmt, _Args) -> ok.
  -endif.
  
  %%%_* Tests ===================================================================
  
  