Beispiel #1
0
	for i in range(len(temp)) :
		result.append(str(i+1)+"\t"+temp[i])
	return "\n".join(result)

# Check if the file is run directly
if(__name__ == '__main__') :
	# Declare options for the parsing with the file
	optparser = OptionParser()
	optparser.add_option('-f', '--inputFile',
			dest='inFile',
			help='filname of the source file',
			default=None)

	# Parse the option available with input
	(options, args) = optparser.parse_args()

	# Grab the source code
	code = None
	if(options.inFile is None) :
		code = sys.stdin
	elif(options.inFile is not None) :
		code = dataFromFile(options.inFile)
	else :
		print("No file specified, system will exit")
		sys.exit("System will exit")

	# Do processing
	code = numberCode(code)
	# Print the modified code
	print(code)
			help='filname of the source file',
			default=None)
	optparser.add_option('-t', '--testFile',
			dest='testFile',
			help='filename of the test cases file',
			default=None)

	# Parse the option available with input
	(options, args) = optparser.parse_args()

	# Grab the source code
	code = None
	if(options.inFile is None) :
		code = sys.stdin
	elif(options.inFile is not None) :
		code = dataFromFile(options.inFile)
	else :
		print("No file specified, system will exit")
		sys.exit("System will exit now")

	# Grab the all the test cases
	test = None
	if(options.testFile is None) :
		test = sys.stdin
	elif(options.testFile is not None) :
		test = dataFromFile(options.testFile)
	else :
		print("No test case file specified, system will exit")
		sys.exit("Software will exit now")
	
	# Split the test case string into specific test cases in form of 2D array
Beispiel #3
0
	return cfg

# Check if the file is run directly
if(__name__ == '__main__') :
	# Declare options for the parsing with the file
	optparser = OptionParser()
	optparser.add_option('-f', '--inputFile',
			dest='inFile',
			help='filname of the source file',
			default=None)

	# Parse the option available with input
	(options, args) = optparser.parse_args()

	# Grab the source code
	code = None
	if(options.inFile is None) :
		code = sys.stdin
	elif(options.inFile is not None) :
		code = dataFromFile(options.inFile)
	else :
		print("No file specified, system will exit")
		sys.exit("System will exit")

	# Apply preprocessors to the code
	code = preprocess(code)

	# Obtain CFG of code
	cfg = codeToCFG(code)
	for i in cfg : print i
Beispiel #4
0
                         default=None)
    optparser.add_option('-t',
                         '--testFile',
                         dest='testFile',
                         help='filename of the test cases file',
                         default=None)

    # Parse the option available with input
    (options, args) = optparser.parse_args()

    # Grab the source code
    code = None
    if (options.inFile is None):
        code = sys.stdin
    elif (options.inFile is not None):
        code = dataFromFile(options.inFile)
    else:
        print("No file specified, system will exit")
        sys.exit("System will exit now")

    # Grab the all the test cases
    test = None
    if (options.testFile is None):
        test = sys.stdin
    elif (options.testFile is not None):
        test = dataFromFile(options.testFile)
    else:
        print("No test case file specified, system will exit")
        sys.exit("Software will exit now")

    # Split the test case string into specific test cases in form of 2D array