添加对while-do语句的支持 (#77)

Co-authored-by: jackfiled <xcrenchangjun@outlook.com>
Reviewed-on: PostGuard/Canon#77
Co-authored-by: ichirinko <1621543655@qq.com>
Co-committed-by: ichirinko <1621543655@qq.com>
This commit is contained in:
ichirinko
2024-05-10 13:52:11 +08:00
committed by jackfiled
parent 4a712fc462
commit f993d49856
11 changed files with 867 additions and 704 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -348,6 +348,7 @@ public static class PascalGrammar
// | CompoundStatement
// | if Expression then Statement ElsePart
// | for id AssignOp Expression to Expression do Statement
// | while Expression do Statement
// 注意这里 read 和 write 作为普通的函数调用处理了
// 因此下面并没有单独声明
new NonTerminator(NonTerminatorType.Statement), [
@@ -387,6 +388,13 @@ public static class PascalGrammar
new NonTerminator(NonTerminatorType.Expression),
new Terminator(KeywordType.Do),
new NonTerminator(NonTerminatorType.Statement)
],
[
// while Expression do Statement
new Terminator(KeywordType.While),
new NonTerminator(NonTerminatorType.Expression),
new Terminator(KeywordType.Do),
new NonTerminator(NonTerminatorType.Statement)
]
]
},