Added support for comments in lxs file
This commit is contained in:
parent
48ed58f077
commit
f3e0eb71d5
|
@ -21,14 +21,14 @@ namespace lxs {
|
||||||
std::vector<std::pair<std::string,std::string> > result;
|
std::vector<std::pair<std::string,std::string> > result;
|
||||||
unsigned int i=0;
|
unsigned int i=0;
|
||||||
while(std::getline(is,line)) {
|
while(std::getline(is,line)) {
|
||||||
if(line.length() == 0) continue;
|
|
||||||
i++;
|
i++;
|
||||||
|
size_t start = line.find_first_not_of(" \t\v\f\r");
|
||||||
|
if(line.length() == 0 || (start != std::string::npos && line.length() > start && line[start] == '#')) continue;
|
||||||
std::size_t loc = line.find_first_of('=');
|
std::size_t loc = line.find_first_of('=');
|
||||||
if(loc == std::string::npos) {
|
if(loc == std::string::npos) {
|
||||||
std::cerr << "Invalid syntax on line " << i << ": no '=' found!" << std::endl;
|
std::cerr << "Invalid syntax on line " << i << ": no '=' found!" << std::endl;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
size_t start = line.find_first_not_of(" \t\v\f\r");
|
|
||||||
if(start == loc) {
|
if(start == loc) {
|
||||||
std::cerr << "Invalid syntax on line " << i << ": no valid tokenname specified!" << std::endl;
|
std::cerr << "Invalid syntax on line " << i << ": no valid tokenname specified!" << std::endl;
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
Loading…
Reference in New Issue