Skip to content

Commit

Permalink
Add a new function to get the parents of a symbol in a grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
sungshik committed Oct 8, 2024
1 parent 4a209dd commit 52297f1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions rascal-textmate-core/src/main/rascal/lang/rascal/grammar/Util.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,17 @@ list[Pointer] find(Grammar g, Production p, Symbol s, Direction dir = forward())
return doFind({}, p, s);
}

@synopsis{
Lookdowns a list of productions for symbol `s` in grammar `g`
}

// TODO: Rename this function because the current name makes little sense in
// isolation (it's supposed to be the opposite of `lookup`, but in that sense,
// the directions are illogical)

set[Production] lookdown(Grammar g, Symbol s)
= {parent | /parent: prod(_, /Symbol _: s, _) := g};

@synopsis{
Lookups a list of productions for symbol `s` in grammar `g`, replacing
formal parameters with actual parameters when needed
Expand Down

0 comments on commit 52297f1

Please sign in to comment.