fixed bug in SECTION_NAME rule
This commit is contained in:
parent
68a4bf6240
commit
2f06a95257
@ -6,6 +6,7 @@
|
|||||||
#include "refptr/refptr.h"
|
#include "refptr/refptr.h"
|
||||||
#include "serialize.h"
|
#include "serialize.h"
|
||||||
#include "unicode.h"
|
#include "unicode.h"
|
||||||
|
#include "parse-input.h"
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main(int argc, char * argv[])
|
int main(int argc, char * argv[])
|
||||||
@ -37,12 +38,14 @@ int main(int argc, char * argv[])
|
|||||||
cerr << "Error opening input file: '" << argv[optind] << "'";
|
cerr << "Error opening input file: '" << argv[optind] << "'";
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
refptr< vector<unichar_t> > ucs_str = deserialize(encoding, ifs);
|
refptr< vector<unichar_t> > ucs = deserialize(encoding, ifs);
|
||||||
if (ucs_str.isNull())
|
if (ucs.isNull())
|
||||||
{
|
{
|
||||||
cerr << "Error deserializing input file." << endl;
|
cerr << "Error deserializing input file." << endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parse_input(ucs);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,9 @@ void parse_input(refptr< vector<unichar_t> > ucs)
|
|||||||
case '\n':
|
case '\n':
|
||||||
SET_ERROR("Unterminated section header");
|
SET_ERROR("Unterminated section header");
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
build_str += c;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RULES:
|
case RULES:
|
||||||
|
11
testinput.i
Normal file
11
testinput.i
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
[rules]
|
||||||
|
|
||||||
|
ASSIGN := ":="
|
||||||
|
DASSIGN := ":=="
|
||||||
|
IDENTIFIER := "[a-zA-Z_][a-zA-Z_0-9]*"
|
||||||
|
|
||||||
|
Assignment := IDENTIFIER ASSIGN Expression
|
||||||
|
|
||||||
|
Expression := IDENTIFIER
|
||||||
|
| Assignment
|
Loading…
x
Reference in New Issue
Block a user