示例#1
0
def initialize(sourceText):
    """
	"""
    global scanner

    # initialize the scanner with the sourceText
    scanner.initialize(sourceText)

    # use the scanner to read the first character from the sourceText
    getChar()
示例#2
0
def initialize(sourceText):
	"""
	"""
	global scanner

	# initialize the scanner with the sourceText
	scanner.initialize(sourceText)

	# use the scanner to read the first character from the sourceText
	getChar()
示例#3
0
def main(sourceText):
    global f
    f = open(outputFilename, "w")

    writeln("Here are the characters returned by the scanner:")
    writeln("  line col  character")

    Scanner.initialize(sourceText)

    character = Scanner.get()
    while True:
        writeln(character)
        if character.cargo == Scanner.ENDMARK:
            break
        character = Scanner.get()

    f.close()
示例#4
0
def main(sourceText):
	global f
	f = open(outputFilename, "w")

	writeln("Here are the characters returned by the scanner:")
	writeln("  line col  character")

	Scanner.initialize(sourceText)

	character = Scanner.get()
	while True:
		writeln(character)
		if character.cargo == Scanner.ENDMARK:
			break
		character = Scanner.get()

	f.close()
def main(sourceText):
    global f
    f = open(outputFilename, "w")      # open the ouput file

    writeln("Here are the characters returned by the scanner:")
    writeln("  line col  character")

    # create a scanner (an instance of the Scanner class)
    scanner.initialize(sourceText)

    #------------------------------------------------------------------
    # Call the scanner's get() method repeatedly
    # to get the characters in the sourceText.
    # Stop when we reach the ENDMARK.
    #------------------------------------------------------------------
    character = scanner.get()       # getfirst Character object from the scanner
    while True:
        writeln(character)
        if character.cargo == scanner.ENDMARK: break
        character = scanner.get()   # getnext

    f.close()  # close the output file
示例#6
0
def main(sourceText):
    global f
    f = open(outputFilename, "w")  # open the ouput file

    #fragment start core
    writeln("Here are the characters returned by the scanner:")
    writeln("  line col  character")

    # create a scanner (an instance of the Scanner class)
    scanner.initialize(sourceText)

    #------------------------------------------------------------------
    # Call the scanner's get() method repeatedly
    # to get the characters in the sourceText.
    # Stop when we reach the ENDMARK.
    #------------------------------------------------------------------
    character = scanner.get()  # getfirst Character object from the scanner
    while True:
        writeln(character)
        if character.cargo == scanner.ENDMARK: break
        character = scanner.get()  # getnext
#fragment stop core

    f.close()  # close the output file
示例#7
0
def initialize(sourceText):
    Scanner.initialize(sourceText)
    getChar()
示例#8
0
文件: Lexer.py 项目: theSwan/NeZha
def initialize(sourceText):
	Scanner.initialize(sourceText)
	getChar()