diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2009-12-21 22:24:48 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2009-12-21 22:24:48 +0000 |
| commit | 97c0fcbbef19012f825cba0fc3f16037322ce84c (patch) | |
| tree | 4169f36e050f4df84280c948148f8f054c37091e /src | |
| parent | 8ebc3f17961ef6a0cf708cc6bdca948d77817ee0 (diff) | |
| download | build-97c0fcbbef19012f825cba0fc3f16037322ce84c.tar.gz build-97c0fcbbef19012f825cba0fc3f16037322ce84c.tar.bz2 build-97c0fcbbef19012f825cba0fc3f16037322ce84c.tar.xz build-97c0fcbbef19012f825cba0fc3f16037322ce84c.zip | |
We're getting closer and closer, qt4 is more configurable and gets QT flags
for you for CXXFLAGS and LDFLAGS, added a bunch more stuff and fixed a strange
function input bug.
Diffstat (limited to '')
| -rw-r--r-- | src/build.y | 12 | ||||
| -rw-r--r-- | src/context.cpp | 2 | ||||
| -rw-r--r-- | src/functionast.cpp | 16 |
3 files changed, 28 insertions, 2 deletions
diff --git a/src/build.y b/src/build.y index a6618e4..3e9c8fd 100644 --- a/src/build.y +++ b/src/build.y | |||
| @@ -188,7 +188,7 @@ value_mods: | |||
| 188 | 188 | ||
| 189 | value_core: variable | 189 | value_core: variable |
| 190 | | literal | 190 | | literal |
| 191 | | function | 191 | | function_no_input |
| 192 | | list | 192 | | list |
| 193 | ; | 193 | ; |
| 194 | 194 | ||
| @@ -254,6 +254,16 @@ function: UNDEF '(' { | |||
| 254 | } | 254 | } |
| 255 | ; | 255 | ; |
| 256 | 256 | ||
| 257 | function_no_input: UNDEF '(' { | ||
| 258 | bld.xAst.addNode( AstNode::typeNull ); | ||
| 259 | bld.xAst.addNode( AstNode::typeFunction ); | ||
| 260 | bld.xAst.openBranch(); | ||
| 261 | bld.xAst.addNode( AstNode::typeString, $1 ); | ||
| 262 | } func_params ')' { | ||
| 263 | bld.xAst.closeNode(); | ||
| 264 | } | ||
| 265 | ; | ||
| 266 | |||
| 257 | requires: TOK_REQUIRES { | 267 | requires: TOK_REQUIRES { |
| 258 | bld.xAst.addNode( AstNode::typeRequires ); | 268 | bld.xAst.addNode( AstNode::typeRequires ); |
| 259 | bld.xAst.openBranch(); | 269 | bld.xAst.openBranch(); |
diff --git a/src/context.cpp b/src/context.cpp index bc48def..e9330e5 100644 --- a/src/context.cpp +++ b/src/context.cpp | |||
| @@ -232,6 +232,8 @@ Bu::FString Context::expand( const Bu::FString &sInS ) | |||
| 232 | char buf[4096]; | 232 | char buf[4096]; |
| 233 | sBuf.append( buf, p.read( buf, 4096 ) ); | 233 | sBuf.append( buf, p.read( buf, 4096 ) ); |
| 234 | } | 234 | } |
| 235 | sBuf = sBuf.replace("\n", " ").replace("\r", " "); | ||
| 236 | sBuf.trimBack(' '); | ||
| 235 | sRet.append( sBuf ); | 237 | sRet.append( sBuf ); |
| 236 | } catch(...) | 238 | } catch(...) |
| 237 | { | 239 | { |
diff --git a/src/functionast.cpp b/src/functionast.cpp index 0d9a938..ceee460 100644 --- a/src/functionast.cpp +++ b/src/functionast.cpp | |||
| @@ -4,6 +4,9 @@ | |||
| 4 | #include "runner.h" | 4 | #include "runner.h" |
| 5 | #include "context.h" | 5 | #include "context.h" |
| 6 | 6 | ||
| 7 | #include <bu/sio.h> | ||
| 8 | using namespace Bu; | ||
| 9 | |||
| 7 | FunctionAst::FunctionAst( const AstBranch *pRoot, class Runner *pRunner ) : | 10 | FunctionAst::FunctionAst( const AstBranch *pRoot, class Runner *pRunner ) : |
| 8 | pRoot( pRoot ), | 11 | pRoot( pRoot ), |
| 9 | pRunner( pRunner ) | 12 | pRunner( pRunner ) |
| @@ -22,9 +25,20 @@ Bu::FString FunctionAst::getName() const | |||
| 22 | return sName; | 25 | return sName; |
| 23 | } | 26 | } |
| 24 | 27 | ||
| 25 | Variable FunctionAst::call( Variable &input, VarList /*lParams*/ ) | 28 | Variable FunctionAst::call( Variable &input, VarList lParams ) |
| 26 | { | 29 | { |
| 27 | pContext->pushScope(); | 30 | pContext->pushScope(); |
| 31 | |||
| 32 | AstBranch::NodeList::const_iterator vName = | ||
| 33 | (*(pRoot->getBranchBegin()+1)).begin(); | ||
| 34 | VarList::iterator vValue = lParams.begin(); | ||
| 35 | for( ; vName && vValue; vName++, vValue++ ) | ||
| 36 | { | ||
| 37 | pContext->addVariable( | ||
| 38 | dynamic_cast<const AstLeaf *>(*vName)->getStrValue(), | ||
| 39 | *vValue | ||
| 40 | ); | ||
| 41 | } | ||
| 28 | pContext->addVariable("INPUT", input ); | 42 | pContext->addVariable("INPUT", input ); |
| 29 | Variable vRet = pRunner->run( (*(pRoot->getBranchBegin()+2)).begin() ); | 43 | Variable vRet = pRunner->run( (*(pRoot->getBranchBegin()+2)).begin() ); |
| 30 | pContext->popScope(); | 44 | pContext->popScope(); |
