Skip to content

Purpose of record Token's x, y, and i fields? #479

Answered by parke
parke asked this question in Q&A
Discussion options

You must be logged in to vote

Are the comments I have added to t.lex() correct?

   function tl.lex(input: string): {Token}, {Token}
      local tokens: {Token} = {}

      local state: LexState = "any"
      local fwd = true
      local y = 1   --  the current source code line number?
      local x = 0   --  the current source code column number?
      local i = 0   --  the current source code byte offset from beginning of file?
      local lc_open_lvl = 0
      local lc_close_lvl = 0
      local ls_open_lvl = 0
      local ls_close_lvl = 0
      local errs: {Token} = {}
      local nt = 0

      local tx: integer   --  the column the current token begins on?
      local ty: integer   --  the line the current token be…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@hishamhm
Comment options

Answer selected by hishamhm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants