Updating resx strings to use tt format

This commit is contained in:
Pranav K 2014-02-12 07:26:20 -08:00
parent ff80c86e0c
commit 63e55ce776
48 changed files with 978 additions and 1425 deletions

View File

@ -1,160 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.Internal.Web.Utils
{
using System;
using System.Reflection;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class CommonResources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal CommonResources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if (object.ReferenceEquals(resourceMan, null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.AspNet.Razor.CommonResources", System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(CommonResources)).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to Value cannot be null or an empty string..
/// </summary>
internal static string Argument_Cannot_Be_Null_Or_Empty
{
get
{
return ResourceManager.GetString("Argument_Cannot_Be_Null_Or_Empty", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Value must be between {0} and {1}..
/// </summary>
internal static string Argument_Must_Be_Between
{
get
{
return ResourceManager.GetString("Argument_Must_Be_Between", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Value must be a value from the &quot;{0}&quot; enumeration..
/// </summary>
internal static string Argument_Must_Be_Enum_Member
{
get
{
return ResourceManager.GetString("Argument_Must_Be_Enum_Member", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Value must be greater than {0}..
/// </summary>
internal static string Argument_Must_Be_GreaterThan
{
get
{
return ResourceManager.GetString("Argument_Must_Be_GreaterThan", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Value must be greater than or equal to {0}..
/// </summary>
internal static string Argument_Must_Be_GreaterThanOrEqualTo
{
get
{
return ResourceManager.GetString("Argument_Must_Be_GreaterThanOrEqualTo", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Value must be less than {0}..
/// </summary>
internal static string Argument_Must_Be_LessThan
{
get
{
return ResourceManager.GetString("Argument_Must_Be_LessThan", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Value must be less than or equal to {0}..
/// </summary>
internal static string Argument_Must_Be_LessThanOrEqualTo
{
get
{
return ResourceManager.GetString("Argument_Must_Be_LessThanOrEqualTo", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Value cannot be an empty string. It must either be null or a non-empty string..
/// </summary>
internal static string Argument_Must_Be_Null_Or_Non_Empty
{
get
{
return ResourceManager.GetString("Argument_Must_Be_Null_Or_Non_Empty", resourceCulture);
}
}
}
}

View File

@ -9,7 +9,6 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Utils; using Microsoft.AspNet.Razor.Utils;
@ -191,7 +190,7 @@ namespace Microsoft.AspNet.Razor.Editor
public void QueueChange(TextChange change) public void QueueChange(TextChange change)
{ {
RazorEditorTrace.TraceLine(RazorResources.Trace_QueuingParse, Path.GetFileName(_fileName), change); RazorEditorTrace.TraceLine(RazorResources.Trace_QueuingParse(Path.GetFileName(_fileName), change));
EnsureOnThread(); EnsureOnThread();
lock (_stateLock) lock (_stateLock)
{ {
@ -306,7 +305,7 @@ namespace Microsoft.AspNet.Razor.Editor
try try
{ {
RazorEditorTrace.TraceLine(RazorResources.Trace_BackgroundThreadStart, fileNameOnly); RazorEditorTrace.TraceLine(RazorResources.Trace_BackgroundThreadStart(fileNameOnly));
EnsureOnThread(); EnsureOnThread();
#if K10 #if K10
@ -319,7 +318,7 @@ namespace Microsoft.AspNet.Razor.Editor
WorkParcel parcel = _main.GetParcel(); WorkParcel parcel = _main.GetParcel();
if (parcel.Changes.Any()) if (parcel.Changes.Any())
{ {
RazorEditorTrace.TraceLine(RazorResources.Trace_ChangesArrived, fileNameOnly, parcel.Changes.Count); RazorEditorTrace.TraceLine(RazorResources.Trace_ChangesArrived(fileNameOnly, parcel.Changes.Count));
try try
{ {
DocumentParseCompleteEventArgs args = null; DocumentParseCompleteEventArgs args = null;
@ -356,9 +355,9 @@ namespace Microsoft.AspNet.Razor.Editor
sw.Reset(); sw.Reset();
#endif #endif
RazorEditorTrace.TraceLine( RazorEditorTrace.TraceLine(
RazorResources.Trace_ParseComplete, RazorResources.Trace_ParseComplete(
fileNameOnly, fileNameOnly,
elapsedMs.HasValue ? elapsedMs.Value.ToString(CultureInfo.InvariantCulture) : "?"); elapsedMs.HasValue ? elapsedMs.Value.ToString(CultureInfo.InvariantCulture) : "?"));
if (results != null && !linkedCancel.IsCancellationRequested) if (results != null && !linkedCancel.IsCancellationRequested)
{ {
@ -376,10 +375,10 @@ namespace Microsoft.AspNet.Razor.Editor
sw.Reset(); sw.Reset();
#endif #endif
_currentParseTree = results.Document; _currentParseTree = results.Document;
RazorEditorTrace.TraceLine(RazorResources.Trace_TreesCompared, RazorEditorTrace.TraceLine(RazorResources.Trace_TreesCompared(
fileNameOnly, fileNameOnly,
elapsedMs.HasValue ? elapsedMs.Value.ToString(CultureInfo.InvariantCulture) : "?", elapsedMs.HasValue ? elapsedMs.Value.ToString(CultureInfo.InvariantCulture) : "?",
treeStructureChanged); treeStructureChanged));
// Build Arguments // Build Arguments
args = new DocumentParseCompleteEventArgs() args = new DocumentParseCompleteEventArgs()
@ -392,7 +391,7 @@ namespace Microsoft.AspNet.Razor.Editor
else else
{ {
// Parse completed but we were cancelled in the mean time. Add these to the discarded changes set // Parse completed but we were cancelled in the mean time. Add these to the discarded changes set
RazorEditorTrace.TraceLine(RazorResources.Trace_ChangesDiscarded, fileNameOnly, allChanges.Count); RazorEditorTrace.TraceLine(RazorResources.Trace_ChangesDiscarded(fileNameOnly, allChanges.Count));
_previouslyDiscarded = allChanges; _previouslyDiscarded = allChanges;
} }
@ -426,7 +425,7 @@ namespace Microsoft.AspNet.Razor.Editor
} }
else else
{ {
RazorEditorTrace.TraceLine(RazorResources.Trace_NoChangesArrived, fileNameOnly, parcel.Changes.Count); RazorEditorTrace.TraceLine(RazorResources.Trace_NoChangesArrived(fileNameOnly));
#if NET45 #if NET45
// No Yield in CoreCLR // No Yield in CoreCLR
@ -444,7 +443,7 @@ namespace Microsoft.AspNet.Razor.Editor
} }
finally finally
{ {
RazorEditorTrace.TraceLine(RazorResources.Trace_BackgroundThreadShutdown, fileNameOnly); RazorEditorTrace.TraceLine(RazorResources.Trace_BackgroundThreadShutdown(fileNameOnly));
// Clean up main thread resources // Clean up main thread resources
_main.Dispose(); _main.Dispose();

View File

@ -3,7 +3,6 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
using Microsoft.AspNet.Razor.Resources;
namespace Microsoft.AspNet.Razor.Editor namespace Microsoft.AspNet.Razor.Editor
{ {
@ -21,9 +20,7 @@ namespace Microsoft.AspNet.Razor.Editor
#if NET45 #if NET45
// No Trace in CoreCLR // No Trace in CoreCLR
Trace.WriteLine(String.Format( Trace.WriteLine(RazorResources.Trace_Startup(
CultureInfo.CurrentCulture,
RazorResources.Trace_Startup,
enabled ? RazorResources.Trace_Enabled : RazorResources.Trace_Disabled)); enabled ? RazorResources.Trace_Enabled : RazorResources.Trace_Disabled));
#endif #endif
_enabled = enabled; _enabled = enabled;
@ -44,9 +41,7 @@ namespace Microsoft.AspNet.Razor.Editor
#if NET45 #if NET45
// No Trace in CoreCLR // No Trace in CoreCLR
Trace.WriteLine(String.Format( Trace.WriteLine(RazorResources.Trace_Format(
CultureInfo.CurrentCulture,
RazorResources.Trace_Format,
String.Format(CultureInfo.CurrentCulture, format, args))); String.Format(CultureInfo.CurrentCulture, format, args)));
#endif #endif
} }

View File

@ -10,7 +10,6 @@ using System.Linq;
using System.Text; using System.Text;
using Microsoft.AspNet.Razor.Generator.Compiler; using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Utils; using Microsoft.AspNet.Razor.Utils;

View File

@ -23,19 +23,19 @@ namespace Microsoft.AspNet.Razor.Generator
{ {
if (startLine < 0) if (startLine < 0)
{ {
throw new ArgumentOutOfRangeException("startLine", String.Format(CultureInfo.CurrentCulture, CommonResources.Argument_Must_Be_GreaterThanOrEqualTo, "startLine", "0")); throw new ArgumentOutOfRangeException("startLine", CommonResources.Argument_Must_Be_GreaterThanOrEqualTo(0));
} }
if (startColumn < 0) if (startColumn < 0)
{ {
throw new ArgumentOutOfRangeException("startColumn", String.Format(CultureInfo.CurrentCulture, CommonResources.Argument_Must_Be_GreaterThanOrEqualTo, "startColumn", "0")); throw new ArgumentOutOfRangeException("startColumn", CommonResources.Argument_Must_Be_GreaterThanOrEqualTo(0));
} }
if (startGeneratedColumn < 0) if (startGeneratedColumn < 0)
{ {
throw new ArgumentOutOfRangeException("startGeneratedColumn", String.Format(CultureInfo.CurrentCulture, CommonResources.Argument_Must_Be_GreaterThanOrEqualTo, "startGeneratedColumn", "0")); throw new ArgumentOutOfRangeException("startGeneratedColumn", CommonResources.Argument_Must_Be_GreaterThanOrEqualTo(0));
} }
if (codeLength < 0) if (codeLength < 0)
{ {
throw new ArgumentOutOfRangeException("codeLength", String.Format(CultureInfo.CurrentCulture, CommonResources.Argument_Must_Be_GreaterThanOrEqualTo, "codeLength", "0")); throw new ArgumentOutOfRangeException("codeLength", CommonResources.Argument_Must_Be_GreaterThanOrEqualTo(0));
} }
StartOffset = startOffset; StartOffset = startOffset;

View File

@ -9,7 +9,6 @@ using System.Linq;
using Microsoft.AspNet.Razor.Editor; using Microsoft.AspNet.Razor.Editor;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;
@ -139,13 +138,12 @@ namespace Microsoft.AspNet.Razor.Parser
} }
else else
{ {
error = String.Format(CultureInfo.CurrentCulture, RazorResources.ErrorComponent_Character, CurrentSymbol.Content); error = RazorResources.ErrorComponent_Character(CurrentSymbol.Content);
} }
Context.OnError( Context.OnError(
CurrentLocation, CurrentLocation,
RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start, RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start(error));
error);
PutCurrentBack(); PutCurrentBack();
Output(SpanKind.MetaCode); Output(SpanKind.MetaCode);
return; return;
@ -180,8 +178,7 @@ namespace Microsoft.AspNet.Razor.Parser
errorReported = true; errorReported = true;
Context.OnError( Context.OnError(
CurrentLocation, CurrentLocation,
RazorResources.ParseError_MissingCharAfterHelperName, RazorResources.ParseError_MissingCharAfterHelperName("("));
"(");
} }
} }
else else
@ -220,8 +217,8 @@ namespace Microsoft.AspNet.Razor.Parser
{ {
Context.OnError( Context.OnError(
errorLocation, errorLocation,
RazorResources.ParseError_MissingCharAfterHelperParameters, RazorResources.ParseError_MissingCharAfterHelperParameters(
Language.GetSample(CSharpSymbolType.LeftBrace)); Language.GetSample(CSharpSymbolType.LeftBrace)));
} }
} }
@ -294,7 +291,7 @@ namespace Microsoft.AspNet.Razor.Parser
if (nested) if (nested)
{ {
Context.OnError(CurrentLocation, String.Format(CultureInfo.CurrentCulture, RazorResources.ParseError_Sections_Cannot_Be_Nested, RazorResources.SectionExample_CS)); Context.OnError(CurrentLocation, RazorResources.ParseError_Sections_Cannot_Be_Nested(RazorResources.SectionExample_CS));
errorReported = true; errorReported = true;
} }
@ -365,8 +362,8 @@ namespace Microsoft.AspNet.Razor.Parser
{ {
editHandler.AutoCompleteString = "}"; editHandler.AutoCompleteString = "}";
Context.OnError(CurrentLocation, Context.OnError(CurrentLocation,
RazorResources.ParseError_Expected_X, RazorResources.ParseError_Expected_X(
Language.GetSample(CSharpSymbolType.RightBrace)); Language.GetSample(CSharpSymbolType.RightBrace)));
} }
else else
{ {
@ -392,8 +389,7 @@ namespace Microsoft.AspNet.Razor.Parser
if (!At(CSharpSymbolType.LeftBrace)) if (!At(CSharpSymbolType.LeftBrace))
{ {
Context.OnError(CurrentLocation, Context.OnError(CurrentLocation,
RazorResources.ParseError_Expected_X, RazorResources.ParseError_Expected_X(Language.GetSample(CSharpSymbolType.LeftBrace)));
Language.GetSample(CSharpSymbolType.LeftBrace));
CompleteBlock(); CompleteBlock();
Output(SpanKind.MetaCode); Output(SpanKind.MetaCode);
return; return;
@ -418,7 +414,7 @@ namespace Microsoft.AspNet.Razor.Parser
if (!At(CSharpSymbolType.RightBrace)) if (!At(CSharpSymbolType.RightBrace))
{ {
editHandler.AutoCompleteString = "}"; editHandler.AutoCompleteString = "}";
Context.OnError(block.Start, RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, block.Name, "}", "{"); Context.OnError(block.Start, RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(block.Name, "}", "{"));
CompleteBlock(); CompleteBlock();
Output(SpanKind.Code); Output(SpanKind.Code);
} }

View File

@ -7,7 +7,6 @@ using System.Globalization;
using System.Linq; using System.Linq;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;
@ -28,7 +27,7 @@ namespace Microsoft.AspNet.Razor.Parser
protected virtual void ReservedDirective(bool topLevel) protected virtual void ReservedDirective(bool topLevel)
{ {
Context.OnError(CurrentLocation, String.Format(CultureInfo.CurrentCulture, RazorResources.ParseError_ReservedWord, CurrentSymbol.Content)); Context.OnError(CurrentLocation, RazorResources.ParseError_ReservedWord(CurrentSymbol.Content));
AcceptAndMoveNext(); AcceptAndMoveNext();
Span.EditHandler.AcceptedCharacters = AcceptedCharacters.None; Span.EditHandler.AcceptedCharacters = AcceptedCharacters.None;
Span.CodeGenerator = SpanCodeGenerator.Null; Span.CodeGenerator = SpanCodeGenerator.Null;
@ -319,9 +318,9 @@ namespace Microsoft.AspNet.Razor.Parser
if (!At(CSharpSymbolType.LeftBrace)) if (!At(CSharpSymbolType.LeftBrace))
{ {
Context.OnError(CurrentLocation, Context.OnError(CurrentLocation,
RazorResources.ParseError_SingleLine_ControlFlowStatements_Not_Allowed, RazorResources.ParseError_SingleLine_ControlFlowStatements_Not_Allowed(
Language.GetSample(CSharpSymbolType.LeftBrace), Language.GetSample(CSharpSymbolType.LeftBrace),
CurrentSymbol.Content); CurrentSymbol.Content));
} }
// Parse the statement and then we're done // Parse the statement and then we're done
@ -510,8 +509,8 @@ namespace Microsoft.AspNet.Razor.Parser
if (At(CSharpSymbolType.Keyword)) if (At(CSharpSymbolType.Keyword))
{ {
Context.OnError(CurrentLocation, Context.OnError(CurrentLocation,
RazorResources.ParseError_Unexpected_Keyword_After_At, RazorResources.ParseError_Unexpected_Keyword_After_At(
CSharpLanguageCharacteristics.GetKeyword(CurrentSymbol.Keyword.Value)); CSharpLanguageCharacteristics.GetKeyword(CurrentSymbol.Keyword.Value)));
} }
else if (At(CSharpSymbolType.LeftBrace)) else if (At(CSharpSymbolType.LeftBrace))
{ {
@ -604,7 +603,7 @@ namespace Microsoft.AspNet.Razor.Parser
if (EndOfFile) if (EndOfFile)
{ {
Context.OnError(block.Start, RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, block.Name, '}', '{'); Context.OnError(block.Start, RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(block.Name, '}', '{'));
} }
else if (acceptTerminatingBrace) else if (acceptTerminatingBrace)
{ {

View File

@ -7,7 +7,6 @@ using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNet.Razor.Editor; using Microsoft.AspNet.Razor.Editor;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Tokenizer; using Microsoft.AspNet.Razor.Tokenizer;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;
@ -256,7 +255,7 @@ namespace Microsoft.AspNet.Razor.Parser
} }
else else
{ {
Context.OnError(CurrentLocation, RazorResources.ParseError_Unexpected_Character_At_Start_Of_CodeBlock_CS, CurrentSymbol.Content); Context.OnError(CurrentLocation, RazorResources.ParseError_Unexpected_Character_At_Start_Of_CodeBlock_CS(CurrentSymbol.Content));
} }
} }
finally finally
@ -479,7 +478,7 @@ namespace Microsoft.AspNet.Razor.Parser
if (!success) if (!success)
{ {
AcceptUntil(CSharpSymbolType.LessThan); AcceptUntil(CSharpSymbolType.LessThan);
Context.OnError(block.Start, RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, block.Name, ")", "("); Context.OnError(block.Start, RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(block.Name, ")", "("));
} }
// If necessary, put an empty-content marker symbol here // If necessary, put an empty-content marker symbol here

View File

@ -5,7 +5,6 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer; using Microsoft.AspNet.Razor.Tokenizer;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;

View File

@ -4,7 +4,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer; using Microsoft.AspNet.Razor.Tokenizer;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;

View File

@ -7,7 +7,6 @@ using System.Linq;
using Microsoft.AspNet.Razor.Editor; using Microsoft.AspNet.Razor.Editor;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;
@ -666,7 +665,7 @@ namespace Microsoft.AspNet.Razor.Parser
bool seenClose = Optional(HtmlSymbolType.CloseAngle); bool seenClose = Optional(HtmlSymbolType.CloseAngle);
if (!seenClose) if (!seenClose)
{ {
Context.OnError(tag.Item2, RazorResources.ParseError_UnfinishedTag, tag.Item1.Content); Context.OnError(tag.Item2, RazorResources.ParseError_UnfinishedTag(tag.Item1.Content));
} }
else else
{ {
@ -744,7 +743,7 @@ namespace Microsoft.AspNet.Razor.Parser
SkipToAndParseCode(HtmlSymbolType.CloseAngle); SkipToAndParseCode(HtmlSymbolType.CloseAngle);
if (!Optional(HtmlSymbolType.CloseAngle)) if (!Optional(HtmlSymbolType.CloseAngle))
{ {
Context.OnError(tagStart, RazorResources.ParseError_UnfinishedTag, "script"); Context.OnError(tagStart, RazorResources.ParseError_UnfinishedTag("script"));
} }
seenEndScript = true; seenEndScript = true;
} }
@ -781,11 +780,11 @@ namespace Microsoft.AspNet.Razor.Parser
} }
if (currentTag != null) if (currentTag != null)
{ {
Context.OnError(currentTag.Item2, RazorResources.ParseError_MissingEndTag, currentTag.Item1.Content); Context.OnError(currentTag.Item2, RazorResources.ParseError_MissingEndTag(currentTag.Item1.Content));
} }
else else
{ {
Context.OnError(tagStart, RazorResources.ParseError_UnexpectedEndTag, tagName); Context.OnError(tagStart, RazorResources.ParseError_UnexpectedEndTag(tagName));
} }
return false; return false;
} }
@ -800,7 +799,7 @@ namespace Microsoft.AspNet.Razor.Parser
tags.Pop(); tags.Pop();
} }
Tuple<HtmlSymbol, SourceLocation> tag = tags.Pop(); Tuple<HtmlSymbol, SourceLocation> tag = tags.Pop();
Context.OnError(tag.Item2, RazorResources.ParseError_MissingEndTag, tag.Item1.Content); Context.OnError(tag.Item2, RazorResources.ParseError_MissingEndTag(tag.Item1.Content));
} }
else if (complete) else if (complete)
{ {

View File

@ -2,7 +2,6 @@
using System; using System;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;
namespace Microsoft.AspNet.Razor.Parser namespace Microsoft.AspNet.Razor.Parser

View File

@ -3,7 +3,6 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;
namespace Microsoft.AspNet.Razor.Parser namespace Microsoft.AspNet.Razor.Parser

View File

@ -3,7 +3,6 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
namespace Microsoft.AspNet.Razor.Parser namespace Microsoft.AspNet.Razor.Parser

View File

@ -8,7 +8,6 @@ using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Utils; using Microsoft.AspNet.Razor.Utils;

View File

@ -6,7 +6,6 @@ using System.Diagnostics.CodeAnalysis;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
namespace Microsoft.AspNet.Razor.Parser.SyntaxTree namespace Microsoft.AspNet.Razor.Parser.SyntaxTree

View File

@ -9,7 +9,6 @@ using System.Linq;
using Microsoft.AspNet.Razor.Editor; using Microsoft.AspNet.Razor.Editor;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer; using Microsoft.AspNet.Razor.Tokenizer;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;
@ -73,9 +72,9 @@ namespace Microsoft.AspNet.Razor.Parser
if (EndOfFile && !mode.HasFlag(BalancingModes.NoErrorOnFailure)) if (EndOfFile && !mode.HasFlag(BalancingModes.NoErrorOnFailure))
{ {
Context.OnError(start, Context.OnError(start,
RazorResources.ParseError_Expected_CloseBracket_Before_EOF, RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
Language.GetSample(left), Language.GetSample(left),
Language.GetSample(right)); Language.GetSample(right)));
} }
return Balance(mode, left, right, start); return Balance(mode, left, right, start);
@ -121,9 +120,9 @@ namespace Microsoft.AspNet.Razor.Parser
if (!mode.HasFlag(BalancingModes.NoErrorOnFailure)) if (!mode.HasFlag(BalancingModes.NoErrorOnFailure))
{ {
Context.OnError(start, Context.OnError(start,
RazorResources.ParseError_Expected_CloseBracket_Before_EOF, RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
Language.GetSample(left), Language.GetSample(left),
Language.GetSample(right)); Language.GetSample(right)));
} }
if (mode.HasFlag(BalancingModes.BacktrackOnFailure)) if (mode.HasFlag(BalancingModes.BacktrackOnFailure))
{ {
@ -333,7 +332,7 @@ namespace Microsoft.AspNet.Razor.Parser
return false; return false;
} }
protected internal bool Required(TSymbolType expected, bool errorIfNotFound, string errorBase) protected internal bool Required(TSymbolType expected, bool errorIfNotFound, Func<string, string> errorBase)
{ {
bool found = At(expected); bool found = At(expected);
if (!found && errorIfNotFound) if (!found && errorIfNotFound)
@ -353,13 +352,12 @@ namespace Microsoft.AspNet.Razor.Parser
} }
else else
{ {
error = String.Format(CultureInfo.CurrentCulture, RazorResources.ErrorComponent_Character, CurrentSymbol.Content); error = RazorResources.ErrorComponent_Character(CurrentSymbol.Content);
} }
Context.OnError( Context.OnError(
CurrentLocation, CurrentLocation,
errorBase, errorBase(error));
error);
} }
return found; return found;
} }

View File

@ -0,0 +1,85 @@
// <auto-generated />
namespace Microsoft.AspNet.Razor
{
using System.Globalization;
using System.Reflection;
using System.Resources;
internal static class CommonResources
{
private static readonly ResourceManager _resourceManager
= new ResourceManager("Microsoft.AspNet.Razor.CommonResources", typeof(CommonResources).GetTypeInfo().Assembly);
/// <summary>
/// Value cannot be null or an empty string.
/// </summary>
internal static string Argument_Cannot_Be_Null_Or_Empty
{
get { return GetString("Argument_Cannot_Be_Null_Or_Empty"); }
}
/// <summary>
/// Value must be between {0} and {1}.
/// </summary>
internal static string Argument_Must_Be_Between(object p0, object p1)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Argument_Must_Be_Between"), p0, p1);
}
/// <summary>
/// Value must be a value from the "{0}" enumeration.
/// </summary>
internal static string Argument_Must_Be_Enum_Member(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Argument_Must_Be_Enum_Member"), p0);
}
/// <summary>
/// Value must be greater than {0}.
/// </summary>
internal static string Argument_Must_Be_GreaterThan(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Argument_Must_Be_GreaterThan"), p0);
}
/// <summary>
/// Value must be greater than or equal to {0}.
/// </summary>
internal static string Argument_Must_Be_GreaterThanOrEqualTo(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Argument_Must_Be_GreaterThanOrEqualTo"), p0);
}
/// <summary>
/// Value must be less than {0}.
/// </summary>
internal static string Argument_Must_Be_LessThan(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Argument_Must_Be_LessThan"), p0);
}
/// <summary>
/// Value must be less than or equal to {0}.
/// </summary>
internal static string Argument_Must_Be_LessThanOrEqualTo(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Argument_Must_Be_LessThanOrEqualTo"), p0);
}
/// <summary>
/// Value cannot be an empty string. It must either be null or a non-empty string.
/// </summary>
internal static string Argument_Must_Be_Null_Or_Non_Empty
{
get { return GetString("Argument_Must_Be_Null_Or_Non_Empty"); }
}
private static string GetString(string name)
{
string value = _resourceManager.GetString(name);
System.Diagnostics.Debug.Assert(value != null);
return value;
}
}
}

View File

@ -0,0 +1,740 @@
// <auto-generated />
namespace Microsoft.AspNet.Razor
{
using System.Globalization;
using System.Reflection;
using System.Resources;
internal static class RazorResources
{
private static readonly ResourceManager _resourceManager
= new ResourceManager("Microsoft.AspNet.Razor.RazorResources", typeof(RazorResources).GetTypeInfo().Assembly);
/// <summary>
/// The active parser must the same as either the markup or code parser.
/// </summary>
internal static string ActiveParser_Must_Be_Code_Or_Markup_Parser
{
get { return GetString("ActiveParser_Must_Be_Code_Or_Markup_Parser"); }
}
/// <summary>
/// code
/// </summary>
internal static string BlockName_Code
{
get { return GetString("BlockName_Code"); }
}
/// <summary>
/// explicit expression
/// </summary>
internal static string BlockName_ExplicitExpression
{
get { return GetString("BlockName_ExplicitExpression"); }
}
/// <summary>
/// The "CancelBacktrack" method can be called only while in a look-ahead process started with the "BeginLookahead" method.
/// </summary>
internal static string CancelBacktrack_Must_Be_Called_Within_Lookahead
{
get { return GetString("CancelBacktrack_Must_Be_Called_Within_Lookahead"); }
}
/// <summary>
/// "EndBlock" was called without a matching call to "StartBlock".
/// </summary>
internal static string EndBlock_Called_Without_Matching_StartBlock
{
get { return GetString("EndBlock_Called_Without_Matching_StartBlock"); }
}
/// <summary>
/// The "@" character must be followed by a ":", "(", or a C# identifier. If you intended to switch to markup, use an HTML start tag, for example:
///
/// @if(isLoggedIn) {
/// &lt;p&gt;Hello, @user!&lt;/p&gt;
/// }
/// </summary>
internal static string ParseError_AtInCode_Must_Be_Followed_By_Colon_Paren_Or_Identifier_Start
{
get { return GetString("ParseError_AtInCode_Must_Be_Followed_By_Colon_Paren_Or_Identifier_Start"); }
}
/// <summary>
/// End of file was reached before the end of the block comment. All comments started with "/*" sequence must be terminated with a matching "*/" sequence.
/// </summary>
internal static string ParseError_BlockComment_Not_Terminated
{
get { return GetString("ParseError_BlockComment_Not_Terminated"); }
}
/// <summary>
/// An opening "{0}" is missing the corresponding closing "{1}".
/// </summary>
internal static string ParseError_Expected_CloseBracket_Before_EOF(object p0, object p1)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ParseError_Expected_CloseBracket_Before_EOF"), p0, p1);
}
/// <summary>
/// The {0} block is missing a closing "{1}" character. Make sure you have a matching "{1}" character for all the "{2}" characters within this block, and that none of the "{1}" characters are being interpreted as markup.
/// </summary>
internal static string ParseError_Expected_EndOfBlock_Before_EOF(object p0, object p1, object p2)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ParseError_Expected_EndOfBlock_Before_EOF"), p0, p1, p2);
}
/// <summary>
/// Expected "{0}".
/// </summary>
internal static string ParseError_Expected_X(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ParseError_Expected_X"), p0);
}
/// <summary>
/// Inline markup blocks (@&lt;p&gt;Content&lt;/p&gt;) cannot be nested. Only one level of inline markup is allowed.
/// </summary>
internal static string ParseError_InlineMarkup_Blocks_Cannot_Be_Nested
{
get { return GetString("ParseError_InlineMarkup_Blocks_Cannot_Be_Nested"); }
}
/// <summary>
/// Markup in a code block must start with a tag and all start tags must be matched with end tags. Do not use unclosed tags like "&lt;br&gt;". Instead use self-closing tags like "&lt;br/&gt;".
/// </summary>
internal static string ParseError_MarkupBlock_Must_Start_With_Tag
{
get { return GetString("ParseError_MarkupBlock_Must_Start_With_Tag"); }
}
/// <summary>
/// The "{0}" element was not closed. All elements must be either self-closing or have a matching end tag.
/// </summary>
internal static string ParseError_MissingEndTag(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ParseError_MissingEndTag"), p0);
}
/// <summary>
/// Sections cannot be empty. The "@section" keyword must be followed by a block of markup surrounded by "{}". For example:
///
/// @section Sidebar {
/// &lt;!-- Markup and text goes here --&gt;
/// }
/// </summary>
internal static string ParseError_MissingOpenBraceAfterSection
{
get { return GetString("ParseError_MissingOpenBraceAfterSection"); }
}
/// <summary>
/// Namespace imports and type aliases cannot be placed within code blocks. They must immediately follow an "@" character in markup. It is recommended that you put them at the top of the page, as in the following example:
///
/// @using System.Drawing;
/// @{
/// // OK here to use types from System.Drawing in the page.
/// }
/// </summary>
internal static string ParseError_NamespaceImportAndTypeAlias_Cannot_Exist_Within_CodeBlock
{
get { return GetString("ParseError_NamespaceImportAndTypeAlias_Cannot_Exist_Within_CodeBlock"); }
}
/// <summary>
/// Expected a "{0}" but found a "{1}". Block statements must be enclosed in "{{" and "}}". You cannot use single-statement control-flow statements in CSHTML pages. For example, the following is not allowed:
///
/// @if(isLoggedIn)
/// &lt;p&gt;Hello, @user&lt;/p&gt;
///
/// Instead, wrap the contents of the block in "{{}}":
///
/// @if(isLoggedIn) {{
/// &lt;p&gt;Hello, @user&lt;/p&gt;
/// }}
/// </summary>
internal static string ParseError_SingleLine_ControlFlowStatements_Not_Allowed(object p0, object p1)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ParseError_SingleLine_ControlFlowStatements_Not_Allowed"), p0, p1);
}
/// <summary>
/// Encountered end tag "{0}" with no matching start tag. Are your start/end tags properly balanced?
/// </summary>
internal static string ParseError_UnexpectedEndTag(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ParseError_UnexpectedEndTag"), p0);
}
/// <summary>
/// Unexpected {0} after section keyword. Section names must start with an "_" or alphabetic character, and the remaining characters must be either "_" or alphanumeric.
/// </summary>
internal static string ParseError_Unexpected_Character_At_Section_Name_Start(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ParseError_Unexpected_Character_At_Section_Name_Start"), p0);
}
/// <summary>
/// "{0}" is not valid at the start of a code block. Only identifiers, keywords, comments, "(" and "{{" are valid.
/// </summary>
internal static string ParseError_Unexpected_Character_At_Start_Of_CodeBlock_CS(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ParseError_Unexpected_Character_At_Start_Of_CodeBlock_CS"), p0);
}
/// <summary>
/// End of file or an unexpected character was reached before the "{0}" tag could be parsed. Elements inside markup blocks must be complete. They must either be self-closing ("&lt;br /&gt;") or have matching end tags ("&lt;p&gt;Hello&lt;/p&gt;"). If you intended to display a "&lt;" character, use the "&lt;" HTML entity.
/// </summary>
internal static string ParseError_UnfinishedTag(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ParseError_UnfinishedTag"), p0);
}
/// <summary>
/// Unterminated string literal. Strings that start with a quotation mark (") must be terminated before the end of the line. However, strings that start with @ and a quotation mark (@") can span multiple lines.
/// </summary>
internal static string ParseError_Unterminated_String_Literal
{
get { return GetString("ParseError_Unterminated_String_Literal"); }
}
/// <summary>
/// Unknown option: "{0}".
/// </summary>
internal static string ParseError_UnknownOption(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ParseError_UnknownOption"), p0);
}
/// <summary>
/// The "{0}" block was not terminated. All "{0}" statements must be terminated with a matching "{1}".
/// </summary>
internal static string ParseError_BlockNotTerminated(object p0, object p1)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ParseError_BlockNotTerminated"), p0, p1);
}
/// <summary>
/// @section Header { ... }
/// </summary>
internal static string SectionExample_CS
{
get { return GetString("SectionExample_CS"); }
}
/// <summary>
/// "&lt;text&gt;" and "&lt;/text&gt;" tags cannot contain attributes.
/// </summary>
internal static string ParseError_TextTagCannotContainAttributes
{
get { return GetString("ParseError_TextTagCannotContainAttributes"); }
}
/// <summary>
/// The "Imports" keyword must be followed by a namespace or a type alias on the same line.
/// </summary>
internal static string ParseError_NamespaceOrTypeAliasExpected
{
get { return GetString("ParseError_NamespaceOrTypeAliasExpected"); }
}
/// <summary>
/// A space or line break was encountered after the "@" character. Only valid identifiers, keywords, comments, "(" and "{" are valid at the start of a code block and they must occur immediately following "@" with no space in between.
/// </summary>
internal static string ParseError_Unexpected_WhiteSpace_At_Start_Of_CodeBlock_CS
{
get { return GetString("ParseError_Unexpected_WhiteSpace_At_Start_Of_CodeBlock_CS"); }
}
/// <summary>
/// The 'inherits' keyword must be followed by a type name on the same line.
/// </summary>
internal static string ParseError_InheritsKeyword_Must_Be_Followed_By_TypeName
{
get { return GetString("ParseError_InheritsKeyword_Must_Be_Followed_By_TypeName"); }
}
/// <summary>
/// Outer tag is missing a name. The first character of a markup block must be an HTML tag with a valid name.
/// </summary>
internal static string ParseError_OuterTagMissingName
{
get { return GetString("ParseError_OuterTagMissingName"); }
}
/// <summary>
/// End of file was reached before the end of the block comment. All comments that start with the "@*" sequence must be terminated with a matching "*@" sequence.
/// </summary>
internal static string ParseError_RazorComment_Not_Terminated
{
get { return GetString("ParseError_RazorComment_Not_Terminated"); }
}
/// <summary>
/// "{0}" character
/// </summary>
internal static string ErrorComponent_Character(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ErrorComponent_Character"), p0);
}
/// <summary>
/// end of file
/// </summary>
internal static string ErrorComponent_EndOfFile
{
get { return GetString("ErrorComponent_EndOfFile"); }
}
/// <summary>
/// space or line break
/// </summary>
internal static string ErrorComponent_Whitespace
{
get { return GetString("ErrorComponent_Whitespace"); }
}
/// <summary>
/// End-of-file was found after the "@" character. "@" must be followed by a valid code block. If you want to output an "@", escape it using the sequence: "@@"
/// </summary>
internal static string ParseError_Unexpected_EndOfFile_At_Start_Of_CodeBlock
{
get { return GetString("ParseError_Unexpected_EndOfFile_At_Start_Of_CodeBlock"); }
}
/// <summary>
/// The {0} property of the {1} structure cannot be null.
/// </summary>
internal static string Structure_Member_CannotBeNull(object p0, object p1)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Structure_Member_CannotBeNull"), p0, p1);
}
/// <summary>
/// Expected a "{0}" after the helper parameters.
/// </summary>
internal static string ParseError_MissingCharAfterHelperParameters(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ParseError_MissingCharAfterHelperParameters"), p0);
}
/// <summary>
/// Expected a "{0}" after the helper name.
/// </summary>
internal static string ParseError_MissingCharAfterHelperName(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ParseError_MissingCharAfterHelperName"), p0);
}
/// <summary>
/// Helper parameter list is missing a closing ")".
/// </summary>
internal static string ParseError_UnterminatedHelperParameterList
{
get { return GetString("ParseError_UnterminatedHelperParameterList"); }
}
/// <summary>
/// Helper blocks cannot be nested within each other.
/// </summary>
internal static string ParseError_Helpers_Cannot_Be_Nested
{
get { return GetString("ParseError_Helpers_Cannot_Be_Nested"); }
}
/// <summary>
/// Parser was started with a null Context property. The Context property must be set BEFORE calling any methods on the parser.
/// </summary>
internal static string Parser_Context_Not_Set
{
get { return GetString("Parser_Context_Not_Set"); }
}
/// <summary>
/// Unexpected "{0}" keyword after "@" character. Once inside code, you do not need to prefix constructs like "{0}" with "@".
/// </summary>
internal static string ParseError_Unexpected_Keyword_After_At(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ParseError_Unexpected_Keyword_After_At"), p0);
}
/// <summary>
/// "{0}" is a reserved word and cannot be used in implicit expressions. An explicit expression ("@()") must be used.
/// </summary>
internal static string ParseError_ReservedWord(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ParseError_ReservedWord"), p0);
}
/// <summary>
/// Unexpected {0} after helper keyword. All helpers must have a name which starts with an "_" or alphabetic character. The remaining characters must be either "_" or alphanumeric.
/// </summary>
internal static string ParseError_Unexpected_Character_At_Helper_Name_Start(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ParseError_Unexpected_Character_At_Helper_Name_Start"), p0);
}
/// <summary>
/// Cannot resume this symbol. Only the symbol immediately preceding the current one can be resumed.
/// </summary>
internal static string Tokenizer_CannotResumeSymbolUnlessIsPrevious
{
get { return GetString("Tokenizer_CannotResumeSymbolUnlessIsPrevious"); }
}
/// <summary>
/// Cannot finish span, there is no current block. Call StartBlock at least once before finishing a span
/// </summary>
internal static string ParserContext_NoCurrentBlock
{
get { return GetString("ParserContext_NoCurrentBlock"); }
}
/// <summary>
/// Cannot complete the tree, there are still open blocks.
/// </summary>
internal static string ParserContext_CannotCompleteTree_OutstandingBlocks
{
get { return GetString("ParserContext_CannotCompleteTree_OutstandingBlocks"); }
}
/// <summary>
/// Cannot complete the tree, StartBlock must be called at least once.
/// </summary>
internal static string ParserContext_CannotCompleteTree_NoRootBlock
{
get { return GetString("ParserContext_CannotCompleteTree_NoRootBlock"); }
}
/// <summary>
/// Cannot complete action, the parser has finished. Only CompleteParse can be called to extract the final parser results after the parser has finished
/// </summary>
internal static string ParserContext_ParseComplete
{
get { return GetString("ParserContext_ParseComplete"); }
}
/// <summary>
/// Block cannot be built because a Type has not been specified in the BlockBuilder
/// </summary>
internal static string Block_Type_Not_Specified
{
get { return GetString("Block_Type_Not_Specified"); }
}
/// <summary>
/// &lt;&lt;character literal&gt;&gt;
/// </summary>
internal static string CSharpSymbol_CharacterLiteral
{
get { return GetString("CSharpSymbol_CharacterLiteral"); }
}
/// <summary>
/// &lt;&lt;comment&gt;&gt;
/// </summary>
internal static string CSharpSymbol_Comment
{
get { return GetString("CSharpSymbol_Comment"); }
}
/// <summary>
/// &lt;&lt;identifier&gt;&gt;
/// </summary>
internal static string CSharpSymbol_Identifier
{
get { return GetString("CSharpSymbol_Identifier"); }
}
/// <summary>
/// &lt;&lt;integer literal&gt;&gt;
/// </summary>
internal static string CSharpSymbol_IntegerLiteral
{
get { return GetString("CSharpSymbol_IntegerLiteral"); }
}
/// <summary>
/// &lt;&lt;keyword&gt;&gt;
/// </summary>
internal static string CSharpSymbol_Keyword
{
get { return GetString("CSharpSymbol_Keyword"); }
}
/// <summary>
/// &lt;&lt;newline sequence&gt;&gt;
/// </summary>
internal static string CSharpSymbol_Newline
{
get { return GetString("CSharpSymbol_Newline"); }
}
/// <summary>
/// &lt;&lt;real literal&gt;&gt;
/// </summary>
internal static string CSharpSymbol_RealLiteral
{
get { return GetString("CSharpSymbol_RealLiteral"); }
}
/// <summary>
/// &lt;&lt;string literal&gt;&gt;
/// </summary>
internal static string CSharpSymbol_StringLiteral
{
get { return GetString("CSharpSymbol_StringLiteral"); }
}
/// <summary>
/// &lt;&lt;white space&gt;&gt;
/// </summary>
internal static string CSharpSymbol_Whitespace
{
get { return GetString("CSharpSymbol_Whitespace"); }
}
/// <summary>
/// &lt;&lt;unknown&gt;&gt;
/// </summary>
internal static string Symbol_Unknown
{
get { return GetString("Symbol_Unknown"); }
}
/// <summary>
/// In order to put a symbol back, it must have been the symbol which ended at the current position. The specified symbol ends at {0}, but the current position is {1}
/// </summary>
internal static string TokenizerView_CannotPutBack(object p0, object p1)
{
return string.Format(CultureInfo.CurrentCulture, GetString("TokenizerView_CannotPutBack"), p0, p1);
}
/// <summary>
/// Unexpected "{0}"
/// </summary>
internal static string ParseError_Unexpected(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ParseError_Unexpected"), p0);
}
/// <summary>
/// Unexpected "{" after "@" character. Once inside the body of a code block (@if {}, @{}, etc.) you do not need to use "@{" to switch to code.
/// </summary>
internal static string ParseError_Unexpected_Nested_CodeBlock
{
get { return GetString("ParseError_Unexpected_Nested_CodeBlock"); }
}
/// <summary>
/// line break
/// </summary>
internal static string ErrorComponent_Newline
{
get { return GetString("ErrorComponent_Newline"); }
}
/// <summary>
/// &lt;&lt;newline sequence&gt;&gt;
/// </summary>
internal static string HtmlSymbol_NewLine
{
get { return GetString("HtmlSymbol_NewLine"); }
}
/// <summary>
/// &lt;&lt;razor comment&gt;&gt;
/// </summary>
internal static string HtmlSymbol_RazorComment
{
get { return GetString("HtmlSymbol_RazorComment"); }
}
/// <summary>
/// &lt;&lt;text&gt;&gt;
/// </summary>
internal static string HtmlSymbol_Text
{
get { return GetString("HtmlSymbol_Text"); }
}
/// <summary>
/// &lt;&lt;white space&gt;&gt;
/// </summary>
internal static string HtmlSymbol_WhiteSpace
{
get { return GetString("HtmlSymbol_WhiteSpace"); }
}
/// <summary>
/// The parser provided to the ParserContext was not a Markup Parser.
/// </summary>
internal static string ParserIsNotAMarkupParser
{
get { return GetString("ParserIsNotAMarkupParser"); }
}
/// <summary>
/// Cannot use built-in RazorComment handler, language characteristics does not define the CommentStart, CommentStar and CommentBody known symbol types or parser does not override TokenizerBackedParser.OutputSpanBeforeRazorComment
/// </summary>
internal static string Language_Does_Not_Support_RazorComment
{
get { return GetString("Language_Does_Not_Support_RazorComment"); }
}
/// <summary>
/// Missing value for session state directive.
/// </summary>
internal static string ParserEror_SessionDirectiveMissingValue
{
get { return GetString("ParserEror_SessionDirectiveMissingValue"); }
}
/// <summary>
/// Cannot call CreateCodeWriter, a CodeWriter was not provided to the Create method
/// </summary>
internal static string CreateCodeWriter_NoCodeWriter
{
get { return GetString("CreateCodeWriter_NoCodeWriter"); }
}
/// <summary>
/// [BG][{0}] Shutdown
/// </summary>
internal static string Trace_BackgroundThreadShutdown(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Trace_BackgroundThreadShutdown"), p0);
}
/// <summary>
/// [BG][{0}] Startup
/// </summary>
internal static string Trace_BackgroundThreadStart(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Trace_BackgroundThreadStart"), p0);
}
/// <summary>
/// [BG][{0}] {1} changes arrived
/// </summary>
internal static string Trace_ChangesArrived(object p0, object p1)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Trace_ChangesArrived"), p0, p1);
}
/// <summary>
/// [BG][{0}] Discarded {1} changes
/// </summary>
internal static string Trace_ChangesDiscarded(object p0, object p1)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Trace_ChangesDiscarded"), p0, p1);
}
/// <summary>
/// [BG][{0}] Collecting {1} discarded changes
/// </summary>
internal static string Trace_CollectedDiscardedChanges(object p0, object p1)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Trace_CollectedDiscardedChanges"), p0, p1);
}
/// <summary>
/// Disabled
/// </summary>
internal static string Trace_Disabled
{
get { return GetString("Trace_Disabled"); }
}
/// <summary>
/// [P][{0}] {3} Change in {2} milliseconds: {1}
/// </summary>
internal static string Trace_EditorProcessedChange(object p0, object p1, object p2, object p3)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Trace_EditorProcessedChange"), p0, p1, p2, p3);
}
/// <summary>
/// [P][{0}] Received Change: {1}
/// </summary>
internal static string Trace_EditorReceivedChange(object p0, object p1)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Trace_EditorReceivedChange"), p0, p1);
}
/// <summary>
/// Enabled
/// </summary>
internal static string Trace_Enabled
{
get { return GetString("Trace_Enabled"); }
}
/// <summary>
/// [Razor] {0}
/// </summary>
internal static string Trace_Format(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Trace_Format"), p0);
}
/// <summary>
/// [BG][{0}] no changes arrived?
/// </summary>
internal static string Trace_NoChangesArrived(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Trace_NoChangesArrived"), p0);
}
/// <summary>
/// [BG][{0}] Parse Complete in {1} milliseconds
/// </summary>
internal static string Trace_ParseComplete(object p0, object p1)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Trace_ParseComplete"), p0, p1);
}
/// <summary>
/// [M][{0}] Queuing Parse for: {1}
/// </summary>
internal static string Trace_QueuingParse(object p0, object p1)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Trace_QueuingParse"), p0, p1);
}
/// <summary>
/// [Razor] Editor Tracing {0}
/// </summary>
internal static string Trace_Startup(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Trace_Startup"), p0);
}
/// <summary>
/// [BG][{0}] Trees Compared in {1} milliseconds. Different = {2}
/// </summary>
internal static string Trace_TreesCompared(object p0, object p1, object p2)
{
return string.Format(CultureInfo.CurrentCulture, GetString("Trace_TreesCompared"), p0, p1, p2);
}
/// <summary>
/// Section blocks ("{0}") cannot be nested. Only one level of section blocks are allowed.
/// </summary>
internal static string ParseError_Sections_Cannot_Be_Nested(object p0)
{
return string.Format(CultureInfo.CurrentCulture, GetString("ParseError_Sections_Cannot_Be_Nested"), p0);
}
private static string GetString(string name)
{
string value = _resourceManager.GetString(name);
System.Diagnostics.Debug.Assert(value != null);
return value;
}
}
}

View File

@ -7,7 +7,6 @@ using System.Globalization;
using System.IO; using System.IO;
using Microsoft.AspNet.Razor.Editor; using Microsoft.AspNet.Razor.Editor;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.Internal.Web.Utils; using Microsoft.Internal.Web.Utils;
@ -131,11 +130,10 @@ namespace Microsoft.AspNet.Razor
Stopwatch sw = new Stopwatch(); Stopwatch sw = new Stopwatch();
sw.Start(); sw.Start();
#endif #endif
RazorEditorTrace.TraceLine(RazorResources.Trace_EditorReceivedChange, Path.GetFileName(FileName), change); RazorEditorTrace.TraceLine(RazorResources.Trace_EditorReceivedChange(Path.GetFileName(FileName), change));
if (change.NewBuffer == null) if (change.NewBuffer == null)
{ {
throw new ArgumentException(String.Format(CultureInfo.CurrentUICulture, throw new ArgumentException(RazorResources.Structure_Member_CannotBeNull(
RazorResources.Structure_Member_CannotBeNull,
"Buffer", "Buffer",
"TextChange"), "change"); "TextChange"), "change");
} }
@ -171,7 +169,11 @@ namespace Microsoft.AspNet.Razor
elapsedMs = sw.ElapsedMilliseconds; elapsedMs = sw.ElapsedMilliseconds;
sw.Reset(); sw.Reset();
#endif #endif
RazorEditorTrace.TraceLine(RazorResources.Trace_EditorProcessedChange, Path.GetFileName(FileName), changeString, elapsedMs.HasValue ? elapsedMs.Value.ToString(CultureInfo.InvariantCulture) : "?", result.ToString()); RazorEditorTrace.TraceLine(
RazorResources.Trace_EditorProcessedChange(
Path.GetFileName(FileName),
changeString, elapsedMs.HasValue ? elapsedMs.Value.ToString(CultureInfo.InvariantCulture) : "?",
result.ToString()));
return result; return result;
} }

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Utils; using Microsoft.AspNet.Razor.Utils;
namespace Microsoft.AspNet.Razor.Text namespace Microsoft.AspNet.Razor.Text

View File

@ -2,7 +2,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Utils; using Microsoft.AspNet.Razor.Utils;
namespace Microsoft.AspNet.Razor.Text namespace Microsoft.AspNet.Razor.Text

View File

@ -27,19 +27,19 @@ namespace Microsoft.AspNet.Razor.Text
{ {
if (oldPosition < 0) if (oldPosition < 0)
{ {
throw new ArgumentOutOfRangeException("oldPosition", String.Format(CultureInfo.CurrentCulture, CommonResources.Argument_Must_Be_GreaterThanOrEqualTo, "0")); throw new ArgumentOutOfRangeException("oldPosition", CommonResources.Argument_Must_Be_GreaterThanOrEqualTo(0));
} }
if (newPosition < 0) if (newPosition < 0)
{ {
throw new ArgumentOutOfRangeException("newPosition", String.Format(CultureInfo.CurrentCulture, CommonResources.Argument_Must_Be_GreaterThanOrEqualTo, "0")); throw new ArgumentOutOfRangeException("newPosition", CommonResources.Argument_Must_Be_GreaterThanOrEqualTo(0));
} }
if (oldLength < 0) if (oldLength < 0)
{ {
throw new ArgumentOutOfRangeException("oldLength", String.Format(CultureInfo.CurrentCulture, CommonResources.Argument_Must_Be_GreaterThanOrEqualTo, "0")); throw new ArgumentOutOfRangeException("oldLength", CommonResources.Argument_Must_Be_GreaterThanOrEqualTo(0));
} }
if (newLength < 0) if (newLength < 0)
{ {
throw new ArgumentOutOfRangeException("newLength", String.Format(CultureInfo.CurrentCulture, CommonResources.Argument_Must_Be_GreaterThanOrEqualTo, "0")); throw new ArgumentOutOfRangeException("newLength", CommonResources.Argument_Must_Be_GreaterThanOrEqualTo(0));
} }
if (oldBuffer == null) if (oldBuffer == null)
{ {

View File

@ -5,7 +5,6 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;

View File

@ -9,7 +9,6 @@ using System.Linq;
using System.Text; using System.Text;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;

View File

@ -4,7 +4,6 @@ using System;
using System.Diagnostics; using System.Diagnostics;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Globalization; using System.Globalization;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;
@ -43,10 +42,9 @@ namespace Microsoft.AspNet.Razor.Tokenizer
{ {
// We've already passed this symbol // We've already passed this symbol
throw new InvalidOperationException( throw new InvalidOperationException(
String.Format(CultureInfo.CurrentCulture, RazorResources.TokenizerView_CannotPutBack(
RazorResources.TokenizerView_CannotPutBack, symbol.Start.AbsoluteIndex + symbol.Content.Length,
symbol.Start.AbsoluteIndex + symbol.Content.Length, Source.Position));
Source.Position));
} }
Source.Position -= symbol.Content.Length; Source.Position -= symbol.Content.Length;
Current = null; Current = null;

View File

@ -6,7 +6,6 @@ using System.Web.WebPages.TestUtils;
using Microsoft.AspNet.Razor.Editor; using Microsoft.AspNet.Razor.Editor;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.AspNet.Razor.Test.Utils; using Microsoft.AspNet.Razor.Test.Utils;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
@ -105,7 +104,7 @@ namespace Microsoft.AspNet.Razor.Test.Editor
CreateHost(), CreateHost(),
"C:\\Foo.cshtml").CheckForStructureChanges(change), "C:\\Foo.cshtml").CheckForStructureChanges(change),
"change", "change",
String.Format(RazorResources.Structure_Member_CannotBeNull, "Buffer", "TextChange")); RazorResources.Structure_Member_CannotBeNull("Buffer", "TextChange"));
} }
private static RazorEngineHost CreateHost() private static RazorEngineHost CreateHost()

View File

@ -4,7 +4,6 @@ using System;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;
@ -29,7 +28,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
{ {
AutoCompleteString = "}" AutoCompleteString = "}"
})), })),
new RazorError(String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, "functions", "}", "{"), new RazorError(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF("functions", "}", "{"),
1, 0, 1)); 1, 0, 1));
} }
@ -50,7 +49,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
.With(new AutoCompleteEditHandler(CSharpLanguageCharacteristics.Instance.TokenizeString) { AutoCompleteString = "}" }) .With(new AutoCompleteEditHandler(CSharpLanguageCharacteristics.Instance.TokenizeString) { AutoCompleteString = "}" })
) )
), ),
new RazorError(String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, "helper", "}", "{"), new RazorError(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF("helper", "}", "{"),
1, 0, 1)); 1, 0, 1));
} }
@ -65,7 +64,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
.Accepts(AcceptedCharacters.Any), .Accepts(AcceptedCharacters.Any),
new MarkupBlock()), new MarkupBlock()),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_X, "}"), RazorResources.ParseError_Expected_X("}"),
17, 0, 17)); 17, 0, 17));
} }
@ -80,7 +79,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
.AsStatement() .AsStatement()
.With(new AutoCompleteEditHandler(CSharpLanguageCharacteristics.Instance.TokenizeString) { AutoCompleteString = "}" }) .With(new AutoCompleteEditHandler(CSharpLanguageCharacteristics.Instance.TokenizeString) { AutoCompleteString = "}" })
), ),
new RazorError(String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, RazorResources.BlockName_Code, "}", "{"), new RazorError(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(RazorResources.BlockName_Code, "}", "{"),
1, 0, 1)); 1, 0, 1));
} }
@ -100,7 +99,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
{ {
AutoCompleteString = "}" AutoCompleteString = "}"
})), })),
new RazorError(String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, "functions", "}", "{"), new RazorError(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF("functions", "}", "{"),
1, 0, 1)); 1, 0, 1));
} }
@ -129,7 +128,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
.With(new StatementCodeGenerator()) .With(new StatementCodeGenerator())
) )
), ),
new RazorError(String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, "helper", "}", "{"), new RazorError(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF("helper", "}", "{"),
1, 0, 1)); 1, 0, 1));
} }
@ -145,7 +144,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
.Accepts(AcceptedCharacters.Any), .Accepts(AcceptedCharacters.Any),
new MarkupBlock( new MarkupBlock(
Factory.Markup("\r\n<p>Foo</p>"))), Factory.Markup("\r\n<p>Foo</p>"))),
new RazorError(String.Format(RazorResources.ParseError_Expected_X, "}"), new RazorError(RazorResources.ParseError_Expected_X("}"),
29, 1, 10)); 29, 1, 10));
} }
@ -168,7 +167,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Span(SpanKind.Code, new CSharpSymbol(Factory.LocationTracker.CurrentLocation, String.Empty, CSharpSymbolType.Unknown)) Factory.Span(SpanKind.Code, new CSharpSymbol(Factory.LocationTracker.CurrentLocation, String.Empty, CSharpSymbolType.Unknown))
.With(new StatementCodeGenerator()) .With(new StatementCodeGenerator())
), ),
new RazorError(String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, RazorResources.BlockName_Code, "}", "{"), new RazorError(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(RazorResources.BlockName_Code, "}", "{"),
1, 0, 1)); 1, 0, 1));
} }
} }

View File

@ -4,7 +4,6 @@ using System;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;
@ -45,7 +44,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
), ),
Factory.Code(" }").AsStatement()), Factory.Code(" }").AsStatement()),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Unexpected_Keyword_After_At, RazorResources.ParseError_Unexpected_Keyword_After_At(
"if"), "if"),
new SourceLocation(13, 0, 13))); new SourceLocation(13, 0, 13)));
} }
@ -108,7 +107,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
ImplicitExpressionTest("Html.En(code()", "Html.En(code()", ImplicitExpressionTest("Html.En(code()", "Html.En(code()",
AcceptedCharacters.Any, AcceptedCharacters.Any,
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_CloseBracket_Before_EOF, RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
"(", ")"), "(", ")"),
new SourceLocation(8, 0, 8))); new SourceLocation(8, 0, 8)));
} }
@ -390,7 +389,7 @@ while(true);", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedC
{ {
const string document = "foreach(var f in Foo) { // foo bar baz"; const string document = "foreach(var f in Foo) { // foo bar baz";
SingleSpanBlockTest(document, document, BlockType.Statement, SpanKind.Code, SingleSpanBlockTest(document, document, BlockType.Statement, SpanKind.Code,
new RazorError(String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, "foreach", '}', '{'), SourceLocation.Zero)); new RazorError(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF("foreach", '}', '{'), SourceLocation.Zero));
} }
[Fact] [Fact]
@ -399,7 +398,7 @@ while(true);", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedC
const string document = "foreach(var f in Foo) { /* foo bar baz"; const string document = "foreach(var f in Foo) { /* foo bar baz";
SingleSpanBlockTest(document, document, BlockType.Statement, SpanKind.Code, SingleSpanBlockTest(document, document, BlockType.Statement, SpanKind.Code,
new RazorError(String.Format(RazorResources.ParseError_BlockComment_Not_Terminated), 24, 0, 24), new RazorError(String.Format(RazorResources.ParseError_BlockComment_Not_Terminated), 24, 0, 24),
new RazorError(String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, "foreach", '}', '{'), SourceLocation.Zero)); new RazorError(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF("foreach", '}', '{'), SourceLocation.Zero));
} }
[Fact] [Fact]
@ -407,7 +406,7 @@ while(true);", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedC
{ {
const string document = "foreach(var f in Foo) { / foo bar baz"; const string document = "foreach(var f in Foo) { / foo bar baz";
SingleSpanBlockTest(document, document, BlockType.Statement, SpanKind.Code, SingleSpanBlockTest(document, document, BlockType.Statement, SpanKind.Code,
new RazorError(String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, "foreach", '}', '{'), SourceLocation.Zero)); new RazorError(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF("foreach", '}', '{'), SourceLocation.Zero));
} }
[Fact] [Fact]

View File

@ -3,7 +3,6 @@
using System; using System;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.TestCommon; using Microsoft.TestCommon;
@ -23,7 +22,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
.Accepts(AcceptedCharacters.NonWhiteSpace) .Accepts(AcceptedCharacters.NonWhiteSpace)
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Unexpected_Character_At_Start_Of_CodeBlock_CS, '"'), RazorResources.ParseError_Unexpected_Character_At_Start_Of_CodeBlock_CS('"'),
1, 0, 1)); 1, 0, 1));
} }
@ -48,7 +47,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
.With(new AutoCompleteEditHandler(CSharpLanguageCharacteristics.Instance.TokenizeString) { AutoCompleteString = "}" }) .With(new AutoCompleteEditHandler(CSharpLanguageCharacteristics.Instance.TokenizeString) { AutoCompleteString = "}" })
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
RazorResources.BlockName_Code, RazorResources.BlockName_Code,
"}", "{"), "}", "{"),
SourceLocation.Zero)); SourceLocation.Zero));
@ -114,7 +113,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
), ),
new RazorError(RazorResources.ParseError_Unexpected_EndOfFile_At_Start_Of_CodeBlock, 8, 1, 5), new RazorError(RazorResources.ParseError_Unexpected_EndOfFile_At_Start_Of_CodeBlock, 8, 1, 5),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, RazorResources.BlockName_Code, "}", "{"), RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(RazorResources.BlockName_Code, "}", "{"),
SourceLocation.Zero)); SourceLocation.Zero));
} }
@ -128,7 +127,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
.Accepts(AcceptedCharacters.NonWhiteSpace)), .Accepts(AcceptedCharacters.NonWhiteSpace)),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Unexpected_Character_At_Start_Of_CodeBlock_CS, "!"), RazorResources.ParseError_Unexpected_Character_At_Start_Of_CodeBlock_CS("!"),
1, 0, 1)); 1, 0, 1));
} }
@ -142,7 +141,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("foo bar\r\nbaz").AsExpression() Factory.Code("foo bar\r\nbaz").AsExpression()
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
RazorResources.BlockName_ExplicitExpression, ')', '('), RazorResources.BlockName_ExplicitExpression, ')', '('),
new SourceLocation(0, 0, 0))); new SourceLocation(0, 0, 0)));
} }
@ -159,7 +158,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("foo bar\r\n").AsExpression() Factory.Code("foo bar\r\n").AsExpression()
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
RazorResources.BlockName_ExplicitExpression, ')', '('), RazorResources.BlockName_ExplicitExpression, ')', '('),
new SourceLocation(0, 0, 0))); new SourceLocation(0, 0, 0)));
} }
@ -174,7 +173,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_CloseBracket_Before_EOF, RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
"(", ")"), "(", ")"),
new SourceLocation(4, 0, 4))); new SourceLocation(4, 0, 4)));
} }
@ -190,7 +189,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("Foo(Bar(Baz)\r\nBiz\r\nBoz") Factory.Code("Foo(Bar(Baz)\r\nBiz\r\nBoz")
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
), ),
new RazorError(String.Format(RazorResources.ParseError_Expected_CloseBracket_Before_EOF, new RazorError(RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
"(", ")"), "(", ")"),
new SourceLocation(3, 0, 3))); new SourceLocation(3, 0, 3)));
} }
@ -208,7 +207,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("Foo(Bar(Baz)\r\nBiz\r\n") Factory.Code("Foo(Bar(Baz)\r\nBiz\r\n")
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
), ),
new RazorError(String.Format(RazorResources.ParseError_Expected_CloseBracket_Before_EOF, new RazorError(RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
"(", ")"), "(", ")"),
new SourceLocation(3, 0, 3))); new SourceLocation(3, 0, 3)));
} }
@ -225,7 +224,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_CloseBracket_Before_EOF, RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
"[", "]"), "[", "]"),
new SourceLocation(3, 0, 3))); new SourceLocation(3, 0, 3)));
} }
@ -244,7 +243,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_CloseBracket_Before_EOF, RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
"[", "]"), "[", "]"),
new SourceLocation(3, 0, 3))); new SourceLocation(3, 0, 3)));
} }
@ -259,7 +258,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code(" var foo = bar; if(foo != null) { bar(); } ").AsStatement() Factory.Code(" var foo = bar; if(foo != null) { bar(); } ").AsStatement()
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
RazorResources.BlockName_Code, '}', '{'), RazorResources.BlockName_Code, '}', '{'),
SourceLocation.Zero)); SourceLocation.Zero));
} }
@ -273,7 +272,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code(" var foo = bar; if(foo != null) { bar(); } ").AsFunctionsBody() Factory.Code(" var foo = bar; if(foo != null) { bar(); } ").AsFunctionsBody()
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
"functions", '}', '{'), "functions", '}', '{'),
SourceLocation.Zero)); SourceLocation.Zero));
} }
@ -292,7 +291,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("if(foo) { baz(); } else { var foo = bar; if(foo != null) { bar(); } ").AsStatement() Factory.Code("if(foo) { baz(); } else { var foo = bar; if(foo != null) { bar(); } ").AsStatement()
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
"else", '}', '{'), "else", '}', '{'),
new SourceLocation(19, 0, 19))); new SourceLocation(19, 0, 19)));
} }
@ -305,7 +304,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("if(foo) { baz(); } else if { var foo = bar; if(foo != null) { bar(); } ").AsStatement() Factory.Code("if(foo) { baz(); } else if { var foo = bar; if(foo != null) { bar(); } ").AsStatement()
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
"else if", '}', '{'), "else if", '}', '{'),
new SourceLocation(19, 0, 19))); new SourceLocation(19, 0, 19)));
} }
@ -318,7 +317,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("do { var foo = bar; if(foo != null) { bar(); } ").AsStatement() Factory.Code("do { var foo = bar; if(foo != null) { bar(); } ").AsStatement()
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
"do", '}', '{'), "do", '}', '{'),
SourceLocation.Zero)); SourceLocation.Zero));
} }
@ -331,7 +330,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("try { var foo = bar; if(foo != null) { bar(); } ").AsStatement() Factory.Code("try { var foo = bar; if(foo != null) { bar(); } ").AsStatement()
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
"try", '}', '{'), "try", '}', '{'),
SourceLocation.Zero)); SourceLocation.Zero));
} }
@ -344,7 +343,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("try { baz(); } catch(Foo) { var foo = bar; if(foo != null) { bar(); } ").AsStatement() Factory.Code("try { baz(); } catch(Foo) { var foo = bar; if(foo != null) { bar(); } ").AsStatement()
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
"catch", '}', '{'), "catch", '}', '{'),
new SourceLocation(15, 0, 15))); new SourceLocation(15, 0, 15)));
} }
@ -357,7 +356,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("try { baz(); } finally { var foo = bar; if(foo != null) { bar(); } ").AsStatement() Factory.Code("try { baz(); } finally { var foo = bar; if(foo != null) { bar(); } ").AsStatement()
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
"finally", '}', '{'), "finally", '}', '{'),
new SourceLocation(15, 0, 15))); new SourceLocation(15, 0, 15)));
} }
@ -401,7 +400,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
[Fact] [Fact]
public void ParseBlockRequiresControlFlowStatementsToHaveBraces() public void ParseBlockRequiresControlFlowStatementsToHaveBraces()
{ {
string expectedMessage = String.Format(RazorResources.ParseError_SingleLine_ControlFlowStatements_Not_Allowed, "{", "<"); string expectedMessage = RazorResources.ParseError_SingleLine_ControlFlowStatements_Not_Allowed("{", "<");
ParseBlockTest("if(foo) <p>Bar</p> else if(bar) <p>Baz</p> else <p>Boz</p>", ParseBlockTest("if(foo) <p>Bar</p> else if(bar) <p>Baz</p> else <p>Boz</p>",
new StatementBlock( new StatementBlock(
Factory.Code("if(foo) ").AsStatement(), Factory.Code("if(foo) ").AsStatement(),
@ -431,7 +430,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("if(foo)) { var bar = foo; }").AsStatement() Factory.Code("if(foo)) { var bar = foo; }").AsStatement()
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_SingleLine_ControlFlowStatements_Not_Allowed, RazorResources.ParseError_SingleLine_ControlFlowStatements_Not_Allowed(
"{", ")"), "{", ")"),
new SourceLocation(7, 0, 7))); new SourceLocation(7, 0, 7)));
} }
@ -463,7 +462,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("if(foo bar\r\n").AsStatement() Factory.Code("if(foo bar\r\n").AsStatement()
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_CloseBracket_Before_EOF, RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
"(", ")"), "(", ")"),
new SourceLocation(2, 0, 2))); new SourceLocation(2, 0, 2)));
} }
@ -477,7 +476,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("foreach(foo bar\r\n").AsStatement() Factory.Code("foreach(foo bar\r\n").AsStatement()
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_CloseBracket_Before_EOF, RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
"(", ")"), "(", ")"),
new SourceLocation(7, 0, 7))); new SourceLocation(7, 0, 7)));
} }
@ -491,7 +490,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("do { } while(foo bar\r\n").AsStatement() Factory.Code("do { } while(foo bar\r\n").AsStatement()
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_CloseBracket_Before_EOF, RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
"(", ")"), "(", ")"),
new SourceLocation(12, 0, 12))); new SourceLocation(12, 0, 12)));
} }
@ -505,7 +504,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("using(foo bar\r\n").AsStatement() Factory.Code("using(foo bar\r\n").AsStatement()
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_CloseBracket_Before_EOF, RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
"(", ")"), "(", ")"),
new SourceLocation(5, 0, 5))); new SourceLocation(5, 0, 5)));
} }
@ -523,7 +522,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("}").AsStatement().Accepts(AcceptedCharacters.None) Factory.Code("}").AsStatement().Accepts(AcceptedCharacters.None)
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_CloseBracket_Before_EOF, RazorResources.ParseError_Expected_CloseBracket_Before_EOF(
"(", ")"), "(", ")"),
new SourceLocation(2, 0, 2))); new SourceLocation(2, 0, 2)));
} }
@ -544,7 +543,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
{ {
SingleSpanBlockTest("if(foo) { var foo = \"blah blah blah blah blah", BlockType.Statement, SpanKind.Code, SingleSpanBlockTest("if(foo) { var foo = \"blah blah blah blah blah", BlockType.Statement, SpanKind.Code,
new RazorError(RazorResources.ParseError_Unterminated_String_Literal, 20, 0, 20), new RazorError(RazorResources.ParseError_Unterminated_String_Literal, 20, 0, 20),
new RazorError(String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, "if", '}', '{'), SourceLocation.Zero)); new RazorError(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF("if", '}', '{'), SourceLocation.Zero));
} }
[Fact] [Fact]
@ -557,7 +556,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
+ "blah", + "blah",
BlockType.Statement, SpanKind.Code, BlockType.Statement, SpanKind.Code,
new RazorError(RazorResources.ParseError_Unterminated_String_Literal, 20, 0, 20), new RazorError(RazorResources.ParseError_Unterminated_String_Literal, 20, 0, 20),
new RazorError(String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, "if", '}', '{'), SourceLocation.Zero)); new RazorError(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF("if", '}', '{'), SourceLocation.Zero));
} }
[Fact] [Fact]
@ -609,7 +608,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.MetaCode("}").Accepts(AcceptedCharacters.None)), Factory.MetaCode("}").Accepts(AcceptedCharacters.None)),
expectedErrors: new[] { expectedErrors: new[] {
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_CloseBracket_Before_EOF, "(", ")"), RazorResources.ParseError_Expected_CloseBracket_Before_EOF( "(", ")"),
14, 0, 14) 14, 0, 14)
}); });
@ -618,7 +617,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
private void RunUnterminatedSimpleKeywordBlock(string keyword) private void RunUnterminatedSimpleKeywordBlock(string keyword)
{ {
SingleSpanBlockTest(keyword + " (foo) { var foo = bar; if(foo != null) { bar(); } ", BlockType.Statement, SpanKind.Code, SingleSpanBlockTest(keyword + " (foo) { var foo = bar; if(foo != null) { bar(); } ", BlockType.Statement, SpanKind.Code,
new RazorError(String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, keyword, '}', '{'), SourceLocation.Zero)); new RazorError(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(keyword, '}', '{'), SourceLocation.Zero));
} }
} }
} }

View File

@ -2,7 +2,6 @@
using System; using System;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.TestCommon; using Microsoft.TestCommon;
@ -33,7 +32,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.EmptyCSharp().AsExpression() Factory.EmptyCSharp().AsExpression()
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
RazorResources.BlockName_ExplicitExpression, RazorResources.BlockName_ExplicitExpression,
")", "("), ")", "("),
new SourceLocation(1, 0, 1))); new SourceLocation(1, 0, 1)));

View File

@ -4,7 +4,6 @@ using System;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.TestCommon; using Microsoft.TestCommon;
@ -53,8 +52,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.MetaCode("}").Accepts(AcceptedCharacters.None)), Factory.MetaCode("}").Accepts(AcceptedCharacters.None)),
Factory.EmptyHtml()), Factory.EmptyHtml()),
new RazorError( new RazorError(
String.Format( RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start(
RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start,
RazorResources.ErrorComponent_Newline), RazorResources.ErrorComponent_Newline),
7, 0, 7)); 7, 0, 7));
} }
@ -70,9 +68,8 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.MetaCode("helper")), Factory.MetaCode("helper")),
Factory.Markup("{")), Factory.Markup("{")),
new RazorError( new RazorError(
String.Format( RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start(
RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start, RazorResources.ErrorComponent_Character("{")),
String.Format(RazorResources.ErrorComponent_Character, "{")),
7, 0, 7)); 7, 0, 7));
} }
@ -91,13 +88,11 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
.AsStatement() .AsStatement()
.AutoCompleteWith("}")))), .AutoCompleteWith("}")))),
new RazorError( new RazorError(
String.Format( RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start(
RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start, RazorResources.ErrorComponent_Character("(")),
String.Format(RazorResources.ErrorComponent_Character, "(")),
8, 0, 8), 8, 0, 8),
new RazorError( new RazorError(
String.Format( RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF,
"helper", "}", "{"), "helper", "}", "{"),
1, 0, 1)); 1, 0, 1));
} }
@ -113,8 +108,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.MetaCode("helper ").Accepts(AcceptedCharacters.None), Factory.MetaCode("helper ").Accepts(AcceptedCharacters.None),
Factory.EmptyCSharp().Hidden())), Factory.EmptyCSharp().Hidden())),
new RazorError( new RazorError(
String.Format( RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start(
RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start,
RazorResources.ErrorComponent_EndOfFile), RazorResources.ErrorComponent_EndOfFile),
8, 0, 8)); 8, 0, 8));
} }
@ -129,8 +123,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.CodeTransition(), Factory.CodeTransition(),
Factory.MetaCode("helper").Accepts(AcceptedCharacters.Any))), Factory.MetaCode("helper").Accepts(AcceptedCharacters.Any))),
new RazorError( new RazorError(
String.Format( RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start(
RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start,
RazorResources.ErrorComponent_EndOfFile), RazorResources.ErrorComponent_EndOfFile),
7, 0, 7)); 7, 0, 7));
} }
@ -148,8 +141,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code(" \r\n").Hidden()), Factory.Code(" \r\n").Hidden()),
Factory.Markup(@" ")), Factory.Markup(@" ")),
new RazorError( new RazorError(
String.Format( RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start(
RazorResources.ParseError_Unexpected_Character_At_Helper_Name_Start,
RazorResources.ErrorComponent_Newline), RazorResources.ErrorComponent_Newline),
30, 0, 30)); 30, 0, 30));
} }
@ -167,7 +159,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("Foo \r\n").Hidden()), Factory.Code("Foo \r\n").Hidden()),
Factory.Markup(" ")), Factory.Markup(" ")),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_MissingCharAfterHelperName, "("), RazorResources.ParseError_MissingCharAfterHelperName("("),
15, 0, 15)); 15, 0, 15));
} }
@ -199,7 +191,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.MetaCode("helper ").Accepts(AcceptedCharacters.None), Factory.MetaCode("helper ").Accepts(AcceptedCharacters.None),
Factory.Code("Foo(string foo) \r\n").Hidden())), Factory.Code("Foo(string foo) \r\n").Hidden())),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_MissingCharAfterHelperParameters, "{"), RazorResources.ParseError_MissingCharAfterHelperParameters("{"),
29, 1, 0)); 29, 1, 0));
} }
@ -222,8 +214,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Markup(" <p>Foo</p>").Accepts(AcceptedCharacters.None)), Factory.Markup(" <p>Foo</p>").Accepts(AcceptedCharacters.None)),
Factory.EmptyCSharp().AsStatement()))), Factory.EmptyCSharp().AsStatement()))),
new RazorError( new RazorError(
String.Format( RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF,
"helper", "}", "{"), "helper", "}", "{"),
1, 0, 1)); 1, 0, 1));
} }
@ -305,8 +296,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
expectedErrors: new[] expectedErrors: new[]
{ {
new RazorError( new RazorError(
String.Format( RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(
RazorResources.ParseError_Expected_EndOfBlock_Before_EOF,
"helper", "}", "{"), "helper", "}", "{"),
new SourceLocation(1, 0, 1)) new SourceLocation(1, 0, 1))
}); });

View File

@ -3,7 +3,6 @@
using System; using System;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.TestCommon; using Microsoft.TestCommon;
@ -49,7 +48,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
.AsImplicitExpression(KeywordSet) .AsImplicitExpression(KeywordSet)
.Accepts(AcceptedCharacters.NonWhiteSpace)), .Accepts(AcceptedCharacters.NonWhiteSpace)),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Unexpected_Character_At_Start_Of_CodeBlock_CS, "/"), RazorResources.ParseError_Unexpected_Character_At_Start_Of_CodeBlock_CS("/"),
new SourceLocation(1, 0, 1))); new SourceLocation(1, 0, 1)));
} }
@ -163,7 +162,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
{ {
ImplicitExpressionTest("foo(()", "foo(()", ImplicitExpressionTest("foo(()", "foo(()",
acceptedCharacters: AcceptedCharacters.Any, acceptedCharacters: AcceptedCharacters.Any,
errors: new RazorError(String.Format(RazorResources.ParseError_Expected_CloseBracket_Before_EOF, "(", ")"), new SourceLocation(4, 0, 4))); errors: new RazorError(RazorResources.ParseError_Expected_CloseBracket_Before_EOF("(", ")"), new SourceLocation(4, 0, 4)));
} }
[Fact] [Fact]

View File

@ -3,7 +3,6 @@
using System; using System;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;
using Microsoft.TestCommon; using Microsoft.TestCommon;
@ -82,7 +81,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code("\r\n") Factory.Code("\r\n")
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords))), .AsImplicitExpression(CSharpCodeParser.DefaultKeywords))),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_CloseBracket_Before_EOF, "(", ")"), RazorResources.ParseError_Expected_CloseBracket_Before_EOF("(", ")"),
4, 0, 4)); 4, 0, 4));
} }
@ -107,7 +106,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
CSharpSymbolType.Unknown)) CSharpSymbolType.Unknown))
.Accepts(AcceptedCharacters.Any)))), .Accepts(AcceptedCharacters.Any)))),
new RazorError(RazorResources.ParseError_RazorComment_Not_Terminated, 5, 0, 5), new RazorError(RazorResources.ParseError_RazorComment_Not_Terminated, 5, 0, 5),
new RazorError(String.Format(RazorResources.ParseError_Expected_CloseBracket_Before_EOF, "(", ")"), 4, 0, 4)); new RazorError(RazorResources.ParseError_Expected_CloseBracket_Before_EOF("(", ")"), 4, 0, 4));
} }
[Fact] [Fact]
@ -143,8 +142,8 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
.Accepts(AcceptedCharacters.None)), .Accepts(AcceptedCharacters.None)),
Factory.Markup("\r\n}")))), Factory.Markup("\r\n}")))),
new RazorError(RazorResources.ParseError_TextTagCannotContainAttributes, 8, 1, 4), new RazorError(RazorResources.ParseError_TextTagCannotContainAttributes, 8, 1, 4),
new RazorError(String.Format(RazorResources.ParseError_MissingEndTag, "text"), 8, 1, 4), new RazorError(RazorResources.ParseError_MissingEndTag("text"), 8, 1, 4),
new RazorError(String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, RazorResources.BlockName_Code, "}", "{"), 1, 0, 1)); new RazorError(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(RazorResources.BlockName_Code, "}", "{"), 1, 0, 1));
} }
[Fact] [Fact]
@ -168,7 +167,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
CSharpSymbolType.Unknown)) CSharpSymbolType.Unknown))
.Accepts(AcceptedCharacters.Any)))), .Accepts(AcceptedCharacters.Any)))),
new RazorError(RazorResources.ParseError_RazorComment_Not_Terminated, 2, 0, 2), new RazorError(RazorResources.ParseError_RazorComment_Not_Terminated, 2, 0, 2),
new RazorError(String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, RazorResources.BlockName_Code, "}", "{"), 1, 0, 1)); new RazorError(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(RazorResources.BlockName_Code, "}", "{"), 1, 0, 1));
} }
} }
} }

View File

@ -3,7 +3,6 @@
using System; using System;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.TestCommon; using Microsoft.TestCommon;
@ -21,7 +20,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
new DirectiveBlock( new DirectiveBlock(
Factory.MetaCode(word).Accepts(AcceptedCharacters.None) Factory.MetaCode(word).Accepts(AcceptedCharacters.None)
), ),
new RazorError(String.Format(RazorResources.ParseError_ReservedWord, word), SourceLocation.Zero)); new RazorError(RazorResources.ParseError_ReservedWord(word), SourceLocation.Zero));
} }
[Theory] [Theory]

View File

@ -4,7 +4,6 @@ using System;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.TestCommon; using Microsoft.TestCommon;
@ -22,8 +21,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.CodeTransition(), Factory.CodeTransition(),
Factory.MetaCode("section\r\n"))), Factory.MetaCode("section\r\n"))),
new RazorError( new RazorError(
String.Format( RazorResources.ParseError_Unexpected_Character_At_Section_Name_Start(
RazorResources.ParseError_Unexpected_Character_At_Section_Name_Start,
RazorResources.ErrorComponent_EndOfFile), RazorResources.ErrorComponent_EndOfFile),
10, 1, 0)); 10, 1, 0));
} }
@ -54,8 +52,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.MetaCode("section \r\n")), Factory.MetaCode("section \r\n")),
Factory.Markup(" ")), Factory.Markup(" ")),
new RazorError( new RazorError(
String.Format( RazorResources.ParseError_Unexpected_Character_At_Section_Name_Start(
RazorResources.ParseError_Unexpected_Character_At_Section_Name_Start,
RazorResources.ErrorComponent_EndOfFile), RazorResources.ErrorComponent_EndOfFile),
23, 1, 4)); 23, 1, 4));
} }
@ -85,9 +82,8 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.MetaCode("section ")), Factory.MetaCode("section ")),
Factory.Markup("9 { <p>Foo</p> }")), Factory.Markup("9 { <p>Foo</p> }")),
new RazorError( new RazorError(
String.Format( RazorResources.ParseError_Unexpected_Character_At_Section_Name_Start(
RazorResources.ParseError_Unexpected_Character_At_Section_Name_Start, RazorResources.ErrorComponent_Character("9")),
String.Format(RazorResources.ErrorComponent_Character, "9")),
9, 0, 9)); 9, 0, 9));
} }
@ -127,8 +123,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.MetaCode("}").Accepts(AcceptedCharacters.None)), Factory.MetaCode("}").Accepts(AcceptedCharacters.None)),
Factory.EmptyHtml()), Factory.EmptyHtml()),
new RazorError( new RazorError(
String.Format( RazorResources.ParseError_Sections_Cannot_Be_Nested(
RazorResources.ParseError_Sections_Cannot_Be_Nested,
RazorResources.SectionExample_CS), RazorResources.SectionExample_CS),
23, 0, 23)); 23, 0, 23));
} }
@ -145,7 +140,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
.AutoCompleteWith("}", atEndOfSpan: true), .AutoCompleteWith("}", atEndOfSpan: true),
new MarkupBlock())), new MarkupBlock())),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_X, "}"), RazorResources.ParseError_Expected_X("}"),
14, 0, 14)); 14, 0, 14));
} }
@ -163,7 +158,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
// Need to provide the markup span as fragments, since the parser will split the {} into separate symbols. // Need to provide the markup span as fragments, since the parser will split the {} into separate symbols.
Factory.Markup(" <p>Foo", "{", "}", "</p>")))), Factory.Markup(" <p>Foo", "{", "}", "</p>")))),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_X, "}"), RazorResources.ParseError_Expected_X("}"),
27, 0, 27)); 27, 0, 27));
} }

View File

@ -3,7 +3,6 @@
using System; using System;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.TestCommon; using Microsoft.TestCommon;
@ -151,7 +150,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
Factory.Code(" { { { { } zoop").AsFunctionsBody() Factory.Code(" { { { { } zoop").AsFunctionsBody()
), ),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, "functions", "}", "{"), RazorResources.ParseError_Expected_EndOfBlock_Before_EOF("functions", "}", "{"),
SourceLocation.Zero)); SourceLocation.Zero));
} }
@ -175,7 +174,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
.AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .AsImplicitExpression(CSharpCodeParser.DefaultKeywords)
.Accepts(AcceptedCharacters.NonWhiteSpace)), .Accepts(AcceptedCharacters.NonWhiteSpace)),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Unexpected_Character_At_Start_Of_CodeBlock_CS, "/"), RazorResources.ParseError_Unexpected_Character_At_Start_Of_CodeBlock_CS("/"),
1, 0, 1)); 1, 0, 1));
} }

View File

@ -4,7 +4,6 @@ using System;
using Microsoft.AspNet.Razor.Editor; using Microsoft.AspNet.Razor.Editor;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;

View File

@ -4,7 +4,6 @@ using System;
using Microsoft.AspNet.Razor.Editor; using Microsoft.AspNet.Razor.Editor;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;
using Microsoft.TestCommon; using Microsoft.TestCommon;

View File

@ -2,7 +2,6 @@
using System; using System;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.TestCommon; using Microsoft.TestCommon;
@ -44,7 +43,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
designTimeParser: true, designTimeParser: true,
expectedErrors: new[] expectedErrors: new[]
{ {
new RazorError(String.Format(RazorResources.ParseError_Unexpected_Character_At_Start_Of_CodeBlock_CS, "}"), new SourceLocation(2, 0, 2)) new RazorError(RazorResources.ParseError_Unexpected_Character_At_Start_Of_CodeBlock_CS("}"), new SourceLocation(2, 0, 2))
}); });
} }
@ -64,7 +63,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
designTimeParser: true, designTimeParser: true,
expectedErrors: new[] expectedErrors: new[]
{ {
new RazorError(String.Format(RazorResources.ParseError_Unexpected_Character_At_Start_Of_CodeBlock_CS, "."), new SourceLocation(2, 0, 2)) new RazorError(RazorResources.ParseError_Unexpected_Character_At_Start_Of_CodeBlock_CS("."), new SourceLocation(2, 0, 2))
}); });
} }

View File

@ -3,7 +3,6 @@
using System; using System;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;

View File

@ -5,7 +5,6 @@ using Microsoft.AspNet.Razor.Editor;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;
@ -39,7 +38,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html
new MarkupBlock( new MarkupBlock(
Factory.Markup("<")))), Factory.Markup("<")))),
new RazorError( new RazorError(
String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, RazorResources.BlockName_Code, "}", "{"), RazorResources.ParseError_Expected_EndOfBlock_Before_EOF(RazorResources.BlockName_Code, "}", "{"),
1, 0, 1)); 1, 0, 1));
} }
@ -67,8 +66,8 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html
designTimeParser: true, designTimeParser: true,
expectedErrors: new[] expectedErrors: new[]
{ {
new RazorError(String.Format(RazorResources.ParseError_UnexpectedEndTag, "html"), 7, 2, 0), new RazorError(RazorResources.ParseError_UnexpectedEndTag("html"), 7, 2, 0),
new RazorError(String.Format(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF, "code", "}", "{"), 1, 0, 1) new RazorError(RazorResources.ParseError_Expected_EndOfBlock_Before_EOF("code", "}", "{"), 1, 0, 1)
}); });
} }
@ -80,7 +79,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html
new MarkupBlock( new MarkupBlock(
Factory.Markup("< \r\n ")), Factory.Markup("< \r\n ")),
designTimeParser: true, designTimeParser: true,
expectedErrors: new RazorError(String.Format(RazorResources.ParseError_UnfinishedTag, String.Empty), 0, 0, 0)); expectedErrors: new RazorError(RazorResources.ParseError_UnfinishedTag(String.Empty), 0, 0, 0));
} }
[Fact] [Fact]
@ -217,7 +216,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html
public void ParseBlockTerminatesAtEOF() public void ParseBlockTerminatesAtEOF()
{ {
SingleSpanBlockTest("<foo>", "<foo>", BlockType.Markup, SpanKind.Markup, SingleSpanBlockTest("<foo>", "<foo>", BlockType.Markup, SpanKind.Markup,
new RazorError(String.Format(RazorResources.ParseError_MissingEndTag, "foo"), new SourceLocation(0, 0, 0))); new RazorError(RazorResources.ParseError_MissingEndTag("foo"), new SourceLocation(0, 0, 0)));
} }
[Fact] [Fact]
@ -265,7 +264,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html
BlockType.Markup, BlockType.Markup,
SpanKind.Markup, SpanKind.Markup,
AcceptedCharacters.None, AcceptedCharacters.None,
new RazorError(String.Format(RazorResources.ParseError_MissingEndTag, "foo"), 0, 0, 0)); new RazorError(RazorResources.ParseError_MissingEndTag("foo"), 0, 0, 0));
} }
@ -360,7 +359,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html
new MarkupBlock( new MarkupBlock(
Factory.Markup("<br/") Factory.Markup("<br/")
), ),
new RazorError(String.Format(RazorResources.ParseError_UnfinishedTag, "br"), SourceLocation.Zero)); new RazorError(RazorResources.ParseError_UnfinishedTag("br"), SourceLocation.Zero));
} }
[Fact] [Fact]

View File

@ -5,7 +5,6 @@ using System.Web.WebPages.TestUtils;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.TestCommon; using Microsoft.TestCommon;

View File

@ -3,7 +3,6 @@
using System; using System;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.TestCommon; using Microsoft.TestCommon;
@ -54,7 +53,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html
ParseBlockTest("</foo> bar baz", ParseBlockTest("</foo> bar baz",
new MarkupBlock( new MarkupBlock(
Factory.Markup("</foo> ").Accepts(AcceptedCharacters.None)), Factory.Markup("</foo> ").Accepts(AcceptedCharacters.None)),
new RazorError(String.Format(RazorResources.ParseError_UnexpectedEndTag, "foo"), SourceLocation.Zero)); new RazorError(RazorResources.ParseError_UnexpectedEndTag("foo"), SourceLocation.Zero));
} }
[Fact] [Fact]
@ -63,7 +62,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html
ParseBlockTest("<p><foo></bar>", ParseBlockTest("<p><foo></bar>",
new MarkupBlock( new MarkupBlock(
Factory.Markup("<p><foo></bar>").Accepts(AcceptedCharacters.None)), Factory.Markup("<p><foo></bar>").Accepts(AcceptedCharacters.None)),
new RazorError(String.Format(RazorResources.ParseError_MissingEndTag, "p"), new SourceLocation(0, 0, 0))); new RazorError(RazorResources.ParseError_MissingEndTag("p"), new SourceLocation(0, 0, 0)));
} }
[Fact] [Fact]
@ -72,7 +71,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html
ParseBlockTest("<foo>blah blah blah blah blah", ParseBlockTest("<foo>blah blah blah blah blah",
new MarkupBlock( new MarkupBlock(
Factory.Markup("<foo>blah blah blah blah blah")), Factory.Markup("<foo>blah blah blah blah blah")),
new RazorError(String.Format(RazorResources.ParseError_MissingEndTag, "foo"), new SourceLocation(0, 0, 0))); new RazorError(RazorResources.ParseError_MissingEndTag("foo"), new SourceLocation(0, 0, 0)));
} }
[Fact] [Fact]
@ -84,7 +83,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html
new MarkupBlock(new AttributeBlockCodeGenerator("bar", new LocationTagged<string>(" bar=", 4, 0, 4), new LocationTagged<string>(String.Empty, 12, 0, 12)), new MarkupBlock(new AttributeBlockCodeGenerator("bar", new LocationTagged<string>(" bar=", 4, 0, 4), new LocationTagged<string>(String.Empty, 12, 0, 12)),
Factory.Markup(" bar=").With(SpanCodeGenerator.Null), Factory.Markup(" bar=").With(SpanCodeGenerator.Null),
Factory.Markup("baz").With(new LiteralAttributeCodeGenerator(new LocationTagged<string>(String.Empty, 9, 0, 9), new LocationTagged<string>("baz", 9, 0, 9))))), Factory.Markup("baz").With(new LiteralAttributeCodeGenerator(new LocationTagged<string>(String.Empty, 9, 0, 9), new LocationTagged<string>("baz", 9, 0, 9))))),
new RazorError(String.Format(RazorResources.ParseError_UnfinishedTag, "foo"), new SourceLocation(0, 0, 0))); new RazorError(RazorResources.ParseError_UnfinishedTag("foo"), new SourceLocation(0, 0, 0)));
} }
} }
} }

View File

@ -3,7 +3,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.TestCommon; using Microsoft.TestCommon;
@ -40,7 +39,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html
ParseBlockTest("<p></> Bar", ParseBlockTest("<p></> Bar",
new MarkupBlock( new MarkupBlock(
Factory.Markup("<p></> ").Accepts(AcceptedCharacters.None)), Factory.Markup("<p></> ").Accepts(AcceptedCharacters.None)),
new RazorError(String.Format(RazorResources.ParseError_MissingEndTag, "p"), 0, 0, 0)); new RazorError(RazorResources.ParseError_MissingEndTag("p"), 0, 0, 0));
} }
[Fact] [Fact]

View File

@ -4,7 +4,6 @@ using System;
using System.IO; using System.IO;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Test.Framework;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Tokenizer.Symbols; using Microsoft.AspNet.Razor.Tokenizer.Symbols;

View File

@ -2,7 +2,6 @@
using System; using System;
using System.Text; using System.Text;
using Microsoft.AspNet.Razor.Resources;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.TestCommon; using Microsoft.TestCommon;