]> git.sur5r.net Git - i3/i3/blobdiff - src/commands_parser.c
generate-command-parser: make input/output configurable
[i3/i3] / src / commands_parser.c
index 20a7d67a16848a0106e3037f4f904a8708d83223..bbba2c44eb5cbc72a69eb5e073266690b401a892 100644 (file)
@@ -46,7 +46,7 @@
  * input parser-specs/commands.spec.
  ******************************************************************************/
 
-#include "GENERATED_enums.h"
+#include "GENERATED_commands_enums.h"
 
 typedef struct token {
     char *name;
@@ -63,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
@@ -182,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) {
@@ -204,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;
@@ -386,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");