diff --git a/SudoScript.Core/Parser.cs b/SudoScript.Core/Parser.cs index feeb9fb..fed087b 100644 --- a/SudoScript.Core/Parser.cs +++ b/SudoScript.Core/Parser.cs @@ -119,22 +119,24 @@ private static List ParseParameters(TokenStream stream) List paramChildren = new List(); // While leftBrace is not read, it will keep reading parameters. - while (stream.Peek(true ,out Token? endToken) && endToken.Type != TokenType.LeftBrace) + while (stream.Peek(true ,out Token? endToken) && endToken.Type != TokenType.LeftBrace) { - if (!stream.Expect(TokenType.Space, out Token _)) + if (!stream.Expect(TokenType.Space, out Token? _)) { throw new Exception("Parameter are expected to be separated by space"); } - - // Checks whether the parameter is an identifier or a cell and parses them acordingly - if (stream.Peek(true, out Token? leftParenthesis) && leftParenthesis.Type == TokenType.LeftParenthesis) + else { - paramChildren.Add(ParseParameterCell(stream)); - } + // Checks whether the parameter is an identifier or a cell and parses them acordingly + if (stream.Peek(true, out Token? leftParenthesis) && leftParenthesis.Type == TokenType.LeftParenthesis) + { + paramChildren.Add(ParseParameterCell(stream)); + } - if (stream.Peek(true, out Token? identifier) && identifier.Type == TokenType.Identifier) - { - paramChildren.Add(ParseParameterIdentifier(stream)); + if (stream.Peek(true, out Token? identifier) && identifier.Type == TokenType.Identifier) + { + paramChildren.Add(ParseParameterIdentifier(stream)); + } } } diff --git a/SudoScript.Core/Tokenizer.cs b/SudoScript.Core/Tokenizer.cs index 010a92a..44649a5 100644 --- a/SudoScript.Core/Tokenizer.cs +++ b/SudoScript.Core/Tokenizer.cs @@ -47,8 +47,6 @@ public sealed class TokenStream : IDisposable private char? _carry; - private readonly string _src; - public TokenStream(TextReader reader) { _reader = reader; @@ -256,7 +254,7 @@ private bool GetToken([NotNullWhen(true)] out Token? nextToken) throw new ArgumentException($"Unrecognized character: {character} is not a recognised token"); } - nextToken = new Token(type, match, row, column, _src); + nextToken = new Token(type, match, row, column, ""); if (nextToken.Type == TokenType.BlockComment || nextToken.Type == TokenType.LineComment) {