diff --git a/parser/parser_lex.l b/parser/parser_lex.l index 4c3ef995e..9436f7ccc 100644 --- a/parser/parser_lex.l +++ b/parser/parser_lex.l @@ -390,6 +390,11 @@ LT_EQUAL <= current_lineno++; BEGIN(INITIAL); } + [^\n] { + DUMP_PREPROCESS; + /* Something we didn't expect */ + yyerror(_("Found unexpected character: '%s'"), yytext); + } } { diff --git a/parser/tst/simple_tests/vars/vars_bad_1.sd b/parser/tst/simple_tests/vars/vars_bad_1.sd new file mode 100644 index 000000000..beb466f2d --- /dev/null +++ b/parser/tst/simple_tests/vars/vars_bad_1.sd @@ -0,0 +1,10 @@ +#=DESCRIPTION trailing garbage should trigger an error +#=EXRESULT FAIL + +@{LIBVIRT} = "libvirt + +/does/not/exist { + + change_profile -> + @{LIBVIRT}-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*, +} diff --git a/parser/tst/simple_tests/vars/vars_bad_2.sd b/parser/tst/simple_tests/vars/vars_bad_2.sd new file mode 100644 index 000000000..17311623c --- /dev/null +++ b/parser/tst/simple_tests/vars/vars_bad_2.sd @@ -0,0 +1,10 @@ +#=DESCRIPTION garbage should trigger an error +#=EXRESULT FAIL + +@{LIBVIRT} = lib"virt + +/does/not/exist { + + change_profile -> + @{LIBVIRT}-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*, +} diff --git a/parser/tst/simple_tests/vars/vars_bad_3.sd b/parser/tst/simple_tests/vars/vars_bad_3.sd new file mode 100644 index 000000000..5a286f304 --- /dev/null +++ b/parser/tst/simple_tests/vars/vars_bad_3.sd @@ -0,0 +1,10 @@ +#=DESCRIPTION garbage should trigger an error +#=EXRESULT FAIL + +@{LIBVIRT} = lib!virt libfail + +/does/not/exist { + + change_profile -> + @{LIBVIRT}-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*, +} diff --git a/parser/tst/simple_tests/vars/vars_bad_trailing_garbage_1.sd b/parser/tst/simple_tests/vars/vars_bad_trailing_garbage_1.sd new file mode 100644 index 000000000..5dfb84a43 --- /dev/null +++ b/parser/tst/simple_tests/vars/vars_bad_trailing_garbage_1.sd @@ -0,0 +1,10 @@ +#=DESCRIPTION trailing garbage should trigger an error +#=EXRESULT FAIL + +@{LIBVIRT} = libvirt" + +/does/not/exist { + + change_profile -> + @{LIBVIRT}-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*, +}