fri.patterns.interpreter.parsergenerator.util
Class SymbolToName

java.lang.Object
  |
  +--fri.patterns.interpreter.parsergenerator.util.SymbolToName

public abstract class SymbolToName
extends java.lang.Object

The contained methods are needed to generate nonterminal names for spawned rules, e.g. for a repeatable nullable rule "(a | b | c)" from the rule "e ::= (a | b | c)* d;".

Author:
(c) 2000, Fritz Ritzberger

Method Summary
static java.lang.String convert(char c)
          Returns a symbolic name for passed symbol, e.g.
static java.lang.String makeIdentifier(java.lang.String symbol)
          Converts the passed character sequence (symbol) to a name that can be used as identifier (but not as Java identifier).
static java.lang.String makeIdentifier(java.lang.String symbol, boolean startIsSignificant)
          Converts the passed character sequence (symbol) to a name that can be used as identifier, optionally as Java identifier.
static java.lang.String makeIdentifier(java.lang.String symbol, java.lang.String enclosingQuoteSubstitute)
          Converts the passed character sequence (symbol) to a name that can be used as identifier (but not as Java identifier).
static java.lang.String makeIdentifier(java.lang.String symbol, java.lang.String enclosingQuoteSubstitute, boolean startIsSignificant)
          Converts the passed character sequence (symbol) to a name that can be used as identifier, optionally as Java identifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

makeIdentifier

public static java.lang.String makeIdentifier(java.lang.String symbol)
Converts the passed character sequence (symbol) to a name that can be used as identifier (but not as Java identifier). If enclosing quotes are found, they will be substituted by "_".

Parameters:
symbol - character sequence to be converted to identifier

makeIdentifier

public static java.lang.String makeIdentifier(java.lang.String symbol,
                                              boolean startIsSignificant)
Converts the passed character sequence (symbol) to a name that can be used as identifier, optionally as Java identifier. If enclosing quotes are found, they will be substituted by "_".

Parameters:
symbol - character sequence to be converted to identifier
startIsSignificant - when true a Java identifier is produced

makeIdentifier

public static java.lang.String makeIdentifier(java.lang.String symbol,
                                              java.lang.String enclosingQuoteSubstitute)
Converts the passed character sequence (symbol) to a name that can be used as identifier (but not as Java identifier). If enclosing quotes are found, they will be substituted by passed substitute string.

Parameters:
symbol - character sequence to be converted to identifier
enclosingQuoteSubstitute - the string to be used for enclosing quotes

makeIdentifier

public static java.lang.String makeIdentifier(java.lang.String symbol,
                                              java.lang.String enclosingQuoteSubstitute,
                                              boolean startIsSignificant)
Converts the passed character sequence (symbol) to a name that can be used as identifier, optionally as Java identifier. If enclosing quotes are found, they will be substituted by passed substitute string.

Parameters:
symbol - character sequence to be converted to identifier
enclosingQuoteSubstitute - the string to be used for enclosing quotes
startIsSignificant - when true a Java identifier is produced

convert

public static java.lang.String convert(char c)
Returns a symbolic name for passed symbol, e.g. "lparen" for "(".