]> git.sur5r.net Git - i3/i3/blob - parser-specs/config.spec
parser: only skip set[\s], not set.*
[i3/i3] / parser-specs / config.spec
1 # vim:ts=2:sw=2:expandtab
2 #
3 # i3 - an improved dynamic tiling window manager
4 # © 2009 Michael Stapelberg and contributors (see also: LICENSE)
5 #
6 # parser-specs/config.spec: Specification file for generate-command-parser.pl
7 # which will generate the appropriate header files for our C parser.
8 #
9 # Use :source highlighting.vim in vim to get syntax highlighting
10 # for this file.
11
12 # TODO: should we implement an include statement for the criteria part so we DRY?
13
14 state INITIAL:
15   # We have an end token here for all the commands which just call some
16   # function without using an explicit 'end' token.
17   end ->
18   error ->
19   '#'                                      -> IGNORE_LINE
20   'set '                                   -> IGNORE_LINE
21   'set  '                                  -> IGNORE_LINE
22   'set_from_resource'                      -> IGNORE_LINE
23   bindtype = 'bindsym', 'bindcode', 'bind' -> BINDING
24   'bar'                                    -> BARBRACE
25   'font'                                   -> FONT
26   'mode'                                   -> MODENAME
27   'floating_minimum_size'                  -> FLOATING_MINIMUM_SIZE_WIDTH
28   'floating_maximum_size'                  -> FLOATING_MAXIMUM_SIZE_WIDTH
29   'floating_modifier'                      -> FLOATING_MODIFIER
30   'default_orientation'                    -> DEFAULT_ORIENTATION
31   'workspace_layout'                       -> WORKSPACE_LAYOUT
32   windowtype = 'new_window', 'new_float'   -> NEW_WINDOW
33   'hide_edge_borders'                      -> HIDE_EDGE_BORDERS
34   'for_window'                             -> FOR_WINDOW
35   'assign'                                 -> ASSIGN
36   'no_focus'                               -> NO_FOCUS
37   'focus_follows_mouse'                    -> FOCUS_FOLLOWS_MOUSE
38   'mouse_warping'                          -> MOUSE_WARPING
39   'force_focus_wrapping'                   -> FORCE_FOCUS_WRAPPING
40   'force_xinerama', 'force-xinerama'       -> FORCE_XINERAMA
41   'disable_randr15', 'disable-randr15'     -> DISABLE_RANDR15
42   'workspace_auto_back_and_forth'          -> WORKSPACE_BACK_AND_FORTH
43   'fake_outputs', 'fake-outputs'           -> FAKE_OUTPUTS
44   'force_display_urgency_hint'             -> FORCE_DISPLAY_URGENCY_HINT
45   'focus_on_window_activation'             -> FOCUS_ON_WINDOW_ACTIVATION
46   'show_marks'                             -> SHOW_MARKS
47   'workspace'                              -> WORKSPACE
48   'ipc_socket', 'ipc-socket'               -> IPC_SOCKET
49   'restart_state'                          -> RESTART_STATE
50   'popup_during_fullscreen'                -> POPUP_DURING_FULLSCREEN
51   exectype = 'exec_always', 'exec'         -> EXEC
52   colorclass = 'client.background'
53       -> COLOR_SINGLE
54   colorclass = 'client.focused_inactive', 'client.focused', 'client.unfocused', 'client.urgent', 'client.placeholder'
55       -> COLOR_BORDER
56
57 # We ignore comments and 'set' lines (variables).
58 state IGNORE_LINE:
59   line
60       -> INITIAL
61
62 # floating_minimum_size <width> x <height>
63 state FLOATING_MINIMUM_SIZE_WIDTH:
64   width = number
65       -> FLOATING_MINIMUM_SIZE_X
66
67 state FLOATING_MINIMUM_SIZE_X:
68   'x'
69       -> FLOATING_MINIMUM_SIZE_HEIGHT
70
71 state FLOATING_MINIMUM_SIZE_HEIGHT:
72   height = number
73       -> call cfg_floating_minimum_size(&width, &height)
74
75 # floating_maximum_size <width> x <height>
76 state FLOATING_MAXIMUM_SIZE_WIDTH:
77   width = number
78       -> FLOATING_MAXIMUM_SIZE_X
79
80 state FLOATING_MAXIMUM_SIZE_X:
81   'x'
82       -> FLOATING_MAXIMUM_SIZE_HEIGHT
83
84 state FLOATING_MAXIMUM_SIZE_HEIGHT:
85   height = number
86       -> call cfg_floating_maximum_size(&width, &height)
87
88 # floating_modifier <modifier>
89 state FLOATING_MODIFIER:
90   modifiers = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Shift', 'Control', 'Ctrl'
91       ->
92   '+'
93       ->
94   end
95       -> call cfg_floating_modifier($modifiers)
96
97 # default_orientation <horizontal|vertical|auto>
98 state DEFAULT_ORIENTATION:
99   orientation = 'horizontal', 'vertical', 'auto'
100       -> call cfg_default_orientation($orientation)
101
102 # workspace_layout <default|stacking|tabbed>
103 state WORKSPACE_LAYOUT:
104   layout = 'default', 'stacking', 'stacked', 'tabbed'
105       -> call cfg_workspace_layout($layout)
106
107 # new_window <normal|1pixel|none>
108 # new_float <normal|1pixel|none>
109 state NEW_WINDOW:
110   border = 'normal', 'pixel'
111       -> NEW_WINDOW_PIXELS
112   border = '1pixel', 'none'
113       -> call cfg_new_window($windowtype, $border, -1)
114
115 state NEW_WINDOW_PIXELS:
116   end
117       -> call cfg_new_window($windowtype, $border, 2)
118   width = number
119       -> NEW_WINDOW_PIXELS_PX
120
121 state NEW_WINDOW_PIXELS_PX:
122   'px'
123       ->
124   end
125       -> call cfg_new_window($windowtype, $border, &width)
126
127 # hide_edge_borders <none|vertical|horizontal|both|smart>
128 # also hide_edge_borders <bool> for compatibility
129 state HIDE_EDGE_BORDERS:
130   hide_borders = 'none', 'vertical', 'horizontal', 'both', 'smart'
131       -> call cfg_hide_edge_borders($hide_borders)
132   hide_borders = '1', 'yes', 'true', 'on', 'enable', 'active'
133       -> call cfg_hide_edge_borders($hide_borders)
134
135 # for_window <criteria> command
136 state FOR_WINDOW:
137   '['
138       -> call cfg_criteria_init(FOR_WINDOW_COMMAND); CRITERIA
139
140 state FOR_WINDOW_COMMAND:
141   command = string
142       -> call cfg_for_window($command)
143
144 # assign <criteria> [→] workspace
145 state ASSIGN:
146   '['
147       -> call cfg_criteria_init(ASSIGN_WORKSPACE); CRITERIA
148
149 state ASSIGN_WORKSPACE:
150   '→'
151       ->
152   'workspace'
153       ->
154   workspace = string
155       -> call cfg_assign($workspace)
156
157 # no_focus <criteria>
158 state NO_FOCUS:
159   '['
160       -> call cfg_criteria_init(NO_FOCUS_END); CRITERIA
161
162 state NO_FOCUS_END:
163   end
164       -> call cfg_no_focus()
165
166 # Criteria: Used by for_window and assign.
167 state CRITERIA:
168   ctype = 'class'       -> CRITERION
169   ctype = 'instance'    -> CRITERION
170   ctype = 'window_role' -> CRITERION
171   ctype = 'con_id'      -> CRITERION
172   ctype = 'id'          -> CRITERION
173   ctype = 'window_type' -> CRITERION
174   ctype = 'con_mark'    -> CRITERION
175   ctype = 'title'       -> CRITERION
176   ctype = 'urgent'      -> CRITERION
177   ctype = 'workspace'   -> CRITERION
178   ctype = 'tiling', 'floating'
179       -> call cfg_criteria_add($ctype, NULL); CRITERIA
180   ']'
181       -> call cfg_criteria_pop_state()
182
183 state CRITERION:
184   '=' -> CRITERION_STR
185
186 state CRITERION_STR:
187   cvalue = word
188       -> call cfg_criteria_add($ctype, $cvalue); CRITERIA
189
190 # focus_follows_mouse bool
191 state FOCUS_FOLLOWS_MOUSE:
192   value = word
193       -> call cfg_focus_follows_mouse($value)
194
195 # mouse_warping warping_t
196 state MOUSE_WARPING:
197   value = 'none', 'output'
198       -> call cfg_mouse_warping($value)
199
200 # force_focus_wrapping
201 state FORCE_FOCUS_WRAPPING:
202   value = word
203       -> call cfg_force_focus_wrapping($value)
204
205 # force_xinerama
206 state FORCE_XINERAMA:
207   value = word
208       -> call cfg_force_xinerama($value)
209
210 # disable_randr15
211 state DISABLE_RANDR15:
212   value = word
213       -> call cfg_disable_randr15($value)
214
215 # workspace_back_and_forth
216 state WORKSPACE_BACK_AND_FORTH:
217   value = word
218       -> call cfg_workspace_back_and_forth($value)
219
220
221 # fake_outputs (for testcases)
222 state FAKE_OUTPUTS:
223   outputs = string
224       -> call cfg_fake_outputs($outputs)
225
226 # force_display_urgency_hint <timeout> ms
227 state FORCE_DISPLAY_URGENCY_HINT:
228   duration_ms = number
229       -> FORCE_DISPLAY_URGENCY_HINT_MS
230
231 # show_marks
232 state SHOW_MARKS:
233   value = word
234       -> call cfg_show_marks($value)
235
236 state FORCE_DISPLAY_URGENCY_HINT_MS:
237   'ms'
238       ->
239   end
240       -> call cfg_force_display_urgency_hint(&duration_ms)
241
242 # focus_on_window_activation <smart|urgent|focus|none>
243 state FOCUS_ON_WINDOW_ACTIVATION:
244   mode = word
245       -> call cfg_focus_on_window_activation($mode)
246
247 # workspace <workspace> output <output>
248 state WORKSPACE:
249   workspace = word
250     -> WORKSPACE_OUTPUT
251
252 state WORKSPACE_OUTPUT:
253   'output'
254       -> WORKSPACE_OUTPUT_STR
255
256 state WORKSPACE_OUTPUT_STR:
257   output = word
258       -> call cfg_workspace($workspace, $output)
259
260 # ipc-socket <path>
261 state IPC_SOCKET:
262   path = string
263       -> call cfg_ipc_socket($path)
264
265 # restart_state <path> (for testcases)
266 state RESTART_STATE:
267   path = string
268       -> call cfg_restart_state($path)
269
270 # popup_during_fullscreen
271 state POPUP_DURING_FULLSCREEN:
272   value = 'ignore', 'leave_fullscreen', 'smart'
273       -> call cfg_popup_during_fullscreen($value)
274
275 # client.background <hexcolor>
276 state COLOR_SINGLE:
277   color = word
278       -> call cfg_color_single($colorclass, $color)
279
280 # colorclass border background text indicator
281 state COLOR_BORDER:
282   border = word
283       -> COLOR_BACKGROUND
284
285 state COLOR_BACKGROUND:
286   background = word
287       -> COLOR_TEXT
288
289 state COLOR_TEXT:
290   text = word
291       -> COLOR_INDICATOR
292
293 state COLOR_INDICATOR:
294   indicator = word
295       -> COLOR_CHILD_BORDER
296   end
297       -> call cfg_color($colorclass, $border, $background, $text, NULL, NULL)
298
299 state COLOR_CHILD_BORDER:
300   child_border = word
301       -> call cfg_color($colorclass, $border, $background, $text, $indicator, $child_border)
302   end
303       -> call cfg_color($colorclass, $border, $background, $text, $indicator, NULL)
304
305 # <exec|exec_always> [--no-startup-id] command
306 state EXEC:
307   no_startup_id = '--no-startup-id'
308       ->
309   command = string
310       -> call cfg_exec($exectype, $no_startup_id, $command)
311
312 # font font
313 state FONT:
314   font = string
315       -> call cfg_font($font)
316
317 # bindsym/bindcode
318 state BINDING:
319   release = '--release'
320       ->
321   border = '--border'
322       ->
323   whole_window = '--whole-window'
324       ->
325   exclude_titlebar = '--exclude-titlebar'
326       ->
327   modifiers = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Shift', 'Control', 'Ctrl', 'Mode_switch', 'Group1', 'Group2', 'Group3', 'Group4', '$mod'
328       ->
329   '+'
330       ->
331   key = word
332       -> BINDCOMMAND
333
334 state BINDCOMMAND:
335   release = '--release'
336       ->
337   border = '--border'
338       ->
339   whole_window = '--whole-window'
340       ->
341   exclude_titlebar = '--exclude-titlebar'
342       ->
343   command = string
344       -> call cfg_binding($bindtype, $modifiers, $key, $release, $border, $whole_window, $exclude_titlebar, $command)
345
346 ################################################################################
347 # Mode configuration
348 ################################################################################
349
350 state MODENAME:
351   pango_markup = '--pango_markup'
352       ->
353   modename = word
354       -> call cfg_enter_mode($pango_markup, $modename); MODEBRACE
355
356 state MODEBRACE:
357   end
358       ->
359   '{'
360       -> MODE
361
362 state MODE:
363   end ->
364   error ->
365   '#' -> MODE_IGNORE_LINE
366   'set' -> MODE_IGNORE_LINE
367   bindtype = 'bindsym', 'bindcode', 'bind'
368       -> MODE_BINDING
369   '}'
370       -> INITIAL
371
372 # We ignore comments and 'set' lines (variables).
373 state MODE_IGNORE_LINE:
374   line
375       -> MODE
376
377 state MODE_BINDING:
378   release = '--release'
379       ->
380   border = '--border'
381       ->
382   whole_window = '--whole-window'
383       ->
384   exclude_titlebar = '--exclude-titlebar'
385       ->
386   modifiers = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Shift', 'Control', 'Ctrl', 'Mode_switch', 'Group1', 'Group2', 'Group3', 'Group4', '$mod'
387       ->
388   '+'
389       ->
390   key = word
391       -> MODE_BINDCOMMAND
392
393 state MODE_BINDCOMMAND:
394   release = '--release'
395       ->
396   border = '--border'
397       ->
398   whole_window = '--whole-window'
399       ->
400   exclude_titlebar = '--exclude-titlebar'
401       ->
402   command = string
403       -> call cfg_mode_binding($bindtype, $modifiers, $key, $release, $border, $whole_window, $exclude_titlebar, $command); MODE
404
405 ################################################################################
406 # Bar configuration (i3bar)
407 ################################################################################
408
409 state BARBRACE:
410   end
411       ->
412   '{'
413       -> call cfg_bar_start(); BAR
414
415 state BAR:
416   end ->
417   error ->
418   '#' -> BAR_IGNORE_LINE
419   'set' -> BAR_IGNORE_LINE
420   'i3bar_command'          -> BAR_BAR_COMMAND
421   'status_command'         -> BAR_STATUS_COMMAND
422   'socket_path'            -> BAR_SOCKET_PATH
423   'mode'                   -> BAR_MODE
424   'hidden_state'           -> BAR_HIDDEN_STATE
425   'id'                     -> BAR_ID
426   'modifier'               -> BAR_MODIFIER
427   'wheel_up_cmd'           -> BAR_WHEEL_UP_CMD
428   'wheel_down_cmd'         -> BAR_WHEEL_DOWN_CMD
429   'bindsym'                -> BAR_BINDSYM
430   'position'               -> BAR_POSITION
431   'output'                 -> BAR_OUTPUT
432   'tray_output'            -> BAR_TRAY_OUTPUT
433   'tray_padding'           -> BAR_TRAY_PADDING
434   'font'                   -> BAR_FONT
435   'separator_symbol'       -> BAR_SEPARATOR_SYMBOL
436   'binding_mode_indicator' -> BAR_BINDING_MODE_INDICATOR
437   'workspace_buttons'      -> BAR_WORKSPACE_BUTTONS
438   'strip_workspace_numbers' -> BAR_STRIP_WORKSPACE_NUMBERS
439   'verbose'                -> BAR_VERBOSE
440   'colors'                 -> BAR_COLORS_BRACE
441   '}'
442       -> call cfg_bar_finish(); INITIAL
443
444 # We ignore comments and 'set' lines (variables).
445 state BAR_IGNORE_LINE:
446   line
447       -> BAR
448
449 state BAR_BAR_COMMAND:
450   command = string
451       -> call cfg_bar_i3bar_command($command); BAR
452
453 state BAR_STATUS_COMMAND:
454   command = string
455       -> call cfg_bar_status_command($command); BAR
456
457 state BAR_SOCKET_PATH:
458   path = string
459       -> call cfg_bar_socket_path($path); BAR
460
461 state BAR_MODE:
462   mode = 'dock', 'hide', 'invisible'
463       -> call cfg_bar_mode($mode); BAR
464
465 state BAR_HIDDEN_STATE:
466   hidden_state = 'hide', 'show'
467       -> call cfg_bar_hidden_state($hidden_state); BAR
468
469 state BAR_ID:
470   bar_id = word
471       -> call cfg_bar_id($bar_id); BAR
472
473 state BAR_MODIFIER:
474   modifier = 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', 'Control', 'Ctrl', 'Shift', 'none', 'off'
475       -> call cfg_bar_modifier($modifier); BAR
476
477 state BAR_WHEEL_UP_CMD:
478   command = string
479       -> call cfg_bar_wheel_up_cmd($command); BAR
480
481 state BAR_WHEEL_DOWN_CMD:
482   command = string
483       -> call cfg_bar_wheel_down_cmd($command); BAR
484
485 state BAR_BINDSYM:
486   button = word
487       -> BAR_BINDSYM_COMMAND
488
489 state BAR_BINDSYM_COMMAND:
490   command = string
491       -> call cfg_bar_bindsym($button, $command); BAR
492
493 state BAR_POSITION:
494   position = 'top', 'bottom'
495       -> call cfg_bar_position($position); BAR
496
497 state BAR_OUTPUT:
498   output = string
499       -> call cfg_bar_output($output); BAR
500
501 state BAR_TRAY_OUTPUT:
502   output = word
503       -> call cfg_bar_tray_output($output); BAR
504
505 state BAR_TRAY_PADDING:
506   padding_px = number
507       -> BAR_TRAY_PADDING_PX
508
509 state BAR_TRAY_PADDING_PX:
510   'px'
511       ->
512   end
513       -> call cfg_bar_tray_padding(&padding_px); BAR
514
515 state BAR_FONT:
516   font = string
517       -> call cfg_bar_font($font); BAR
518
519 state BAR_SEPARATOR_SYMBOL:
520   separator = string
521       -> call cfg_bar_separator_symbol($separator); BAR
522
523 state BAR_BINDING_MODE_INDICATOR:
524   value = word
525       -> call cfg_bar_binding_mode_indicator($value); BAR
526
527 state BAR_WORKSPACE_BUTTONS:
528   value = word
529       -> call cfg_bar_workspace_buttons($value); BAR
530
531 state BAR_STRIP_WORKSPACE_NUMBERS:
532   value = word
533       -> call cfg_bar_strip_workspace_numbers($value); BAR
534
535 state BAR_VERBOSE:
536   value = word
537       -> call cfg_bar_verbose($value); BAR
538
539 state BAR_COLORS_BRACE:
540   end
541       ->
542   '{'
543       -> BAR_COLORS
544
545 state BAR_COLORS:
546   end ->
547   '#' -> BAR_COLORS_IGNORE_LINE
548   'set' -> BAR_COLORS_IGNORE_LINE
549   colorclass = 'background', 'statusline', 'separator', 'focused_background', 'focused_statusline', 'focused_separator'
550       -> BAR_COLORS_SINGLE
551   colorclass = 'focused_workspace', 'active_workspace', 'inactive_workspace', 'urgent_workspace', 'binding_mode'
552       -> BAR_COLORS_BORDER
553   '}'
554       -> BAR
555
556 # We ignore comments and 'set' lines (variables).
557 state BAR_COLORS_IGNORE_LINE:
558   line
559       -> BAR_COLORS
560
561 state BAR_COLORS_SINGLE:
562   color = word
563       -> call cfg_bar_color_single($colorclass, $color); BAR_COLORS
564
565 state BAR_COLORS_BORDER:
566   border = word
567       -> BAR_COLORS_BACKGROUND
568
569 state BAR_COLORS_BACKGROUND:
570   background = word
571       -> BAR_COLORS_TEXT
572
573 state BAR_COLORS_TEXT:
574   end
575       -> call cfg_bar_color($colorclass, $border, $background, NULL); BAR_COLORS
576   text = word
577       -> call cfg_bar_color($colorclass, $border, $background, $text); BAR_COLORS