author | zecke <zecke> | 2002-09-10 12:09:49 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-10 12:09:49 (UTC) |
commit | 6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4 (patch) (side-by-side diff) | |
tree | 6ebc93c6432f4ed9d00ef1448b6a047ef522a79a /library/backend/vcc.y | |
parent | d10cddb3c9ce75bc90b14add14bc133737fe35aa (diff) | |
download | opie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.zip opie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.tar.gz opie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.tar.bz2 |
Qtopia1-6 merge
still to test
bic changes to be resolved
more changes to be made?
-rw-r--r-- | library/backend/vcc.y | 103 |
1 files changed, 56 insertions, 47 deletions
diff --git a/library/backend/vcc.y b/library/backend/vcc.y index e326a64..5bcf0cb 100644 --- a/library/backend/vcc.y +++ b/library/backend/vcc.y @@ -517,7 +517,7 @@ static int lexWithinMode(enum LexMode mode) { return 0; } -static char lexGetc_() +static int lexGetc_()
{ /* get next char from input, no buffering. */ if (lexBuf.curPos == lexBuf.inputLen) @@ -931,60 +931,69 @@ static int match_begin_end_name(int end) { static char* lexGetQuotedPrintable() { - char cur; - + int c;
+ lexSkipWhite();
+ c = lexLookahead();
lexClearToken(); - do { - cur = lexGetc(); - switch (cur) { - case '=': { - int c = 0; - int next[2]; - int i; - for (i = 0; i < 2; i++) { - next[i] = lexGetc(); - if (next[i] >= '0' && next[i] <= '9') - c = c * 16 + next[i] - '0'; - else if (next[i] >= 'A' && next[i] <= 'F') - c = c * 16 + next[i] - 'A' + 10; - else +
+ while (c != EOF && c != ';') {
+ if (c == '\n') {
+ // break, leave '\n' on remaining chars.
break; + } else if (c == '=') {
+ int cur = 0;
+ int next;
+
+ lexSkipLookahead(); // skip '='
+ next = lexLookahead();
+
+ if (next == '\n') {
+ // skip and only skip the \n
+ lexSkipLookahead();
+ c = lexLookahead();
+ ++mime_lineNum; // aid in error reporting
+ continue;
+ } else if (next >= '0' && next <= '9') {
+ cur = next - '0';
+ } else if (next >= 'A' && next <= 'F') {
+ cur = next - 'A' + 10;
+ } else {
+ // we have been sent buggy stuff. doesn't matter
+ // what we do so long as we keep going.
+ // should probably spit an error here
+ c = lexLookahead();
+ continue;
} - if (i == 0) { - /* single '=' follow by LINESEP is continuation sign? */ - if (next[0] == '\n') { - ++mime_lineNum; - } - else { - lexPushLookaheadc('='); - goto EndString; - } +
+ lexSkipLookahead(); // skip A-Z0-9
+ next = lexLookahead();
+
+ cur = cur * 16;
+ // this time really just expecting 0-9A-F
+ if (next >= '0' && next <= '9') {
+ cur += next - '0';
+ } else if (next >= 'A' && next <= 'F') {
+ cur += next - 'A' + 10;
+ } else {
+ // we have been sent buggy stuff. doesn't matter
+ // what we do so long as we keep going.
+ // should probably spit an error here
+ c = lexLookahead();
+ continue;
} - else if (i == 1) { - lexPushLookaheadc(next[1]); - lexPushLookaheadc(next[0]); - lexAppendc('='); +
+ // got a valid escaped =. append it.
+ lexSkipLookahead(); // skip second 0-9A-F
+ lexAppendc(cur);
} else { - lexAppendc(c); + lexSkipLookahead(); // skip whatever we just read.
+ lexAppendc(c); // and append it.
} - break; - } /* '=' */ - case '\n': { - lexPushLookaheadc('\n'); - goto EndString; + c = lexLookahead();
} - case (char)EOF: - break; - default: - lexAppendc(cur); - break; - } /* switch */ - } while (cur != (char)EOF); - -EndString: lexAppendc(0); - return lexStr(); - } /* LexQuotedPrintable */ + return c==EOF?0:lexStr();
+}
static int yylex() { |