/**
 * @license
 * Copyright 2017 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

package foam.lib.json;

import foam.lib.parse.*;

public class ArrayParser
  extends ProxyParser
{
  public ArrayParser() {
    super(new Seq1(3,
      Whitespace.instance(),
      Literal.create("["),
      Whitespace.instance(),
      new Repeat(
        new ProxyParser() { public Parser getDelegate() { return AnyParser.instance(); }},
        new Seq0(Whitespace.instance(), Literal.create(","), Whitespace.instance())),
      Whitespace.instance(),
      Literal.create("]")));
  }
}

/**
 * @license
 * Copyright 2017 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

package foam.lib.json;

import foam.lib.parse.*;

public class ArrayParser
  extends ProxyParser
{
  public ArrayParser() {
    super(new Seq1(3,
      Whitespace.instance(),
      Literal.create("["),
      Whitespace.instance(),
      new Repeat(
        AnyParser.instance(),
        new Seq0(Whitespace.instance(), Literal.create(","), Whitespace.instance())),
      Whitespace.instance(),
      Literal.create("]")));
  }
}

--- 
+++ 
@@ -17,7 +17,7 @@
       Literal.create("["),
       Whitespace.instance(),
       new Repeat(
-        AnyParser.instance(),
+        new ProxyParser() { public Parser getDelegate() { return AnyParser.instance(); }},
         new Seq0(Whitespace.instance(), Literal.create(","), Whitespace.instance())),
       Whitespace.instance(),
       Literal.create("]")));
Fix for infinite recursion if Array and Any Parsers.
