diff options
author | Andreas Krennmair <ak@synflood.at> | 2009-03-20 10:30:10 +0100 |
---|---|---|
committer | Andreas Krennmair <ak@synflood.at> | 2009-03-20 10:30:10 +0100 |
commit | cf5037df47b7ec321a1cac9c2e6e964373c72d84 (patch) | |
tree | 084520cf246121366bb4b87277fe0140267f5939 /filter | |
parent | 2d6951c99f1b6b0da1278e7366d3c7d72ab4027c (diff) |
Revert "regenerated parser with latest version of Coco/R."
This reverts commit 2d6951c99f1b6b0da1278e7366d3c7d72ab4027c.
Diffstat (limited to 'filter')
-rw-r--r-- | filter/Parser.cpp | 7 | ||||
-rw-r--r-- | filter/Parser.h | 16 | ||||
-rw-r--r-- | filter/Scanner.cpp | 29 |
3 files changed, 28 insertions, 24 deletions
diff --git a/filter/Parser.cpp b/filter/Parser.cpp index 22b53d85..9ae6f9e4 100644 --- a/filter/Parser.cpp +++ b/filter/Parser.cpp @@ -205,6 +205,13 @@ void Parser::Parse() { } Parser::Parser(Scanner *scanner) { + _EOF = 0; + _openblock = 1; + _closeblock = 2; + _ident = 3; + _stringliteral = 4; + _numliteral = 5; + _rangeliteral = 6; maxT = 21; minErrDist = 2; diff --git a/filter/Parser.h b/filter/Parser.h index ddc31ffd..2e292a1c 100644 --- a/filter/Parser.h +++ b/filter/Parser.h @@ -28,15 +28,13 @@ public: class Parser { private: - enum { - _EOF=0, - _openblock=1, - _closeblock=2, - _ident=3, - _stringliteral=4, - _numliteral=5, - _rangeliteral=6, - }; + int _EOF; + int _openblock; + int _closeblock; + int _ident; + int _stringliteral; + int _numliteral; + int _rangeliteral; int maxT; Token *dummyToken; diff --git a/filter/Scanner.cpp b/filter/Scanner.cpp index 395d3f76..624f7538 100644 --- a/filter/Scanner.cpp +++ b/filter/Scanner.cpp @@ -343,12 +343,11 @@ void Scanner::Init() { eofSym = 0; maxT = 21; noSym = 21; - int i; - for (i = 46; i <= 46; ++i) start.set(i, 3); - for (i = 65; i <= 90; ++i) start.set(i, 3); - for (i = 95; i <= 95; ++i) start.set(i, 3); - for (i = 97; i <= 122; ++i) start.set(i, 3); - for (i = 48; i <= 57; ++i) start.set(i, 9); + for (int i = 46; i <= 46; ++i) start.set(i, 3); + for (int i = 65; i <= 90; ++i) start.set(i, 3); + for (int i = 95; i <= 95; ++i) start.set(i, 3); + for (int i = 97; i <= 122; ++i) start.set(i, 3); + for (int i = 48; i <= 57; ++i) start.set(i, 9); start.set(40, 1); start.set(41, 2); start.set(34, 4); @@ -419,7 +418,7 @@ void Scanner::AddCh() { delete tval; tval = newBuf; } - tval[tlen++] = ch; + tval[tlen++] = ch; NextCh(); } @@ -491,11 +490,11 @@ Token* Scanner::NextToken() { {t->kind = 2; break;} case 3: case_3: - if ((ch >= L'-' && ch <= L'.') || (ch >= L'A' && ch <= L'Z') || ch == L'_' || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_3;} + if (ch >= L'-' && ch <= L'.' || ch >= L'A' && ch <= L'Z' || ch == L'_' || ch >= L'a' && ch <= L'z') {AddCh(); goto case_3;} else {t->kind = 3; wchar_t *literal = coco_string_create(tval, 0, tlen); t->kind = keywords.get(literal, t->kind); coco_string_delete(literal); break;} case 4: case_4: - if (ch <= L'!' || (ch >= L'#' && ch <= 65535)) {AddCh(); goto case_4;} + if (ch <= L'!' || ch >= L'#' && ch <= 65535) {AddCh(); goto case_4;} else if (ch == L'"') {AddCh(); goto case_5;} else {t->kind = noSym; break;} case 5: @@ -503,24 +502,24 @@ Token* Scanner::NextToken() { {t->kind = 4; break;} case 6: case_6: - if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_6;} + if (ch >= L'0' && ch <= L'9') {AddCh(); goto case_6;} else {t->kind = 5; break;} case 7: case_7: - if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_8;} + if (ch >= L'0' && ch <= L'9') {AddCh(); goto case_8;} else {t->kind = noSym; break;} case 8: case_8: - if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_8;} + if (ch >= L'0' && ch <= L'9') {AddCh(); goto case_8;} else {t->kind = 6; break;} case 9: case_9: - if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_9;} + if (ch >= L'0' && ch <= L'9') {AddCh(); goto case_9;} else if (ch == L':') {AddCh(); goto case_7;} else {t->kind = 5; break;} case 10: - if ((ch >= L'-' && ch <= L'.') || (ch >= L'A' && ch <= L'Z') || ch == L'_' || (ch >= L'a' && ch <= L'z')) {AddCh(); goto case_3;} - else if ((ch >= L'0' && ch <= L'9')) {AddCh(); goto case_6;} + if (ch >= L'-' && ch <= L'.' || ch >= L'A' && ch <= L'Z' || ch == L'_' || ch >= L'a' && ch <= L'z') {AddCh(); goto case_3;} + else if (ch >= L'0' && ch <= L'9') {AddCh(); goto case_6;} else {t->kind = 3; wchar_t *literal = coco_string_create(tval, 0, tlen); t->kind = keywords.get(literal, t->kind); coco_string_delete(literal); break;} case 11: case_11: |