소스 검색

Reset line numbers;

bjorn 9 년 전
부모
커밋
0bc937af9a
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 2
      parse.lua

+ 3 - 2
parse.lua

@@ -1,8 +1,8 @@
 local lpeg = require 'lpeg'
 local P, R, S, V, C, Ct, Cmt, Cg, Cc, Cf, Cmt = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.C, lpeg.Ct, lpeg.Cmt, lpeg.Cg, lpeg.Cc, lpeg.Cf, lpeg.Cmt
 
-local line = 1
-local lastLinePos = 1
+local line
+local lastLinePos
 
 local function pack(...)
   return { n = select('#', ...), ... }
@@ -307,5 +307,6 @@ end
 return function(str)
   assert(type(str) == 'string', 'parser expects a string')
   str = stripComments(str)
+  line, lastLinePos = 1, 1
   return graphQL:match(str) or error('Syntax error near line ' .. line, 2)
 end