diff options
-rw-r--r-- | postrun.cpp | 5 | ||||
-rw-r--r-- | test.prn | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/postrun.cpp b/postrun.cpp index 4de856b..17d72ca 100644 --- a/postrun.cpp +++ b/postrun.cpp @@ -50,18 +50,15 @@ vector<string> tokenise(istream &stream){ case 'x':{ int res; c=stream.get(); - cerr<<"Parsed "<<c; if(!stream)throw string("Non-terminated hexadecimal escape sequence in string at end of file"); res=c>='0'&&c<='9'?c-'0':(c>='a'&&c<='f')||(c>='A'&&c<='F')?(c&~32)-'A'+10:-1; if(res==-1)throw "Invalid character '"+string(1,c)+"'' in hexadecimal escape sequence in string"; res*=16; c=stream.get(); - cerr<<c<<" into "; if(!stream)throw string("Non-terminated hexadecimal escape sequence in string at end of file"); res+=c>='0'&&c<='9'?c-'0':(c>='a'&&c<='f')||(c>='A'&&c<='F')?(c&~32)-'A'+10:-241; if(res<0)throw "Invalid character '"+string(1,c)+"'' in hexadecimal escape sequence in string"; c=(char)res; - cerr<<(int)c<<endl; break; } } @@ -177,7 +174,7 @@ void run(vector<string> T){ for(end=start;end<T.size()&&T[end]!="}";end++); vector<string> &functoks=functions[name]; functoks.resize(end-start); - for(unsigned int i=start;i<end;i++)functoks[i]=move(T[i]); + for(unsigned int i=start;i<end;i++)functoks[i-start]=move(T[i]); T.erase(T.begin()+cursor,T.begin()+end+1); } else if(word=="@include"){ if(cursor+1>=T.size())throw string("Unterminated @include statement at end of file"); @@ -1,2 +1,6 @@ +@defun "hoi" { + "hoi\n" print +} +hoi hoi hoi "a" "b\x0a" + print 1 12 + 3 - print |