Skip to content
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

Open
wants to merge 27 commits into
base: master
Choose a base branch
from

Conversation

alexadralt
Copy link

No description provided.


public enum MarkdownTokenType
{
NoConversion,

This comment was marked as resolved.

{
NoConversion,
ToItalic,
ToBold,

This comment was marked as resolved.

{
var markdownSpan = markdown.AsSpan();
var context = new StringBuilder();
var stepCount = markdownSpan.Length / _sliceSize;

This comment was marked as resolved.


public class Md : IMd
{
private readonly ITokenizer[] _tokenizers =

This comment was marked as resolved.

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.

[Description("Тест на производительность")]
public void Render_PerformanceTest()
{
var fullStr = ArrangePerformanceTest("_Hello_ world_12. Hel_lo world_", 20000);

This comment was marked as resolved.

InsideWord = insideWord;
}

public ReadOnlyMemory<char> Text { get; set; }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В каких-то классах у тебя поля классов до конструктора прописаны, в каких-то после. Давай одного стиля придерживаться

using Markdown.Tokenizer;

var tokenAliases = new Dictionary<string, MdTokenType>();
tokenAliases.Add("_", MdTokenType.Italic);

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>

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.

return true;
}

if (mathcedOpeningToken)

This comment was marked as resolved.


private bool IsWordDelimiter(char c)
{
return c is ' ' or '\t' or '\n' or '\r' or ',' or '.'

This comment was marked as resolved.

int i = 0;
foreach (var ch in pattern)
{
if (index + i >= input.Length || ch != input[index + i])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Мы тут за пределы строки не можем в теории выйти?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

По идее нет, так как если условие index + i >= input.Length выполняется, то оператор || не должен проверять второе условие. Так же у меня есть пара тест кейсов, где элементы разметки находятся в конце строки, и там никаких проблем не наблюдается.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants