Example #1
0
 public Parser(IEnumerable <Token> source)
 {
     if (source == null)
     {
         throw new ArgumentNullException(nameof(source));
     }
     diagnostics = new DiagnosticCollection();
     tokens      = source
                   .Where(t => t.Kind != TokenKind.Whitespace && t.Kind != TokenKind.Invalid && t.Kind != TokenKind.Comment)
                   .ToArray();
 }
Example #2
0
 public Lexer(SourceText sourceText)
 {
     source      = sourceText;
     TextWindow  = new SlidingTextWindow(source);
     diagnostics = new DiagnosticCollection();
 }
        DiagnosticCollection ReadDiagnostics(XmlElement e)
        {
            DiagnosticCollection diags = new DiagnosticCollection();

             if (e.HasChildNodes)
             {
            foreach (XmlNode childNode in e.ChildNodes)
            {
               XmlElement child = childNode as XmlElement;
               if (child != null && child.NamespaceURI == schematronNamespaceURI)
               {
                  if (child.LocalName == diagnostic)
                     diags.Add(ReadDiagnostic(child));
                  else
                     throw new Exception(String.Format("'{0}' is an unknown schematron element.", child.Name));
               }
            }
             }

             return diags;
        }
Example #4
0
 public Binder(Scope parent, FunctionSymbol function)
 {
     Scope       = parent ?? throw new ArgumentNullException(nameof(parent));
     Function    = function;
     diagnostics = new DiagnosticCollection();
 }