public Model.CSSDocument ParseStream(Stream stream) { StringBuilder sb = new StringBuilder(); TextWriter errorCatch = new StringWriter(sb); Scanner scanner = new Scanner(stream); Parser parser = new Parser(scanner); parser.errors.errorStream = errorCatch; parser.Parse(); doc = parser.CSSDoc; SpitErrors(sb); return doc; }
public List<Token> GetTokens(string file) { StringBuilder sb = new StringBuilder(); TextWriter errorCatch = new StringWriter(sb); Scanner scanner = new Scanner(file); List<Token> ts = new List<Token>(); Token t = scanner.Scan(); if (t.val != "\0") { ts.Add(t); } while (t.val != "\0") { t = scanner.Scan(); ts.Add(t); } return ts; }
/*------------------------------------------------------------------------* *----- SCANNER DESCRIPTION ----------------------------------------------* *------------------------------------------------------------------------*/ public Parser(Scanner scanner) { this.scanner = scanner; errors = new Errors(); }