Lines Matching refs:tokenizer
926 CBORTokenizer* tokenizer,
929 CBORTokenizer* tokenizer,
932 CBORTokenizer* tokenizer,
935 void ParseUTF16String(CBORTokenizer* tokenizer, StreamingParserHandler* out) { in ParseUTF16String() argument
937 span<uint8_t> rep = tokenizer->GetString16WireRep(); in ParseUTF16String()
941 tokenizer->Next(); in ParseUTF16String()
944 bool ParseUTF8String(CBORTokenizer* tokenizer, StreamingParserHandler* out) { in ParseUTF8String() argument
945 assert(tokenizer->TokenTag() == CBORTokenTag::STRING8); in ParseUTF8String()
946 out->HandleString8(tokenizer->GetString8()); in ParseUTF8String()
947 tokenizer->Next(); in ParseUTF8String()
952 CBORTokenizer* tokenizer, in ParseValue() argument
956 Status{Error::CBOR_STACK_LIMIT_EXCEEDED, tokenizer->Status().pos}); in ParseValue()
960 if (tokenizer->TokenTag() == CBORTokenTag::ENVELOPE) in ParseValue()
961 tokenizer->EnterEnvelope(); in ParseValue()
962 switch (tokenizer->TokenTag()) { in ParseValue()
964 out->HandleError(tokenizer->Status()); in ParseValue()
968 tokenizer->Status().pos}); in ParseValue()
972 tokenizer->Next(); in ParseValue()
976 tokenizer->Next(); in ParseValue()
980 tokenizer->Next(); in ParseValue()
983 out->HandleInt32(tokenizer->GetInt32()); in ParseValue()
984 tokenizer->Next(); in ParseValue()
987 out->HandleDouble(tokenizer->GetDouble()); in ParseValue()
988 tokenizer->Next(); in ParseValue()
991 return ParseUTF8String(tokenizer, out); in ParseValue()
993 ParseUTF16String(tokenizer, out); in ParseValue()
996 out->HandleBinary(tokenizer->GetBinary()); in ParseValue()
997 tokenizer->Next(); in ParseValue()
1001 return ParseMap(stack_depth + 1, tokenizer, out); in ParseValue()
1003 return ParseArray(stack_depth + 1, tokenizer, out); in ParseValue()
1006 Status{Error::CBOR_UNSUPPORTED_VALUE, tokenizer->Status().pos}); in ParseValue()
1015 CBORTokenizer* tokenizer, in ParseArray() argument
1017 assert(tokenizer->TokenTag() == CBORTokenTag::ARRAY_START); in ParseArray()
1018 tokenizer->Next(); in ParseArray()
1020 while (tokenizer->TokenTag() != CBORTokenTag::STOP) { in ParseArray()
1021 if (tokenizer->TokenTag() == CBORTokenTag::DONE) { in ParseArray()
1023 Status{Error::CBOR_UNEXPECTED_EOF_IN_ARRAY, tokenizer->Status().pos}); in ParseArray()
1026 if (tokenizer->TokenTag() == CBORTokenTag::ERROR_VALUE) { in ParseArray()
1027 out->HandleError(tokenizer->Status()); in ParseArray()
1031 if (!ParseValue(stack_depth, tokenizer, out)) in ParseArray()
1035 tokenizer->Next(); in ParseArray()
1043 CBORTokenizer* tokenizer, in ParseMap() argument
1045 assert(tokenizer->TokenTag() == CBORTokenTag::MAP_START); in ParseMap()
1047 tokenizer->Next(); in ParseMap()
1048 while (tokenizer->TokenTag() != CBORTokenTag::STOP) { in ParseMap()
1049 if (tokenizer->TokenTag() == CBORTokenTag::DONE) { in ParseMap()
1051 Status{Error::CBOR_UNEXPECTED_EOF_IN_MAP, tokenizer->Status().pos}); in ParseMap()
1054 if (tokenizer->TokenTag() == CBORTokenTag::ERROR_VALUE) { in ParseMap()
1055 out->HandleError(tokenizer->Status()); in ParseMap()
1059 if (tokenizer->TokenTag() == CBORTokenTag::STRING8) { in ParseMap()
1060 if (!ParseUTF8String(tokenizer, out)) in ParseMap()
1062 } else if (tokenizer->TokenTag() == CBORTokenTag::STRING16) { in ParseMap()
1063 ParseUTF16String(tokenizer, out); in ParseMap()
1066 Status{Error::CBOR_INVALID_MAP_KEY, tokenizer->Status().pos}); in ParseMap()
1070 if (!ParseValue(stack_depth, tokenizer, out)) in ParseMap()
1074 tokenizer->Next(); in ParseMap()
1088 CBORTokenizer tokenizer(bytes); in ParseCBOR() local
1089 if (tokenizer.TokenTag() == CBORTokenTag::ERROR_VALUE) { in ParseCBOR()
1090 out->HandleError(tokenizer.Status()); in ParseCBOR()
1095 assert(tokenizer.TokenTag() == CBORTokenTag::ENVELOPE); in ParseCBOR()
1096 tokenizer.EnterEnvelope(); in ParseCBOR()
1097 if (tokenizer.TokenTag() != CBORTokenTag::MAP_START) { in ParseCBOR()
1099 Status{Error::CBOR_MAP_START_EXPECTED, tokenizer.Status().pos}); in ParseCBOR()
1102 if (!ParseMap(/*stack_depth=*/1, &tokenizer, out)) in ParseCBOR()
1104 if (tokenizer.TokenTag() == CBORTokenTag::DONE) in ParseCBOR()
1106 if (tokenizer.TokenTag() == CBORTokenTag::ERROR_VALUE) { in ParseCBOR()
1107 out->HandleError(tokenizer.Status()); in ParseCBOR()
1110 out->HandleError(Status{Error::CBOR_TRAILING_JUNK, tokenizer.Status().pos}); in ParseCBOR()
1125 CBORTokenizer tokenizer(bytes); in AppendString8EntryToCBORMapTmpl() local
1126 if (tokenizer.TokenTag() == CBORTokenTag::ERROR_VALUE) in AppendString8EntryToCBORMapTmpl()
1127 return tokenizer.Status(); in AppendString8EntryToCBORMapTmpl()
1128 if (tokenizer.TokenTag() != CBORTokenTag::ENVELOPE) in AppendString8EntryToCBORMapTmpl()
1130 size_t envelope_size = tokenizer.GetEnvelopeContents().size(); in AppendString8EntryToCBORMapTmpl()
1135 (tokenizer.GetEnvelopeContents()[0] != EncodeIndefiniteLengthMapStart())) in AppendString8EntryToCBORMapTmpl()