Skip to content

Commit

Permalink
Merge pull request #13227 from 0xc0170/fix_revert_pr13210
Browse files Browse the repository at this point in the history
Revert "Fix kv parsing bug in greentea client."
  • Loading branch information
0xc0170 committed Jul 3, 2020
2 parents 3400ef6 + dd209da commit d4f72df
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions features/frameworks/greentea-client/source/greentea_test_env.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ static int CurTok = 0;
*
* tok_eof ::= EOF (end of file)
* tok_open ::= "{{"
* tok_close ::= "}}\n"
* tok_close ::= "}}"
* tok_semicolon ::= ";"
* tok_string ::= [a-zA-Z0-9_-!@#$%^&*()]+ // See isstring() function
*
Expand Down Expand Up @@ -597,7 +597,7 @@ extern "C" int greentea_parse_kv(char *out_key,

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

// close ::= '}'
if (LastChar == '}') {
LastChar = greentea_getc();
if (LastChar == '}') {
LastChar = greentea_getc();
if (LastChar == '\n') {
LastChar = '!';
return tok_close;
}
}
}
if (LastChar == '}') {
LastChar = greentea_getc();
if (LastChar == '}') {
LastChar = '!';
return tok_close;
}
}

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

0 comments on commit d4f72df

Please sign in to comment.