]> git.sur5r.net Git - i3/i3/blobdiff - src/commands_parser.c
Merge branch 'fix-aspect'
[i3/i3] / src / commands_parser.c
index 71f1c149d4f054a92bcc441ced69570f9ef5e894..93ee38896eb96fb9f9cd63cb913875562583e904 100644 (file)
@@ -1,4 +1,5 @@
-#line 2 "commands_parser.c"
+#undef I3__FILE__
+#define I3__FILE__ "commands_parser.c"
 /*
  * vim:ts=4:sw=4:expandtab
  *
@@ -45,7 +46,7 @@
  * input parser-specs/commands.spec.
  ******************************************************************************/
 
-#include "GENERATED_enums.h"
+#include "GENERATED_command_enums.h"
 
 typedef struct token {
     char *name;
@@ -62,7 +63,7 @@ typedef struct tokenptr {
     int n;
 } cmdp_token_ptr;
 
-#include "GENERATED_tokens.h"
+#include "GENERATED_command_tokens.h"
 
 /*******************************************************************************
  * The (small) stack where identified literals are stored during the parsing
@@ -181,7 +182,7 @@ static Match current_match;
 static struct CommandResult subcommand_output;
 static struct CommandResult command_output;
 
-#include "GENERATED_call.h"
+#include "GENERATED_command_call.h"
 
 
 static void next_state(const cmdp_token *token) {
@@ -189,6 +190,7 @@ static void next_state(const cmdp_token *token) {
         subcommand_output.json_gen = command_output.json_gen;
         subcommand_output.needs_tree_render = false;
         GENERATED_call(token->extra.call_identifier, &subcommand_output);
+        state = subcommand_output.next_state;
         /* If any subcommand requires a tree_render(), we need to make the
          * whole parser result request a tree_render(). */
         if (subcommand_output.needs_tree_render)
@@ -203,7 +205,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;
@@ -385,6 +386,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");