summaryrefslogtreecommitdiff
path: root/src/cli_def.l
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2008-02-06 15:06:53 -0800
committerAn-Cheng Huang <ancheng@vyatta.com>2008-02-06 15:06:53 -0800
commite62a2cf723b0a0830e066468c7a7cac4d3445136 (patch)
treea56b1f8495f93ac7a3af73c932806c120c9e5749 /src/cli_def.l
parentf9b13d3b2b8af1b7df64a2bd38dce543994d5e93 (diff)
downloadvyatta-cfg-e62a2cf723b0a0830e066468c7a7cac4d3445136.tar.gz
vyatta-cfg-e62a2cf723b0a0830e066468c7a7cac4d3445136.zip
make parse error message more useful
Diffstat (limited to 'src/cli_def.l')
-rw-r--r--src/cli_def.l16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/cli_def.l b/src/cli_def.l
index 3158a0f..07c9c68 100644
--- a/src/cli_def.l
+++ b/src/cli_def.l
@@ -269,9 +269,11 @@ RE_ACT_FIELD (help|syntax|commit|delete|update|activate|create|begin|end|comp_he
#[^\n]*\n {
/* comment */
+ ++yy_cli_def_lineno;
}
\n {
+ ++yy_cli_def_lineno;
return EOL;
}
@@ -302,6 +304,7 @@ RE_ACT_FIELD (help|syntax|commit|delete|update|activate|create|begin|end|comp_he
}
<str>\\\n {
+ ++yy_cli_def_lineno;
/* continuation */
}
@@ -352,7 +355,10 @@ RE_ACT_FIELD (help|syntax|commit|delete|update|activate|create|begin|end|comp_he
free(tmp);
}
-<expression>\n { /* skip the \n */ }
+<expression>\n {
+ /* skip the \n */
+ ++yy_cli_def_lineno;
+ }
<expression><<EOF>> {
BEGIN(INITIAL);
@@ -372,6 +378,9 @@ RE_ACT_FIELD (help|syntax|commit|delete|update|activate|create|begin|end|comp_he
}
<action>\n?.* {
+ if (yy_cli_def_text[0] == '\n') {
+ ++yy_cli_def_lineno;
+ }
append_action(yy_cli_def_text);
}
@@ -391,7 +400,10 @@ RE_ACT_FIELD (help|syntax|commit|delete|update|activate|create|begin|end|comp_he
<INITIAL,expression>[ \t]+ { /* space */ }
-<expression>\\\n { /* continuation */ }
+<expression>\\\n {
+ /* continuation */
+ ++yy_cli_def_lineno;
+ }
{RE_TYPE_NAME} {
int i = 0;