Skip to content

Commit

Permalink
demo: Add some T_ARG_TOKEN options.
Browse files Browse the repository at this point in the history
  • Loading branch information
biot committed Nov 28, 2014
1 parent 0fe64e9 commit 1ec843b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions demo/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ t_token_dict dict[] = {
{ T_CALC, "calc" },
{ T_PLUS, "+" },
{ T_EXIT, "exit" },
{ T_LED, "led" },
{ T_ON, "on" },
{ T_OFF, "off" },
{ }
};

Expand All @@ -48,13 +51,22 @@ t_token tokens_mode_calc[] = {
.help = "Exit calc mode" },
};

t_token tokens_on_off[] = {
{ T_ON },
{ T_OFF },
};

t_token tokens_mode_device[] = {
{ T_SHOW,
.help = "Show device information" },
{ T_MKDIR,
.help = "Create directory" },
{ T_LS,
.help = "List files and directories" },
{ T_LED,
.arg_type = T_ARG_TOKEN,
.subtokens = tokens_on_off,
.help = "LED control" },
{ T_EXIT,
.help = "Exit device mode" },
{ }
Expand Down
3 changes: 3 additions & 0 deletions demo/commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@ enum {
T_CALC,
T_PLUS,
T_EXIT,
T_LED,
T_ON,
T_OFF,
};

0 comments on commit 1ec843b

Please sign in to comment.