mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 241788 - mozilla::Tokenizer - token type for \n should whitespace if given in constructor r=honzab
This commit is contained in:
parent
f2674e1627
commit
e8d450bb24
@ -260,12 +260,12 @@ Tokenizer::Parse(Token& aToken) const
|
||||
state = PARSE_WORD;
|
||||
} else if (IsNumber(*next)) {
|
||||
state = PARSE_INTEGER;
|
||||
} else if (strchr(mWhitespaces, *next)) { // not UTF-8 friendly?
|
||||
state = PARSE_WS;
|
||||
} else if (*next == '\r') {
|
||||
state = PARSE_CRLF;
|
||||
} else if (*next == '\n') {
|
||||
state = PARSE_LF;
|
||||
} else if (strchr(mWhitespaces, *next)) { // not UTF-8 friendly?
|
||||
state = PARSE_WS;
|
||||
} else {
|
||||
state = PARSE_CHAR;
|
||||
}
|
||||
|
@ -526,6 +526,21 @@ TEST(Tokenizer, SkipWhites)
|
||||
EXPECT_TRUE(p.CheckEOF());
|
||||
}
|
||||
|
||||
TEST(Tokenizer, SkipCustomWhites)
|
||||
{
|
||||
Tokenizer p("Text1 \n\r\t.Text2 \n\r\t.", " \n\r\t.");
|
||||
|
||||
EXPECT_TRUE(p.CheckWord("Text1"));
|
||||
p.SkipWhites();
|
||||
EXPECT_TRUE(p.CheckWord("Text2"));
|
||||
EXPECT_TRUE(p.CheckWhite());
|
||||
EXPECT_TRUE(p.CheckWhite());
|
||||
EXPECT_TRUE(p.CheckWhite());
|
||||
EXPECT_TRUE(p.CheckWhite());
|
||||
EXPECT_TRUE(p.CheckWhite());
|
||||
EXPECT_TRUE(p.CheckEOF());
|
||||
}
|
||||
|
||||
TEST(Tokenizer, IntegerReading)
|
||||
{
|
||||
#define INT_6_BITS 64U
|
||||
|
Loading…
Reference in New Issue
Block a user