diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-05-16 20:30:07 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-05-16 20:30:07 +0000 |
commit | 78c8bbc4157d577c291b289602794ecd1ff24c42 (patch) | |
tree | 288be46fb3bd79e6a7bf01ee90a17b6511cd1b99 /src/gram.y | |
parent | 979486e1b46a894fc9de2abe6eb8985536a5013c (diff) | |
download | gdbm-78c8bbc4157d577c291b289602794ecd1ff24c42.tar.gz gdbm-78c8bbc4157d577c291b289602794ecd1ff24c42.tar.bz2 |
Provide support for a simplified "define" construct.
* doc/gdbm.texinfo: Document the "define" statement.
* src/datconv.c: Support short and ushort data types.
* src/gdbmtool.c: Don't call checkdb prior to handling
the "hash" command.
* src/gram.y: Support simplified definition construct:
"define key|content type".
Diffstat (limited to 'src/gram.y')
-rw-r--r-- | src/gram.y | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -40,7 +40,7 @@ struct dsegm *dsdef[DS_MAX]; %type <string> string %type <arg> arg %type <arglist> arglist arg1list -%type <dsegm> def +%type <dsegm> def defbody %type <dsegmlist> deflist %type <num> defid %type <kvpair> kvpair compound value @@ -183,12 +183,22 @@ string : T_IDENT | T_WORD ; -defn : T_DEF defid { begin_def (); } '{' deflist optcomma '}' +defn : T_DEF defid { begin_def (); } defbody { end_def (); dsegm_free_list (dsdef[$2]); - dsdef[$2] = $5.head; - } + dsdef[$2] = $4; + } + ; + +defbody : '{' deflist optcomma '}' + { + $$ = $2.head; + } + | T_TYPE + { + $$ = dsegm_new_field ($1, NULL, 1); + } ; optcomma : /* empty */ |