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

記号関係は別な関数にまとめた方が良いかも? #29

Open
github-actions bot opened this issue Apr 9, 2023 · 0 comments
Open

記号関係は別な関数にまとめた方が良いかも? #29

github-actions bot opened this issue Apr 9, 2023 · 0 comments
Labels

Comments

@github-actions
Copy link

github-actions bot commented Apr 9, 2023

https://api.github.com/yuriacats/csharp-shisoku/blob/58460ff96aa211a0bac2847aeff2bfb8d24caf94/shisoku/Lex.cs#L81

                input = input[(1)..];

            }
            else if (input[0] == ';')
            {
                tokens.Add(new TokenSemicolon());
                input = input[(1)..];
            }
            else if (input[0] == ':')
            {
                tokens.Add(new TokenColon());
                input = input[(1)..];
            }
            else if (input[0] == ',')
            {
                tokens.Add(new TokenComma());
                input = input[(1)..];
            }
            else if (input[0] == '?')
            {
                tokens.Add(new TokenQuestion());
                input = input[(1)..];
            }
            else if (input[0] == '|')
            {
                tokens.Add(new TokenPipe());
                input = input[(1)..];
            }
            else if (input[0] == '-')
            {
                if (input.Length >= 2 && input[1] == '>')
                {
                    tokens.Add(new TokenArrow());
                    input = input[(2)..];
                }
                else
                {
                    tokens.Add(new TokenMinus());
                    input = input[(1)..];
                }
                // TODO 記号関係は別な関数にまとめた方が良いかも?
            }
            else if (input[0] == '{')
            {
                tokens.Add(new TokenCurlyBracket());
                input = input[(1)..];
            }
            else if (input[0] == '}')
            {
                tokens.Add(new TokenCurlyBracketClose());
                input = input[(1)..];
            }
            else if (Char.IsWhiteSpace(input[0]) || Char.IsControl(input[0]))
            {
                input = input[(1)..];
@github-actions github-actions bot added the todo label Apr 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants