#------------------------------------------------------------------------------
# VectorLiteral
-#foo = []
-#foo = [1]
-#foo = [1,2,3]
-#foo = foo[1]
-#foo = [1,2,3,4,5][2]
+foo = []
+foo = [1]
+foo = [1,2,3]
+foo = foo[1]
+foo = [1,2,3,4,5][2]
# ListLiteral
-#foo = ()
-#foo = (1,2,3)
-#foo = foo[1]
-#foo = (1,2,3,4,5)[2]
+foo = ()
+foo = (1,2,3)
+foo = foo[1]
+foo = (1,2,3,4,5)[2]
# FuncLiteral
foo = { 1 + 1 }
-#foo = {|a| a + 1}
-#foo = {|a,b| a + b }
-#foo = foo(1,2)
-#foo = ({|a,b| a + b })(1,2)
+foo = {|a| a + 1}
+foo = {|a,b| a + b }
+foo = foo(1,2)
+foo = ({|a,b| a + b })(1,2)
# ID
-#foo = bar
-#foo.bar = bar
+foo = bar
+foo.bar = bar
# NUM
-#foo = 1
-#foo = 1.0
+foo = 1
+foo = 1.0
# CHAR
-#foo = 'a'
+foo = 'a'
# STRING
-#foo = "some string"
-#foo = "12345"[2]
+foo = "some string"
+foo = "12345"[2]
# SYMBOL
-#foo = $some_symbol
+foo = $some_symbol
# MAP
-#foo = {
-# $foo : 1 + 1,
-# $bar : 2 + 2,
-# $stuff : 3 + 3
-#}
+foo = {
+ $foo : 1 + 1,
+ $bar : 2 + 2,
+ $stuff : 3 + 3
+}
# Macro
-#% if [
-# (Expression Block Block) : exec_if($1, $2, $3),
-# (Expression Block) : exec_if($1, $2)
-#]
+% if [
+ (Expression Block Block) : exec_if($1, $2, $3),
+ (Expression Block) : exec_if($1, $2)
+]
-#if (1==1)
-#{
-# 1 + 1
-#}{
-#
-#}
-#
-#if (1 == 1)
-#{
-#
-#}
+if (1==1)
+{
+ 1 + 1
+}{
+
+}
+
+if (1 == 1)
+{
+
+}
#------------------------------------------------------------------------------
# Configuration Objects
#------------------------------------------------------------------------------
-# Configuration for the binary artifact
+# Configuration for the release binary artifact
DLangParser = Binary.new({
:name => 'dlang',
- :output_dir => 'build/parser',
+ :output_dir => 'build/release',
+ :compiler_options => [ '-c', '-Wall', '-Werror', '-o' ],
+ :static_libs => [
+ './deps/parse-utils/build/static/bin/libparse-utils.a',
+ ],
+ :source_files => [ 'source/**/*.c*' ],
+ :include_dirs => [
+ 'source/**/',
+ 'deps/parse-utils/source/**/'
+ ],
+})
+DLangParser.setup_default_rake_tasks()
+
+# Configuration for the release binary artifact
+DLangDebug = Binary.new({
+ :name => 'dlang',
+ :output_dir => 'build/debug',
:compiler_options => [ '-c', '-Wall', '-Werror', '-o' ],
:static_libs => [
'./deps/cork/build/static/bin/libcork.a',
'./deps/parse-utils/build/static/bin/libparse-utils.a',
],
+ :preprocessor_defines => [ 'DEBUG' ],
:source_files => [ 'source/**/*.c*' ],
:include_dirs => [
'source/**/',
'deps/parse-utils/source/**/'
],
})
-DLangParser.setup_default_rake_tasks()
+DLangDebug.setup_default_rake_tasks()
# Configuration for the unit tests
UnitTest = Tests.new({
})
UnitTest.setup_default_rake_tasks()
+#------------------------------------------------------------------------------
+# Main Tasks
+#------------------------------------------------------------------------------
desc 'Build and link all artifacts'
-task :release => [ :cork, :parse_utils, DLangParser.name() ]
+task :release => [ :parse_utils, DLangParser.name() ]
+task :debug => [ :cork, :parse_utils, DLangDebug.name() ]
desc 'Build the cork memory leak detector'
task :cork do
#include "dlparser.h"
#include "exception.h"
-#include "cork.h"
+#include "common.h"
DLParser::DLParser() : BTParser(_new DLLexer())
{
AST* DLParser::MapLiteral(void)
{
AST* ret = NULL;
-
- match(LBRACE);
- do
+ AST* child = NULL;
+ try
{
- if( lookaheadType(1) == COMMA ) consume();
+ match(LBRACE);
+ do
+ {
+ if( lookaheadType(1) == COMMA ) consume();
- AST* child = Literal();
- match(SEP);
- child = _new AST(SEP, 2, child, LogicalExpr());
+ child = Literal();
+ match(SEP);
+ child = _new AST(SEP, 2, child, LogicalExpr());
- ret = ((ret == NULL) ? _new AST(MAP) : ret);
- ret->addChild(child);
+ ret = ((ret == NULL) ? _new AST(MAP) : ret);
+ ret->addChild(child);
+ }
+ while( lookaheadType(1) == COMMA );
+ match(RBRACE);
+ }
+ catch(Exception e)
+ {
+ if(ret != NULL) delete ret;
+ if(child != NULL) delete child;
+ throw e;
}
- while( lookaheadType(1) == COMMA );
- match(RBRACE);
-
return ret;
}