summaryrefslogtreecommitdiffstats
path: root/src/scanner.l
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2021-07-27 16:35:14 +0200
committerPhil Sutter <phil@nwl.cc>2022-03-01 10:54:03 +0100
commit543bf3c2bb5e67b024231f01c9d88fb29298c72b (patch)
tree0b70319409d6aadafd3b855656a108babb0ede85 /src/scanner.l
parent881058103484a20f2c81960e833075fa69805412 (diff)
scanner: import, export: Move to own scopes
In theory, one could use a common scope for both import and export commands, their parameters are identical. Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'src/scanner.l')
-rw-r--r--src/scanner.l14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/scanner.l b/src/scanner.l
index 8725295a..97545b70 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -211,6 +211,8 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr})
%s SCANSTATE_TCP
%s SCANSTATE_TYPE
%s SCANSTATE_VLAN
+%s SCANSTATE_CMD_EXPORT
+%s SCANSTATE_CMD_IMPORT
%s SCANSTATE_CMD_LIST
%s SCANSTATE_CMD_MONITOR
%s SCANSTATE_CMD_RESET
@@ -344,8 +346,8 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr})
"reset" { scanner_push_start_cond(yyscanner, SCANSTATE_CMD_RESET); return RESET; }
"flush" { return FLUSH; }
"rename" { return RENAME; }
-"import" { return IMPORT; }
-"export" { return EXPORT; }
+"import" { scanner_push_start_cond(yyscanner, SCANSTATE_CMD_IMPORT); return IMPORT; }
+"export" { scanner_push_start_cond(yyscanner, SCANSTATE_CMD_EXPORT); return EXPORT; }
"monitor" { scanner_push_start_cond(yyscanner, SCANSTATE_CMD_MONITOR); return MONITOR; }
"position" { return POSITION; }
@@ -759,9 +761,11 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr})
"all" { return ALL; }
-"xml" { return XML; }
-"json" { return JSON; }
-"vm" { return VM; }
+<SCANSTATE_CMD_EXPORT,SCANSTATE_CMD_IMPORT,SCANSTATE_CMD_MONITOR>{
+ "xml" { return XML; }
+ "json" { return JSON; }
+ "vm" { return VM; }
+}
"exists" { return EXISTS; }
"missing" { return MISSING; }