def comment(self, line, text): if self._verbose: sys.stdout.write("Comment %s in line %d\n" % ( text, line, )) return False def data(self, tag, tagline, val, valline, delim, inloop): if self._verbose: sys.stdout.write( "data item %s in line %d:%d, delim=%s, inloop=%s - " \ % (tag, tagline, valline, str( delim ), str( inloop ),) ) sys.stdout.write(val) sys.stdout.write("\n") return False # # if __name__ == "__main__": e = sas.ErrorHandler() c = Ch(verbose=False) l = sas.StarLexer(fp=sys.stdin, bufsize=0, verbose=False) with sas.timer("DDL"): p = Parser.parse(lexer=l, content_handler=c, error_handler=e, verbose=False)
def comment(self, line, text): if self._verbose: sys.stdout.write("Comment %s in line %d\n" % ( text, line, )) return False def data(self, tag, tagline, val, valline, delim, inloop): if self._verbose: sys.stdout.write( "data item %s in line %d:%d, delim=%s, inloop=%s - " \ % (tag, tagline, valline, str( delim ), str( inloop ),) ) sys.stdout.write(val) sys.stdout.write("\n") return False # # if __name__ == "__main__": e = sas.ErrorHandler() c = Ch(verbose=False) l = sas.StarLexer(fp=sys.stdin, bufsize=0) #, verbose = True ) with sas.timer("SANS"): p = SansParser.parse(lexer=l, content_handler=c, error_handler=e, verbose=False)
# # if __name__ == "__main__": # l = StarLexer( verbose = True ) # lex.runmain() iterator = True if len(sys.argv) > 1: if sys.argv[1] == "send": iterator = False if iterator: with sas.timer("lexer (iter)"): l = StarLexer(fp=sys.stdin, bufsize=0, verbose=True) for t in l: # pprint.pprint( t ) pass else: with sas.timer("lexer (send)"): l = StarLexer() # verbose = True ) for line in sys.stdin: l.send(line) for t in l: # pprint.pprint( t ) pass
def comment(self, line, text): if self._verbose: sys.stdout.write("Comment %s in line %d\n" % ( text, line, )) return False def data(self, tag, tagline, val, valline, delim, inloop): if self._verbose: sys.stdout.write( "data item %s in line %d:%d, delim=%s, inloop=%s - " \ % (tag, tagline, valline, str( delim ), str( inloop ),) ) sys.stdout.write(val) sys.stdout.write("\n") return False # # if __name__ == "__main__": e = sas.ErrorHandler() c = Ch(verbose=False) l = sas.StarLexer(fp=sys.stdin, bufsize=0, verbose=False) with sas.timer("CIF"): p = CifParser.parse(lexer=l, content_handler=c, error_handler=e, verbose=False)
else: sys.stdout.write(" delimited with %s\n" % (delim, )) return False def endValue(self, line, delim): if self._verbose: sys.stdout.write("end value in line %d" % (line, )) if delim is None: sys.stdout.write("\n") else: sys.stdout.write(" delimited with %s\n" % (delim, )) return False def characters(self, line, val): if self._verbose: sys.stdout.write("characters in line " + str(line)) sys.stdout.write(" >>> ") sys.stdout.write(val) sys.stdout.write(" <<<\n") # # if __name__ == "__main__": e = sas.ErrorHandler() c = Ch(verbose=False) l = sas.StarLexer(fp=sys.stdin, bufsize=0, verbose=False) with sas.timer("SAS"): p = SasParser.parse(lexer=l, content_handler=c, error_handler=e, verbose=False)
def tag(self, line, tag): if self._verbose: sys.stdout.write("tag %s in line %d\n" % ( tag, line, )) def value(self, line, val, delim): if self._verbose: sys.stdout.write("value in line " + str(line)) if delim is not None: sys.stdout.write("delimited with " + str(delim)) sys.stdout.write(" >>> ") sys.stdout.write(val) sys.stdout.write(" <<<\n") # # if __name__ == "__main__": e = sas.ErrorHandler() c = Ch(verbose=False) l = sas.StarLexer(fp=sys.stdin, bufsize=0, verbose=False) with sas.timer("SANS2"): p = Parser.parse(lexer=l, content_handler=c, error_handler=e, verbose=False)