line continuation handling, not fully working
This commit is contained in:
parent
57190f3366
commit
44ec8b0ccf
44
lex.c
44
lex.c
|
@ -591,14 +591,14 @@ enum LexToken LexScanGetToken(Picoc *pc, struct LexState *Lexer,
|
||||||
case ':':
|
case ':':
|
||||||
GotToken = TokenColon;
|
GotToken = TokenColon;
|
||||||
break;
|
break;
|
||||||
// XXX: multiline support
|
// XXX: line continuation feature
|
||||||
// case '\\':
|
case '\\':
|
||||||
// if (NextChar == ' ' || NextChar == '\n') {
|
if (NextChar == ' ' || NextChar == '\n') {
|
||||||
// LEXER_INC(Lexer);
|
LEXER_INC(Lexer);
|
||||||
// LexSkipLineCont(Lexer, NextChar);
|
LexSkipLineCont(Lexer, NextChar);
|
||||||
// } else
|
} else
|
||||||
// LexFail(pc, Lexer, "xx illegal character '%c'", ThisChar);
|
LexFail(pc, Lexer, "illegal character '%c'", ThisChar);
|
||||||
// break;
|
break;
|
||||||
default:
|
default:
|
||||||
LexFail(pc, Lexer, "illegal character '%c'", ThisChar);
|
LexFail(pc, Lexer, "illegal character '%c'", ThisChar);
|
||||||
break;
|
break;
|
||||||
|
@ -801,8 +801,8 @@ enum LexToken LexGetRawToken(struct ParseState *Parser, struct Value **Value,
|
||||||
|
|
||||||
Token = (enum LexToken)*(unsigned char*)Parser->Pos;
|
Token = (enum LexToken)*(unsigned char*)Parser->Pos;
|
||||||
}
|
}
|
||||||
} while ((Parser->FileName == pc->StrEmpty &&
|
} while ((Parser->FileName == pc->StrEmpty && Token == TokenEOF) ||
|
||||||
Token == TokenEOF) || Token == TokenEndOfLine);
|
Token == TokenEndOfLine);
|
||||||
|
|
||||||
Parser->CharacterPos = *((unsigned char*)Parser->Pos + 1);
|
Parser->CharacterPos = *((unsigned char*)Parser->Pos + 1);
|
||||||
ValueSize = LexTokenSize(Token);
|
ValueSize = LexTokenSize(Token);
|
||||||
|
@ -1104,22 +1104,20 @@ enum LexToken LexRawPeekToken(struct ParseState *Parser)
|
||||||
/* find the end of the line */
|
/* find the end of the line */
|
||||||
void LexToEndOfMacro(struct ParseState *Parser)
|
void LexToEndOfMacro(struct ParseState *Parser)
|
||||||
{
|
{
|
||||||
// bool isContinued = false;
|
// XXX: line continuation feature
|
||||||
|
bool isContinued = false;
|
||||||
while (true) {
|
while (true) {
|
||||||
enum LexToken Token = (enum LexToken)*(unsigned char*)Parser->Pos;
|
enum LexToken Token = (enum LexToken)*(unsigned char*)Parser->Pos;
|
||||||
if (Token == TokenEndOfLine || Token == TokenEOF)
|
if (Token == TokenEOF)
|
||||||
return;
|
return;
|
||||||
// XXX: multiline support
|
else if (Token == TokenEndOfLine) {
|
||||||
// else if (Token == TokenEndOfLine) {
|
if (!isContinued)
|
||||||
// if (!isContinued)
|
return;
|
||||||
// return;
|
isContinued = false;
|
||||||
// else
|
}
|
||||||
// isContinued = false;
|
if (Token == TokenBackSlash)
|
||||||
else
|
isContinued = true;
|
||||||
// XXX: multiline support
|
LexGetRawToken(Parser, NULL, true);
|
||||||
// if (Token == TokenBackSlash)
|
|
||||||
// isContinued = true;
|
|
||||||
LexGetRawToken(Parser, NULL, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue