Class HygieneReport


  • public class HygieneReport
    extends java.lang.Object
    A report on the hygiene of a grammar.

    A grammar is considered "unhygienic" if it contains any of the following features: unreachable (i.e., unused) nonterminals, unproductive nonterminals, or unproductive rules.

    • Method Detail

      • checkGrammar

        public void checkGrammar()
      • checkAmbiguity

        public void checkAmbiguity()
      • isClean

        public boolean isClean()
        Is this grammar "clean"?
        Returns:
        true iff the grammar has no unhygienic features
      • getCompiledGrammar

        public ParserGrammar getCompiledGrammar()
        Get the grammar associated with this report.

        Note that if the grammar was open when the report was created, it may have changed since this report was created.

        Returns:
        the grammar.
      • getUnproductiveRules

        public java.util.Set<Rule> getUnproductiveRules()
        Get the unproductive rules.
        Returns:
        the unproductive rules.
      • getUnproductiveSymbols

        public java.util.Set<NonterminalSymbol> getUnproductiveSymbols()
        Get the unproductive symbols.
        Returns:
        the unproductive symbols.
      • getUnreachableSymbols

        public java.util.Set<NonterminalSymbol> getUnreachableSymbols()
        Get the unreachable symbols.
        Returns:
        the unreachable symbols.
      • getUndefinedSymbols

        public java.util.Set<NonterminalSymbol> getUndefinedSymbols()
        Get the unreachable symbols.
        Returns:
        the unreachable symbols.
      • ambiguityChecked

        public boolean ambiguityChecked()
        Did the dk.brics.grammar.ambiguity analyzer run successfully?
        Returns:
        true, if the analyzer ran successfully
      • provablyUnambiguous

        public boolean provablyUnambiguous()
        Did the dk.brics.grammar.ambiguity analyzer report the grammar unambiguous?
        Returns:
        true, if the grammar is unambiguous
      • reliablyUnambiguous

        public boolean reliablyUnambiguous()
        Did the dk.brics.grammar.ambiguity analyzer run reliably?
        Returns:
        true, if the analyzer detected no uncheckable characters or character classes
      • getAmbiguityReport

        public java.lang.String getAmbiguityReport()
        Get the dk.brics.grammar.ambiguity analyzer report.
        Returns:
        the report, or null if no report is available