Class LexNamer

java.lang.Object
de.monticore.grammar.LexNamer

public class LexNamer extends Object
Class generates human readable names for Lexersymbols
  • Field Details

    • NAME_PATTERN

      public static final Pattern NAME_PATTERN
    • constantCounter

      protected int constantCounter
    • lexCounter

      protected int lexCounter
    • usedLex

      protected Map<String,String> usedLex
    • usedConstants

      protected Map<String,String> usedConstants
    • goodNames

      protected static Map<String,String> goodNames
  • Constructor Details

    • LexNamer

      public LexNamer()
  • Method Details

    • getGoodNames

      public static Map<String,String> getGoodNames()
    • createGoodName

      public static String createGoodName(String x)
      Returns a good name for the lex symbol or ""
    • createSimpleGoodName

      public static String createSimpleGoodName(String x)
      Returns a good name for the lex symbol or ""
    • getLexName

      @Deprecated public String getLexName(MCGrammarSymbol grammarSymbol, String sym)
      Computes a new name for the lexical production or returns the previously computed one.
    • getComputedLexName

      public Optional<String> getComputedLexName(String sym)
    • getOrComputeLexName

      public String getOrComputeLexName(MCGrammarSymbol grammarSymbol, String sym)
      Returns Human-Readable, antlr conformed name for a lexsymbols nice names for common tokens (change constructor to add tokenes) LEXi where i is number for unknown ones
      Parameters:
      sym - lexer symbol
      Returns:
      Human-Readable, antlr conformed name for a lexsymbols
    • getConstantName

      @Deprecated public String getConstantName(String sym)
      Deprecated.
    • getComputedConstantName

      public Optional<String> getComputedConstantName(String sym)
    • getOrComputeConstantName

      public String getOrComputeConstantName(String sym)
    • convertKeyword

      protected String convertKeyword(String key)
    • getLexnames

      public Set<String> getLexnames()
    • getUsedConstants

      public Set<String> getUsedConstants()