Skip to content

Commit

Permalink
Refactor using a new Peggy operator
Browse files Browse the repository at this point in the history
  • Loading branch information
hchiba1 committed Dec 9, 2024
1 parent 6be5ee6 commit 85f3055
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 38 deletions.
28 changes: 6 additions & 22 deletions lib/parser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 4 additions & 16 deletions lib/spang.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -940,15 +940,9 @@ Verb = VarOrIri
}

// [79] ObjectList ::= Object ( ',' Object )*
ObjectList = o:Object os:( WS* ',' WS* Object )*
ObjectList = o:Object os:( WS* ',' WS* @Object )*
{
let ret = [o];

os.forEach((oi) => {
ret.push(oi[3]);
});

return ret;
return [o, ...os];
}

// [80] Object ::= GraphNode
Expand Down Expand Up @@ -994,15 +988,9 @@ VerbPath = Path
VerbSimple = Var

// [86] ObjectListPath ::= ObjectPath ( ',' ObjectPath )*
ObjectListPath = o:ObjectPath os:( WS* ',' WS* ObjectPath )*
ObjectListPath = o:ObjectPath os:( WS* ',' WS* @ObjectPath )*
{
let ret = [o];

os.forEach((oi) => {
ret.push(oi[3]);
});

return ret;
return [o, ...os];
}

// [87] ObjectPath ::= GraphNodePath
Expand Down

0 comments on commit 85f3055

Please sign in to comment.