Research portable Memory game | Исследовать портируемую игру Память
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
753B

  1. from CPP import *
  2. from Function import *
  3. def process(FILE_IN):
  4. # Read file.
  5. lines_in = []
  6. with open(FILE_IN) as file:
  7. for line in file:
  8. lines_in.append(line.rstrip())
  9. f = Function()
  10. out = includes()
  11. # Parse.
  12. for ln in lines_in:
  13. ln = ln.rstrip()
  14. # Empty line.
  15. if ln == "":
  16. out += "\n"
  17. # Comment.
  18. elif (
  19. ln.startswith("#") and
  20. not f.isBody
  21. ):
  22. out += replaceComment(ln) + "\n"
  23. # Function.
  24. else:
  25. f.parseLine(ln)
  26. if f.isComplete:
  27. cpp = CPP(f)
  28. out += cpp.translate()
  29. # Create new function instance.
  30. f = Function()
  31. return out