-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Шевырин Никита #229
base: master
Are you sure you want to change the base?
Шевырин Никита #229
Conversation
|
||
public enum MarkdownTokenType | ||
{ | ||
NoConversion, |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
{ | ||
NoConversion, | ||
ToItalic, | ||
ToBold, |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Markdown/Markdown/Md.cs
Outdated
{ | ||
var markdownSpan = markdown.AsSpan(); | ||
var context = new StringBuilder(); | ||
var stepCount = markdownSpan.Length / _sliceSize; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Markdown/Markdown/Md.cs
Outdated
|
||
public class Md : IMd | ||
{ | ||
private readonly ITokenizer[] _tokenizers = |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Markdown/Markdown/Md.cs
Outdated
var sliceStart = step * _sliceSize; | ||
var sliceSize = Math.Min(_sliceSize, markdownSpan.Length - sliceStart); | ||
var stepSpan = markdownSpan.Slice(sliceStart, sliceSize); | ||
foreach (var tokenizer in _tokenizers) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Markdown/Markdown.Tests/MdTests.cs
Outdated
[Description("Тест на производительность")] | ||
public void Render_PerformanceTest() | ||
{ | ||
var fullStr = ArrangePerformanceTest("_Hello_ world_12. Hel_lo world_", 20000); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
InsideWord = insideWord; | ||
} | ||
|
||
public ReadOnlyMemory<char> Text { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В каких-то классах у тебя поля классов до конструктора прописаны, в каких-то после. Давай одного стиля придерживаться
Markdown/Markdown/Program.cs
Outdated
using Markdown.Tokenizer; | ||
|
||
var tokenAliases = new Dictionary<string, MdTokenType>(); | ||
tokenAliases.Add("_", MdTokenType.Italic); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Может вынесем инициализацию этих объектов в какой-то отдельный класс? Его тогда и в тестах переиспользовать можно будет
|
||
namespace Markdown.SyntaxRules; | ||
|
||
public class NestingRule : ISyntaxRule<MdTokenType> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не кажется что у NestingRule, TokensInDifferentWordsRule и NumberRule много общего кода, и отличается только одна проверка. Можно ли как-то общий функционал вынести?
input.Slice(plainTextStart, str!.Length - plainTextStart)); | ||
} | ||
|
||
private bool TryMatchTokenAliases( |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
return true; | ||
} | ||
|
||
if (mathcedOpeningToken) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
||
private bool IsWordDelimiter(char c) | ||
{ | ||
return c is ' ' or '\t' or '\n' or '\r' or ',' or '.' |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
int i = 0; | ||
foreach (var ch in pattern) | ||
{ | ||
if (index + i >= input.Length || ch != input[index + i]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Мы тут за пределы строки не можем в теории выйти?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
По идее нет, так как если условие index + i >= input.Length
выполняется, то оператор ||
не должен проверять второе условие. Так же у меня есть пара тест кейсов, где элементы разметки находятся в конце строки, и там никаких проблем не наблюдается.
No description provided.