config parser: recover after invalid input

This is done by ignoring the rest of the current line and jumping to the
nearest <error> token.

fixes #879
This commit is contained in:
Michael Stapelberg
2012-11-20 17:09:03 +01:00
parent 6148136e7c
commit 3cb909fa62
5 changed files with 100 additions and 4 deletions

View File

@ -15,6 +15,7 @@ state INITIAL:
# We have an end token here for all the commands which just call some
# function without using an explicit 'end' token.
end ->
error ->
'#' -> IGNORE_LINE
'set' -> IGNORE_LINE
bindtype = 'bindsym', 'bindcode', 'bind' -> BINDING
@ -298,6 +299,7 @@ state MODEBRACE:
state MODE:
end ->
error ->
'#' -> MODE_IGNORE_LINE
'set' -> MODE_IGNORE_LINE
bindtype = 'bindsym', 'bindcode', 'bind'
@ -336,6 +338,7 @@ state BARBRACE:
state BAR:
end ->
error ->
'#' -> BAR_IGNORE_LINE
'set' -> BAR_IGNORE_LINE
'i3bar_command' -> BAR_BAR_COMMAND