• Home
  • Raw
  • Download

Lines Matching refs:token

131   Token token;  in parse()  local
132 skipCommentTokens(token); in parse()
139 token.type_ = tokenError; in parse()
140 token.start_ = beginDoc; in parse()
141 token.end_ = endDoc; in parse()
144 token); in parse()
152 Token token; in readValue() local
153 skipCommentTokens(token); in readValue()
169 switch (token.type_) { in readValue()
171 successful = readObject(token); in readValue()
175 successful = readArray(token); in readValue()
179 successful = decodeNumber(token); in readValue()
182 successful = decodeString(token); in readValue()
186 currentValue().setOffsetStart(token.start_ - begin_); in readValue()
187 currentValue().setOffsetLimit(token.end_ - begin_); in readValue()
191 currentValue().setOffsetStart(token.start_ - begin_); in readValue()
192 currentValue().setOffsetLimit(token.end_ - begin_); in readValue()
196 currentValue().setOffsetStart(token.start_ - begin_); in readValue()
197 currentValue().setOffsetLimit(token.end_ - begin_); in readValue()
211 currentValue().setOffsetStart(token.start_ - begin_); in readValue()
212 currentValue().setOffsetLimit(token.end_ - begin_); in readValue()
213 return addError("Syntax error: value, object or array expected.", token); in readValue()
224 void Reader::skipCommentTokens(Token& token) { in skipCommentTokens() argument
227 readToken(token); in skipCommentTokens()
228 } while (token.type_ == tokenComment); in skipCommentTokens()
230 readToken(token); in skipCommentTokens()
234 bool Reader::expectToken(TokenType type, Token& token, const char* message) { in expectToken() argument
235 readToken(token); in expectToken()
236 if (token.type_ != type) in expectToken()
237 return addError(message, token); in expectToken()
241 bool Reader::readToken(Token& token) { in readToken() argument
243 token.start_ = current_; in readToken()
248 token.type_ = tokenObjectBegin; in readToken()
251 token.type_ = tokenObjectEnd; in readToken()
254 token.type_ = tokenArrayBegin; in readToken()
257 token.type_ = tokenArrayEnd; in readToken()
260 token.type_ = tokenString; in readToken()
264 token.type_ = tokenComment; in readToken()
278 token.type_ = tokenNumber; in readToken()
282 token.type_ = tokenTrue; in readToken()
286 token.type_ = tokenFalse; in readToken()
290 token.type_ = tokenNull; in readToken()
294 token.type_ = tokenArraySeparator; in readToken()
297 token.type_ = tokenMemberSeparator; in readToken()
300 token.type_ = tokenEndOfStream; in readToken()
307 token.type_ = tokenError; in readToken()
308 token.end_ = current_; in readToken()
480 Token token; in readArray() local
482 ok = readToken(token); in readArray()
483 while (token.type_ == tokenComment && ok) { in readArray()
484 ok = readToken(token); in readArray()
487 (token.type_ != tokenArraySeparator && token.type_ != tokenArrayEnd); in readArray()
490 "Missing ',' or ']' in array declaration", token, tokenArrayEnd); in readArray()
492 if (token.type_ == tokenArrayEnd) in readArray()
498 bool Reader::decodeNumber(Token& token) { in decodeNumber() argument
500 if (!decodeNumber(token, decoded)) in decodeNumber()
503 currentValue().setOffsetStart(token.start_ - begin_); in decodeNumber()
504 currentValue().setOffsetLimit(token.end_ - begin_); in decodeNumber()
508 bool Reader::decodeNumber(Token& token, Value& decoded) { in decodeNumber() argument
510 for (Location inspect = token.start_; inspect != token.end_; ++inspect) { in decodeNumber()
512 (*inspect == '-' && inspect != token.start_); in decodeNumber()
515 return decodeDouble(token, decoded); in decodeNumber()
519 Location current = token.start_; in decodeNumber()
528 while (current < token.end_) { in decodeNumber()
531 return addError("'" + std::string(token.start_, token.end_) + in decodeNumber()
533 token); in decodeNumber()
540 if (value > threshold || current != token.end_ || in decodeNumber()
542 return decodeDouble(token, decoded); in decodeNumber()
556 bool Reader::decodeDouble(Token& token) { in decodeDouble() argument
558 if (!decodeDouble(token, decoded)) in decodeDouble()
561 currentValue().setOffsetStart(token.start_ - begin_); in decodeDouble()
562 currentValue().setOffsetLimit(token.end_ - begin_); in decodeDouble()
566 bool Reader::decodeDouble(Token& token, Value& decoded) { in decodeDouble() argument
570 int length = int(token.end_ - token.start_); in decodeDouble()
574 return addError("Unable to parse token length", token); in decodeDouble()
586 memcpy(buffer, token.start_, length); in decodeDouble()
590 std::string buffer(token.start_, token.end_); in decodeDouble()
595 return addError("'" + std::string(token.start_, token.end_) + in decodeDouble()
597 token); in decodeDouble()
602 bool Reader::decodeString(Token& token) { in decodeString() argument
604 if (!decodeString(token, decoded)) in decodeString()
607 currentValue().setOffsetStart(token.start_ - begin_); in decodeString()
608 currentValue().setOffsetLimit(token.end_ - begin_); in decodeString()
612 bool Reader::decodeString(Token& token, std::string& decoded) { in decodeString() argument
613 decoded.reserve(token.end_ - token.start_ - 2); in decodeString()
614 Location current = token.start_ + 1; // skip '"' in decodeString()
615 Location end = token.end_ - 1; // do not include '"' in decodeString()
622 return addError("Empty escape sequence in string", token, current); in decodeString()
651 if (!decodeUnicodeCodePoint(token, current, end, unicode)) in decodeString()
656 return addError("Bad escape sequence in string", token, current); in decodeString()
665 bool Reader::decodeUnicodeCodePoint(Token& token, in decodeUnicodeCodePoint() argument
670 if (!decodeUnicodeEscapeSequence(token, current, end, unicode)) in decodeUnicodeCodePoint()
677 token, in decodeUnicodeCodePoint()
681 if (decodeUnicodeEscapeSequence(token, current, end, surrogatePair)) { in decodeUnicodeCodePoint()
688 token, in decodeUnicodeCodePoint()
694 bool Reader::decodeUnicodeEscapeSequence(Token& token, in decodeUnicodeEscapeSequence() argument
701 token, in decodeUnicodeEscapeSequence()
716 token, in decodeUnicodeEscapeSequence()
723 Reader::addError(const std::string& message, Token& token, Location extra) { in addError() argument
725 info.token_ = token; in addError()
746 Token& token, in addErrorAndRecover() argument
748 addError(message, token); in addErrorAndRecover()
840 Token token; in pushError() local
841 token.type_ = tokenError; in pushError()
842 token.start_ = begin_ + value.getOffsetStart(); in pushError()
843 token.end_ = end_ + value.getOffsetLimit(); in pushError()
845 info.token_ = token; in pushError()
858 Token token; in pushError() local
859 token.type_ = tokenError; in pushError()
860 token.start_ = begin_ + value.getOffsetStart(); in pushError()
861 token.end_ = begin_ + value.getOffsetLimit(); in pushError()
863 info.token_ = token; in pushError()