Subversion Repositories spk

Rev

Rev 1 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1 Rev 114
Line 96... Line 96...
96
			*d=atof(t->text);
96
			*d=atof(t->text);
97
	}
97
	}
98
	return bRes;
98
	return bRes;
99
}
99
}
100
//---------------------------------------------------------------------------------
100
//---------------------------------------------------------------------------------
101
/*char * bod_parser_base::loadString(token_stream& is, const char *context)
-
 
102
{
-
 
103
	int pos=(int)is.tell();
-
 
104
	bod_text_parser::token *t, *prev=NULL;
-
 
105
	size_t size=0;
-
 
106
	while((t=is.tok())!=NULL && t->type==token::t_text || t->type==token::t_colon){
-
 
107
		size+=strlen(t->text) + 1;
-
 
108
		++is;
-
 
109
	}
-
 
110
	size++;
-
 
111
	
-
 
112
	if(t==NULL){
-
 
113
		error(is.previous(), S_Error, "%sUnexpected end of document found while looking for end of string (;)", context);
-
 
114
		return NULL;
-
 
115
	}
101
/*
116
	if(t->type!=token::t_semicolon){
-
 
117
		error(t, S_Error, "%sUnexpected here '%s' while loading string", context, t->getText());
-
 
118
		return NULL;
-
 
119
	}
-
 
120
 
-
 
121
	char *str, *s;
-
 
122
	str=new char[size];
-
 
123
	s=str;
-
 
124
 
-
 
125
	// it can happen that the stream will unload some tokens as we iterate through it
102
	load a "bod string" - should only be used when the parser is set to "bod compatibility"
126
	// whis will fix problem with pos being greater than current pos
-
 
127
	if((size_t)pos > is.tell())
-
 
128
		pos-=token_stream::tokenTreshold;
-
 
129
 
-
 
130
	is.advance(-((int)is.tell() - pos));
-
 
131
	while((t=is.tok())!=NULL && t->type==token::t_text || t->type==token::t_colon){
-
 
132
		if(prev!=NULL && prev->type==token::t_text && t->type==token::t_text){
-
 
133
			*s=' ';
-
 
134
			s++;
-
 
135
		}
-
 
136
		size=strlen(t->text);
-
 
137
		memcpy(s, t->text, size);
-
 
138
		s+=(int)size;
-
 
139
		
-
 
140
		prev=t;
-
 
141
		++is;
-
 
142
	}
-
 
143
	*s=0;
-
 
144
 
-
 
145
	++is;
-
 
146
	return str;
-
 
147
}*/
103
*/
148
 
-
 
149
char * bod_parser_base::loadString(token_stream& is, const char *context)
104
char * bod_parser_base::loadString(token_stream& is, const char *context)
150
{
105
{
151
	bod_text_parser::token *t, *prev=NULL;
106
	bod_text_parser::token *t, *prev=NULL;
152
	string_builder str="";
107
	string_builder str="";
153
	
108
	
154
	while((t=is.tok())!=NULL && (t->type==token::t_text || t->type==token::t_colon)){
109
	//while((t=is.tok())!=NULL && (t->type==token::t_text || t->type==token::t_colon)){
-
 
110
	while((t=is.tok())!=NULL && !(t->type==token::t_semicolon || t->type==token::t_openCrBracket || t->type==token::t_closeCrBracket)){
155
		if(prev!=NULL && prev->type==token::t_text && t->type==token::t_text){
111
		if(prev!=NULL && prev->type==token::t_text && t->type==token::t_text){
156
			str << ' ';
112
			str << ' ';
157
		}
113
		}
158
		str << t->getText();
114
		str << t->getText();
159
		prev=t;
115
		prev=t;