Skip to content

Commit d4f72df

Browse files
authored
Merge pull request #13227 from 0xc0170/fix_revert_pr13210
Revert "Fix kv parsing bug in greentea client."
2 parents 3400ef6 + dd209da commit d4f72df

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

features/frameworks/greentea-client/source/greentea_test_env.cpp

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ static int CurTok = 0;
523523
*
524524
* tok_eof ::= EOF (end of file)
525525
* tok_open ::= "{{"
526-
* tok_close ::= "}}\n"
526+
* tok_close ::= "}}"
527527
* tok_semicolon ::= ";"
528528
* tok_string ::= [a-zA-Z0-9_-!@#$%^&*()]+ // See isstring() function
529529
*
@@ -597,7 +597,7 @@ extern "C" int greentea_parse_kv(char *out_key,
597597

598598
case tok_open:
599599
if (HandleKV(out_key, out_value, out_key_size, out_value_size)) {
600-
// We've found {{ KEY ; VALUE }}\n expression
600+
// We've found {{ KEY ; VALUE }} expression
601601
return 1;
602602
}
603603
break;
@@ -684,7 +684,7 @@ static int isstring(int c) {
684684
*
685685
* <TOK_EOF> ::= EOF (end of file)
686686
* <TOK_OPEN> ::= "{{"
687-
* <TOK_CLOSE> ::= "}}\n"
687+
* <TOK_CLOSE> ::= "}}"
688688
* <TOK_SEMICOLON> ::= ";"
689689
* <TOK_STRING> ::= [a-zA-Z0-9_-!@#$%^&*()]+ // See isstring() function *
690690
*
@@ -737,16 +737,13 @@ static int gettok(char *out_str, const int str_size) {
737737
}
738738

739739
// close ::= '}'
740-
if (LastChar == '}') {
741-
LastChar = greentea_getc();
742-
if (LastChar == '}') {
743-
LastChar = greentea_getc();
744-
if (LastChar == '\n') {
745-
LastChar = '!';
746-
return tok_close;
747-
}
748-
}
749-
}
740+
if (LastChar == '}') {
741+
LastChar = greentea_getc();
742+
if (LastChar == '}') {
743+
LastChar = '!';
744+
return tok_close;
745+
}
746+
}
750747

751748
if (LastChar == EOF)
752749
return tok_eof;
@@ -765,8 +762,8 @@ static int gettok(char *out_str, const int str_size) {
765762
* <MESSAGE>: <TOK_OPEN> <TOK_STRING> <TOK_SEMICOLON> <TOK_STRING> <TOK_CLOSE>
766763
*
767764
* Examples:
768-
* message: "{{__timeout; 1000}}\n"
769-
* "{{__sync; 12345678-1234-5678-1234-567812345678}}\n"
765+
* message: "{{__timeout; 1000}}"
766+
* "{{__sync; 12345678-1234-5678-1234-567812345678}}"
770767
*
771768
* \param out_key Output buffer to store key string value
772769
* \param out_value Output buffer to store value string value

0 commit comments

Comments
 (0)