{"action":"created","issue":{"url":"https://api.github.com/repos/Khan/KaTeX/issues/386","labels_url":"https://api.github.com/repos/Khan/KaTeX/issues/386/labels{/name}","comments_url":"https://api.github.com/repos/Khan/KaTeX/issues/386/comments","events_url":"https://api.github.com/repos/Khan/KaTeX/issues/386/events","html_url":"https://github.com/Khan/KaTeX/pull/386","id":116079302,"number":386,"title":"Avoid re-lexing, move position to internal state","user":{"login":"gagern","id":190759,"avatar_url":"https://avatars.githubusercontent.com/u/190759?v=3","gravatar_id":"","url":"https://api.github.com/users/gagern","html_url":"https://github.com/gagern","followers_url":"https://api.github.com/users/gagern/followers","following_url":"https://api.github.com/users/gagern/following{/other_user}","gists_url":"https://api.github.com/users/gagern/gists{/gist_id}","starred_url":"https://api.github.com/users/gagern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gagern/subscriptions","organizations_url":"https://api.github.com/users/gagern/orgs","repos_url":"https://api.github.com/users/gagern/repos","events_url":"https://api.github.com/users/gagern/events{/privacy}","received_events_url":"https://api.github.com/users/gagern/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-10T10:31:39Z","updated_at":"2015-11-20T16:46:21Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Khan/KaTeX/pulls/386","html_url":"https://github.com/Khan/KaTeX/pull/386","diff_url":"https://github.com/Khan/KaTeX/pull/386.diff","patch_url":"https://github.com/Khan/KaTeX/pull/386.patch"},"body":"Instead of passing around the current position as an argument, we now have a parser property called `pos` to keep track of that.  Instead of repeatedly re-lexing at the current position we now have a property called `nextToken` which contains the token beginning at the current position.  We may need to\r\nre-lex if we switch mode.  Since the position is kept in the parser state, we don't need to return it from parsing methods, which obsoletes the `ParseResult` class.\r\n\r\nThis file contains two hacks (search for `TODO` in the diff) aimed at keeping error messages exactly as they were. Once #385 gets merged, we can improve these locations and adjust the error message expectations accordingly. Right now, this PR won't conflict with #385 but doesn't depend on it either. In the long run, we might even go one step further and switch from reporting an error *position* to reporting an error *token* or *group*. We could underline these ad a whole.\r\n\r\nThis is the last step in addressing #266. It prepares the way for implementing macros."},"comment":{"url":"https://api.github.com/repos/Khan/KaTeX/issues/comments/158455926","html_url":"https://github.com/Khan/KaTeX/pull/386#issuecomment-158455926","issue_url":"https://api.github.com/repos/Khan/KaTeX/issues/386","id":158455926,"user":{"login":"gagern","id":190759,"avatar_url":"https://avatars.githubusercontent.com/u/190759?v=3","gravatar_id":"","url":"https://api.github.com/users/gagern","html_url":"https://github.com/gagern","followers_url":"https://api.github.com/users/gagern/followers","following_url":"https://api.github.com/users/gagern/following{/other_user}","gists_url":"https://api.github.com/users/gagern/gists{/gist_id}","starred_url":"https://api.github.com/users/gagern/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gagern/subscriptions","organizations_url":"https://api.github.com/users/gagern/orgs","repos_url":"https://api.github.com/users/gagern/repos","events_url":"https://api.github.com/users/gagern/events{/privacy}","received_events_url":"https://api.github.com/users/gagern/received_events","type":"User","site_admin":false},"created_at":"2015-11-20T16:46:21Z","updated_at":"2015-11-20T16:46:21Z","body":"I'm glad you don't mind being reminded this way. :grinning:"}}