Change the "for" keyword to "while".

The semantics is closer to C's "while". Also, "while" is simpler, which
means simpler interactions with assertions, pre- and post-conditions.
This commit is contained in:
Nigel Tao committed 2017-05-13 14:31:52 +10:00
1 parent de28a715b3
commit e87ff7163b
5 files changed
+18 -18

No files matched your search

+2 -2
View File
@@ -171,7 +171,7 @@ const (
IDFunc = ID(0x60<<KeyShift | FlagsOther)
IDPtr = ID(0x61<<KeyShift | FlagsOther)
IDAssert = ID(0x62<<KeyShift | FlagsOther)
IDFor = ID(0x63<<KeyShift | FlagsOther)
IDWhile = ID(0x63<<KeyShift | FlagsOther)
IDIf = ID(0x64<<KeyShift | FlagsOther)
IDElse = ID(0x65<<KeyShift | FlagsOther)
IDReturn = ID(0x66<<KeyShift | FlagsOther | FlagsImplicitSemicolon)
@@ -296,7 +296,7 @@ var builtInsByKey = [nBuiltInKeys]struct {
IDFunc >> KeyShift: {"func", IDFunc},
IDPtr >> KeyShift: {"ptr", IDPtr},
IDAssert >> KeyShift: {"assert", IDAssert},
IDFor >> KeyShift: {"for", IDFor},
IDWhile >> KeyShift: {"while", IDWhile},
IDIf >> KeyShift: {"if", IDIf},
IDElse >> KeyShift: {"else", IDElse},
IDReturn >> KeyShift: {"return", IDReturn},