|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbyucc.jhdl.base.Util
A set of utility routines.
Constructor Summary | |
Util()
|
Method Summary | |
static boolean |
isLegalJHDLIdentifier(java.lang.String str)
Used to check if an identifier is a legal JHDL user identifier. |
static java.lang.String |
makeLegalJHDLIdentifier(java.lang.String str)
Converts an arbitrary string into a legal JHDL name. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Util()
Method Detail |
public static boolean isLegalJHDLIdentifier(java.lang.String str)
Nameable.caseSensitivity(boolean)
. JHDL names accept Unicode.
str
- the string being checked.
public static java.lang.String makeLegalJHDLIdentifier(java.lang.String str)
The conversion rules are as follows: Any character that is not alphanumeric is replaced by an underscore (_). Consecutive underscores are reduced to a single underscore. If the resulting string begins with an underscore followed by a letter, the leading underscore is removed. In all other cases where the result does not begin with a letter, the string "jhdl_" is prepended to the result. Case sensitivity is preserved.
Examples: "My name-1" becomes "My_name_1", "__test__" becomes "test_", null becomes "jhdl_", and "1hot/control.bit[1]" becomes "jhdl_1hot_control_bit_1_".
str
- the string to be converted
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |