Exemplo n.º 1
0
        public Stringish RenderTrace(Stringish prefix)
        {
            var writer = new System.IO.StringWriter();
            var seen   = new Dictionary <SourceReference, bool>();

            SourceReference.Write(writer, prefix.ToString(), seen);
            return(new SimpleStringish(writer.ToString()));
        }
Exemplo n.º 2
0
        private static bool VerifySymbol(Stringish strish, ReportError error)
        {
            var str = strish.ToString();

            if (str.Length < 1)
            {
                error("An attribute name cannot be empty.");
                return(false);
            }
            switch (Char.GetUnicodeCategory(str[0]))
            {
            case UnicodeCategory.LowercaseLetter:
            case UnicodeCategory.OtherLetter:
                break;

            default:
                error(String.Format("The name “{0}” is unbecoming of an attribute; it cannot start with “{1}”.",
                                    str, str[0]));
                return(false);
            }
            for (var it = 1; it < str.Length; it++)
            {
                if (str[it] == '_')
                {
                    continue;
                }
                switch (Char.GetUnicodeCategory(str[it]))
                {
                case UnicodeCategory.DecimalDigitNumber:
                case UnicodeCategory.LetterNumber:
                case UnicodeCategory.LowercaseLetter:
                case UnicodeCategory.OtherLetter:
                case UnicodeCategory.OtherNumber:
                case UnicodeCategory.TitlecaseLetter:
                case UnicodeCategory.UppercaseLetter:
                    continue;

                default:
                    error(String.Format("The name “{0}” is unbecoming of an attribute; it cannot contain “{1}”.",
                                        str, str[it]));
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 3
0
 public ComputeValue Get(Stringish name)
 {
     return(this[name.ToString()]);
 }
Exemplo n.º 4
0
 public bool Has(Stringish name)
 {
     return(Has(name.ToString()));
 }
Exemplo n.º 5
0
 public bool VerifySymbol(SourceReference source_reference, Stringish strish)
 {
     return(VerifySymbol(source_reference, strish.ToString()));
 }
Exemplo n.º 6
0
 public static bool VerifySymbol(Stringish strish)
 {
     return(VerifySymbol(strish.ToString()));
 }