%{ #include "LLP_Support.h" #include #include #define YYLLOC_DEFAULT(out, in, num) { (out).first_column = (in)[1].first_column; \ (out).last_column = (in)[num].last_column; \ fprintf(stderr, "\nMERGING LOCATIONS: (%i - %i) [%i](%i - %i)\n", (in)[1].first_column, (in)[1].last_column, num, (in)[num].first_column, (in)[num].last_column); \ } %} %token NAME %token STRING %token BAD_CHARACTER %% outer : node { } ; node : NAME optional_params optional_children { } ; optional_params : /* nothing */ { } | '[' param_list ']' { } | '[' param_list error { LLP_SetErrorMessage("Expected ']' after parameter list", @3); } | '[' error { LLP_SetErrorMessage("Expected parameter list after ']'", @2); } ; param_list : param { } | param_list ',' param { } | param_list ',' error { LLP_SetErrorMessage("Expected Node after ',' in parameter list", @3); } ; param : value { } | NAME '=' value { } | NAME '=' error { LLP_SetErrorMessage("Expected value after '=' in named parameter", @3); } | NAME error { LLP_SetErrorMessage("Expected '=' after parameter name", @2); } ; value : STRING { } ; optional_children : /* nothing */ { } ; %%