Delete trailing whitespace
- #EngineeringDay - Total replaced: 506 Matching files: 118 Did not change any files under test/Microsoft.AspNet.Razor.Test/TestFiles - avoiding need to redo hashes
This commit is contained in:
parent
15348b0468
commit
0f724a51df
|
|
@ -1,17 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
|
|
@ -26,36 +26,36 @@
|
|||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
|
|
|
|||
|
|
@ -73,8 +73,8 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
private static TagHelperAttributeDescriptor ToAttributeDescriptor(PropertyInfo property)
|
||||
{
|
||||
var attributeNameAttribute = property.GetCustomAttribute<HtmlAttributeNameAttribute>(inherit: false);
|
||||
var attributeName = attributeNameAttribute != null ?
|
||||
attributeNameAttribute.Name :
|
||||
var attributeName = attributeNameAttribute != null ?
|
||||
attributeNameAttribute.Name :
|
||||
property.Name;
|
||||
|
||||
return new TagHelperAttributeDescriptor(attributeName, property.Name, property.PropertyType.FullName);
|
||||
|
|
@ -85,7 +85,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
var typeInfo = type.GetTypeInfo();
|
||||
var contentBehaviorAttribute = typeInfo.GetCustomAttribute<ContentBehaviorAttribute>(inherit: false);
|
||||
|
||||
return contentBehaviorAttribute != null ?
|
||||
return contentBehaviorAttribute != null ?
|
||||
contentBehaviorAttribute.ContentBehavior :
|
||||
ContentBehavior.None;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resolves all <see cref="TagHelperDescriptor"/>s for <see cref="ITagHelper"/>s from the given
|
||||
/// Resolves all <see cref="TagHelperDescriptor"/>s for <see cref="ITagHelper"/>s from the given
|
||||
/// <paramref name="assemblyName"/>.
|
||||
/// </summary>
|
||||
/// <param name="assemblyName">
|
||||
|
|
@ -105,7 +105,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
nameof(lookupText));
|
||||
}
|
||||
|
||||
// Grab the assembly name from the lookup text strings. Due to our supported lookupText formats it will
|
||||
// Grab the assembly name from the lookup text strings. Due to our supported lookupText formats it will
|
||||
// always be the last element provided.
|
||||
var assemblyName = lookupStrings.Last().Trim();
|
||||
string typeName = null;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
/// Calls the <see cref="ITagHelper.ProcessAsync"/> method on <see cref="ITagHelper"/>s.
|
||||
/// </summary>
|
||||
/// <param name="context">Contains information associated with running <see cref="ITagHelper"/>s.</param>
|
||||
/// <returns>Resulting <see cref="TagHelperOutput"/> from processing all of the
|
||||
/// <returns>Resulting <see cref="TagHelperOutput"/> from processing all of the
|
||||
/// <paramref name="context"/>'s <see cref="ITagHelper"/>s.</returns>
|
||||
public async Task<TagHelperOutput> RunAsync([NotNull] TagHelperExecutionContext context)
|
||||
{
|
||||
|
|
@ -27,7 +27,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
/// </summary>
|
||||
/// <param name="context">Contains information associated with running <see cref="ITagHelper"/>s.</param>
|
||||
/// <param name="bufferedBody">Contains the buffered content of the current HTML tag.</param>
|
||||
/// <returns>Resulting <see cref="TagHelperOutput"/> from processing all of the
|
||||
/// <returns>Resulting <see cref="TagHelperOutput"/> from processing all of the
|
||||
/// <paramref name="context"/>'s <see cref="ITagHelper"/>s.</returns>
|
||||
public async Task<TagHelperOutput> RunAsync([NotNull] TagHelperExecutionContext context,
|
||||
[NotNull] TextWriter bufferedBody)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
/// all valid <see cref="ITagHelper"/> <see cref="Type"/>s.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of an <see cref="Assembly"/> to search.</param>
|
||||
/// <returns>An <see cref="IEnumerable{Type}"/> of valid <see cref="ITagHelper"/> <see cref="Type"/>s.</returns>
|
||||
/// <returns>An <see cref="IEnumerable{Type}"/> of valid <see cref="ITagHelper"/> <see cref="Type"/>s.</returns>
|
||||
public IEnumerable<Type> Resolve(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
"frameworks": {
|
||||
"net45": { },
|
||||
"aspnet50": { },
|
||||
"aspnetcore50": {
|
||||
"aspnetcore50": {
|
||||
"dependencies": {
|
||||
"System.Reflection.Extensions": "4.0.0-beta-*"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
|
|
@ -26,36 +26,36 @@
|
|||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
|
|
|
|||
|
|
@ -58,9 +58,9 @@ namespace Microsoft.AspNet.Razor.Editor
|
|||
return PartialParseResult.Rejected;
|
||||
}
|
||||
|
||||
// In some editors intellisense insertions are handled as "dotless commits". If an intellisense selection is confirmed
|
||||
// via something like '.' a dotless commit will append a '.' and then insert the remaining intellisense selection prior
|
||||
// to the appended '.'. This 'if' statement attempts to accept the intermediate steps of a dotless commit via
|
||||
// In some editors intellisense insertions are handled as "dotless commits". If an intellisense selection is confirmed
|
||||
// via something like '.' a dotless commit will append a '.' and then insert the remaining intellisense selection prior
|
||||
// to the appended '.'. This 'if' statement attempts to accept the intermediate steps of a dotless commit via
|
||||
// intellisense. It will accept two cases:
|
||||
// 1. '@foo.' -> '@foobaz.'.
|
||||
// 2. '@foobaz..' -> '@foobaz.bar.'. Includes Sub-cases '@foobaz()..' -> '@foobaz().bar.' etc.
|
||||
|
|
@ -128,7 +128,7 @@ namespace Microsoft.AspNet.Razor.Editor
|
|||
}
|
||||
|
||||
// Once a dotless commit has been performed you then have something like '@DateTime.'. This scenario is used to detect the
|
||||
// situation when you try to perform another dotless commit resulting in a textchange with '..'. Completing 'DateTime.Now'
|
||||
// situation when you try to perform another dotless commit resulting in a textchange with '..'. Completing 'DateTime.Now'
|
||||
// in intellisense with a '.' could result in: '@DateTime.' -> '@DateTime..' -> '@DateTime.Now.' which is accepted.
|
||||
private static bool IsSecondaryDotlessCommitInsertion(Span target, TextChange change)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
/// The current C# rendering mode.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="ExpressionRenderingMode.WriteToOutput"/> forces C# generation to write
|
||||
/// <see cref="ExpressionRenderingMode.WriteToOutput"/> forces C# generation to write
|
||||
/// <see cref="Compiler.Chunk"/>s to the output page, i.e. WriteLiteral("Hello World").
|
||||
/// <see cref="ExpressionRenderingMode.InjectCode"/> writes <see cref="Compiler.Chunk"/> values in their
|
||||
/// rawest form, i.g. "Hello World".
|
||||
|
|
@ -46,7 +46,7 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
/// <remarks>
|
||||
/// If <see cref="TargetWriterName"/> is <c>null</c> values will be written using a default write method
|
||||
/// i.e. WriteLiteral("Hello World").
|
||||
/// If <see cref="TargetWriterName"/> is not <c>null</c> values will be written to the given
|
||||
/// If <see cref="TargetWriterName"/> is not <c>null</c> values will be written to the given
|
||||
/// <see cref="TargetWriterName"/>, i.e. WriteLiteralTo(myWriter, "Hello World").
|
||||
/// </remarks>
|
||||
public string TargetWriterName { get; set; }
|
||||
|
|
|
|||
|
|
@ -443,9 +443,9 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
|||
}
|
||||
if (i > 0 && i % 80 == 0)
|
||||
{
|
||||
// If current character is a high surrogate and the following
|
||||
// character is a low surrogate, don't break them.
|
||||
// Otherwise when we write the string to a file, we might lose
|
||||
// If current character is a high surrogate and the following
|
||||
// character is a low surrogate, don't break them.
|
||||
// Otherwise when we write the string to a file, we might lose
|
||||
// the characters.
|
||||
if (Char.IsHighSurrogate(literal[i])
|
||||
&& (i < literal.Length - 1)
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
|||
// In design time: __o = somecode();
|
||||
// In Run time: Write(somecode());
|
||||
//
|
||||
// In both cases the padding would have been 1 space to remote the space the @ symbol takes, which will be smaller than the 6
|
||||
// In both cases the padding would have been 1 space to remote the space the @ symbol takes, which will be smaller than the 6
|
||||
// chars the hidden generated code takes.
|
||||
if (padding < 0)
|
||||
{
|
||||
|
|
@ -110,7 +110,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
|||
|
||||
while (firstSpanInLine.Previous != null)
|
||||
{
|
||||
// When scanning previous spans we need to be break down the spans with spaces. The parser combines
|
||||
// When scanning previous spans we need to be break down the spans with spaces. The parser combines
|
||||
// whitespace into existing spans so you'll see tabs, newlines etc. within spans. We only care about
|
||||
// the \t in existing spans.
|
||||
var previousContent = firstSpanInLine.Previous.Content ?? String.Empty;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
|||
/// </summary>
|
||||
/// <param name="bodyVisitor">The <see cref="IChunkVisitor"/> used to render chunks found in the body.</param>
|
||||
/// <param name="writer">The <see cref="CSharpCodeWriter"/> used to write code.</param>
|
||||
/// <param name="context">A <see cref="CodeBuilderContext"/> instance that contains information about
|
||||
/// <param name="context">A <see cref="CodeBuilderContext"/> instance that contains information about
|
||||
/// the current code generation process.</param>
|
||||
public CSharpTagHelperCodeRenderer([NotNull] IChunkVisitor bodyVisitor,
|
||||
[NotNull] CSharpCodeWriter writer,
|
||||
|
|
@ -194,13 +194,13 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
|||
// Bufferable attributes are attributes that can have Razor code inside of them.
|
||||
var bufferableAttribute = IsStringAttribute(attributeDescriptor);
|
||||
|
||||
// Plain text values are non Razor code (@DateTime.Now) values. If an attribute is bufferable it
|
||||
// may be more than just a plain text value, it may also contain Razor code which is why we attempt
|
||||
// Plain text values are non Razor code (@DateTime.Now) values. If an attribute is bufferable it
|
||||
// may be more than just a plain text value, it may also contain Razor code which is why we attempt
|
||||
// to retrieve a plain text value here.
|
||||
string textValue;
|
||||
var isPlainTextValue = TryGetPlainTextValue(attributeValueChunk, out textValue);
|
||||
|
||||
// If we haven't recorded a value and we need to buffer an attribute value and the value is not
|
||||
// If we haven't recorded a value and we need to buffer an attribute value and the value is not
|
||||
// plain text then we need to prepare the value prior to setting it below.
|
||||
if (!attributeValueRecorded && bufferableAttribute && !isPlainTextValue)
|
||||
{
|
||||
|
|
@ -239,7 +239,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
|||
}
|
||||
else
|
||||
{
|
||||
// TODO: Make complex types in non-bufferable attributes work in
|
||||
// TODO: Make complex types in non-bufferable attributes work in
|
||||
// https://github.com/aspnet/Razor/issues/129
|
||||
if (!isPlainTextValue)
|
||||
{
|
||||
|
|
@ -291,7 +291,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
|||
var attributeValue = htmlAttribute.Value;
|
||||
var isPlainTextValue = TryGetPlainTextValue(attributeValue, out textValue);
|
||||
|
||||
// HTML attributes are always strings. So if this value is not plain text i.e. if the value contains
|
||||
// HTML attributes are always strings. So if this value is not plain text i.e. if the value contains
|
||||
// C# code, then we need to buffer it.
|
||||
if (!isPlainTextValue)
|
||||
{
|
||||
|
|
@ -305,7 +305,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
|||
}
|
||||
|
||||
_writer.WriteStartInstanceMethodInvocation(
|
||||
ExecutionContextVariableName,
|
||||
ExecutionContextVariableName,
|
||||
_tagHelperContext.ExecutionContextAddHtmlAttributeMethodName);
|
||||
_writer.WriteStringLiteral(htmlAttribute.Key)
|
||||
.WriteParameterSeparator();
|
||||
|
|
@ -435,7 +435,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
|||
private void BuildBufferedWritingScope(IList<Chunk> chunks)
|
||||
{
|
||||
// We're building a writing scope around the provided chunks which captures everything written from the
|
||||
// page. Therefore, we do not want to write to any other buffer since we're using the pages buffer to
|
||||
// page. Therefore, we do not want to write to any other buffer since we're using the pages buffer to
|
||||
// ensure we capture all content that's written, directly or indirectly.
|
||||
var oldWriter = _context.TargetWriterName;
|
||||
_context.TargetWriterName = null;
|
||||
|
|
@ -483,7 +483,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
|||
{
|
||||
if (_designTimeMode)
|
||||
{
|
||||
// There is no value buffer in design time mode but we still want to write out a value. We write a
|
||||
// There is no value buffer in design time mode but we still want to write out a value. We write a
|
||||
// value to ensure the tag helper's property type is string.
|
||||
writer.Write("string.Empty");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
|||
|
||||
Writer.WriteStartAssignment(TagHelperDirectiveSyntaxHelper);
|
||||
|
||||
// The parsing mechanism for the add/remove TagHelper chunk (CSharpCodeParser.TagHelperDirective())
|
||||
// The parsing mechanism for the add/remove TagHelper chunk (CSharpCodeParser.TagHelperDirective())
|
||||
// removes quotes that surround the lookupText.
|
||||
_csharpCodeVisitor.CreateExpressionCodeMapping(
|
||||
string.Format(
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
|||
{
|
||||
private CSharpCodeVisitor _csharpCodeVisitor;
|
||||
|
||||
public CSharpTypeMemberVisitor([NotNull] CSharpCodeVisitor csharpCodeVisitor,
|
||||
[NotNull] CSharpCodeWriter writer,
|
||||
public CSharpTypeMemberVisitor([NotNull] CSharpCodeVisitor csharpCodeVisitor,
|
||||
[NotNull] CSharpCodeWriter writer,
|
||||
[NotNull] CodeBuilderContext context)
|
||||
: base(writer, context)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler
|
|||
else if (chunk is TypeMemberChunk)
|
||||
{
|
||||
Visit((TypeMemberChunk)chunk);
|
||||
}
|
||||
}
|
||||
else if (chunk is UsingChunk)
|
||||
{
|
||||
Visit((UsingChunk)chunk);
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler
|
|||
// Check the first character of the current write operation.
|
||||
builder[builder.Length - data.Length] == '\n')
|
||||
{
|
||||
// This is newline that's spread across two writes. Skip the first character of the
|
||||
// This is newline that's spread across two writes. Skip the first character of the
|
||||
// current write operation.
|
||||
//
|
||||
// We don't need to increment our newline counter because we already did that when we
|
||||
|
|
@ -107,7 +107,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler
|
|||
trailingPartStart = 1;
|
||||
}
|
||||
|
||||
// Iterate the string, stopping at each occurrence of a newline character. This lets us count the
|
||||
// Iterate the string, stopping at each occurrence of a newline character. This lets us count the
|
||||
// newline occurrences and keep the index of the last one.
|
||||
while ((i = data.IndexOfAny(NewLineCharacters, i)) >= 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
namespace Microsoft.AspNet.Razor.Generator.Compiler
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see cref="Chunk"/> used to look up <see cref="TagHelpers.TagHelperDescriptor"/>s that should be ignored
|
||||
/// A <see cref="Chunk"/> used to look up <see cref="TagHelpers.TagHelperDescriptor"/>s that should be ignored
|
||||
/// within the Razor page.
|
||||
/// </summary>
|
||||
public class RemoveTagHelperChunk : Chunk
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
/// </summary>
|
||||
/// <example>
|
||||
/// If @foo is rendered with WriteToOutput, the code generator would output the following code:
|
||||
///
|
||||
///
|
||||
/// Write(foo);
|
||||
/// </example>
|
||||
WriteToOutput,
|
||||
|
|
@ -21,7 +21,7 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
/// </summary>
|
||||
/// <example>
|
||||
/// If @foo is rendered with InjectCode, the code generator would output the following code:
|
||||
///
|
||||
///
|
||||
/// foo
|
||||
/// </example>
|
||||
InjectCode
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public static readonly string DefaultWriteAttributeMethodName = "WriteAttribute";
|
||||
public static readonly string DefaultWriteAttributeToMethodName = "WriteAttributeTo";
|
||||
|
||||
public static readonly GeneratedClassContext Default =
|
||||
public static readonly GeneratedClassContext Default =
|
||||
new GeneratedClassContext(DefaultExecuteMethodName,
|
||||
DefaultWriteMethodName,
|
||||
DefaultWriteLiteralMethodName,
|
||||
|
|
@ -30,19 +30,19 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
if (string.IsNullOrEmpty(executeMethodName))
|
||||
{
|
||||
throw new ArgumentException(
|
||||
CommonResources.Argument_Cannot_Be_Null_Or_Empty,
|
||||
CommonResources.Argument_Cannot_Be_Null_Or_Empty,
|
||||
nameof(executeMethodName));
|
||||
}
|
||||
if (string.IsNullOrEmpty(writeMethodName))
|
||||
{
|
||||
throw new ArgumentException(
|
||||
CommonResources.Argument_Cannot_Be_Null_Or_Empty,
|
||||
CommonResources.Argument_Cannot_Be_Null_Or_Empty,
|
||||
nameof(writeMethodName));
|
||||
}
|
||||
if (string.IsNullOrEmpty(writeLiteralMethodName))
|
||||
{
|
||||
throw new ArgumentException(
|
||||
CommonResources.Argument_Cannot_Be_Null_Or_Empty,
|
||||
CommonResources.Argument_Cannot_Be_Null_Or_Empty,
|
||||
nameof(writeLiteralMethodName));
|
||||
}
|
||||
|
||||
|
|
@ -69,8 +69,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
string writeLiteralToMethodName,
|
||||
string templateTypeName,
|
||||
GeneratedTagHelperContext generatedTagHelperContext)
|
||||
: this(executeMethodName,
|
||||
writeMethodName,
|
||||
: this(executeMethodName,
|
||||
writeMethodName,
|
||||
writeLiteralMethodName,
|
||||
generatedTagHelperContext)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -71,10 +71,10 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
{
|
||||
if (_context == null)
|
||||
{
|
||||
_context = new CodeGeneratorContext(Host,
|
||||
ClassName,
|
||||
RootNamespaceName,
|
||||
SourceFileName,
|
||||
_context = new CodeGeneratorContext(Host,
|
||||
ClassName,
|
||||
RootNamespaceName,
|
||||
SourceFileName,
|
||||
GenerateLinePragmas);
|
||||
Initialize(_context);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
/// <param name="target">
|
||||
/// The <see cref="Block"/> responsible for this <see cref="TagHelperCodeGenerator"/>.
|
||||
/// </param>
|
||||
/// <param name="context">A <see cref="CodeGeneratorContext"/> instance that contains information about
|
||||
/// <param name="context">A <see cref="CodeGeneratorContext"/> instance that contains information about
|
||||
/// the current code generation process.</param>
|
||||
public override void GenerateStartBlockCode(Block target, CodeGeneratorContext context)
|
||||
{
|
||||
|
|
@ -88,7 +88,7 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
/// <param name="target">
|
||||
/// The <see cref="Block"/> responsible for this <see cref="TagHelperCodeGenerator"/>.
|
||||
/// </param>
|
||||
/// <param name="context">A <see cref="CodeGeneratorContext"/> instance that contains information about
|
||||
/// <param name="context">A <see cref="CodeGeneratorContext"/> instance that contains information about
|
||||
/// the current code generation process.</param>
|
||||
public override void GenerateEndBlockCode(Block target, CodeGeneratorContext context)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the text used to look up <see cref="TagHelpers.TagHelperDescriptor"/>s that should be added to or
|
||||
/// Gets the text used to look up <see cref="TagHelpers.TagHelperDescriptor"/>s that should be added to or
|
||||
/// removed from the Razor page.
|
||||
/// </summary>
|
||||
public string LookupText { get; }
|
||||
|
|
@ -37,13 +37,13 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public bool RemoveTagHelperDescriptors { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Generates <see cref="Compiler.AddTagHelperChunk"/>s if <see cref="RemoveTagHelperDescriptors"/> is
|
||||
/// Generates <see cref="Compiler.AddTagHelperChunk"/>s if <see cref="RemoveTagHelperDescriptors"/> is
|
||||
/// <c>true</c>, otherwise <see cref="Compiler.RemoveTagHelperChunk"/>s are generated.
|
||||
/// </summary>
|
||||
/// <param name="target">
|
||||
/// The <see cref="Span"/> responsible for this <see cref="AddOrRemoveTagHelperCodeGenerator"/>.
|
||||
/// </param>
|
||||
/// <param name="context">A <see cref="CodeGeneratorContext"/> instance that contains information about
|
||||
/// <param name="context">A <see cref="CodeGeneratorContext"/> instance that contains information about
|
||||
/// the current code generation process.</param>
|
||||
public override void GenerateCode(Span target, CodeGeneratorContext context)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ namespace Microsoft.AspNet.Razor
|
|||
public class GeneratorResults : ParserResults
|
||||
{
|
||||
public GeneratorResults(ParserResults parserResults, CodeBuilderResult codeBuilderResult, CodeTree codeTree)
|
||||
: this(parserResults.Document,
|
||||
parserResults.ParserErrors,
|
||||
: this(parserResults.Document,
|
||||
parserResults.ParserErrors,
|
||||
codeBuilderResult,
|
||||
codeTree)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
// This file is used by Code Analysis to maintain SuppressMessage
|
||||
// attributes that are applied to this project.
|
||||
// Project-level suppressions either have no target or are given
|
||||
// a specific target and scoped to a namespace, type, member, etc.
|
||||
// This file is used by Code Analysis to maintain SuppressMessage
|
||||
// attributes that are applied to this project.
|
||||
// Project-level suppressions either have no target or are given
|
||||
// a specific target and scoped to a namespace, type, member, etc.
|
||||
//
|
||||
// To add a suppression to this file, right-click the message in the
|
||||
// Error List, point to "Suppress Message(s)", and click
|
||||
// "In Project Suppression File".
|
||||
// You do not need to add suppressions to this file manually.
|
||||
// To add a suppression to this file, right-click the message in the
|
||||
// Error List, point to "Suppress Message(s)", and click
|
||||
// "In Project Suppression File".
|
||||
// You do not need to add suppressions to this file manually.
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
var blockGen = new HelperCodeGenerator(signature, headerComplete);
|
||||
Context.CurrentBlock.CodeGenerator = blockGen;
|
||||
|
||||
// The block will generate appropriate code,
|
||||
// The block will generate appropriate code,
|
||||
Span.CodeGenerator = SpanCodeGenerator.Null;
|
||||
|
||||
if (!headerComplete)
|
||||
|
|
@ -551,9 +551,9 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
// Set up code generation
|
||||
// The generated chunk of this code generator is picked up by CSharpDesignTimeHelpersVisitor which
|
||||
// renders the C# to colorize the user provided value. We trim the quotes around the user's value
|
||||
// so when we render the code we can project the users value into double quotes to not invoke C#
|
||||
// IntelliSense.
|
||||
Span.CodeGenerator =
|
||||
// so when we render the code we can project the users value into double quotes to not invoke C#
|
||||
// IntelliSense.
|
||||
Span.CodeGenerator =
|
||||
new AddOrRemoveTagHelperCodeGenerator(removeTagHelperDescriptors, rawValue.Trim('"'));
|
||||
}
|
||||
|
||||
|
|
@ -562,7 +562,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
if (!startsWithQuote ||
|
||||
!rawValue.EndsWith("\"", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Context.OnError(startLocation,
|
||||
Context.OnError(startLocation,
|
||||
RazorResources.FormatParseError_DirectiveMustBeSurroundedByQuotes(keyword));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
|
||||
// Accept the "await" and move on
|
||||
AcceptAndMoveNext();
|
||||
|
||||
|
||||
// Accept 1 or more spaces between the await and the following code.
|
||||
AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true));
|
||||
|
||||
|
|
|
|||
|
|
@ -322,7 +322,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
ImplicitExpression(AcceptedCharacters.NonWhiteSpace);
|
||||
}
|
||||
|
||||
// Async implicit expressions include the "await" keyword and therefore need to allow spaces to
|
||||
// Async implicit expressions include the "await" keyword and therefore need to allow spaces to
|
||||
// separate the "await" and the following code.
|
||||
private void AsyncImplicitExpression()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -185,8 +185,8 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
EndTagBlock(tags, complete);
|
||||
}
|
||||
|
||||
private bool AfterTagStart(SourceLocation tagStart,
|
||||
Stack<Tuple<HtmlSymbol, SourceLocation>> tags,
|
||||
private bool AfterTagStart(SourceLocation tagStart,
|
||||
Stack<Tuple<HtmlSymbol, SourceLocation>> tags,
|
||||
IDisposable tagBlockWrapper)
|
||||
{
|
||||
if (!EndOfFile)
|
||||
|
|
@ -269,8 +269,8 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
return false;
|
||||
}
|
||||
|
||||
private bool EndTag(SourceLocation tagStart,
|
||||
Stack<Tuple<HtmlSymbol, SourceLocation>> tags,
|
||||
private bool EndTag(SourceLocation tagStart,
|
||||
Stack<Tuple<HtmlSymbol, SourceLocation>> tags,
|
||||
IDisposable tagBlockWrapper)
|
||||
{
|
||||
// Accept "/" and move next
|
||||
|
|
@ -531,15 +531,15 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
// Dynamic value, start a new block and set the code generator
|
||||
using (Context.StartBlock(BlockType.Markup))
|
||||
{
|
||||
Context.CurrentBlock.CodeGenerator =
|
||||
Context.CurrentBlock.CodeGenerator =
|
||||
new DynamicAttributeBlockCodeGenerator(prefix.GetContent(prefixStart), valueStart);
|
||||
|
||||
OtherParserBlock();
|
||||
}
|
||||
}
|
||||
else if (At(HtmlSymbolType.Text) &&
|
||||
CurrentSymbol.Content.Length > 0 &&
|
||||
CurrentSymbol.Content[0] == '~' &&
|
||||
else if (At(HtmlSymbolType.Text) &&
|
||||
CurrentSymbol.Content.Length > 0 &&
|
||||
CurrentSymbol.Content[0] == '~' &&
|
||||
NextIs(HtmlSymbolType.ForwardSlash))
|
||||
{
|
||||
// Virtual Path value
|
||||
|
|
@ -558,7 +558,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
sym.Type != HtmlSymbolType.WhiteSpace &&
|
||||
sym.Type != HtmlSymbolType.NewLine &&
|
||||
sym.Type != HtmlSymbolType.Transition &&
|
||||
// This condition checks for the end of the attribute value (it repeats some of the checks above
|
||||
// This condition checks for the end of the attribute value (it repeats some of the checks above
|
||||
// but for now that's ok)
|
||||
!IsEndOfAttributeValue(quote, sym));
|
||||
Accept(value);
|
||||
|
|
@ -577,7 +577,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
|
||||
private bool IsUnquotedEndOfAttributeValue(HtmlSymbol sym)
|
||||
{
|
||||
// If unquoted, we have a larger set of terminating characters:
|
||||
// If unquoted, we have a larger set of terminating characters:
|
||||
// http://dev.w3.org/html5/spec/tokenization.html#attribute-value-unquoted-state
|
||||
// Also we need to detect "/" and ">"
|
||||
return sym.Type == HtmlSymbolType.DoubleQuote ||
|
||||
|
|
@ -714,8 +714,8 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
return RestOfTag(tag, tags, tagBlockWrapper);
|
||||
}
|
||||
|
||||
private bool RestOfTag(Tuple<HtmlSymbol, SourceLocation> tag,
|
||||
Stack<Tuple<HtmlSymbol, SourceLocation>> tags,
|
||||
private bool RestOfTag(Tuple<HtmlSymbol, SourceLocation> tag,
|
||||
Stack<Tuple<HtmlSymbol, SourceLocation>> tags,
|
||||
IDisposable tagBlockWrapper)
|
||||
{
|
||||
TagContent();
|
||||
|
|
@ -873,11 +873,11 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
}
|
||||
}
|
||||
|
||||
private void CompleteTagBlockWithSpan(IDisposable tagBlockWrapper,
|
||||
private void CompleteTagBlockWithSpan(IDisposable tagBlockWrapper,
|
||||
AcceptedCharacters acceptedCharacters,
|
||||
SpanKind spanKind)
|
||||
{
|
||||
Debug.Assert(tagBlockWrapper != null,
|
||||
Debug.Assert(tagBlockWrapper != null,
|
||||
"Tag block wrapper should not be null when attempting to complete a block");
|
||||
|
||||
Span.EditHandler.AcceptedCharacters = acceptedCharacters;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
|
||||
public abstract void ParseBlock();
|
||||
|
||||
// Markup Parsers need the ParseDocument and ParseSection methods since the markup parser is the first parser to hit the document
|
||||
// Markup Parsers need the ParseDocument and ParseSection methods since the markup parser is the first parser to hit the document
|
||||
// and the logic may be different than the ParseBlock method.
|
||||
public virtual void ParseDocument()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
/// <summary>
|
||||
/// Tracks the given <paramref name="error"/>.
|
||||
/// </summary>
|
||||
/// <param name="error">The <see cref="RazorError"/> to track.</param>
|
||||
/// <param name="error">The <see cref="RazorError"/> to track.</param>
|
||||
public void OnError(RazorError error)
|
||||
{
|
||||
_errors.Add(error);
|
||||
|
|
@ -46,7 +46,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
/// Creates and tracks a new <see cref="RazorError"/>.
|
||||
/// </summary>
|
||||
/// <param name="location"><see cref="SourceLocation"/> of the error.</param>
|
||||
/// <param name="message">A message describing the error.</param>
|
||||
/// <param name="message">A message describing the error.</param>
|
||||
public void OnError(SourceLocation location, string message)
|
||||
{
|
||||
_errors.Add(new RazorError(message, location));
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a sequence of <see cref="TagHelperDescriptor"/>s for tag helpers that are registered in the
|
||||
/// Returns a sequence of <see cref="TagHelperDescriptor"/>s for tag helpers that are registered in the
|
||||
/// specified <paramref name="documentRoot"/>.
|
||||
/// </summary>
|
||||
/// <param name="documentRoot">The <see cref="Block"/> to scan for tag helper registrations in.</param>
|
||||
|
|
@ -215,7 +215,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
{
|
||||
return new ISyntaxTreeRewriter[]
|
||||
{
|
||||
// TODO: Modify the below WhiteSpaceRewriter & ConditionalAttributeCollapser to handle
|
||||
// TODO: Modify the below WhiteSpaceRewriter & ConditionalAttributeCollapser to handle
|
||||
// TagHelperBlock's: https://github.com/aspnet/Razor/issues/117
|
||||
|
||||
// Move whitespace from start of expression block to markup
|
||||
|
|
|
|||
|
|
@ -67,13 +67,13 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether two <see cref="TagHelperBlock"/>s are equal by comparing the <see cref="TagName"/>,
|
||||
/// Determines whether two <see cref="TagHelperBlock"/>s are equal by comparing the <see cref="TagName"/>,
|
||||
/// <see cref="Attributes"/>, <see cref="Block.Type"/>, <see cref="Block.CodeGenerator"/> and
|
||||
/// <see cref="Block.Children"/>.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="TagHelperBlock"/> to check equality against.</param>
|
||||
/// <returns>
|
||||
/// <c>true</c> if the current <see cref="TagHelperBlock"/> is equivalent to the given
|
||||
/// <c>true</c> if the current <see cref="TagHelperBlock"/> is equivalent to the given
|
||||
/// <paramref name="other"/>, <c>false</c> otherwise.
|
||||
/// </returns>
|
||||
public bool Equals(TagHelperBlock other)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers
|
|||
public class TagHelperBlockBuilder : BlockBuilder
|
||||
{
|
||||
/// <summary>
|
||||
/// Instantiates a new <see cref="TagHelperBlockBuilder"/> instance based on given the
|
||||
/// Instantiates a new <see cref="TagHelperBlockBuilder"/> instance based on given the
|
||||
/// <paramref name="original"/>.
|
||||
/// </summary>
|
||||
/// <param name="original">The original <see cref="TagHelperBlock"/> to copy data from.</param>
|
||||
|
|
@ -170,7 +170,7 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers
|
|||
{
|
||||
// We've found an '=' symbol, this means that the coming symbols will either be a quote
|
||||
// or value (in the case that the value is unquoted).
|
||||
// Spaces after/before the equal symbol are not yet supported:
|
||||
// Spaces after/before the equal symbol are not yet supported:
|
||||
// https://github.com/aspnet/Razor/issues/123
|
||||
|
||||
// TODO: Handle malformed tags, if there's an '=' then there MUST be a value.
|
||||
|
|
@ -290,7 +290,7 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers
|
|||
else if (isDynamic && childSpan.CodeGenerator == SpanCodeGenerator.Null)
|
||||
{
|
||||
// Usually the dynamic code generator handles rendering the null code generators underneath
|
||||
// it. This doesn't make sense in terms of tag helpers though, we need to change null code
|
||||
// it. This doesn't make sense in terms of tag helpers though, we need to change null code
|
||||
// generators to markup code generators.
|
||||
|
||||
newCodeGenerator = new MarkupCodeGenerator();
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers.Internal
|
|||
// Found a new tag helper block
|
||||
TrackTagHelperBlock(new TagHelperBlockBuilder(tagName, descriptors, childBlock));
|
||||
|
||||
// If it's a self closing block then we don't have to worry about nested children
|
||||
// If it's a self closing block then we don't have to worry about nested children
|
||||
// within the tag... complete it.
|
||||
if (IsSelfClosing(childBlock))
|
||||
{
|
||||
|
|
@ -117,7 +117,7 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers.Internal
|
|||
// At this point the child is a Span or Block with Type BlockType.Tag that doesn't happen to be a
|
||||
// tag helper.
|
||||
|
||||
// Add the child to current block.
|
||||
// Add the child to current block.
|
||||
_currentBlock.Children.Add(child);
|
||||
}
|
||||
|
||||
|
|
@ -130,12 +130,12 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers.Internal
|
|||
// the document, that's the only way we can have a non-zero _blockStack.Count.
|
||||
if (_blockStack.Count != 0)
|
||||
{
|
||||
// We reverse the children so we can search from the back to the front for the TagHelper that is
|
||||
// We reverse the children so we can search from the back to the front for the TagHelper that is
|
||||
// malformed.
|
||||
var candidateChildren = _currentBlock.Children.Reverse();
|
||||
var malformedTagHelper = candidateChildren.OfType<TagHelperBlock>().FirstOrDefault();
|
||||
|
||||
// If the malformed tag helper is null that means something other than a TagHelper caused the
|
||||
// If the malformed tag helper is null that means something other than a TagHelper caused the
|
||||
// unbalancing of the syntax tree (should never happen).
|
||||
Debug.Assert(malformedTagHelper != null);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace Microsoft.AspNet.Razor
|
|||
/// The result of attempting an incremental parse
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Either the Accepted or Rejected flag is ALWAYS set.
|
||||
/// Either the Accepted or Rejected flag is ALWAYS set.
|
||||
/// Additionally, Provisional may be set with Accepted and SpanContextChanged may be set with Rejected.
|
||||
/// Provisional may NOT be set with Rejected and SpanContextChanged may NOT be set with Accepted.
|
||||
/// </remarks>
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ namespace Microsoft.AspNet.Razor
|
|||
|
||||
/// <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) {
|
||||
/// <p>Hello, @user!</p>
|
||||
/// }
|
||||
|
|
@ -104,7 +104,7 @@ namespace Microsoft.AspNet.Razor
|
|||
|
||||
/// <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) {
|
||||
/// <p>Hello, @user!</p>
|
||||
/// }
|
||||
|
|
@ -228,7 +228,7 @@ namespace Microsoft.AspNet.Razor
|
|||
|
||||
/// <summary>
|
||||
/// Sections cannot be empty. The "@section" keyword must be followed by a block of markup surrounded by "{}". For example:
|
||||
///
|
||||
///
|
||||
/// @section Sidebar {
|
||||
/// <!-- Markup and text goes here -->
|
||||
/// }
|
||||
|
|
@ -240,7 +240,7 @@ namespace Microsoft.AspNet.Razor
|
|||
|
||||
/// <summary>
|
||||
/// Sections cannot be empty. The "@section" keyword must be followed by a block of markup surrounded by "{}". For example:
|
||||
///
|
||||
///
|
||||
/// @section Sidebar {
|
||||
/// <!-- Markup and text goes here -->
|
||||
/// }
|
||||
|
|
@ -252,7 +252,7 @@ namespace Microsoft.AspNet.Razor
|
|||
|
||||
/// <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.
|
||||
|
|
@ -265,7 +265,7 @@ namespace Microsoft.AspNet.Razor
|
|||
|
||||
/// <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.
|
||||
|
|
@ -278,12 +278,12 @@ namespace Microsoft.AspNet.Razor
|
|||
|
||||
/// <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)
|
||||
/// <p>Hello, @user</p>
|
||||
///
|
||||
///
|
||||
/// Instead, wrap the contents of the block in "{{}}":
|
||||
///
|
||||
///
|
||||
/// @if(isLoggedIn) {{
|
||||
/// <p>Hello, @user</p>
|
||||
/// }}
|
||||
|
|
@ -295,12 +295,12 @@ namespace Microsoft.AspNet.Razor
|
|||
|
||||
/// <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)
|
||||
/// <p>Hello, @user</p>
|
||||
///
|
||||
///
|
||||
/// Instead, wrap the contents of the block in "{{}}":
|
||||
///
|
||||
///
|
||||
/// @if(isLoggedIn) {{
|
||||
/// <p>Hello, @user</p>
|
||||
/// }}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using Microsoft.Internal.Web.Utils;
|
|||
namespace Microsoft.AspNet.Razor
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies a Razor directive that is rendered as an attribute on the generated class.
|
||||
/// Specifies a Razor directive that is rendered as an attribute on the generated class.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
|
||||
public sealed class RazorDirectiveAttribute : Attribute
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace Microsoft.AspNet.Razor
|
|||
/// This parser is designed to allow editors to avoid having to worry about incremental parsing.
|
||||
/// The CheckForStructureChanges method can be called with every change made by a user in an editor and
|
||||
/// the parser will provide a result indicating if it was able to incrementally reparse the document.
|
||||
///
|
||||
///
|
||||
/// The general workflow for editors with this parser is:
|
||||
/// 0. User edits document
|
||||
/// 1. Editor builds TextChange structure describing the edit and providing a reference to the _updated_ text buffer
|
||||
|
|
@ -30,25 +30,25 @@ namespace Microsoft.AspNet.Razor
|
|||
/// b. If it can not, the Parser starts a background parse task and return PartialParseResult.Rejected
|
||||
/// NOTE: Additional flags can be applied to the PartialParseResult, see that enum for more details. However,
|
||||
/// the Accepted or Rejected flags will ALWAYS be present
|
||||
///
|
||||
///
|
||||
/// A change can only be incrementally parsed if a single, unique, Span (see Microsoft.AspNet.Razor.Parser.SyntaxTree) in the syntax tree can
|
||||
/// be identified as owning the entire change. For example, if a change overlaps with multiple spans, the change cannot be
|
||||
/// parsed incrementally and a full reparse is necessary. A Span "owns" a change if the change occurs either a) entirely
|
||||
/// within it's boundaries or b) it is a pure insertion (see TextChange) at the end of a Span whose CanGrow flag (see Span) is
|
||||
/// true.
|
||||
///
|
||||
///
|
||||
/// Even if a single unique Span owner can be identified, it's possible the edit will cause the Span to split or merge with other
|
||||
/// Spans, in which case, a full reparse is necessary to identify the extent of the changes to the tree.
|
||||
///
|
||||
///
|
||||
/// When the RazorEditorParser returns Accepted, it updates CurrentParseTree immediately. However, the editor is expected to
|
||||
/// update it's own data structures independently. It can use CurrentParseTree to do this, as soon as the editor returns from
|
||||
/// CheckForStructureChanges, but it should (ideally) have logic for doing so without needing the new tree.
|
||||
///
|
||||
///
|
||||
/// When Rejected is returned by CheckForStructureChanges, a background parse task has _already_ been started. When that task
|
||||
/// finishes, the DocumentStructureChanged event will be fired containing the new generated code, parse tree and a reference to
|
||||
/// the original TextChange that caused the reparse, to allow the editor to resolve the new tree against any changes made since
|
||||
/// the original TextChange that caused the reparse, to allow the editor to resolve the new tree against any changes made since
|
||||
/// calling CheckForStructureChanges.
|
||||
///
|
||||
///
|
||||
/// If a call to CheckForStructureChanges occurs while a reparse is already in-progress, the reparse is cancelled IMMEDIATELY
|
||||
/// and Rejected is returned without attempting to reparse. This means that if a conusmer calls CheckForStructureChanges, which
|
||||
/// returns Rejected, then calls it again before DocumentParseComplete is fired, it will only recieve one DocumentParseComplete
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
|
|
@ -26,36 +26,36 @@
|
|||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
|
|
|
|||
|
|
@ -56,10 +56,10 @@ namespace Microsoft.AspNet.Razor
|
|||
/// <remarks>
|
||||
/// IMPORTANT: This does NOT need to be called before GeneratedCode! GenerateCode will automatically
|
||||
/// parse the document first.
|
||||
///
|
||||
///
|
||||
/// The cancel token provided can be used to cancel the parse. However, please note
|
||||
/// that the parse occurs _synchronously_, on the callers thread. This parameter is
|
||||
/// provided so that if the caller is in a background thread with a CancellationToken,
|
||||
/// that the parse occurs _synchronously_, on the callers thread. This parameter is
|
||||
/// provided so that if the caller is in a background thread with a CancellationToken,
|
||||
/// it can pass it along to the parser.
|
||||
/// </remarks>
|
||||
/// <param name="input">The input text to parse</param>
|
||||
|
|
@ -71,7 +71,7 @@ namespace Microsoft.AspNet.Razor
|
|||
return ParseTemplateCore(input.ToDocument(), sourceFileName: null, cancelToken: cancelToken);
|
||||
}
|
||||
|
||||
// See ParseTemplate(ITextBuffer, CancellationToken?),
|
||||
// See ParseTemplate(ITextBuffer, CancellationToken?),
|
||||
// this overload simply wraps a TextReader in a TextBuffer (see ITextBuffer and BufferingTextReader)
|
||||
public ParserResults ParseTemplate(TextReader input, string sourceFileName)
|
||||
{
|
||||
|
|
@ -114,14 +114,14 @@ namespace Microsoft.AspNet.Razor
|
|||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The cancel token provided can be used to cancel the parse. However, please note
|
||||
/// that the parse occurs _synchronously_, on the callers thread. This parameter is
|
||||
/// provided so that if the caller is in a background thread with a CancellationToken,
|
||||
/// that the parse occurs _synchronously_, on the callers thread. This parameter is
|
||||
/// provided so that if the caller is in a background thread with a CancellationToken,
|
||||
/// it can pass it along to the parser.
|
||||
///
|
||||
///
|
||||
/// The className, rootNamespace and sourceFileName parameters are optional and override the default
|
||||
/// specified by the Host. For example, the WebPageRazorHost in System.Web.WebPages.Razor configures the
|
||||
/// Class Name, Root Namespace and Source File Name based on the virtual path of the page being compiled.
|
||||
/// However, the built-in RazorEngineHost class uses constant defaults, so the caller will likely want to
|
||||
/// However, the built-in RazorEngineHost class uses constant defaults, so the caller will likely want to
|
||||
/// change them using these parameters
|
||||
/// </remarks>
|
||||
/// <param name="input">The input text to parse</param>
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
|||
/// Resolves <see cref="TagHelperDescriptor"/>s based on the given <paramref name="resolutionContext"/>.
|
||||
/// </summary>
|
||||
/// <param name="resolutionContext">
|
||||
/// <see cref="TagHelperDescriptorResolutionContext"/> used to resolve descriptors for the Razor page.
|
||||
/// <see cref="TagHelperDescriptorResolutionContext"/> used to resolve descriptors for the Razor page.
|
||||
/// </param>
|
||||
/// <returns>An <see cref="IEnumerable{TagHelperDescriptor}"/> of <see cref="TagHelperDescriptor"/>s based
|
||||
/// <returns>An <see cref="IEnumerable{TagHelperDescriptor}"/> of <see cref="TagHelperDescriptor"/>s based
|
||||
/// on the given <paramref name="resolutionContext"/>.</returns>
|
||||
IEnumerable<TagHelperDescriptor> Resolve(TagHelperDescriptorResolutionContext resolutionContext);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
|||
/// Instantiates a new instance of the <see cref="TagHelperAttributeDescriptor"/> class.
|
||||
/// </summary>
|
||||
/// <param name="name">The HTML attribute name.</param>
|
||||
/// <param name="propertyName">The name of the CLR property name that corresponds to the HTML
|
||||
/// <param name="propertyName">The name of the CLR property name that corresponds to the HTML
|
||||
/// attribute.</param>
|
||||
/// <param name="typeName">
|
||||
/// The full name of the named (see <paramref name="propertyName"/>) property's
|
||||
/// The full name of the named (see <paramref name="propertyName"/>) property's
|
||||
/// <see cref="System.Type"/>.
|
||||
/// </param>
|
||||
public TagHelperAttributeDescriptor(string name,
|
||||
|
|
@ -46,7 +46,7 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
|||
public string PropertyName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The full name of the named (see <see name="PropertyName"/>) property's
|
||||
/// The full name of the named (see <see name="PropertyName"/>) property's
|
||||
/// <see cref="System.Type"/>.
|
||||
/// </summary>
|
||||
public string TypeName { get; private set; }
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
|||
public class TagHelperAttributeValueCodeRenderer
|
||||
{
|
||||
/// <summary>
|
||||
/// Called during Razor's code generation process to generate code that instantiates the value of the tag
|
||||
/// Called during Razor's code generation process to generate code that instantiates the value of the tag
|
||||
/// helper's property. Last value written should not be or end with a semicolon.
|
||||
/// </summary>
|
||||
/// <param name="attributeDescriptor">The <see cref="TagHelperAttributeDescriptor"/> to generate code for.</param>
|
||||
/// <param name="writer">The <see cref="CSharpCodeWriter"/> that's used to write code.</param>
|
||||
/// <param name="context">A <see cref="CodeGeneratorContext"/> instance that contains information about
|
||||
/// <param name="context">A <see cref="CodeGeneratorContext"/> instance that contains information about
|
||||
/// the current code generation process.</param>
|
||||
/// <param name="renderAttributeValue"><see cref="Action"/> that renders the raw value of the HTML attribute.</param>
|
||||
public virtual void RenderAttributeValue([NotNull] TagHelperAttributeDescriptor attributeDescriptor,
|
||||
|
|
|
|||
|
|
@ -24,16 +24,16 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
|||
[NotNull] string typeName,
|
||||
[NotNull] string assemblyName,
|
||||
ContentBehavior contentBehavior)
|
||||
: this(tagName,
|
||||
typeName,
|
||||
assemblyName,
|
||||
contentBehavior,
|
||||
: this(tagName,
|
||||
typeName,
|
||||
assemblyName,
|
||||
contentBehavior,
|
||||
Enumerable.Empty<TagHelperAttributeDescriptor>())
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of the <see cref="TagHelperDescriptor"/> class with the given
|
||||
/// Instantiates a new instance of the <see cref="TagHelperDescriptor"/> class with the given
|
||||
/// <paramref name="attributes"/>.
|
||||
/// </summary>
|
||||
/// <param name="tagName">The tag name that the tag helper targets. '*' indicates a catch-all
|
||||
|
|
|
|||
|
|
@ -21,15 +21,15 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
|||
/// <summary>
|
||||
/// Determines if the two given tag helpers are equal.
|
||||
/// </summary>
|
||||
/// <param name="descriptorX">A <see cref="TagHelperDescriptor"/> to compare with the given
|
||||
/// <param name="descriptorX">A <see cref="TagHelperDescriptor"/> to compare with the given
|
||||
/// <paramref name="descriptorY"/>.</param>
|
||||
/// <param name="descriptorY">A <see cref="TagHelperDescriptor"/> to compare with the given
|
||||
/// <param name="descriptorY">A <see cref="TagHelperDescriptor"/> to compare with the given
|
||||
/// <paramref name="descriptorX"/>.</param>
|
||||
/// <returns><c>true</c> if <paramref name="descriptorX"/> and <paramref name="descriptorY"/> are equal,
|
||||
/// <c>false</c> otherwise.</returns>
|
||||
/// <remarks>
|
||||
/// Determines equality based on <see cref="TagHelperDescriptor.TypeName"/>,
|
||||
/// <see cref="TagHelperDescriptor.AssemblyName"/>, <see cref="TagHelperDescriptor.TagName"/> and
|
||||
/// Determines equality based on <see cref="TagHelperDescriptor.TypeName"/>,
|
||||
/// <see cref="TagHelperDescriptor.AssemblyName"/>, <see cref="TagHelperDescriptor.TagName"/> and
|
||||
/// <see cref="TagHelperDescriptor.ContentBehavior"/>.
|
||||
/// </remarks>
|
||||
public bool Equals(TagHelperDescriptor descriptorX, TagHelperDescriptor descriptorY)
|
||||
|
|
@ -44,7 +44,7 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
|||
/// Returns an <see cref="int"/> value that uniquely identifies the given <see cref="TagHelperDescriptor"/>.
|
||||
/// </summary>
|
||||
/// <param name="descriptor">The <see cref="TagHelperDescriptor"/> to create a hash code for.</param>
|
||||
/// <returns>An <see cref="int"/> that uniquely identifies the given <paramref name="descriptor"/>.</returns>
|
||||
/// <returns>An <see cref="int"/> that uniquely identifies the given <paramref name="descriptor"/>.</returns>
|
||||
public int GetHashCode(TagHelperDescriptor descriptor)
|
||||
{
|
||||
return HashCodeCombiner.Start()
|
||||
|
|
|
|||
|
|
@ -35,10 +35,10 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
|||
/// <summary>
|
||||
/// Gets all tag helpers that match the given <paramref name="tagName"/>.
|
||||
/// </summary>
|
||||
/// <param name="tagName">The name of the HTML tag to match. Providing a '*' tag name
|
||||
/// <param name="tagName">The name of the HTML tag to match. Providing a '*' tag name
|
||||
/// retrieves catch-all <see cref="TagHelperDescriptor"/>s (descriptors that target every tag).</param>
|
||||
/// <returns><see cref="TagHelperDescriptor"/>s that apply to the given <paramref name="tagName"/>.
|
||||
/// Will return an empty <see cref="Enumerable" /> if no <see cref="TagHelperDescriptor"/>s are
|
||||
/// Will return an empty <see cref="Enumerable" /> if no <see cref="TagHelperDescriptor"/>s are
|
||||
/// found.</returns>
|
||||
public IEnumerable<TagHelperDescriptor> GetTagHelpers(string tagName)
|
||||
{
|
||||
|
|
@ -63,7 +63,7 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
|||
{
|
||||
return matchingDescriptors.Concat(descriptors);
|
||||
}
|
||||
|
||||
|
||||
// We couldn't any descriptors associated with the requested tag name, return all
|
||||
// of the "catch-all" tag descriptors (there may not be any).
|
||||
return descriptors;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
|||
|
||||
/// <summary>
|
||||
/// <see cref="TagHelperDirectiveDescriptor"/>s used to resolve <see cref="TagHelperDescriptor"/>s.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public IList<TagHelperDirectiveDescriptor> DirectiveDescriptors { get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -275,7 +275,7 @@ namespace Microsoft.AspNet.Razor.Tokenizer
|
|||
if (CurrentCharacter == '\\')
|
||||
{
|
||||
TakeCurrent(); // Take the '\'
|
||||
|
||||
|
||||
// If the next char is the same quote that started this
|
||||
if (CurrentCharacter == quote || CurrentCharacter == '\\')
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ namespace Microsoft.AspNet.Razor.Tokenizer
|
|||
{
|
||||
public static bool IsXmlNameStartChar(char chr)
|
||||
{
|
||||
// [4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] |
|
||||
// [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] |
|
||||
// [4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] |
|
||||
// [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] |
|
||||
// [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
|
||||
// http://www.w3.org/TR/REC-xml/#NT-Name
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
public bool Equals(TagHelperAttributeDescriptor descriptorX, TagHelperAttributeDescriptor descriptorY)
|
||||
{
|
||||
return descriptorX.Name == descriptorY.Name &&
|
||||
descriptorX.PropertyName == descriptorY.PropertyName &&
|
||||
descriptorX.PropertyName == descriptorY.PropertyName &&
|
||||
descriptorX.TypeName == descriptorY.TypeName;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
{
|
||||
// Arrange
|
||||
var objectAssemblyName = typeof(object).GetTypeInfo().Assembly.GetName().Name;
|
||||
var expectedDescriptor =
|
||||
var expectedDescriptor =
|
||||
new TagHelperDescriptor("Object", "System.Object", objectAssemblyName, ContentBehavior.None);
|
||||
|
||||
// Act
|
||||
|
|
@ -205,7 +205,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
[Fact]
|
||||
public void CreateDescriptor_ResolvesCustomContentBehavior()
|
||||
{
|
||||
// Arrange
|
||||
// Arrange
|
||||
var expectedDescriptor = new TagHelperDescriptor(
|
||||
"CustomContentBehavior",
|
||||
typeof(CustomContentBehaviorTagHelper).FullName,
|
||||
|
|
@ -223,7 +223,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
[Fact]
|
||||
public void CreateDescriptor_DoesNotResolveInheritedCustomContentBehavior()
|
||||
{
|
||||
// Arrange
|
||||
// Arrange
|
||||
var expectedDescriptor = new TagHelperDescriptor(
|
||||
"InheritedCustomContentBehavior",
|
||||
typeof(InheritedCustomContentBehaviorTagHelper).FullName,
|
||||
|
|
@ -340,18 +340,18 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
// Arrange
|
||||
var expectedDescriptors = new[] {
|
||||
new TagHelperDescriptor(
|
||||
"span",
|
||||
typeof(MultipleAttributeTagHelper).FullName,
|
||||
AssemblyName,
|
||||
ContentBehavior.None),
|
||||
new TagHelperDescriptor(
|
||||
"p",
|
||||
typeof(MultipleAttributeTagHelper).FullName,
|
||||
"span",
|
||||
typeof(MultipleAttributeTagHelper).FullName,
|
||||
AssemblyName,
|
||||
ContentBehavior.None),
|
||||
new TagHelperDescriptor(
|
||||
"div",
|
||||
typeof(MultipleAttributeTagHelper).FullName,
|
||||
"p",
|
||||
typeof(MultipleAttributeTagHelper).FullName,
|
||||
AssemblyName,
|
||||
ContentBehavior.None),
|
||||
new TagHelperDescriptor(
|
||||
"div",
|
||||
typeof(MultipleAttributeTagHelper).FullName,
|
||||
AssemblyName,
|
||||
ContentBehavior.None)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -69,10 +69,10 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
|
||||
// We're treating 'string' as a TagHelper so we can test TagHelpers in multiple assemblies without
|
||||
// building a separate assembly with a single TagHelper.
|
||||
var stringTagHelperDescriptor =
|
||||
new TagHelperDescriptor("string",
|
||||
"System.String",
|
||||
assemblyB,
|
||||
var stringTagHelperDescriptor =
|
||||
new TagHelperDescriptor("string",
|
||||
"System.String",
|
||||
assemblyB,
|
||||
ContentBehavior.None);
|
||||
|
||||
return new TheoryData<Dictionary<string, IEnumerable<Type>>, // descriptorAssemblyLookups
|
||||
|
|
@ -138,7 +138,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
new []
|
||||
{
|
||||
new TagHelperDirectiveDescriptor(
|
||||
Valid_PlainTagHelperType.FullName + ", " + assemblyA,
|
||||
Valid_PlainTagHelperType.FullName + ", " + assemblyA,
|
||||
TagHelperDirectiveType.AddTagHelper),
|
||||
new TagHelperDirectiveDescriptor(assemblyA, TagHelperDirectiveType.AddTagHelper)
|
||||
},
|
||||
|
|
@ -153,7 +153,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
{
|
||||
new TagHelperDirectiveDescriptor(assemblyA, TagHelperDirectiveType.AddTagHelper),
|
||||
new TagHelperDirectiveDescriptor(
|
||||
Valid_PlainTagHelperType.FullName + ", " + assemblyA,
|
||||
Valid_PlainTagHelperType.FullName + ", " + assemblyA,
|
||||
TagHelperDirectiveType.RemoveTagHelper)
|
||||
},
|
||||
new [] { Valid_InheritedTagHelperDescriptor }
|
||||
|
|
@ -167,7 +167,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
{
|
||||
new TagHelperDirectiveDescriptor(assemblyA, TagHelperDirectiveType.AddTagHelper),
|
||||
new TagHelperDirectiveDescriptor(
|
||||
Valid_PlainTagHelperType.FullName + ", " + assemblyA,
|
||||
Valid_PlainTagHelperType.FullName + ", " + assemblyA,
|
||||
TagHelperDirectiveType.RemoveTagHelper),
|
||||
new TagHelperDirectiveDescriptor(assemblyA, TagHelperDirectiveType.AddTagHelper)
|
||||
},
|
||||
|
|
@ -471,7 +471,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
return Resolve(
|
||||
new TagHelperDescriptorResolutionContext(
|
||||
lookupTexts.Select(
|
||||
lookupText =>
|
||||
lookupText =>
|
||||
new TagHelperDirectiveDescriptor(lookupText, TagHelperDirectiveType.AddTagHelper))));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
public void GenerateStartTag_ReturnsSelfClosingStartTag_Attributes()
|
||||
{
|
||||
// Arrange
|
||||
var tagHelperOutput = new TagHelperOutput("p",
|
||||
var tagHelperOutput = new TagHelperOutput("p",
|
||||
attributes: new Dictionary<string, string>
|
||||
{
|
||||
{ "class", "btn" },
|
||||
|
|
@ -114,7 +114,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
public void GenerateStartTag_ReturnsNothingIfWhitespaceTagName()
|
||||
{
|
||||
// Arrange
|
||||
var tagHelperOutput = new TagHelperOutput(" ",
|
||||
var tagHelperOutput = new TagHelperOutput(" ",
|
||||
attributes: new Dictionary<string, string>
|
||||
{
|
||||
{ "class", "btn" },
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace Microsoft.AspNet.Razor.Test
|
|||
{
|
||||
// Arrange
|
||||
var language = new CSharpRazorCodeLanguage();
|
||||
var host = new RazorEngineHost(language);
|
||||
var host = new RazorEngineHost(language);
|
||||
var codeBuilderContext = new CodeBuilderContext(
|
||||
host,
|
||||
"myclass",
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ namespace Microsoft.AspNet.Razor.Test.Editor
|
|||
parser.CheckForStructureChanges(new TextChange(0, 0, new StringTextBuffer(String.Empty), input.Length, input));
|
||||
|
||||
// Assert
|
||||
MiscUtils.DoWithTimeoutIfNotDebugging(parseComplete.Wait);
|
||||
MiscUtils.DoWithTimeoutIfNotDebugging(parseComplete.Wait);
|
||||
|
||||
Assert.Equal(
|
||||
SimpleCSHTMLDocumentGenerated.ReadAllText(),
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ namespace Microsoft.AspNet.Razor.Test.Framework
|
|||
{
|
||||
}
|
||||
|
||||
public MarkupTagHelperBlock(string tagName,
|
||||
public MarkupTagHelperBlock(string tagName,
|
||||
IDictionary<string, SyntaxTreeNode> attributes)
|
||||
: this(tagName, attributes, new SyntaxTreeNode[0])
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,15 +35,15 @@ namespace Microsoft.AspNet.Razor.Test.Framework
|
|||
|
||||
protected abstract ParserBase SelectActiveParser(ParserBase codeParser, ParserBase markupParser);
|
||||
|
||||
public virtual ParserContext CreateParserContext(ITextDocument input,
|
||||
ParserBase codeParser,
|
||||
public virtual ParserContext CreateParserContext(ITextDocument input,
|
||||
ParserBase codeParser,
|
||||
ParserBase markupParser,
|
||||
ParserErrorSink errorSink)
|
||||
{
|
||||
return new ParserContext(input,
|
||||
codeParser,
|
||||
markupParser,
|
||||
SelectActiveParser(codeParser, markupParser),
|
||||
return new ParserContext(input,
|
||||
codeParser,
|
||||
markupParser,
|
||||
SelectActiveParser(codeParser, markupParser),
|
||||
errorSink);
|
||||
}
|
||||
|
||||
|
|
@ -161,13 +161,13 @@ namespace Microsoft.AspNet.Razor.Test.Framework
|
|||
return ParseDocument(document, designTimeParser: false, errorSink: errorSink);
|
||||
}
|
||||
|
||||
protected virtual ParserResults ParseDocument(string document,
|
||||
bool designTimeParser,
|
||||
protected virtual ParserResults ParseDocument(string document,
|
||||
bool designTimeParser,
|
||||
ParserErrorSink errorSink)
|
||||
{
|
||||
return RunParse(document,
|
||||
parser => parser.ParseDocument,
|
||||
designTimeParser,
|
||||
return RunParse(document,
|
||||
parser => parser.ParseDocument,
|
||||
designTimeParser,
|
||||
parserSelector: c => c.MarkupParser,
|
||||
errorSink: errorSink);
|
||||
}
|
||||
|
|
@ -180,9 +180,9 @@ namespace Microsoft.AspNet.Razor.Test.Framework
|
|||
return RunParse(document, parser => parser.ParseBlock, designTimeParser);
|
||||
}
|
||||
|
||||
protected virtual ParserResults RunParse(string document,
|
||||
Func<ParserBase, Action> parserActionSelector,
|
||||
bool designTimeParser,
|
||||
protected virtual ParserResults RunParse(string document,
|
||||
Func<ParserBase, Action> parserActionSelector,
|
||||
bool designTimeParser,
|
||||
Func<ParserContext, ParserBase> parserSelector = null,
|
||||
ParserErrorSink errorSink = null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -492,40 +492,40 @@ namespace Microsoft.AspNet.Razor.Test.Generator
|
|||
});
|
||||
}
|
||||
|
||||
protected static LineMapping BuildLineMapping(int documentAbsoluteIndex,
|
||||
int documentLineIndex,
|
||||
int generatedAbsoluteIndex,
|
||||
int generatedLineIndex,
|
||||
int characterOffsetIndex,
|
||||
protected static LineMapping BuildLineMapping(int documentAbsoluteIndex,
|
||||
int documentLineIndex,
|
||||
int generatedAbsoluteIndex,
|
||||
int generatedLineIndex,
|
||||
int characterOffsetIndex,
|
||||
int contentLength)
|
||||
{
|
||||
return BuildLineMapping(documentAbsoluteIndex,
|
||||
documentLineIndex,
|
||||
characterOffsetIndex,
|
||||
generatedAbsoluteIndex,
|
||||
generatedLineIndex,
|
||||
characterOffsetIndex,
|
||||
return BuildLineMapping(documentAbsoluteIndex,
|
||||
documentLineIndex,
|
||||
characterOffsetIndex,
|
||||
generatedAbsoluteIndex,
|
||||
generatedLineIndex,
|
||||
characterOffsetIndex,
|
||||
contentLength);
|
||||
}
|
||||
|
||||
protected static LineMapping BuildLineMapping(int documentAbsoluteIndex,
|
||||
int documentLineIndex,
|
||||
int documentCharacterOffsetIndex,
|
||||
int generatedAbsoluteIndex,
|
||||
int generatedLineIndex,
|
||||
int generatedCharacterOffsetIndex,
|
||||
protected static LineMapping BuildLineMapping(int documentAbsoluteIndex,
|
||||
int documentLineIndex,
|
||||
int documentCharacterOffsetIndex,
|
||||
int generatedAbsoluteIndex,
|
||||
int generatedLineIndex,
|
||||
int generatedCharacterOffsetIndex,
|
||||
int contentLength)
|
||||
{
|
||||
return new LineMapping(
|
||||
documentLocation: new MappingLocation(
|
||||
new SourceLocation(documentAbsoluteIndex,
|
||||
documentLineIndex,
|
||||
documentCharacterOffsetIndex),
|
||||
new SourceLocation(documentAbsoluteIndex,
|
||||
documentLineIndex,
|
||||
documentCharacterOffsetIndex),
|
||||
contentLength),
|
||||
generatedLocation: new MappingLocation(
|
||||
new SourceLocation(generatedAbsoluteIndex,
|
||||
generatedLineIndex,
|
||||
generatedCharacterOffsetIndex),
|
||||
new SourceLocation(generatedAbsoluteIndex,
|
||||
generatedLineIndex,
|
||||
generatedCharacterOffsetIndex),
|
||||
contentLength)
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator.CodeTree
|
|||
var result = codeBuilder.Build();
|
||||
|
||||
BaselineWriter.WriteBaseline(
|
||||
@"test\Microsoft.AspNet.Razor.Test\TestFiles\CodeGenerator\CS\Output\CSharpCodeBuilder.cs",
|
||||
@"test\Microsoft.AspNet.Razor.Test\TestFiles\CodeGenerator\CS\Output\CSharpCodeBuilder.cs",
|
||||
result.Code);
|
||||
|
||||
var expectedOutput = TestFile.Create("TestFiles/CodeGenerator/CS/Output/CSharpCodeBuilder.cs").ReadAllText();
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
|
|||
{
|
||||
Assert.True(spanIndex > 0);
|
||||
|
||||
var parser = new RazorParser(new CSharpCodeParser(),
|
||||
var parser = new RazorParser(new CSharpCodeParser(),
|
||||
new HtmlMarkupParser(),
|
||||
tagHelperDescriptorResolver: null);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ namespace Microsoft.AspNet.Razor
|
|||
var block = new ExpressionBlock();
|
||||
var addTagHelperDirective = spanFactory.MetaCode(SyntaxConstants.CSharp.AddTagHelperKeyword + " ");
|
||||
|
||||
// Act
|
||||
// Act
|
||||
builder.StartChunkBlock<ExpressionBlockChunk>(block);
|
||||
builder.AddAddTagHelperChunk("some text", addTagHelperDirective);
|
||||
builder.EndChunkBlock();
|
||||
|
|
@ -45,7 +45,7 @@ namespace Microsoft.AspNet.Razor
|
|||
var block = new ExpressionBlock();
|
||||
var removeTagHelperDirective = spanFactory.MetaCode(SyntaxConstants.CSharp.RemoveTagHelperKeyword + " ");
|
||||
|
||||
// Act
|
||||
// Act
|
||||
builder.StartChunkBlock<ExpressionBlockChunk>(block);
|
||||
builder.AddRemoveTagHelperChunk("some text", removeTagHelperDirective);
|
||||
builder.EndChunkBlock();
|
||||
|
|
@ -67,8 +67,8 @@ namespace Microsoft.AspNet.Razor
|
|||
var spanFactory = SpanFactory.CreateCsHtml();
|
||||
var previousSpan = spanFactory.EmptyHtml().Builder.Build();
|
||||
var builder = new CodeTreeBuilder();
|
||||
|
||||
// Act
|
||||
|
||||
// Act
|
||||
builder.AddLiteralChunk("some text", previousSpan);
|
||||
|
||||
// Assert
|
||||
|
|
@ -87,7 +87,7 @@ namespace Microsoft.AspNet.Razor
|
|||
var newSpan = spanFactory.Markup("<p>").Builder.Build();
|
||||
var builder = new CodeTreeBuilder();
|
||||
|
||||
// Act
|
||||
// Act
|
||||
builder.AddLiteralChunk("<a>", previousSpan);
|
||||
builder.AddLiteralChunk("<p>", newSpan);
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ namespace Microsoft.AspNet.Razor
|
|||
var literalSpan = spanFactory.Markup("<p>").Builder.Build();
|
||||
var builder = new CodeTreeBuilder();
|
||||
|
||||
// Act
|
||||
// Act
|
||||
builder.AddStatementChunk("int a = 10;", codeSpan);
|
||||
builder.AddLiteralChunk("<p>", literalSpan);
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler
|
|||
|
||||
var expected = new SourceLocation(
|
||||
absoluteIndex: 6 + newLine.Length + WriterNewLineLength,
|
||||
lineIndex: 2,
|
||||
lineIndex: 2,
|
||||
characterIndex: 0);
|
||||
|
||||
Assert.Equal(expected, location);
|
||||
|
|
@ -111,8 +111,8 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler
|
|||
var location = writer.GetCurrentSourceLocation();
|
||||
|
||||
var expected = new SourceLocation(
|
||||
absoluteIndex: 9 + newLine.Length + newLine.Length,
|
||||
lineIndex: 2,
|
||||
absoluteIndex: 9 + newLine.Length + newLine.Length,
|
||||
lineIndex: 2,
|
||||
characterIndex: 2);
|
||||
|
||||
Assert.Equal(expected, location);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
|
|||
{
|
||||
if (directiveDescriptor.DirectiveType == TagHelperDirectiveType.RemoveTagHelper)
|
||||
{
|
||||
// We don't yet support "typeName, assemblyName" for @removetaghelper in this test class. Will
|
||||
// We don't yet support "typeName, assemblyName" for @removetaghelper in this test class. Will
|
||||
// add that ability and add the corresponding end-to-end test verification in:
|
||||
// https://github.com/aspnet/Razor/issues/222
|
||||
descriptors = null;
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
|
|||
[Fact]
|
||||
public void ParseBlockSupportsLineCommentBetweenIfAndElseClause()
|
||||
{
|
||||
SingleSpanBlockTest(@"if(foo) { bar(); }
|
||||
SingleSpanBlockTest(@"if(foo) { bar(); }
|
||||
// Foo
|
||||
// Bar
|
||||
else { baz(); }", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedCharacters.None);
|
||||
|
|
@ -176,10 +176,10 @@ else if(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
|
|||
public void ParseBlockParsesElseIfBranchesOfIfStatement()
|
||||
{
|
||||
const string ifStatement = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||
Debug.WriteLine(@""foo } bar"");
|
||||
Debug.WriteLine(@""foo } bar"");
|
||||
}";
|
||||
const string elseIfBranch = @" else if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||
Debug.WriteLine(@""bar } baz"");
|
||||
const string elseIfBranch = @" else if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||
Debug.WriteLine(@""bar } baz"");
|
||||
}";
|
||||
const string document = ifStatement + elseIfBranch;
|
||||
|
||||
|
|
@ -190,10 +190,10 @@ else if(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
|
|||
public void ParseBlockParsesMultipleElseIfBranchesOfIfStatement()
|
||||
{
|
||||
const string ifStatement = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||
Debug.WriteLine(@""foo } bar"");
|
||||
Debug.WriteLine(@""foo } bar"");
|
||||
}";
|
||||
const string elseIfBranch = @" else if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||
Debug.WriteLine(@""bar } baz"");
|
||||
const string elseIfBranch = @" else if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||
Debug.WriteLine(@""bar } baz"");
|
||||
}";
|
||||
const string document = ifStatement + elseIfBranch + elseIfBranch + elseIfBranch + elseIfBranch;
|
||||
SingleSpanBlockTest(document, BlockType.Statement, SpanKind.Code);
|
||||
|
|
@ -203,10 +203,10 @@ else if(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
|
|||
public void ParseBlockParsesMultipleElseIfBranchesOfIfStatementFollowedByOneElseBranch()
|
||||
{
|
||||
const string ifStatement = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||
Debug.WriteLine(@""foo } bar"");
|
||||
Debug.WriteLine(@""foo } bar"");
|
||||
}";
|
||||
const string elseIfBranch = @" else if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||
Debug.WriteLine(@""bar } baz"");
|
||||
const string elseIfBranch = @" else if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||
Debug.WriteLine(@""bar } baz"");
|
||||
}";
|
||||
const string elseBranch = @" else { Debug.WriteLine(@""bar } baz""); }";
|
||||
const string document = ifStatement + elseIfBranch + elseIfBranch + elseBranch;
|
||||
|
|
@ -218,10 +218,10 @@ else if(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
|
|||
public void ParseBlockStopsParsingCodeAfterElseBranch()
|
||||
{
|
||||
const string ifStatement = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||
Debug.WriteLine(@""foo } bar"");
|
||||
Debug.WriteLine(@""foo } bar"");
|
||||
}";
|
||||
const string elseIfBranch = @" else if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||
Debug.WriteLine(@""bar } baz"");
|
||||
const string elseIfBranch = @" else if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||
Debug.WriteLine(@""bar } baz"");
|
||||
}";
|
||||
const string elseBranch = @" else { Debug.WriteLine(@""bar } baz""); }";
|
||||
const string document = ifStatement + elseIfBranch + elseBranch + elseIfBranch;
|
||||
|
|
@ -234,7 +234,7 @@ else if(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
|
|||
public void ParseBlockStopsParsingIfIfStatementNotFollowedByElse()
|
||||
{
|
||||
const string document = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||
Debug.WriteLine(@""foo } bar"");
|
||||
Debug.WriteLine(@""foo } bar"");
|
||||
}";
|
||||
|
||||
SingleSpanBlockTest(document, BlockType.Statement, SpanKind.Code);
|
||||
|
|
@ -245,7 +245,7 @@ else if(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
|
|||
{
|
||||
// We don't want to be a full C# parser - If the else if is missing it's condition, the C# compiler can handle that, we have all the info we need to keep parsing
|
||||
const string ifBranch = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||
Debug.WriteLine(@""foo } bar"");
|
||||
Debug.WriteLine(@""foo } bar"");
|
||||
}";
|
||||
const string elseIfBranch = @" else if { foo(); }";
|
||||
const string document = ifBranch + elseIfBranch;
|
||||
|
|
@ -292,7 +292,7 @@ else if(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
|
|||
[Fact]
|
||||
public void ParseBlockSupportsLineCommentBetweenDoAndWhileClause()
|
||||
{
|
||||
SingleSpanBlockTest(@"do { var foo = bar; }
|
||||
SingleSpanBlockTest(@"do { var foo = bar; }
|
||||
// Foo
|
||||
// Bar
|
||||
while(true);", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedCharacters.None);
|
||||
|
|
@ -449,7 +449,7 @@ while(true);", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedC
|
|||
[Fact]
|
||||
public void ParseBlockSupportsLineCommentBetweenTryAndFinallyClause()
|
||||
{
|
||||
SingleSpanBlockTest(@"try { bar(); }
|
||||
SingleSpanBlockTest(@"try { bar(); }
|
||||
// Foo
|
||||
// Bar
|
||||
finally { baz(); }", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedCharacters.None);
|
||||
|
|
@ -483,8 +483,8 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
|
|||
public void ParseBlockSupportsMarkupWithinTryClause()
|
||||
{
|
||||
RunSimpleWrappedMarkupTest(
|
||||
prefix: "try {",
|
||||
markup: " <p>Foo</p> ",
|
||||
prefix: "try {",
|
||||
markup: " <p>Foo</p> ",
|
||||
suffix: "}",
|
||||
expectedMarkup: new MarkupBlock(
|
||||
Factory.Markup(" "),
|
||||
|
|
@ -504,8 +504,8 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
|
|||
public void ParseBlockSupportsMarkupWithinCatchClause()
|
||||
{
|
||||
RunSimpleWrappedMarkupTest(
|
||||
prefix: "try { var foo = new { } } catch(Foo Bar Baz) {",
|
||||
markup: " <p>Foo</p> ",
|
||||
prefix: "try { var foo = new { } } catch(Foo Bar Baz) {",
|
||||
markup: " <p>Foo</p> ",
|
||||
suffix: "}",
|
||||
expectedMarkup: new MarkupBlock(
|
||||
Factory.Markup(" "),
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
|
|||
Factory.Markup("<script>")),
|
||||
Factory.Markup("(function foo() { return 1; })();"),
|
||||
new MarkupTagBlock(
|
||||
Factory.Markup("</script>")),
|
||||
Factory.Markup("</script>")),
|
||||
Factory.Markup(" ")),
|
||||
Factory.MetaCode("}").Accepts(AcceptedCharacters.None)),
|
||||
Factory.EmptyHtml()));
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html
|
|||
new MarkupBlock(
|
||||
new MarkupTagBlock(
|
||||
Factory.Markup("<foo>").Accepts(AcceptedCharacters.None)),
|
||||
Factory.Markup("bar"),
|
||||
Factory.Markup("bar"),
|
||||
Factory.Markup("<!-- zoop -->").Accepts(AcceptedCharacters.None),
|
||||
Factory.Markup("baz"),
|
||||
new MarkupTagBlock(
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html
|
|||
.Accepts(AcceptedCharacters.NonWhiteSpace))),
|
||||
Factory.Markup("/Boz").With(new LiteralAttributeCodeGenerator(new LocationTagged<string>(String.Empty, 49, 0, 49), new LocationTagged<string>("/Boz", 49, 0, 49)))),
|
||||
Factory.Markup(" />")),
|
||||
Factory.Markup(" ")
|
||||
Factory.Markup(" ")
|
||||
),
|
||||
Factory.MetaCode("}").Accepts(AcceptedCharacters.None)),
|
||||
Factory.EmptyHtml()));
|
||||
|
|
|
|||
|
|
@ -58,12 +58,12 @@ namespace Microsoft.AspNet.Razor.Test.Parser.PartialParsing
|
|||
{
|
||||
return new RazorEngineHost(new TLanguage())
|
||||
{
|
||||
GeneratedClassContext = new GeneratedClassContext("Execute",
|
||||
"Write",
|
||||
"WriteLiteral",
|
||||
"WriteTo",
|
||||
"WriteLiteralTo",
|
||||
"Template",
|
||||
GeneratedClassContext = new GeneratedClassContext("Execute",
|
||||
"Write",
|
||||
"WriteLiteral",
|
||||
"WriteTo",
|
||||
"WriteLiteralTo",
|
||||
"Template",
|
||||
"DefineSection",
|
||||
new GeneratedTagHelperContext()),
|
||||
DesignTimeMode = true
|
||||
|
|
|
|||
|
|
@ -1181,9 +1181,9 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers
|
|||
return new TagHelperDescriptorProvider(descriptors);
|
||||
}
|
||||
|
||||
public override ParserContext CreateParserContext(ITextDocument input,
|
||||
ParserBase codeParser,
|
||||
ParserBase markupParser,
|
||||
public override ParserContext CreateParserContext(ITextDocument input,
|
||||
ParserBase codeParser,
|
||||
ParserBase markupParser,
|
||||
ParserErrorSink errorSink)
|
||||
{
|
||||
return base.CreateParserContext(input, codeParser, markupParser, errorSink);
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ namespace Microsoft.AspNet.Razor.Test.Text
|
|||
[Fact]
|
||||
public void TestIsDelete()
|
||||
{
|
||||
// Arrange
|
||||
// Arrange
|
||||
var oldBuffer = new Mock<ITextBuffer>().Object;
|
||||
var newBuffer = new Mock<ITextBuffer>().Object;
|
||||
var change = new TextChange(0, 1, oldBuffer, 0, newBuffer);
|
||||
|
|
@ -89,7 +89,7 @@ namespace Microsoft.AspNet.Razor.Test.Text
|
|||
[Fact]
|
||||
public void TestDeleteCreatesTheRightSizeChange()
|
||||
{
|
||||
// Arrange
|
||||
// Arrange
|
||||
var oldBuffer = new Mock<ITextBuffer>().Object;
|
||||
var newBuffer = new Mock<ITextBuffer>().Object;
|
||||
var change = new TextChange(0, 1, oldBuffer, 0, newBuffer);
|
||||
|
|
@ -102,7 +102,7 @@ namespace Microsoft.AspNet.Razor.Test.Text
|
|||
[Fact]
|
||||
public void TestIsInsert()
|
||||
{
|
||||
// Arrange
|
||||
// Arrange
|
||||
var oldBuffer = new Mock<ITextBuffer>().Object;
|
||||
var newBuffer = new Mock<ITextBuffer>().Object;
|
||||
var change = new TextChange(0, 0, oldBuffer, 35, newBuffer);
|
||||
|
|
@ -114,7 +114,7 @@ namespace Microsoft.AspNet.Razor.Test.Text
|
|||
[Fact]
|
||||
public void TestInsertCreateTheRightSizeChange()
|
||||
{
|
||||
// Arrange
|
||||
// Arrange
|
||||
var oldBuffer = new Mock<ITextBuffer>().Object;
|
||||
var newBuffer = new Mock<ITextBuffer>().Object;
|
||||
var change = new TextChange(0, 0, oldBuffer, 1, newBuffer);
|
||||
|
|
@ -127,7 +127,7 @@ namespace Microsoft.AspNet.Razor.Test.Text
|
|||
[Fact]
|
||||
public void TestIsReplace()
|
||||
{
|
||||
// Arrange
|
||||
// Arrange
|
||||
var oldBuffer = new Mock<ITextBuffer>().Object;
|
||||
var newBuffer = new Mock<ITextBuffer>().Object;
|
||||
var change = new TextChange(0, 5, oldBuffer, 10, newBuffer);
|
||||
|
|
@ -139,7 +139,7 @@ namespace Microsoft.AspNet.Razor.Test.Text
|
|||
[Fact]
|
||||
public void ReplaceCreatesTheRightSizeChange()
|
||||
{
|
||||
// Arrange
|
||||
// Arrange
|
||||
var oldBuffer = new Mock<ITextBuffer>().Object;
|
||||
var newBuffer = new Mock<ITextBuffer>().Object;
|
||||
var change = new TextChange(0, 5, oldBuffer, 10, newBuffer);
|
||||
|
|
@ -152,7 +152,7 @@ namespace Microsoft.AspNet.Razor.Test.Text
|
|||
[Fact]
|
||||
public void ReplaceCreatesTheRightSizeChange1()
|
||||
{
|
||||
// Arrange
|
||||
// Arrange
|
||||
var oldBuffer = new Mock<ITextBuffer>().Object;
|
||||
var newBuffer = new Mock<ITextBuffer>().Object;
|
||||
var change = new TextChange(0, 5, oldBuffer, 1, newBuffer);
|
||||
|
|
|
|||
Loading…
Reference in New Issue