Remove error for "@" in nested codeblocks.
Also removed the corresponding test and resource for this change. #64
This commit is contained in:
parent
9afab74b8c
commit
8099dcda63
|
|
@ -507,13 +507,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
else
|
||||
{
|
||||
// Throw errors as necessary, but continue parsing
|
||||
if (At(CSharpSymbolType.Keyword))
|
||||
{
|
||||
Context.OnError(CurrentLocation,
|
||||
RazorResources.FormatParseError_Unexpected_Keyword_After_At(
|
||||
CSharpLanguageCharacteristics.GetKeyword(CurrentSymbol.Keyword.Value)));
|
||||
}
|
||||
else if (At(CSharpSymbolType.LeftBrace))
|
||||
if (At(CSharpSymbolType.LeftBrace))
|
||||
{
|
||||
Context.OnError(CurrentLocation, RazorResources.ParseError_Unexpected_Nested_CodeBlock);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -694,22 +694,6 @@ namespace Microsoft.AspNet.Razor
|
|||
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
|
||||
{
|
||||
get { return GetString("ParseError_Unexpected_Keyword_After_At"); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unexpected "{0}" keyword after "@" character. Once inside code, you do not need to prefix constructs like "{0}" with "@".
|
||||
/// </summary>
|
||||
internal static string FormatParseError_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>
|
||||
|
|
|
|||
|
|
@ -264,9 +264,6 @@ Instead, wrap the contents of the block in "{{}}":
|
|||
<data name="Parser_Context_Not_Set" xml:space="preserve">
|
||||
<value>Parser was started with a null Context property. The Context property must be set BEFORE calling any methods on the parser.</value>
|
||||
</data>
|
||||
<data name="ParseError_Unexpected_Keyword_After_At" xml:space="preserve">
|
||||
<value>Unexpected "{0}" keyword after "@" character. Once inside code, you do not need to prefix constructs like "{0}" with "@".</value>
|
||||
</data>
|
||||
<data name="ParseError_ReservedWord" xml:space="preserve">
|
||||
<value>"{0}" is a reserved word and cannot be used in implicit expressions. An explicit expression ("@()") must be used.</value>
|
||||
</data>
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void NestedCodeBlockWithAtCausesError()
|
||||
public void NestedCodeBlockWithAtDoesntCauseError()
|
||||
{
|
||||
ParseBlockTest("if (true) { @if(false) { } }",
|
||||
new StatementBlock(
|
||||
|
|
@ -44,10 +44,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
|
|||
Factory.CodeTransition(),
|
||||
Factory.Code("if(false) { }").AsStatement()
|
||||
),
|
||||
Factory.Code(" }").AsStatement()),
|
||||
new RazorError(
|
||||
RazorResources.FormatParseError_Unexpected_Keyword_After_At("if"),
|
||||
new SourceLocation(13, 0, 13)));
|
||||
Factory.Code(" }").AsStatement()));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
Loading…
Reference in New Issue