浏览代码

added ?: syntax

Nicolas Cannasse 18 年之前
父节点
当前提交
37c626c9f5
共有 2 个文件被更改,包括 3 次插入0 次删除
  1. 1 0
      doc/CHANGES.txt
  2. 2 0
      parser.ml

+ 1 - 0
doc/CHANGES.txt

@@ -13,6 +13,7 @@
 	more accurate stack trace for socket remoting
 	prevent some memory leak in haxe.Timer / JS
 	added flash fullscreen support
+	added cond?a:b syntax support
 
 2007-03-06: 1.12
 	added flash lite support with -D flash_lite

+ 2 - 0
parser.ml

@@ -597,6 +597,8 @@ and expr_next e1 = parser
 		make_binop op e1 e2
 	| [< '(Unop op,p) when is_postfix e1 op; s >] ->
 		expr_next (EUnop (op,Postfix,e1), punion (pos e1) p) s
+	| [< '(Question,_); e2 = expr; '(DblDot,_); e3 = expr >] ->
+		(EIf (e1,e2,Some e3),punion (pos e1) (pos e3))
 	| [< >] -> e1
 
 and parse_switch_cases eswitch cases = parser