以下代码按预期编译和运行:
fun {Tokenize Lexemes}
case Lexemes of
Head|Tail then
case Head of
"+" then
operator(type:plus)|{Tokenize Tail}
else
if {String.isFloat Head} then
number(Head)|{Tokenize Tail}
else
nil
end
end
else
nil
end
end
但是,如果我添加另一个 case 子句,例如下面的代码,则在编译缺少 'end' 语句时会出现错误。
fun {Tokenize Lexemes}
case Lexemes of
Head|Tail then
case Head of
"+" then
operator(type:plus)|{Tokenize Tail}
"*" then
operator(type:multiply)|{Tokenize Tail}
else
if {String.isFloat Head} then
number(Head)|{Tokenize Tail}
else
nil
end
end
else
nil
end
end
错误:
** expected 'end'
** inside case phrase (at the line of the "*")
是什么赋予了?