From e4e57451010cc70317bfcd30449195f2d4076637 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 23 May 2022 19:56:43 +0200 Subject: [PATCH] Fix parsing comments for Scripting API types that are templates --- .../Bindings/BindingsGenerator.Parsing.cs | 37 ++++++++++++++++--- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Parsing.cs b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Parsing.cs index f46e162e9..2b578bc93 100644 --- a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Parsing.cs +++ b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Parsing.cs @@ -62,6 +62,7 @@ namespace Flax.Build.Bindings tokensCount++; switch (token.Type) { + case TokenType.Newline: case TokenType.Whitespace: break; case TokenType.CommentMultiLine: { @@ -71,18 +72,42 @@ namespace Flax.Build.Bindings case TokenType.CommentSingleLine: { var commentLine = token.Value.Trim(); - - // Fix '//' comments if (commentLine.StartsWith("// ")) + { + // Fix '//' comments commentLine = "/// " + commentLine.Substring(3); - - // Fix inlined summary - if (commentLine.StartsWith("/// ") && commentLine.EndsWith("")) + } + else if (commentLine.StartsWith("/// ") && commentLine.EndsWith("")) + { + // Fix inlined summary commentLine = "/// " + commentLine.Substring(13, commentLine.Length - 23); - + isValid = false; + } + else if (commentLine.StartsWith("/// ")) + { + // End searching after summary begin found + isValid = false; + } context.StringCache.Insert(0, commentLine); break; } + case TokenType.GreaterThan: + { + // Template definition + // TODO: return created template definition for Template types + while (isValid) + { + token = context.Tokenizer.PreviousToken(true, true); + tokensCount++; + if (token.Type == TokenType.LessThan) + { + token = context.Tokenizer.PreviousToken(true, true); + tokensCount++; + break; + } + } + break; + } default: isValid = false; break;