killme2008 / aviatorscript

A high performance scripting language hosted on the JVM.
http://fnil.net/aviator/
4.66k stars 853 forks source link

三元表达式里面不支持多条语句? #152

Closed Horanol closed 5 years ago

Horanol commented 5 years ago

(a == 1)?(b = 1.1;c = 1.2;):(b=2.2) 如上面这个表达式,aviator 报错 Syntax error:expect ':' at 17, current token: [type='Char',lexeme=';',index=17]. Parsing expression: (a == 1)?(b = 1.1;^^

killme2008 commented 5 years ago

这个可能是个 bug,因为多行语句是后面引入的,我分析下。

killme2008 commented 5 years ago

这样的语法是不支持的,多行语句是作为顶层 statement,不允许再嵌入三元表达式。你可以将嵌套的表达式提取到外面赋值。