internal void ThrowParserError(ParserResults result) { if (result.ParserErrors.Any()) { StringBuilder builder = new StringBuilder(); foreach (RazorError error in result.ParserErrors) { if (result.ParserErrors.IndexOf(error) > 0) { builder.AppendLine(); builder.AppendLine(); } SourceLocation location = error.Location; builder.AppendFormat(EXCEPTION_LOCATION_FORMAT, location.LineIndex, location.CharacterIndex); builder.AppendLine(); builder.AppendLine(error.Message); } string message = builder.ToString(); throw new RazorJsException(message); } throw new RazorJsException(UNHANDLED_EXCEPTION); }
public GeneratorResults(ParserResults parserResults, CodeCompileUnit generatedCode, IDictionary <int, GeneratedCodeMapping> designTimeLineMappings) : this(parserResults.Document, parserResults.ParserErrors, generatedCode, designTimeLineMappings) { }
public GeneratorResults(ParserResults parserResults, CodeCompileUnit generatedCode, IDictionary<int, GeneratedCodeMapping> designTimeLineMappings) : this(parserResults.Document, parserResults.ParserErrors, generatedCode, designTimeLineMappings) { }
string GetModelTypeName(ParserResults results) { var visitor = new RazorCSharpParserModelTypeVisitor(); results.Document.Accept(visitor); return visitor.ModelTypeName; }
void ParseTemplate(string html) { var parser = new RazorParser(codeLanguage.CreateCodeParser(), new HtmlMarkupParser()); parserResults = parser.Parse(new StringReader(html)); }