Do not allow constant names to start with numbers.
This commit is contained in:
parent
e4dc363d24
commit
5eb9d7242b
1 changed files with 7 additions and 4 deletions
|
@ -46,7 +46,7 @@ namespace Bind.Structures
|
|||
set
|
||||
{
|
||||
if (!String.IsNullOrEmpty(value))
|
||||
_name = Translate(value.Trim());
|
||||
_name = Translate(value.Trim(), false);
|
||||
else _name = value;
|
||||
|
||||
PreviousName = value;
|
||||
|
@ -105,7 +105,7 @@ namespace Bind.Structures
|
|||
}
|
||||
}
|
||||
|
||||
_value = Translate(value);
|
||||
_value = Translate(value, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,9 +166,9 @@ namespace Bind.Structures
|
|||
|
||||
#endregion
|
||||
|
||||
#region public static string Translate(string s)
|
||||
#region Translate
|
||||
|
||||
public static string Translate(string s)
|
||||
public static string Translate(string s, bool isValue)
|
||||
{
|
||||
translator.Remove(0, translator.Length);
|
||||
|
||||
|
@ -178,6 +178,9 @@ namespace Bind.Structures
|
|||
bool next_char_uppercase = true;
|
||||
bool is_after_digit = false;
|
||||
|
||||
if (!isValue && Char.IsDigit(s[0]))
|
||||
translator.Insert(0, Settings.ConstantPrefix);
|
||||
|
||||
foreach (char c in s)
|
||||
{
|
||||
if (c == '_')
|
||||
|
|
Loading…
Reference in a new issue