Package net.emustudio.edigen.passes
Class NarrowMasksVisitor
- java.lang.Object
-
- net.emustudio.edigen.Visitor
-
- net.emustudio.edigen.passes.NarrowMasksVisitor
-
public class NarrowMasksVisitor extends Visitor
A visitor which removes all child masks of a node except the first one, attaches them to a new empty pattern and attaches that pattern (if it is not empty) to the first mask.This is necessary to represent the fact that if no pattern matches an input, the next mask (and its associated patterns) is tried.
-
-
Constructor Summary
Constructors Constructor Description NarrowMasksVisitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidvisit(Pattern pattern)Moves all child masks of the pattern node except the first one.voidvisit(Rule rule)Moves all child masks of the rule node except the first one.
-
-
-
Method Detail
-
visit
public void visit(Rule rule) throws SemanticException
Moves all child masks of the rule node except the first one.- Overrides:
visitin classVisitor- Parameters:
rule- the rule node- Throws:
SemanticException- never
-
visit
public void visit(Pattern pattern) throws SemanticException
Moves all child masks of the pattern node except the first one.- Overrides:
visitin classVisitor- Parameters:
pattern- the pattern node- Throws:
SemanticException- never
-
-