Skip to content

Commit

Permalink
Merge pull request snabbco#847 from dpino/binary-string-types
Browse files Browse the repository at this point in the history
Add binary serialization support for identity-ref
  • Loading branch information
dpino authored Jun 28, 2017
2 parents 275dcaf + e0eedbb commit eb0135d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lib/yang/binary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,16 @@ local function data_emitter(production)
end
end
end
local native_types = {
enumeration = true,
identityref = true,
string = true,
}
function handlers.scalar(production)
local primitive_type = production.argument_type.primitive_type
local type = assert(value.types[primitive_type], "unsupported type: "..primitive_type)
-- FIXME: needs a case for unions
if primitive_type == 'string' or primitive_type == 'enumeration' then
if native_types[primitive_type] then
return function(data, stream)
stream:write_stringref('stringref')
stream:write_stringref(data)
Expand Down

0 comments on commit eb0135d

Please sign in to comment.