Remove hardcoded type names from msgpack-gen.lua

Except for the `Error *` type, all parameter types are valid identifiers, so
reuse that LPeg rule.
This commit is contained in:
Thiago de Arruda
2014-05-16 08:00:31 -03:00
parent bd2ab0d8a5
commit 32b6122460

View File

@@ -20,18 +20,7 @@ c_id = letter * (alpha ^ 0)
c_void = P('void')
c_param_type = (
((P('Error') * fill * P('*') * fill) * Cc('error')) +
(C(P('bool')) * (ws ^ 1)) +
(C(P('int64_t')) * (ws ^ 1)) +
(C(P('double')) * (ws ^ 1)) +
(C(P('StringArray')) * (ws ^ 1)) +
(C(P('String')) * (ws ^ 1)) +
(C(P('Buffer')) * (ws ^ 1)) +
(C(P('Window')) * (ws ^ 1)) +
(C(P('Tabpage')) * (ws ^ 1)) +
(C(P('Object')) * (ws ^ 1)) +
(C(P('Position')) * (ws ^ 1)) +
(C(P('Array')) * (ws ^ 1)) +
(C(P('Dictionary')) * (ws ^ 1))
(C(c_id) * (ws ^ 1))
)
c_type = (C(c_void) * (ws ^ 1)) + c_param_type
c_param = Ct(c_param_type * C(c_id))