Python code example

Here is a Python code snippet.

 
indentCount = 0 
textChars = [] 
suffixChars = [] 
# convert the line into a list of characters 
# and feed the list to the ReadAhead generator 
chars = ReadAhead(list(line)) 
c = chars.next() 
# get first while c and c == INDENT_CHAR: 
# process indent characters 
indentCount += 1 
c = chars.next() 
while c and c != SYMBOL: 
# process text characters textChars.append(c) 
c = chars.next() 
if c and c == SYMBOL: 
c = chars.next() 
# read past the SYMBOL while c: 
# process suffix characters 
suffixChars.append(c) c = chars.next() 
Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s