Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(3)  |  Call(3)  |  Derive(0)  |  Import(0)

        def parse(premonition_stream_1):
	result = []

	input = premonition_stream_1.peek()
	while input not in [None]:
		if input == "(":
			premonition_stream_1.consume()
			item = parse(premonition_stream_1)
		elif input == ")":
			premonition_stream_1.consume()
			break
		elif input == "\"":
			item = parse_string_literal(premonition_stream_1)
		elif input == "\\":
			premonition_stream_1.consume()
			# symbol
			input = premonition_stream_1.peek()
			literal = StringIO()
			while (input not in [None, " ", "\t", ")"]):
				premonition_stream_1.consume()
	
				literal.write(input)
				input = premonition_stream_1.peek()
	
			item = symbol(literal.getvalue())
		#elif input == "{":
		#	item = parse_string_literal_2(premonition_stream_1)
		elif input in [" ", "\t"]:
			premonition_stream_1.consume()
			input = premonition_stream_1.peek()
			continue
		else: # printable char
			input = premonition_stream_1.peek()
			literal = StringIO()
			while (input not in [None, " ", "\t", ")"]):
				premonition_stream_1.consume()

				literal.write(input)

				input = premonition_stream_1.peek()

			#item = resolve(symbol(literal.getvalue()))

			literal = literal.getvalue()

			if len(literal) > 0 and literal[0] >= '0' and literal[0] <= '9':
				item = int(literal) # FIXME double? E? # FIXME: ValueError: invalid literal for int(): 5-Mar-2007
			else:
				item = symbol(literal)
		#else:
		#	raise exceptions.SyntaxError("syntax error near \"%s\"" % input)

		result.append(item)

		input = premonition_stream_1.peek()

	return result
        


src/i/m/IMAPFS-HEAD/niceimap.py   IMAPFS(Download)
	stream.seek(0)
	premonition_stream_1 = lisp.premonition_stream(stream)
	items = lisp.parse(premonition_stream_1)
	return items
 
	#premonition_stream_1.consume()
 
	items = lisp.parse(premonition_stream_1)
	# items = [1, [\UID, 0807, \FLAGS, [\Seen], ...], 2, [\UID, 0808, \FLAGS, [\Seen], ...]]
 
		assert(premonition_stream_1.peek() == "(")
		premonition_stream_1.consume()
		flags = lisp.parse(premonition_stream_1)
 
		assert(premonition_stream_1.peek() == " ")