mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-29 09:03:14 +08:00
feat(yaml_parser): Correct parsing whitespaces-separated strings
Fix given scenarios in yaml parsings: - Correct reading string containing multiple words separated by a whitespace (space/tab) on token value retrieving - Remove any unnecessary whitespaces from the end of a string on token value retrieving Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
bddf1bbe76
commit
966aa460f7
@@ -275,10 +275,12 @@ bool tokenize(ConstStringRef text, LinesCache &outLines, TokensCache &outTokens,
|
||||
context.isParsingIdent = false;
|
||||
auto tokEnd = consumeNameIdentifier(text, context.pos);
|
||||
if (tokEnd != context.pos) {
|
||||
auto tokenData = ConstStringRef(context.pos, tokEnd - context.pos);
|
||||
tokenData = tokenData.trimEnd(isWhitespace);
|
||||
if (context.lineTraits.hasDictionaryEntry) {
|
||||
outTokens.push_back(Token(ConstStringRef(context.pos, tokEnd - context.pos), Token::LiteralString));
|
||||
outTokens.push_back(Token(tokenData, Token::LiteralString));
|
||||
} else {
|
||||
outTokens.push_back(Token(ConstStringRef(context.pos, tokEnd - context.pos), Token::Identifier));
|
||||
outTokens.push_back(Token(tokenData, Token::Identifier));
|
||||
}
|
||||
} else {
|
||||
tokEnd = consumeNumberOrSign(text, context.pos);
|
||||
|
||||
Reference in New Issue
Block a user