mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-26 09:23:55 +00:00
grammar neaten
This commit is contained in:
parent
90d8f7c501
commit
791bcbbdef
5 changed files with 84 additions and 59 deletions
|
|
@ -57,17 +57,17 @@
|
|||
|
||||
"|" {
|
||||
*yyextra = mlr_dsl_ast_node_alloc(yytext, MLR_DSL_AST_NODE_TYPE_OPERATOR);
|
||||
return FILTER_DSL_BIT_OR;
|
||||
return FILTER_DSL_BITWISE_OR;
|
||||
}
|
||||
|
||||
"^" {
|
||||
*yyextra = mlr_dsl_ast_node_alloc(yytext, MLR_DSL_AST_NODE_TYPE_OPERATOR);
|
||||
return FILTER_DSL_BIT_XOR;
|
||||
return FILTER_DSL_BITWISE_XOR;
|
||||
}
|
||||
|
||||
"&" {
|
||||
*yyextra = mlr_dsl_ast_node_alloc(yytext, MLR_DSL_AST_NODE_TYPE_OPERATOR);
|
||||
return FILTER_DSL_BIT_AND;
|
||||
return FILTER_DSL_BITWISE_AND;
|
||||
}
|
||||
|
||||
"+" {
|
||||
|
|
|
|||
|
|
@ -38,138 +38,138 @@
|
|||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
filter_dsl_body(A) ::= filter_dsl_bool_expr(B). {
|
||||
filter_dsl_body(A) ::= fdsl_logical_or_term(B). {
|
||||
A = B;
|
||||
past->proot = A;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
filter_dsl_bool_expr(A) ::= filter_dsl_or_term(B). {
|
||||
fdsl_logical_or_term(A) ::= fdsl_logical_and_term(B). {
|
||||
A = B;
|
||||
}
|
||||
filter_dsl_bool_expr(A) ::= filter_dsl_bool_expr(B) FILTER_DSL_LOGICAL_OR(O) filter_dsl_or_term(C). {
|
||||
fdsl_logical_or_term(A) ::= fdsl_logical_or_term(B) FILTER_DSL_LOGICAL_OR(O) fdsl_logical_and_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
filter_dsl_or_term(A) ::= filter_dsl_and_term(B). {
|
||||
fdsl_logical_and_term(A) ::= fdsl_eqne_term(B). {
|
||||
A = B;
|
||||
}
|
||||
filter_dsl_or_term(A) ::= filter_dsl_or_term(B) FILTER_DSL_LOGICAL_AND(O) filter_dsl_and_term(C). {
|
||||
fdsl_logical_and_term(A) ::= fdsl_logical_and_term(B) FILTER_DSL_LOGICAL_AND(O) fdsl_eqne_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
filter_dsl_and_term(A) ::= filter_dsl_eqne_term(B). {
|
||||
fdsl_eqne_term(A) ::= fdsl_cmp_term(B). {
|
||||
A = B;
|
||||
}
|
||||
filter_dsl_and_term(A) ::= filter_dsl_and_term(B) FILTER_DSL_MATCHES(O) filter_dsl_eqne_term(C). {
|
||||
fdsl_eqne_term(A) ::= fdsl_eqne_term(B) FILTER_DSL_MATCHES(O) fdsl_cmp_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
filter_dsl_and_term(A) ::= filter_dsl_and_term(B) FILTER_DSL_DOES_NOT_MATCH(O) filter_dsl_eqne_term(C). {
|
||||
fdsl_eqne_term(A) ::= fdsl_eqne_term(B) FILTER_DSL_DOES_NOT_MATCH(O) fdsl_cmp_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
filter_dsl_and_term(A) ::= filter_dsl_and_term(B) FILTER_DSL_EQ(O) filter_dsl_eqne_term(C). {
|
||||
fdsl_eqne_term(A) ::= fdsl_eqne_term(B) FILTER_DSL_EQ(O) fdsl_cmp_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
filter_dsl_and_term(A) ::= filter_dsl_and_term(B) FILTER_DSL_NE(O) filter_dsl_eqne_term(C). {
|
||||
fdsl_eqne_term(A) ::= fdsl_eqne_term(B) FILTER_DSL_NE(O) fdsl_cmp_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
filter_dsl_eqne_term(A) ::= filter_dsl_cmp_term(B). {
|
||||
fdsl_cmp_term(A) ::= fdsl_bitwise_or_term(B). {
|
||||
A = B;
|
||||
}
|
||||
filter_dsl_eqne_term(A) ::= filter_dsl_eqne_term(B) FILTER_DSL_GT(O) filter_dsl_cmp_term(C). {
|
||||
fdsl_cmp_term(A) ::= fdsl_cmp_term(B) FILTER_DSL_GT(O) fdsl_bitwise_or_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
filter_dsl_eqne_term(A) ::= filter_dsl_eqne_term(B) FILTER_DSL_GE(O) filter_dsl_cmp_term(C). {
|
||||
fdsl_cmp_term(A) ::= fdsl_cmp_term(B) FILTER_DSL_GE(O) fdsl_bitwise_or_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
filter_dsl_eqne_term(A) ::= filter_dsl_eqne_term(B) FILTER_DSL_LT(O) filter_dsl_cmp_term(C). {
|
||||
fdsl_cmp_term(A) ::= fdsl_cmp_term(B) FILTER_DSL_LT(O) fdsl_bitwise_or_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
filter_dsl_eqne_term(A) ::= filter_dsl_eqne_term(B) FILTER_DSL_LE(O) filter_dsl_cmp_term(C). {
|
||||
fdsl_cmp_term(A) ::= fdsl_cmp_term(B) FILTER_DSL_LE(O) fdsl_bitwise_or_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
filter_dsl_cmp_term(A) ::= filter_dsl_bit_or_term(B). {
|
||||
fdsl_bitwise_or_term(A) ::= fdsl_bitwise_xor_term(B). {
|
||||
A = B;
|
||||
}
|
||||
filter_dsl_cmp_term(A) ::= filter_dsl_cmp_term(B) FILTER_DSL_BIT_OR(O) filter_dsl_bit_or_term(C). {
|
||||
fdsl_bitwise_or_term(A) ::= fdsl_bitwise_or_term(B) FILTER_DSL_BITWISE_OR(O) fdsl_bitwise_xor_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
filter_dsl_bit_or_term(A) ::= filter_dsl_bit_xor_term(B). {
|
||||
fdsl_bitwise_xor_term(A) ::= fdsl_bitwise_and_term(B). {
|
||||
A = B;
|
||||
}
|
||||
filter_dsl_bit_or_term(A) ::= filter_dsl_bit_or_term(B) FILTER_DSL_BIT_XOR(O) filter_dsl_bit_xor_term(C). {
|
||||
fdsl_bitwise_xor_term(A) ::= fdsl_bitwise_xor_term(B) FILTER_DSL_BITWISE_XOR(O) fdsl_bitwise_and_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
filter_dsl_bit_xor_term(A) ::= filter_dsl_bit_and_term(B). {
|
||||
fdsl_bitwise_and_term(A) ::= fdsl_addsubdot_term(B). {
|
||||
A = B;
|
||||
}
|
||||
filter_dsl_bit_xor_term(A) ::= filter_dsl_bit_xor_term(B) FILTER_DSL_BIT_AND(O) filter_dsl_bit_and_term(C). {
|
||||
fdsl_bitwise_and_term(A) ::= fdsl_bitwise_and_term(B) FILTER_DSL_BITWISE_AND(O) fdsl_addsubdot_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
filter_dsl_bit_and_term(A) ::= filter_dsl_pmdot_term(B). {
|
||||
fdsl_addsubdot_term(A) ::= fdsl_muldiv_term(B). {
|
||||
A = B;
|
||||
}
|
||||
filter_dsl_bit_and_term(A) ::= filter_dsl_bit_and_term(B) FILTER_DSL_PLUS(O) filter_dsl_pmdot_term(C). {
|
||||
fdsl_addsubdot_term(A) ::= fdsl_addsubdot_term(B) FILTER_DSL_PLUS(O) fdsl_muldiv_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
filter_dsl_bit_and_term(A) ::= filter_dsl_bit_and_term(B) FILTER_DSL_MINUS(O) filter_dsl_pmdot_term(C). {
|
||||
fdsl_addsubdot_term(A) ::= fdsl_addsubdot_term(B) FILTER_DSL_MINUS(O) fdsl_muldiv_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
filter_dsl_bit_and_term(A) ::= filter_dsl_bit_and_term(B) FILTER_DSL_DOT(O) filter_dsl_pmdot_term(C). {
|
||||
fdsl_addsubdot_term(A) ::= fdsl_addsubdot_term(B) FILTER_DSL_DOT(O) fdsl_muldiv_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
filter_dsl_pmdot_term(A) ::= filter_dsl_muldiv_term(B). {
|
||||
fdsl_muldiv_term(A) ::= fdsl_binary_bitwise_op_term(B). {
|
||||
A = B;
|
||||
}
|
||||
filter_dsl_pmdot_term(A) ::= filter_dsl_pmdot_term(B) FILTER_DSL_TIMES(O) filter_dsl_muldiv_term(C). {
|
||||
fdsl_muldiv_term(A) ::= fdsl_muldiv_term(B) FILTER_DSL_TIMES(O) fdsl_binary_bitwise_op_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
filter_dsl_pmdot_term(A) ::= filter_dsl_pmdot_term(B) FILTER_DSL_DIVIDE(O) filter_dsl_muldiv_term(C). {
|
||||
fdsl_muldiv_term(A) ::= fdsl_muldiv_term(B) FILTER_DSL_DIVIDE(O) fdsl_binary_bitwise_op_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
filter_dsl_pmdot_term(A) ::= filter_dsl_pmdot_term(B) FILTER_DSL_INT_DIVIDE(O) filter_dsl_muldiv_term(C). {
|
||||
fdsl_muldiv_term(A) ::= fdsl_muldiv_term(B) FILTER_DSL_INT_DIVIDE(O) fdsl_binary_bitwise_op_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
filter_dsl_pmdot_term(A) ::= filter_dsl_pmdot_term(B) FILTER_DSL_MOD(O) filter_dsl_muldiv_term(C). {
|
||||
fdsl_muldiv_term(A) ::= fdsl_muldiv_term(B) FILTER_DSL_MOD(O) fdsl_binary_bitwise_op_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
filter_dsl_muldiv_term(A) ::= filter_dsl_unary_term(B). {
|
||||
fdsl_binary_bitwise_op_term(A) ::= fdsl_pow_term(B). {
|
||||
A = B;
|
||||
}
|
||||
filter_dsl_muldiv_term(A) ::= FILTER_DSL_PLUS(O) filter_dsl_unary_term(C). {
|
||||
fdsl_binary_bitwise_op_term(A) ::= FILTER_DSL_PLUS(O) fdsl_pow_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_unary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, C);
|
||||
}
|
||||
filter_dsl_muldiv_term(A) ::= FILTER_DSL_MINUS(O) filter_dsl_unary_term(C). {
|
||||
fdsl_binary_bitwise_op_term(A) ::= FILTER_DSL_MINUS(O) fdsl_pow_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_unary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, C);
|
||||
}
|
||||
filter_dsl_muldiv_term(A) ::= FILTER_DSL_NOT(O) filter_dsl_unary_term(C). {
|
||||
fdsl_binary_bitwise_op_term(A) ::= FILTER_DSL_NOT(O) fdsl_pow_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_unary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, C);
|
||||
}
|
||||
filter_dsl_muldiv_term(A) ::= FILTER_DSL_BIT_NOT(O) filter_dsl_unary_term(C). {
|
||||
fdsl_binary_bitwise_op_term(A) ::= FILTER_DSL_BIT_NOT(O) fdsl_pow_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_unary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, C);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
filter_dsl_unary_term(A) ::= filter_dsl_exp_term(B). {
|
||||
fdsl_pow_term(A) ::= fdsl_atom_or_fcn(B). {
|
||||
A = B;
|
||||
}
|
||||
filter_dsl_unary_term(A) ::= filter_dsl_exp_term(B) FILTER_DSL_POW(O) filter_dsl_unary_term(C). {
|
||||
fdsl_pow_term(A) ::= fdsl_atom_or_fcn(B) FILTER_DSL_POW(O) fdsl_pow_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
|
||||
|
|
@ -178,17 +178,17 @@ filter_dsl_unary_term(A) ::= filter_dsl_exp_term(B) FILTER_DSL_POW(O) filter_dsl
|
|||
// within Miller internally, field names are of the form "x". We coded the
|
||||
// lexer to give us field names with leading "$" so we can confidently strip it
|
||||
// off here.
|
||||
filter_dsl_exp_term(A) ::= FILTER_DSL_FIELD_NAME(B). {
|
||||
fdsl_atom_or_fcn(A) ::= FILTER_DSL_FIELD_NAME(B). {
|
||||
char* dollar_name = B->text;
|
||||
char* no_dollar_name = &dollar_name[1];
|
||||
A = mlr_dsl_ast_node_alloc(no_dollar_name, B->type);
|
||||
}
|
||||
filter_dsl_exp_term(A) ::= FILTER_DSL_NUMBER(B). {
|
||||
fdsl_atom_or_fcn(A) ::= FILTER_DSL_NUMBER(B). {
|
||||
A = B;
|
||||
}
|
||||
|
||||
// Strip off the leading/trailing double quotes which are included by the lexer
|
||||
filter_dsl_exp_term(A) ::= FILTER_DSL_STRING(B). {
|
||||
fdsl_atom_or_fcn(A) ::= FILTER_DSL_STRING(B). {
|
||||
char* input = B->text;
|
||||
char* stripped = &input[1];
|
||||
int len = strlen(input);
|
||||
|
|
@ -197,7 +197,7 @@ filter_dsl_exp_term(A) ::= FILTER_DSL_STRING(B). {
|
|||
}
|
||||
|
||||
// Strip off the leading '"' and trailing '"i' which are included by the lexer
|
||||
filter_dsl_exp_term(A) ::= FILTER_DSL_REGEXI(B). {
|
||||
fdsl_atom_or_fcn(A) ::= FILTER_DSL_REGEXI(B). {
|
||||
char* input = B->text;
|
||||
char* stripped = &input[1];
|
||||
int len = strlen(input);
|
||||
|
|
@ -205,10 +205,10 @@ filter_dsl_exp_term(A) ::= FILTER_DSL_REGEXI(B). {
|
|||
A = mlr_dsl_ast_node_alloc(stripped, B->type);
|
||||
}
|
||||
|
||||
filter_dsl_exp_term(A) ::= FILTER_DSL_CONTEXT_VARIABLE(B). {
|
||||
fdsl_atom_or_fcn(A) ::= FILTER_DSL_CONTEXT_VARIABLE(B). {
|
||||
A = B;
|
||||
}
|
||||
filter_dsl_exp_term(A) ::= FILTER_DSL_LPAREN filter_dsl_bool_expr(B) FILTER_DSL_RPAREN. {
|
||||
fdsl_atom_or_fcn(A) ::= FILTER_DSL_LPAREN fdsl_logical_or_term(B) FILTER_DSL_RPAREN. {
|
||||
A = B;
|
||||
}
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ filter_dsl_exp_term(A) ::= FILTER_DSL_LPAREN filter_dsl_bool_expr(B) FILTER_DSL_
|
|||
// * On the "c" we append the next argument to get "anon(a,b,c)".
|
||||
// * On the "f" we change the function name to get "f(a,b,c)".
|
||||
|
||||
filter_dsl_exp_term(A) ::= FILTER_DSL_FCN_NAME(O) FILTER_DSL_LPAREN filter_dsl_fcn_args(B) FILTER_DSL_RPAREN. {
|
||||
fdsl_atom_or_fcn(A) ::= FILTER_DSL_FCN_NAME(O) FILTER_DSL_LPAREN filter_dsl_fcn_args(B) FILTER_DSL_RPAREN. {
|
||||
A = mlr_dsl_ast_node_set_function_name(B, O->text);
|
||||
}
|
||||
// xxx need to invalidate "f(10,)" -- use some non-empty-args expr.
|
||||
|
|
@ -227,9 +227,9 @@ filter_dsl_fcn_args(A) ::= . {
|
|||
A = mlr_dsl_ast_node_alloc_zary("anon", MLR_DSL_AST_NODE_TYPE_FUNCTION_NAME);
|
||||
}
|
||||
|
||||
filter_dsl_fcn_args(A) ::= filter_dsl_bool_expr(B). {
|
||||
filter_dsl_fcn_args(A) ::= fdsl_logical_or_term(B). {
|
||||
A = mlr_dsl_ast_node_alloc_unary("anon", MLR_DSL_AST_NODE_TYPE_FUNCTION_NAME, B);
|
||||
}
|
||||
filter_dsl_fcn_args(A) ::= filter_dsl_fcn_args(B) FILTER_DSL_COMMA filter_dsl_bool_expr(C). {
|
||||
filter_dsl_fcn_args(A) ::= filter_dsl_fcn_args(B) FILTER_DSL_COMMA fdsl_logical_or_term(C). {
|
||||
A = mlr_dsl_ast_node_append_arg(B, C);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,17 +66,17 @@
|
|||
|
||||
"|" {
|
||||
*yyextra = mlr_dsl_ast_node_alloc(yytext, MLR_DSL_AST_NODE_TYPE_OPERATOR);
|
||||
return PUT_DSL_BIT_OR;
|
||||
return PUT_DSL_BITWISE_OR;
|
||||
}
|
||||
|
||||
"^" {
|
||||
*yyextra = mlr_dsl_ast_node_alloc(yytext, MLR_DSL_AST_NODE_TYPE_OPERATOR);
|
||||
return PUT_DSL_BIT_XOR;
|
||||
return PUT_DSL_BITWISE_XOR;
|
||||
}
|
||||
|
||||
"&" {
|
||||
*yyextra = mlr_dsl_ast_node_alloc(yytext, MLR_DSL_AST_NODE_TYPE_OPERATOR);
|
||||
return PUT_DSL_BIT_AND;
|
||||
return PUT_DSL_BITWISE_AND;
|
||||
}
|
||||
|
||||
"+" {
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ put_dsl_eqne_term(A) ::= put_dsl_eqne_term(B) PUT_DSL_LE(O) put_dsl_cmp_term(C).
|
|||
put_dsl_cmp_term(A) ::= put_dsl_bit_or_term(B). {
|
||||
A = B;
|
||||
}
|
||||
put_dsl_cmp_term(A) ::= put_dsl_cmp_term(B) PUT_DSL_BIT_OR(O) put_dsl_bit_or_term(C). {
|
||||
put_dsl_cmp_term(A) ::= put_dsl_cmp_term(B) PUT_DSL_BITWISE_OR(O) put_dsl_bit_or_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ put_dsl_cmp_term(A) ::= put_dsl_cmp_term(B) PUT_DSL_BIT_OR(O) put_dsl_bit_or_ter
|
|||
put_dsl_bit_or_term(A) ::= put_dsl_bit_xor_term(B). {
|
||||
A = B;
|
||||
}
|
||||
put_dsl_bit_or_term(A) ::= put_dsl_bit_or_term(B) PUT_DSL_BIT_XOR(O) put_dsl_bit_xor_term(C). {
|
||||
put_dsl_bit_or_term(A) ::= put_dsl_bit_or_term(B) PUT_DSL_BITWISE_XOR(O) put_dsl_bit_xor_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ put_dsl_bit_or_term(A) ::= put_dsl_bit_or_term(B) PUT_DSL_BIT_XOR(O) put_dsl_bit
|
|||
put_dsl_bit_xor_term(A) ::= put_dsl_bit_and_term(B). {
|
||||
A = B;
|
||||
}
|
||||
put_dsl_bit_xor_term(A) ::= put_dsl_bit_xor_term(B) PUT_DSL_BIT_AND(O) put_dsl_bit_and_term(C). {
|
||||
put_dsl_bit_xor_term(A) ::= put_dsl_bit_xor_term(B) PUT_DSL_BITWISE_AND(O) put_dsl_bit_and_term(C). {
|
||||
A = mlr_dsl_ast_node_alloc_binary(O->text, MLR_DSL_AST_NODE_TYPE_OPERATOR, B, C);
|
||||
}
|
||||
|
||||
|
|
|
|||
33
c/todo.txt
33
c/todo.txt
|
|
@ -13,13 +13,15 @@ TOP OF LIST
|
|||
|
||||
! join on partial value-field matches
|
||||
|
||||
* mlr per-release docs: linkto from releases page
|
||||
|
||||
* full-int64 I/O & math:
|
||||
o make int-to-int-enabled without remorse:
|
||||
k make int-to-int-enabled:
|
||||
unary: abs ceil floor round sgn
|
||||
binary: roundm max min
|
||||
! make int-to-int enabled ... but beware, we are introducing overflow for bignums
|
||||
where it wasn't before: doc needs to be clear re '$z=float($x)+float($y)' :^/
|
||||
binary: + - u- * % //
|
||||
o make int-to-int enabled ... but beware, we are introducing overflow for bignums
|
||||
where it wasn't before: doc needs to be clear re '$z=float($x)+float($y)' :^/
|
||||
note that // should be floor division for floats, too. mldent.
|
||||
http://python-history.blogspot.com/2010/08/why-pythons-integer-division-floors.html.
|
||||
o expanded UTs x all of the above. lncl. ./tmod
|
||||
|
|
@ -35,8 +37,31 @@ TOP OF LIST
|
|||
... or change the precedence :)
|
||||
o *.y production renames (slip by one on the left)
|
||||
o *.l reorg/neaten
|
||||
o make a ^^ ?
|
||||
* dsls bake deps
|
||||
o precedence b04k: mlr put -v '$z=(~$x)' vs. mlr put -v '$z=~$x'
|
||||
o bitops re intermediate float, both from literal & from field name
|
||||
|
||||
o fix:
|
||||
$ mlr filter -v '$y==-$x' /dev/null
|
||||
== (operator):
|
||||
y (field_name).
|
||||
- (operator):
|
||||
x (field_name).
|
||||
|
||||
$ mlr filter -v '$y==~$x' /dev/null
|
||||
== (operator):
|
||||
y (field_name).
|
||||
~ (operator):
|
||||
x (field_name).
|
||||
|
||||
$ mlr put -v '$y=-$x' /dev/null
|
||||
= (operator):
|
||||
y (field_name).
|
||||
- (operator):
|
||||
x (field_name).
|
||||
|
||||
$ mlr put -v '$y=~$x' /dev/null
|
||||
Syntax error!
|
||||
|
||||
* mlr doc precedence:
|
||||
Operators Associativity
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue