From c7dcbd82d6ba4bc952c31c21e0668338d569ee24 Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Fri, 8 Mar 2019 15:56:46 -0800 Subject: [PATCH] Added missed files to RazorSyntaxGenerator (dotnet/aspnetcore-tooling#318) \n\nCommit migrated from https://github.com/dotnet/aspnetcore-tooling/commit/84066bc88038d6cdd591b277708f3c62e9c1d406 --- .../Model/AbstractNode.cs | 14 ++++++++ .../RazorSyntaxGenerator/Model/Comment.cs | 14 ++++++++ .../tools/RazorSyntaxGenerator/Model/Field.cs | 32 +++++++++++++++++++ .../tools/RazorSyntaxGenerator/Model/Kind.cs | 13 ++++++++ .../tools/RazorSyntaxGenerator/Model/Node.cs | 23 +++++++++++++ .../Model/PredefinedNode.cs | 9 ++++++ .../tools/RazorSyntaxGenerator/Model/Tree.cs | 20 ++++++++++++ .../RazorSyntaxGenerator/Model/TreeType.cs | 22 +++++++++++++ .../tools/RazorSyntaxGenerator/README.md | 6 +--- 9 files changed, 148 insertions(+), 5 deletions(-) create mode 100644 src/Razor/tools/RazorSyntaxGenerator/Model/AbstractNode.cs create mode 100644 src/Razor/tools/RazorSyntaxGenerator/Model/Comment.cs create mode 100644 src/Razor/tools/RazorSyntaxGenerator/Model/Field.cs create mode 100644 src/Razor/tools/RazorSyntaxGenerator/Model/Kind.cs create mode 100644 src/Razor/tools/RazorSyntaxGenerator/Model/Node.cs create mode 100644 src/Razor/tools/RazorSyntaxGenerator/Model/PredefinedNode.cs create mode 100644 src/Razor/tools/RazorSyntaxGenerator/Model/Tree.cs create mode 100644 src/Razor/tools/RazorSyntaxGenerator/Model/TreeType.cs diff --git a/src/Razor/tools/RazorSyntaxGenerator/Model/AbstractNode.cs b/src/Razor/tools/RazorSyntaxGenerator/Model/AbstractNode.cs new file mode 100644 index 0000000000..bc120f8095 --- /dev/null +++ b/src/Razor/tools/RazorSyntaxGenerator/Model/AbstractNode.cs @@ -0,0 +1,14 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Xml.Serialization; + +namespace RazorSyntaxGenerator +{ + public class AbstractNode : TreeType + { + [XmlElement(ElementName = "Field", Type = typeof(Field))] + public List Fields; + } +} diff --git a/src/Razor/tools/RazorSyntaxGenerator/Model/Comment.cs b/src/Razor/tools/RazorSyntaxGenerator/Model/Comment.cs new file mode 100644 index 0000000000..7b26ed940b --- /dev/null +++ b/src/Razor/tools/RazorSyntaxGenerator/Model/Comment.cs @@ -0,0 +1,14 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Xml; +using System.Xml.Serialization; + +namespace RazorSyntaxGenerator +{ + public class Comment + { + [XmlAnyElement] + public XmlElement[] Body; + } +} diff --git a/src/Razor/tools/RazorSyntaxGenerator/Model/Field.cs b/src/Razor/tools/RazorSyntaxGenerator/Model/Field.cs new file mode 100644 index 0000000000..fe900160b0 --- /dev/null +++ b/src/Razor/tools/RazorSyntaxGenerator/Model/Field.cs @@ -0,0 +1,32 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Xml.Serialization; + +namespace RazorSyntaxGenerator +{ + public class Field + { + [XmlAttribute] + public string Name; + + [XmlAttribute] + public string Type; + + [XmlAttribute] + public string Optional; + + [XmlAttribute] + public string Override; + + [XmlAttribute] + public string New; + + [XmlElement(ElementName = "Kind", Type = typeof(Kind))] + public List Kinds; + + [XmlElement] + public Comment PropertyComment; + } +} diff --git a/src/Razor/tools/RazorSyntaxGenerator/Model/Kind.cs b/src/Razor/tools/RazorSyntaxGenerator/Model/Kind.cs new file mode 100644 index 0000000000..fb1254d500 --- /dev/null +++ b/src/Razor/tools/RazorSyntaxGenerator/Model/Kind.cs @@ -0,0 +1,13 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Xml.Serialization; + +namespace RazorSyntaxGenerator +{ + public class Kind + { + [XmlAttribute] + public string Name; + } +} diff --git a/src/Razor/tools/RazorSyntaxGenerator/Model/Node.cs b/src/Razor/tools/RazorSyntaxGenerator/Model/Node.cs new file mode 100644 index 0000000000..365bc4d393 --- /dev/null +++ b/src/Razor/tools/RazorSyntaxGenerator/Model/Node.cs @@ -0,0 +1,23 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Xml.Serialization; + +namespace RazorSyntaxGenerator +{ + public class Node : TreeType + { + [XmlAttribute] + public string Root; + + [XmlAttribute] + public string Errors; + + [XmlElement(ElementName = "Kind", Type = typeof(Kind))] + public List Kinds; + + [XmlElement(ElementName = "Field", Type = typeof(Field))] + public List Fields; + } +} diff --git a/src/Razor/tools/RazorSyntaxGenerator/Model/PredefinedNode.cs b/src/Razor/tools/RazorSyntaxGenerator/Model/PredefinedNode.cs new file mode 100644 index 0000000000..8fb09e6ca8 --- /dev/null +++ b/src/Razor/tools/RazorSyntaxGenerator/Model/PredefinedNode.cs @@ -0,0 +1,9 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace RazorSyntaxGenerator +{ + public class PredefinedNode : TreeType + { + } +} diff --git a/src/Razor/tools/RazorSyntaxGenerator/Model/Tree.cs b/src/Razor/tools/RazorSyntaxGenerator/Model/Tree.cs new file mode 100644 index 0000000000..000b5aaf19 --- /dev/null +++ b/src/Razor/tools/RazorSyntaxGenerator/Model/Tree.cs @@ -0,0 +1,20 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Xml.Serialization; + +namespace RazorSyntaxGenerator +{ + [XmlRoot] + public class Tree + { + [XmlAttribute] + public string Root; + + [XmlElement(ElementName = "Node", Type = typeof(Node))] + [XmlElement(ElementName = "AbstractNode", Type = typeof(AbstractNode))] + [XmlElement(ElementName = "PredefinedNode", Type = typeof(PredefinedNode))] + public List Types; + } +} diff --git a/src/Razor/tools/RazorSyntaxGenerator/Model/TreeType.cs b/src/Razor/tools/RazorSyntaxGenerator/Model/TreeType.cs new file mode 100644 index 0000000000..8900c786f4 --- /dev/null +++ b/src/Razor/tools/RazorSyntaxGenerator/Model/TreeType.cs @@ -0,0 +1,22 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Xml.Serialization; + +namespace RazorSyntaxGenerator +{ + public class TreeType + { + [XmlAttribute] + public string Name; + + [XmlAttribute] + public string Base; + + [XmlElement] + public Comment TypeComment; + + [XmlElement] + public Comment FactoryComment; + } +} diff --git a/src/Razor/tools/RazorSyntaxGenerator/README.md b/src/Razor/tools/RazorSyntaxGenerator/README.md index 0d3aee7912..c19e1d681b 100644 --- a/src/Razor/tools/RazorSyntaxGenerator/README.md +++ b/src/Razor/tools/RazorSyntaxGenerator/README.md @@ -4,8 +4,4 @@ Syntax generator tool for the Razor syntax tree. This is a modified version of R ## Usage -dotnet run `path/to/Syntax.xml` `path/to/generated/output` - -E.g, - -`dotnet run ../Microsoft.AspNetCore.Razor.Language/Syntax/Syntax.xml ../Microsoft.AspNetCore.Razor.Language/Syntax/Generated/` \ No newline at end of file +dotnet run `full/path/to/Syntax.xml` `full/path/to/generated/output` \ No newline at end of file