Remove the "? but not !?" effect

This commit is contained in:
Nigel Tao committed 2018-12-16 11:03:31 +11:00
1 parent 9311f7a694
commit dd28f3c0f9
2 files changed
+12 -18

No files matched your search

-2
View File
@@ -129,8 +129,6 @@ func (e Effect) String() string {
return ""
case EffectImpure:
return "!"
case EffectOptional:
return "?"
case EffectImpure | EffectOptional:
return "!?"
case EffectImpure | EffectOptional | EffectCoroutine:
+12 -16
View File
@@ -1126,21 +1126,17 @@ func (p *parser) parseOperand() (*a.Expr, error) {
}
func (p *parser) parseEffect() a.Effect {
switch p.peek1() {
case t.IDQuestion:
p.src = p.src[1:]
return a.EffectOptional
case t.IDExclam:
p.src = p.src[1:]
if p.peek1() != t.IDQuestion {
return a.EffectImpure
}
p.src = p.src[1:]
if p.peek1() != t.IDQuestion {
return a.EffectImpure | a.EffectOptional
}
p.src = p.src[1:]
return a.EffectImpure | a.EffectOptional | a.EffectCoroutine
if p.peek1() != t.IDExclam {
return 0
}
return 0
p.src = p.src[1:]
if p.peek1() != t.IDQuestion {
return a.EffectImpure
}
p.src = p.src[1:]
if p.peek1() != t.IDQuestion {
return a.EffectImpure | a.EffectOptional
}
p.src = p.src[1:]
return a.EffectImpure | a.EffectOptional | a.EffectCoroutine
}