fr.umlv.tatoo.cc.parser.grammar
Class GrammarFactory

java.lang.Object
  extended by fr.umlv.tatoo.cc.parser.grammar.GrammarFactory
All Implemented Interfaces:
GrammarRepository

public class GrammarFactory
extends Object
implements GrammarRepository


Constructor Summary
GrammarFactory()
           
GrammarFactory(IdMap<VariableDecl> variableMap)
           
 
Method Summary
 void addStartNonTerminal(NonTerminalDecl nonTerminal)
           
 Set<TerminalDecl> checkUnusedTerminal()
           
 TerminalDecl createEof(Priority priority)
           
 TerminalDecl createError(String id)
           
 NonTerminalDecl createNonTerminal(String id)
           
 Priority createPriority(String id, double priorityValue, Priority.Associativity associativity)
           
 ProductionDecl createProduction(String id, NonTerminalDecl left, List<? extends VariableDecl> right, Priority priority, VersionDecl version)
           
 TerminalDecl createTerminal(String id, Priority priority, boolean branching)
          Creates a new terminal.
 VersionDecl createVersion(String id, VersionDecl parent)
           
 Priority findProductionPriority(String productionId, List<? extends VariableDecl> rights)
           
 Collection<? extends NonTerminalDecl> getAllNonTerminals()
           
 Collection<? extends Priority> getAllPriorities()
           
 Collection<? extends ProductionDecl> getAllProductions()
           
 Collection<? extends TerminalDecl> getAllTerminals()
           
 Collection<? extends VersionDecl> getAllVersions()
           
 Map<VersionDecl,? extends Set<? extends VersionDecl>> getDependingVersionMap()
           
 TerminalDecl getEof()
           
 TerminalDecl getError()
           
 Priority getPriority(String id)
           
 Map<NonTerminalDecl,? extends Collection<? extends ProductionDecl>> getProductionsByNonTerminal()
           
 Set<? extends NonTerminalDecl> getStartNonTerminalSet()
           
 IdMap<VariableDecl> getVariableMap()
           
 VersionDecl getVersion(String id)
           
 boolean isEofDefined()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GrammarFactory

public GrammarFactory()

GrammarFactory

public GrammarFactory(IdMap<VariableDecl> variableMap)
Method Detail

checkUnusedTerminal

public Set<TerminalDecl> checkUnusedTerminal()

getVariableMap

public IdMap<VariableDecl> getVariableMap()

createProduction

public ProductionDecl createProduction(String id,
                                       NonTerminalDecl left,
                                       List<? extends VariableDecl> right,
                                       Priority priority,
                                       VersionDecl version)

createTerminal

public TerminalDecl createTerminal(String id,
                                   Priority priority,
                                   boolean branching)
Creates a new terminal.

Parameters:
id - terminal id.
priority - may be null, in that case default priority is used.
branching - true if the terminal is a branching terminal
Returns:
a terminal declaration
See Also:
Priority.getNoPriority(), getAllTerminals(), createEof(Priority)

createNonTerminal

public NonTerminalDecl createNonTerminal(String id)

addStartNonTerminal

public void addStartNonTerminal(NonTerminalDecl nonTerminal)

createVersion

public VersionDecl createVersion(String id,
                                 VersionDecl parent)

getVersion

public VersionDecl getVersion(String id)

createPriority

public Priority createPriority(String id,
                               double priorityValue,
                               Priority.Associativity associativity)

getPriority

public Priority getPriority(String id)

getDependingVersionMap

public Map<VersionDecl,? extends Set<? extends VersionDecl>> getDependingVersionMap()

findProductionPriority

public Priority findProductionPriority(String productionId,
                                       List<? extends VariableDecl> rights)

getEof

public TerminalDecl getEof()

isEofDefined

public boolean isEofDefined()

createEof

public TerminalDecl createEof(Priority priority)

getError

public TerminalDecl getError()

createError

public TerminalDecl createError(String id)

getAllProductions

public Collection<? extends ProductionDecl> getAllProductions()
Specified by:
getAllProductions in interface GrammarRepository

getAllTerminals

public Collection<? extends TerminalDecl> getAllTerminals()
Specified by:
getAllTerminals in interface GrammarRepository

getAllNonTerminals

public Collection<? extends NonTerminalDecl> getAllNonTerminals()
Specified by:
getAllNonTerminals in interface GrammarRepository

getStartNonTerminalSet

public Set<? extends NonTerminalDecl> getStartNonTerminalSet()
Specified by:
getStartNonTerminalSet in interface GrammarRepository

getAllPriorities

public Collection<? extends Priority> getAllPriorities()

getAllVersions

public Collection<? extends VersionDecl> getAllVersions()
Specified by:
getAllVersions in interface GrammarRepository

getProductionsByNonTerminal

public Map<NonTerminalDecl,? extends Collection<? extends ProductionDecl>> getProductionsByNonTerminal()
Specified by:
getProductionsByNonTerminal in interface GrammarRepository