Adjustements

dev
Alberto Restifo 2020-04-19 20:49:48 +02:00
parent aded275148
commit dd1288089f
3 changed files with 4 additions and 3 deletions

View File

@ -18,6 +18,8 @@ abstract class CBOR::Decoder
when Token::StringT
finish_token!
token.value
when Token::ByteArrayT
# Consume the array :)
end
end
end

View File

@ -17,7 +17,7 @@ class CBOR::Lexer
def initialize(@io : IO)
@current_pos = 0
@token = Token::UndefinedT.new(0)
@token = Token::NullT.new(0)
@token_finished = true
end

View File

@ -1,6 +1,5 @@
class CBOR::Token
record NullT, byte_number : Int64
record UndefinedT, byte_number : Int64
record BoolT, byte_number : Int64, value : Bool
record ArrayT, byte_number : Int64, size : UInt32?
record MapT, byte_number : Int64, size : UInt32?
@ -11,7 +10,7 @@ class CBOR::Token
record StringArrayT, byte_number : Int64
record BytesArrayT, byte_number : Int64
alias T = NullT | UndefinedT | BoolT | ArrayT | MapT | IntT | FloatT | StringT | BytesT | StringArrayT | BytesArrayT
alias T = NullT | BoolT | ArrayT | MapT | IntT | FloatT | StringT | BytesT | StringArrayT | BytesArrayT
def self.to_s(token : T)
case token