add: Array declaration and variable indexer.

This commit is contained in:
2024-08-17 17:50:28 +08:00
parent c7077bd0fd
commit 97f9fb9ec3
12 changed files with 200 additions and 30 deletions

View File

@@ -131,6 +131,21 @@ public class LexicalParserTests : LexicalTestBase
]);
}
[Fact]
public void LexicalParserTest4()
{
ValidateLexicalTokens(LexicalScanner.PascalParser(), "array [0..9] of integer", [
(LexicalTokenType.Keyword, "array"),
(LexicalTokenType.Delimiter, "["),
(LexicalTokenType.ConstInteger, "0"),
(LexicalTokenType.Delimiter, ".."),
(LexicalTokenType.ConstInteger, "9"),
(LexicalTokenType.Delimiter, "]"),
(LexicalTokenType.Keyword, "of"),
(LexicalTokenType.Keyword, "integer")
]);
}
[Theory]
[InlineData("""
program exFunction;

View File

@@ -107,6 +107,7 @@ public class LexicalTokenParserTest : LexicalTestBase
[Theory]
[InlineData(123, "123")]
[InlineData(0, "0")]
[InlineData(10, "10..20")]
public void ConstIntegerTest(int value, string input)
{
StringReadState state = new(input);