Skip to content

Commit

Permalink
fix: Support for latest syntax, per w3c/did-core#334
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Sabadello <[email protected]>
  • Loading branch information
peacekeeper committed Jul 17, 2020
1 parent 501b49f commit f9be99b
Show file tree
Hide file tree
Showing 35 changed files with 270 additions and 448 deletions.
10 changes: 5 additions & 5 deletions src/main/java/did/parser/Displayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* -----------------------------------------------------------------------------
*
* Producer : com.parse2.aparse.Parser 2.5
* Produced : Fri Apr 19 22:09:52 CEST 2019
* Produced : Mon Jul 13 23:12:39 CEST 2020
*
* -----------------------------------------------------------------------------
*/
Expand Down Expand Up @@ -45,22 +45,22 @@ public Object visit(Rule_did_url rule)
return visitRules(rule.rules);
}

public Object visit(Rule_param rule)
public Object visit(Rule_did_query rule)
{
return visitRules(rule.rules);
}

public Object visit(Rule_param_name rule)
public Object visit(Rule_param rule)
{
return visitRules(rule.rules);
}

public Object visit(Rule_param_value rule)
public Object visit(Rule_param_name rule)
{
return visitRules(rule.rules);
}

public Object visit(Rule_param_char rule)
public Object visit(Rule_param_value rule)
{
return visitRules(rule.rules);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/did/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* -----------------------------------------------------------------------------
*
* Producer : com.parse2.aparse.Parser 2.5
* Produced : Fri Apr 19 22:09:52 CEST 2019
* Produced : Mon Jul 13 23:12:39 CEST 2020
*
* -----------------------------------------------------------------------------
*/
Expand Down Expand Up @@ -166,10 +166,10 @@ static private Rule parse(String rulename, String string, boolean trace)
else if (rulename.equalsIgnoreCase("method-specific-id")) rule = Rule_method_specific_id.parse(context);
else if (rulename.equalsIgnoreCase("idchar")) rule = Rule_idchar.parse(context);
else if (rulename.equalsIgnoreCase("did-url")) rule = Rule_did_url.parse(context);
else if (rulename.equalsIgnoreCase("did-query")) rule = Rule_did_query.parse(context);
else if (rulename.equalsIgnoreCase("param")) rule = Rule_param.parse(context);
else if (rulename.equalsIgnoreCase("param-name")) rule = Rule_param_name.parse(context);
else if (rulename.equalsIgnoreCase("param-value")) rule = Rule_param_value.parse(context);
else if (rulename.equalsIgnoreCase("param-char")) rule = Rule_param_char.parse(context);
else if (rulename.equalsIgnoreCase("path-abempty")) rule = Rule_path_abempty.parse(context);
else if (rulename.equalsIgnoreCase("segment")) rule = Rule_segment.parse(context);
else if (rulename.equalsIgnoreCase("pchar")) rule = Rule_pchar.parse(context);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/did/parser/ParserAlternative.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* -----------------------------------------------------------------------------
*
* Producer : com.parse2.aparse.Parser 2.5
* Produced : Fri Apr 19 22:09:52 CEST 2019
* Produced : Mon Jul 13 23:12:39 CEST 2020
*
* -----------------------------------------------------------------------------
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/did/parser/ParserContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* -----------------------------------------------------------------------------
*
* Producer : com.parse2.aparse.Parser 2.5
* Produced : Fri Apr 19 22:09:52 CEST 2019
* Produced : Mon Jul 13 23:12:39 CEST 2020
*
* -----------------------------------------------------------------------------
*/
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/did/parser/ParserException.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* -----------------------------------------------------------------------------
*
* Producer : com.parse2.aparse.Parser 2.5
* Produced : Fri Apr 19 22:09:52 CEST 2019
* Produced : Mon Jul 13 23:12:39 CEST 2020
*
* -----------------------------------------------------------------------------
*/
Expand All @@ -16,10 +16,10 @@
* <p>Signals that a parse failure has occurred.</p>
*
* <p>Producer : com.parse2.aparse.Parser 2.5<br/>
* Produced : Fri Apr 19 22:09:52 CEST 2019</p>
* Produced : Mon Jul 13 23:12:39 CEST 2020</p>
*/

public class ParserException extends RuntimeException
public class ParserException extends Exception
{
private String reason;
private String text60;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/did/parser/Rule.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* -----------------------------------------------------------------------------
*
* Producer : com.parse2.aparse.Parser 2.5
* Produced : Fri Apr 19 22:09:52 CEST 2019
* Produced : Mon Jul 13 23:12:39 CEST 2020
*
* -----------------------------------------------------------------------------
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/did/parser/Rule_ALPHA.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* -----------------------------------------------------------------------------
*
* Producer : com.parse2.aparse.Parser 2.5
* Produced : Fri Apr 19 22:09:52 CEST 2019
* Produced : Mon Jul 13 23:12:39 CEST 2020
*
* -----------------------------------------------------------------------------
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/did/parser/Rule_DIGIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* -----------------------------------------------------------------------------
*
* Producer : com.parse2.aparse.Parser 2.5
* Produced : Fri Apr 19 22:09:52 CEST 2019
* Produced : Mon Jul 13 23:12:39 CEST 2020
*
* -----------------------------------------------------------------------------
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/did/parser/Rule_HEXDIG.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* -----------------------------------------------------------------------------
*
* Producer : com.parse2.aparse.Parser 2.5
* Produced : Fri Apr 19 22:09:52 CEST 2019
* Produced : Mon Jul 13 23:12:39 CEST 2020
*
* -----------------------------------------------------------------------------
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/did/parser/Rule_did.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* -----------------------------------------------------------------------------
*
* Producer : com.parse2.aparse.Parser 2.5
* Produced : Fri Apr 19 22:09:52 CEST 2019
* Produced : Mon Jul 13 23:12:39 CEST 2020
*
* -----------------------------------------------------------------------------
*/
Expand Down
158 changes: 158 additions & 0 deletions src/main/java/did/parser/Rule_did_query.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
/* -----------------------------------------------------------------------------
* Rule_did_query.java
* -----------------------------------------------------------------------------
*
* Producer : com.parse2.aparse.Parser 2.5
* Produced : Mon Jul 13 23:12:39 CEST 2020
*
* -----------------------------------------------------------------------------
*/

package did.parser;

import java.util.ArrayList;

final public class Rule_did_query extends Rule
{
public Rule_did_query(String spelling, ArrayList<Rule> rules)
{
super(spelling, rules);
}

public Object accept(Visitor visitor)
{
return visitor.visit(this);
}

public static Rule_did_query parse(ParserContext context)
{
context.push("did-query");

boolean parsed = true;
int s0 = context.index;
ParserAlternative a0 = new ParserAlternative(s0);

ArrayList<ParserAlternative> as1 = new ArrayList<ParserAlternative>();
parsed = false;
{
int s1 = context.index;
ParserAlternative a1 = new ParserAlternative(s1);
parsed = true;
if (parsed)
{
boolean f1 = true;
int c1 = 0;
for (int i1 = 0; i1 < 1 && f1; i1++)
{
Rule rule = Rule_param.parse(context);
if ((f1 = rule != null))
{
a1.add(rule, context.index);
c1++;
}
}
parsed = c1 == 1;
}
if (parsed)
{
boolean f1 = true;
@SuppressWarnings("unused")
int c1 = 0;
while (f1)
{
int g1 = context.index;
ArrayList<ParserAlternative> as2 = new ArrayList<ParserAlternative>();
parsed = false;
{
int s2 = context.index;
ParserAlternative a2 = new ParserAlternative(s2);
parsed = true;
if (parsed)
{
boolean f2 = true;
int c2 = 0;
for (int i2 = 0; i2 < 1 && f2; i2++)
{
Rule rule = Terminal_StringValue.parse(context, "&");
if ((f2 = rule != null))
{
a2.add(rule, context.index);
c2++;
}
}
parsed = c2 == 1;
}
if (parsed)
{
boolean f2 = true;
int c2 = 0;
for (int i2 = 0; i2 < 1 && f2; i2++)
{
Rule rule = Rule_param.parse(context);
if ((f2 = rule != null))
{
a2.add(rule, context.index);
c2++;
}
}
parsed = c2 == 1;
}
if (parsed)
{
as2.add(a2);
}
context.index = s2;
}

ParserAlternative b = ParserAlternative.getBest(as2);

parsed = b != null;

if (parsed)
{
a1.add(b.rules, b.end);
context.index = b.end;
}

f1 = context.index > g1;
if (parsed) c1++;
}
parsed = true;
}
if (parsed)
{
as1.add(a1);
}
context.index = s1;
}

ParserAlternative b = ParserAlternative.getBest(as1);

parsed = b != null;

if (parsed)
{
a0.add(b.rules, b.end);
context.index = b.end;
}

Rule rule = null;
if (parsed)
{
rule = new Rule_did_query(context.text.substring(a0.start, a0.end), a0.rules);
}
else
{
context.index = s0;
}

context.pop("did-query", parsed);

return (Rule_did_query)rule;
}
}

/* -----------------------------------------------------------------------------
* eof
* -----------------------------------------------------------------------------
*/
70 changes: 2 additions & 68 deletions src/main/java/did/parser/Rule_did_url.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* -----------------------------------------------------------------------------
*
* Producer : com.parse2.aparse.Parser 2.5
* Produced : Fri Apr 19 22:09:52 CEST 2019
* Produced : Mon Jul 13 23:12:39 CEST 2020
*
* -----------------------------------------------------------------------------
*/
Expand Down Expand Up @@ -54,72 +54,6 @@ public static Rule_did_url parse(ParserContext context)
parsed = c1 == 1;
}
if (parsed)
{
boolean f1 = true;
@SuppressWarnings("unused")
int c1 = 0;
while (f1)
{
int g1 = context.index;
ArrayList<ParserAlternative> as2 = new ArrayList<ParserAlternative>();
parsed = false;
{
int s2 = context.index;
ParserAlternative a2 = new ParserAlternative(s2);
parsed = true;
if (parsed)
{
boolean f2 = true;
int c2 = 0;
for (int i2 = 0; i2 < 1 && f2; i2++)
{
Rule rule = Terminal_StringValue.parse(context, ";");
if ((f2 = rule != null))
{
a2.add(rule, context.index);
c2++;
}
}
parsed = c2 == 1;
}
if (parsed)
{
boolean f2 = true;
int c2 = 0;
for (int i2 = 0; i2 < 1 && f2; i2++)
{
Rule rule = Rule_param.parse(context);
if ((f2 = rule != null))
{
a2.add(rule, context.index);
c2++;
}
}
parsed = c2 == 1;
}
if (parsed)
{
as2.add(a2);
}
context.index = s2;
}

ParserAlternative b = ParserAlternative.getBest(as2);

parsed = b != null;

if (parsed)
{
a1.add(b.rules, b.end);
context.index = b.end;
}

f1 = context.index > g1;
if (parsed) c1++;
}
parsed = true;
}
if (parsed)
{
boolean f1 = true;
int c1 = 0;
Expand Down Expand Up @@ -169,7 +103,7 @@ public static Rule_did_url parse(ParserContext context)
int c2 = 0;
for (int i2 = 0; i2 < 1 && f2; i2++)
{
Rule rule = Rule_query.parse(context);
Rule rule = Rule_did_query.parse(context);
if ((f2 = rule != null))
{
a2.add(rule, context.index);
Expand Down
Loading

0 comments on commit f9be99b

Please sign in to comment.