Exemplo n.º 1
0
 def run(self, urlctx, url, ctx, out):
     instream = urlctx.resolve(url)
     if instream is None:
         raise NotFound()
     s = ShowThmScanner(instream)
     try:
         while 1:
             cmd = verify.read_sexp(s)
             if cmd is None:
                 return True
             if type(cmd) != str:
                 raise SyntaxError('cmd must be atom: %s has type %s' %
                                   (cmd, type(cmd)))
             arg = verify.read_sexp(s)
             self.error = False
             ctx.do_cmd(cmd, arg, out)
             if cmd == 'thm' and len(arg):
                 self.thmlist.append((self.error, arg[0], arg[2], arg[3],
                                      s.get_linestash()))
             elif cmd == 'defthm' and len(arg):
                 self.thmlist.append((self.error, arg[0], arg[4], arg[5],
                                      s.get_linestash()))
             s.clear_linestash()
     except verify.VerifyError, x:
         out.write('Verify error at %s:%d:\n%s' % (url, s.lineno, x.why))
Exemplo n.º 2
0
def run_regression(urlctx, url, ctx, out):
    s = verify.Scanner(urlctx.resolve(url))
    while 1:
         cmd = verify.read_sexp(s)
         if cmd is None:
              return True
         if type(cmd) != str:
              raise SyntaxError('cmd must be atom')
         arg = verify.read_sexp(s)
         ctx.do_cmd(cmd, arg, out)
Exemplo n.º 3
0
def run_regression(urlctx, url, ctx, out):
    s = verify.Scanner(urlctx.resolve(url))
    while 1:
        cmd = verify.read_sexp(s)
        if cmd is None:
            return True
        if type(cmd) != str:
            raise SyntaxError('cmd must be atom')
        arg = verify.read_sexp(s)
        ctx.do_cmd(cmd, arg, out)
Exemplo n.º 4
0
 def run(self, urlctx, url, ctx, out):
     s = ShowThmScanner(urlctx.resolve(url))
     try:
         while 1:
             cmd = verify.read_sexp(s)
             if cmd is None:
                 display_404(self.response, self.thmname)
                 return True
             if type(cmd) != str:
                 raise SyntaxError('cmd must be atom: %s has type %s' %
                                   (cmd, type(cmd)))
             if cmd in ('thm', 'defthm'):
                 tok = s.get_tok()
                 if tok != '(':
                     raise SyntaxError('expected thm or defthm start')
                 tok = s.get_tok()
                 if tok == self.thmname:
                     show_thm = ShowThm(s, self.response.out, cmd,
                                        self.linkable_thms, self.style,
                                        self.url)
                     show_thm.header(self.thmname)
                     show_thm.write_linestash(s.get_linestash())
                     s.start_recording(show_thm)
                     show_thm.run(ctx)
                     return True
                 else:
                     self.linkable_thms.add(tok)
                     arg = [tok]
                     while True:
                         sexp = verify.read_sexp(s)
                         if sexp == ')':
                             break
                         arg.append(sexp)
             else:
                 arg = verify.read_sexp(s)
             ctx.do_cmd(cmd, arg, out)
             s.clear_linestash()
     except verify.VerifyError, x:
         out.write('Verify error at %s:%d:\n%s' % (url, s.lineno, x.why))
Exemplo n.º 5
0
 def run(self, urlctx, url, ctx, out):
     instream = urlctx.resolve(url)
     if instream is None:
         raise NotFound()
     s = ShowThmScanner(instream)
     try:
         while 1:
             cmd = verify.read_sexp(s)
             if cmd is None:
                 return True
             if type(cmd) != str:
                 raise SyntaxError('cmd must be atom: %s has type %s' % (cmd, type(cmd)))
             arg = verify.read_sexp(s)
             self.error = False
             ctx.do_cmd(cmd, arg, out)
             if cmd == 'thm' and len(arg):
                 self.thmlist.append((self.error, arg[0], arg[2], arg[3], s.get_linestash()))
             elif cmd == 'defthm' and len(arg):
                 self.thmlist.append((self.error, arg[0], arg[4], arg[5], s.get_linestash()))
             s.clear_linestash()
     except verify.VerifyError, x:
         out.write('Verify error at %s:%d:\n%s' % (url, s.lineno, x.why))
Exemplo n.º 6
0
 def run(self, urlctx, url, ctx, out):
     s = ShowThmScanner(urlctx.resolve(url))
     try:
         while 1:
             cmd = verify.read_sexp(s)
             if cmd is None:
                 display_404(self.response, self.thmname)
                 return True
             if type(cmd) != str:
                 raise SyntaxError('cmd must be atom: %s has type %s' % (cmd, type(cmd)))
             if cmd in ('thm', 'defthm'):
                 tok = s.get_tok()
                 if tok != '(':
                     raise SyntaxError('expected thm or defthm start')
                 tok = s.get_tok()
                 if tok == self.thmname:
                     show_thm = ShowThm(s, self.response.out, cmd, self.linkable_thms, self.style, self.url)
                     show_thm.header(self.thmname)
                     show_thm.write_linestash(s.get_linestash())
                     s.start_recording(show_thm)
                     show_thm.run(ctx)
                     return True
                 else:
                     self.linkable_thms.add(tok)
                     arg = [tok]
                     while True:
                         sexp = verify.read_sexp(s)
                         if sexp == ')':
                             break
                         arg.append(sexp)
             else:
                 arg = verify.read_sexp(s)
             ctx.do_cmd(cmd, arg, out)
             s.clear_linestash()
     except verify.VerifyError, x:
         out.write('Verify error at %s:%d:\n%s' % (url, s.lineno, x.why))
Exemplo n.º 7
0
def sexp(s):
     stream = StringStream(s)
     return verify.read_sexp(verify.Scanner(stream))
Exemplo n.º 8
0
def sexp(s):
    stream = StringStream(s)
    return verify.read_sexp(verify.Scanner(stream))