Browse Source

added ?: syntax

Nicolas Cannasse 18 years ago
parent
commit
37c626c9f5
2 changed files with 3 additions and 0 deletions
  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
 	more accurate stack trace for socket remoting
 	prevent some memory leak in haxe.Timer / JS
 	prevent some memory leak in haxe.Timer / JS
 	added flash fullscreen support
 	added flash fullscreen support
+	added cond?a:b syntax support
 
 
 2007-03-06: 1.12
 2007-03-06: 1.12
 	added flash lite support with -D flash_lite
 	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
 		make_binop op e1 e2
 	| [< '(Unop op,p) when is_postfix e1 op; s >] ->
 	| [< '(Unop op,p) when is_postfix e1 op; s >] ->
 		expr_next (EUnop (op,Postfix,e1), punion (pos e1) p) 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
 	| [< >] -> e1
 
 
 and parse_switch_cases eswitch cases = parser
 and parse_switch_cases eswitch cases = parser