X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fcommands_parser.c;h=bbba2c44eb5cbc72a69eb5e073266690b401a892;hb=d36264e403050d6c9dc564b90debe5bdb175488b;hp=6cfac202e69a231bcad730a6fc78773ad010ffc9;hpb=1d95d296a5f08ac024d56f20723f202158954549;p=i3%2Fi3 diff --git a/src/commands_parser.c b/src/commands_parser.c index 6cfac202..bbba2c44 100644 --- a/src/commands_parser.c +++ b/src/commands_parser.c @@ -1,3 +1,5 @@ +#undef I3__FILE__ +#define I3__FILE__ "commands_parser.c" /* * vim:ts=4:sw=4:expandtab * @@ -44,7 +46,7 @@ * input parser-specs/commands.spec. ******************************************************************************/ -#include "GENERATED_enums.h" +#include "GENERATED_commands_enums.h" typedef struct token { char *name; @@ -61,7 +63,7 @@ typedef struct tokenptr { int n; } cmdp_token_ptr; -#include "GENERATED_tokens.h" +#include "GENERATED_commands_tokens.h" /******************************************************************************* * The (small) stack where identified literals are stored during the parsing @@ -180,7 +182,7 @@ static Match current_match; static struct CommandResult subcommand_output; static struct CommandResult command_output; -#include "GENERATED_call.h" +#include "GENERATED_commands_call.h" static void next_state(const cmdp_token *token) { @@ -202,7 +204,6 @@ static void next_state(const cmdp_token *token) { } } -/* TODO: Return parsing errors via JSON. */ struct CommandResult *parse_command(const char *input) { DLOG("COMMAND: *%s*\n", input); state = INITIAL; @@ -384,6 +385,11 @@ struct CommandResult *parse_command(const char *input) { y(map_open); ystr("success"); y(bool, false); + /* We set parse_error to true to distinguish this from other + * errors. i3-nagbar is spawned upon keypresses only for parser + * errors. */ + ystr("parse_error"); + y(bool, true); ystr("error"); ystr(errormessage); ystr("input");