Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Guido Wachsmuth committed Dec 8, 2013
1 parent 24e39b9 commit b8edf02
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions org.metaborg.meta.lang.nabl/trans/generation/scoping-sites.str
Expand Up @@ -10,25 +10,33 @@ imports

rules

// anonymous scope
binding-to-scope-rules:
BindingRule(pattern, constr*, clause*) -> [SCOPE_RULE(pattern, seq), QUERY_SCOPE_RULE(pattern, ns-term*)]
BindingRule(pattern, constr*, clause*) -> [SCOPE_RULE(pattern, seq), q*]
where
cong* := <filterconcat(to-scope-cong(|pattern))> clause*
where
// scopes at least one namespace
ns-term* := <filterconcat(?ScopeClause(<map(ns-to-term)>)); nonempty> clause*
// but does not define any explicit name
; <not(fetch-elem(?DefClause(Explicit(), _, _, _, _, _, _)))> clause*
; anon* := [SCOPE_CALL(ns-term*)]
; q* := [QUERY_SCOPE_RULE(pattern, ns-term*)]
<+ anon* := []
; q* := []
where
seq := <nonempty; to-seq> [cong*, anon*]

// named scope
binding-to-scope-rules:
BindingRule(pattern, constr*, clause*) -> [QUERY_SCOPE_RULE(pattern, ns-term*)]
where
cong* := <filterconcat(to-scope-cong(|pattern))> clause*
where
ns-term* := <filterconcat(?ScopeClause(<map(ns-to-term)>)); nonempty> clause*
; <fetch-elem(?DefClause(Explicit(), _, _, _, _, _, _))> clause*
// scopes at least one namespace
ns-term* := <filterconcat(?ScopeClause(<map(ns-to-term)>)); nonempty> clause*
// does define an explicit name
; <fetch-elem(?DefClause(Explicit(), _, _, _, _, _, _))> clause*

to-scope-cong(|pattern):
_ -> <filterconcat(to-scope-cong(|pattern)); nonempty> part*
Expand Down

0 comments on commit b8edf02

Please sign in to comment.