fix and tests for arguments
This commit is contained in:
parent
676b86d194
commit
735b49ff2a
|
@ -61,8 +61,8 @@ struct false_value : pegtl_istring_t("false") {};
|
|||
struct key_path : list< seq< sor< alpha, one< '_' > >, star< sor< alnum, one< '_', '-' > > > >, one< '.' > > {};
|
||||
|
||||
// argument
|
||||
struct argument_index : until< at< one< '}' > >, must< digit > > {};
|
||||
struct argument : seq< one< '{' >, must< argument_index >, any > {};
|
||||
struct argument_index : plus< digit > {};
|
||||
struct argument : seq< one< '{' >, must< argument_index, one< '}' > > > {};
|
||||
|
||||
// expressions and operators
|
||||
struct expr : sor< dq_string, sq_string, number, argument, true_value, false_value, key_path > {};
|
||||
|
|
|
@ -20,7 +20,7 @@ static std::vector<std::string> valid_queries = {
|
|||
"'\\uffFf' = '\\u0020'",
|
||||
"'\\u01111' = 'asdf\\u0111asdf'",
|
||||
|
||||
// numbers, bools, keypaths
|
||||
// expressions (numbers, bools, keypaths, arguments)
|
||||
"-1 = 12",
|
||||
"0 = 001",
|
||||
"0x0 = -0X398235fcAb",
|
||||
|
@ -30,6 +30,10 @@ static std::vector<std::string> valid_queries = {
|
|||
"_ = a",
|
||||
"_a = _.aZ",
|
||||
"a09._br.z = __-__.Z-9",
|
||||
|
||||
// arguments
|
||||
"{0} = {19}",
|
||||
"{0} = {0}",
|
||||
};
|
||||
|
||||
static std::vector<std::string> invalid_queries = {
|
||||
|
@ -44,12 +48,21 @@ static std::vector<std::string> invalid_queries = {
|
|||
"\" = ''",
|
||||
"' = ''",
|
||||
|
||||
// invalid numbers, bools, keypaths
|
||||
// expressions
|
||||
"03a = 1",
|
||||
"1..0 = 1",
|
||||
"1.0. = 1",
|
||||
"1-0 = 1",
|
||||
"0x = 1",
|
||||
"truey = false",
|
||||
"- = a",
|
||||
"a..b = a",
|
||||
"a$a = a",
|
||||
"{} = {0}",
|
||||
"{-1} = {0}",
|
||||
"{a} = {0}",
|
||||
"{ = }",
|
||||
|
||||
|
||||
"truepredicate &&",
|
||||
"truepredicate & truepredicate",
|
||||
|
|
Loading…
Reference in New Issue