From 7453f5ffe17a682e4fc66928ac2f28675a8db53a Mon Sep 17 00:00:00 2001 From: "Mike D. Lowis" Date: Sun, 26 Feb 2012 14:51:22 -0500 Subject: [PATCH] Disabled support for macros --- example.dl | 30 +++++++++++++++--------------- source/dlparser/dlparser.cpp | 16 ++++++++-------- source/dlparser/macro/param.c | 5 ++++- 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/example.dl b/example.dl index 785218f..0b8ff13 100644 --- a/example.dl +++ b/example.dl @@ -5,11 +5,11 @@ #% if ( cond, branch1:Block ) { # exec_if( cond, branch1 ) #} -# + #% ifelse ( cond, branch1:Block, branch2:Block ) { # exec_if( cond, branch1, branch2 ) #} -# + #% foreach ( lst, fn:Block ) { # for_each(fn, lst) #} @@ -42,7 +42,7 @@ #------------------------------------------------------------------------------ # Collection Access and Iteration Tests #------------------------------------------------------------------------------ -# Accessing elements of lists, vectors, and strings +## Accessing elements of lists, vectors, and strings #lst1 = `(4,5,6) #print(lst1[0], " Hello, World!") # @@ -71,19 +71,19 @@ #------------------------------------------------------------------------------ # Delayed Evaluation #------------------------------------------------------------------------------ -% delay ( exp ) { - make_promise({ exp }) -} - -% force ( prom ) { - force( prom ) -} +#% delay ( exp ) { +# make_promise({ exp }) +#} +# +#% force ( prom ) { +# force( prom ) +#} -foo = delay nonexistent_var + 1 -nonexistent_var = 19 -assert( typeof(foo) == Block ) -assert( typeof( force foo ) == Num ) -print( force( foo ), " Hello, World!" ) +#foo = delay nonexistent_var + 1 +#nonexistent_var = 19 +#assert( typeof(foo) == Block ) +#assert( typeof( force foo ) == Num ) +#print( force( foo ), " Hello, World!" ) #------------------------------------------------------------------------------ # Type Checking Tests diff --git a/source/dlparser/dlparser.cpp b/source/dlparser/dlparser.cpp index 7692b8d..dd7886b 100644 --- a/source/dlparser/dlparser.cpp +++ b/source/dlparser/dlparser.cpp @@ -73,14 +73,14 @@ AST* DLParser::Expression(void) match(ASSIGN); ret = _new AST( ASSIGN, 2, id_node, Expression()); } - else if( (lookaheadType(1) == MACRO) && (lookaheadType(2) == ID)) - { - ret = MacroDefinition(); - } - else if( isMacro( lookaheadToken(1) ) ) - { - ret = MacroExpansion(); - } + //else if( (lookaheadType(1) == MACRO) && (lookaheadType(2) == ID)) + //{ + // ret = MacroDefinition(); + //} + //else if( isMacro( lookaheadToken(1) ) ) + //{ + // ret = MacroExpansion(); + //} else { ret = LogicalExpr(); diff --git a/source/dlparser/macro/param.c b/source/dlparser/macro/param.c index 16f5164..367c118 100644 --- a/source/dlparser/macro/param.c +++ b/source/dlparser/macro/param.c @@ -20,7 +20,10 @@ Param::Param(AST* param_def) Param::~Param() { - delete param_value; + if( param_value != NULL ) + { + delete param_value; + } } std::string Param::name(void) -- 2.54.0