Guest User

Untitled

a guest
May 25th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. static XMLTNGToken * handle_state_data(XMLTNGToker *toker) {
  2. char *p = [toker currentPosition];
  3. char *start = p;
  4. char *end = [toker endPosition];
  5. bool eof = false;
  6. XMLTNGToken *token;
  7.  
  8. if (*p == '<') {
  9. return parse_markup(toker);
  10. }
  11.  
  12. if ((p = memchr(p, '<', end - p)) == NULL) {
  13. eof = true;
  14. p = end;
  15. }
  16.  
  17. if (eof) {
  18. //points past the document on purpose
  19. [toker setCurrentPosition:p + 1];
  20. } else {
  21. //we want the current position sitting at the <
  22. [toker setCurrentPosition:p];
  23. }
  24.  
  25. return [XMLTNGTokenCharacters tokenForCharacters:start length:p - start];
  26. }
Add Comment
Please, Sign In to add comment