예제 #1
0
 internal ModelParsingException(HtmlCorpusParser <TTag> .TagPart <TTag> last, string lastText)
     : base(
         "Unclosed tags:" + last + "\nline:" + last.Line + "\ntext:" + lastText)
 {
     TextPos = last.Start;
     Pos     = last.ModelStart;
     Line    = last.Line;
 }
예제 #2
0
 /// <summary>
 /// Creates new tags worker
 /// </summary>
 /// <param name="tagsNames">names of supported tags (should also contain undefined tag name)</param>
 /// <param name="undefinedTagName">name of undefined tag</param>
 public StringTagsWorker(
     [NotNull] IEnumerable <string> tagsNames,
     [NotNull] string undefinedTagName)
 {
     _renderer         = new HtmlRenderer <string>((t, b) => t.Type, (s1, s2) => string.Compare(s1, s2, StringComparison.Ordinal));
     _values           = tagsNames.ToList();
     _undefinedTagName = undefinedTagName;
     _parser           = new HtmlParser(new HashSet <string>(_values));
 }
예제 #3
0
 /// <summary>
 /// Creates new tags worker
 /// </summary>
 /// <param name="undefinedValue">value that should be used as undefined</param>
 /// <param name="valuesComparer">comparer that will be used to handle enum values</param>
 public EnumsTagWorker(
     TType undefinedValue,
     [NotNull]
     Func <TType, TType, int> valuesComparer
     )
 {
     _undefinedValue = undefinedValue;
     Types           = Enumers.GetEnumValuesDictionary <TType>();
     Strings         = Enumers.GetEnumStringValuesDictionary <TType>();
     _renderer       = new HtmlRenderer <TType>((e, s) => Strings[e.Type], valuesComparer);
     _values         = Enumers.Values <TType>();
     _parser         = new HtmlEntitiesParser(Types);
 }