public static Object parse(String element) throws PathSegment.PathSegmentSyntaxException
  {
    Queue<Token> tokens = tokenizeElement(element);
    Object result = parseElement(tokens);

    if (!tokens.isEmpty())
    {
      throw new PathSegment.PathSegmentSyntaxException("tokens left over after parsing; first excess token: " + tokens.peek().toErrorString() );
    }

    return result;
  }
@Test(dataProvider = "undecodables")
  public void testUndecodable(String undecoable, String expectedErrorMessage)
  {
    try
    {
      URIElementParser.parse(undecoable);
      Assert.fail();
    }
    catch (PathSegment.PathSegmentSyntaxException e)
    {
      Assert.assertEquals(e.getMessage(), expectedErrorMessage);
    }
  }