aboutsummaryrefslogtreecommitdiff
path: root/src/minimacro.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/minimacro.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/minimacro.cpp b/src/minimacro.cpp
index 2bd156c..1d2abf8 100644
--- a/src/minimacro.cpp
+++ b/src/minimacro.cpp
@@ -20,8 +20,9 @@ Bu::MiniMacro::~MiniMacro()
20 20
21Bu::FString Bu::MiniMacro::parse( const Bu::FString &sIn ) 21Bu::FString Bu::MiniMacro::parse( const Bu::FString &sIn )
22{ 22{
23 bContinue = true;
23 Bu::FString sOut; 24 Bu::FString sOut;
24 for( sCur = sIn.getStr(); *sCur; sCur++ ) 25 for( sCur = sIn.getStr(); *sCur && bContinue; sCur++ )
25 { 26 {
26 if( *sCur == '{' ) 27 if( *sCur == '{' )
27 { 28 {
@@ -53,6 +54,8 @@ Bu::FString Bu::MiniMacro::parse( const Bu::FString &sIn )
53 } 54 }
54 } 55 }
55 56
57 iLastPos = (int)sCur - (int)sIn.getStr();
58
56 return sOut; 59 return sOut;
57} 60}
58 61
@@ -101,6 +104,29 @@ Bu::FString Bu::MiniMacro::parseCond()
101Bu::FString Bu::MiniMacro::parseCmd() 104Bu::FString Bu::MiniMacro::parseCmd()
102{ 105{
103 Bu::FString sOut; 106 Bu::FString sOut;
107 const char *sNext = sCur;
108 for(; *sNext != ':' && *sNext != '}' && *sNext != '\0'; sNext++ );
109 if( *sNext != '\0' )
110 {
111 Bu::FString sName( sCur, (int)sNext-(int)sCur );
112 if( sName == "end" )
113 {
114 sCur = sNext;
115 bContinue = false;
116 return sOut;
117 }
118 else
119 {
120 throw Bu::ExceptionBase("Unknown command '%s'.",
121 sName.getStr()
122 );
123 }
124 }
125 else
126 {
127 printf("Uh...?\n");
128 }
129
104 printf("%20s\n", sCur ); 130 printf("%20s\n", sCur );
105 return sOut; 131 return sOut;
106} 132}
@@ -142,3 +168,8 @@ const Bu::FString &Bu::MiniMacro::getvar( const Bu::FString &sName )
142 return hVars.get( sName ); 168 return hVars.get( sName );
143} 169}
144 170
171int Bu::MiniMacro::getPosition()
172{
173 return iLastPos;
174}
175