public static Parser CreateParser(CompilerContext context, TotemOptions options) { ContractUtils.RequiresNotNull(context, "context"); ContractUtils.RequiresNotNull(options, "options"); TotemCompilerOptions compilerOptions = context.Options as TotemCompilerOptions; if (options == null) { throw new ValueErrorException(Resources.TotemContextRequired); } SourceCodeReader reader; try { reader = context.SourceUnit.GetReader(); } catch (IOException e) { context.Errors.Add(context.SourceUnit, e.Message, SourceSpan.Invalid, 0, Severity.Error); throw; } Tokenizer tokenizer = new Tokenizer(context.Errors, compilerOptions); tokenizer.Initialize(null, reader, context.SourceUnit, SourceLocation.MinValue); Parser result = new Parser(context, tokenizer, context.Errors, context.ParserSink, compilerOptions.Module); result._sourceReader = reader; return result; }
public TokenizerErrorSink(Parser parser) { Assert.NotNull(parser); _parser = parser; }