Implement 'restore' in new parser

This commit is contained in:
Michael Stapelberg 2010-05-11 23:00:31 +02:00
parent a0e33c1d68
commit c75a6732bf
2 changed files with 11 additions and 0 deletions

View File

@ -109,6 +109,7 @@ up { return TOK_UP; }
down { return TOK_DOWN; } down { return TOK_DOWN; }
before { return TOK_BEFORE; } before { return TOK_BEFORE; }
after { return TOK_AFTER; } after { return TOK_AFTER; }
restore { BEGIN(WANT_WS_STRING); return TOK_RESTORE; }
class { BEGIN(WANT_QSTRING); return TOK_CLASS; } class { BEGIN(WANT_QSTRING); return TOK_CLASS; }
id { BEGIN(WANT_QSTRING); return TOK_ID; } id { BEGIN(WANT_QSTRING); return TOK_ID; }

View File

@ -122,6 +122,7 @@ void parse_cmd(const char *new) {
%token TOK_DOWN "down" %token TOK_DOWN "down"
%token TOK_AFTER "after" %token TOK_AFTER "after"
%token TOK_BEFORE "before" %token TOK_BEFORE "before"
%token TOK_RESTORE "restore"
%token TOK_CLASS "class" %token TOK_CLASS "class"
%token TOK_ID "id" %token TOK_ID "id"
@ -252,6 +253,7 @@ operation:
| mark | mark
| layout | layout
| border */ | border */
| restore
| move | move
| workspace | workspace
| attach | attach
@ -435,3 +437,11 @@ before_after:
TOK_BEFORE { $<number>$ = TOK_BEFORE; } TOK_BEFORE { $<number>$ = TOK_BEFORE; }
| TOK_AFTER { $<number>$ = TOK_AFTER; } | TOK_AFTER { $<number>$ = TOK_AFTER; }
; ;
restore:
TOK_RESTORE WHITESPACE STR
{
printf("restoring \"%s\"\n", $<string>3);
tree_append_json($<string>3);
}
;