Comments
The interface UniversalExpressionParser.IExpressionLanguageProvider has properties string LineCommentMarker { get; }, string MultilineCommentStartMarker { get; }, and string MultilineCommentEndMarker { get; } for specifying comment markers.
If the values of these properties are not null, line and code block comments can be used.
The abstract implementation UniversalExpressionParser.ExpressionLanguageProviderBase of UniversalExpressionParser.IExpressionLanguageProvider overrides these properties to return “//”, “/”, and “/” (the values of these properties can be overridden in subclasses).
The on commented out code data is stored in property IReadOnlyList<UniversalExpressionParser.ICommentedTextData> SortedCommentedTextData { get; } in UniversalExpressionParser.IParsedExpressionResult, an instance of which is returned by the call to method UniversalExpressionParser.IExpressionParser.ParseExpression(…).
Below are some examples of line and code block comments:
1// Line comment
2var x = 5*y; // another line comments
3
4println(x +/*Code block
5comments
6can span multiple lines and can be placed anywhere.
7*/y+10*z);
8
9/*
10Another code block comments
11var y=5*x;
12var z = 3*y;
13*/
Click here to see the visualized instance of UniversalExpressionParser.IParseExpressionResult
Below is the definition of interface UniversalExpressionParser.ICommentedTextData that stores data on comments.
1// Copyright (c) UniversalExpressionParser Project. All rights reserved.
2// Licensed under the MIT License. See LICENSE in the solution root for license information.
3
4using UniversalExpressionParser.ExpressionItems;
5
6namespace UniversalExpressionParser
7{
8 /// <summary>
9 /// Info on commented out code block.
10 /// </summary>
11 public interface ICommentedTextData: ITextItem
12 {
13 /// <summary>
14 /// If true, the comment is a line comment. Otherwise, it is a block comment.
15 /// </summary>
16 bool IsLineComment { get; }
17 }
18}