Subversion Repositories spk

Rev

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

Rev 1 Rev 114
Line 4... Line 4...
4
#include "bod_cut_parser.h"
4
#include "bod_cut_parser.h"
-
 
5
 
-
 
6
#include <assert.h>
5
//---------------------------------------------------------------------------------
7
//---------------------------------------------------------------------------------
6
bob_dom_document * bod_parser::parseBuffer(char *pszBuffer, size_t size, fileType type)
8
bob_dom_document * bod_parser::parseBuffer(char *pszBuffer, size_t size, fileType type)
7
{
9
{
8
	bod_text_parser parser;
10
	bod_text_parser parser;
9
	token_stream is;
11
	token_stream is;
Line 38... Line 40...
38
		doc->cut=cut;
40
		doc->cut=cut;
39
	}
41
	}
40
	return doc;
42
	return doc;
41
}
43
}
42
//---------------------------------------------------------------------------------
44
//---------------------------------------------------------------------------------
43
bool bod_parser::compile(char *pszBuffer, size_t size, fileType type, bob_dom_obinaryfilestream& os)
45
bool bod_parser::compile(char *pszBuffer, size_t size, fileType type, obinaryfilestream& os)
44
{
46
{
45
	bod_text_parser parser;
-
 
46
	token_stream is;
47
	token_stream is;
47
	bod_parser_base *errorObj;
48
	bod_parser_base *errorObj;
48
	bool bRes=false;
49
	bool bRes=false;
49
	
50
	
-
 
51
	is.parseFlags((bod_text_parser::ParseFlags)bod_text_parser::parseBODComments);
50
	is.rdbuffer(pszBuffer, size);
52
	is.rdbuffer(pszBuffer, size);
51
	
53
	
52
	if(type==bobFile){
54
	if(type==bobFile){
53
		bod_bob_parser *bp=new bod_bob_parser(m_settings);
55
		bod_bob_parser *bp=new bod_bob_parser(m_settings);
54
		errorObj=bp;
56
		errorObj=bp;
Line 57... Line 59...
57
	else if(type==cutFile){
59
	else if(type==cutFile){
58
		bod_cut_parser *cp=new bod_cut_parser(m_settings);
60
		bod_cut_parser *cp=new bod_cut_parser(m_settings);
59
		bRes=cp->compile(is, os);
61
		bRes=cp->compile(is, os);
60
		errorObj=cp;
62
		errorObj=cp;
61
	}
63
	}
-
 
64
	else
-
 
65
		assert(0); // invalid fileType
62
	
66
	
63
	for(iterator &it=errorObj->errors.begin(); it!=errorObj->errors.end(); ++it){
67
	for(iterator &it=errorObj->errors.begin(); it!=errorObj->errors.end(); ++it){
64
		error(it);
68
		error(it);
65
	}
69
	}
-
 
70
	
-
 
71
	delete errorObj;
-
 
72
	
66
	return bRes;
73
	return bRes;
67
}
74
}
68
//---------------------------------------------------------------------------------
75
//---------------------------------------------------------------------------------
69
void bod_parser::error(iterator& it)
76
void bod_parser::error(iterator& it)
70
{
77
{