Merge pull request #26 from zjnue/master

allow expr printing when -D hscriptPos is set and make if parsing slightly stricter
This commit is contained in:
Nicolas Cannasse
2015-01-13 08:28:15 +01:00
2 changed files with 5 additions and 3 deletions
+2
View File
@@ -434,7 +434,9 @@ class Parser {
#end
return switch( id ) {
case "if":
ensure(TPOpen);
var cond = parseExpr();
ensure(TPClose);
var e1 = parseExpr();
var e2 = null;
var semic = false;
+3 -3
View File
@@ -64,12 +64,12 @@ class Printer {
}
}
function expr( e : Expr) {
function expr( e : Expr ) {
if( e == null ) {
add("??NULL??");
return;
}
switch( e ) {
switch( #if hscriptPos e.e #else e #end ) {
case EConst(c):
switch( c ) {
case CInt(i): add(i);
@@ -119,7 +119,7 @@ class Printer {
case ECall(e, args):
if( e == null )
expr(e);
else switch( e ) {
else switch( #if hscriptPos e.e #else e #end ) {
case EField(_), EIdent(_), EConst(_):
expr(e);
default: