BeginComment:
This program simply copies an input stream to the console line by line.

Copyright © 2020 Richard Lesh.  All rights reserved.
EndComment

Pragma: UseUnicode

BeginProgram: StreamIO2

BeginMain:
	ScalarDecl: <string>? line
###############################################################################
# Python and Swift don't have assignment operators usually
# used in this type of input loop so we have to assign separately.
###############################################################################
BeginEval: language =~ m/py|swift/
	BeginFor: getline(line); line != EOF; getline(line)
		PrintLine: line!
	EndFor
ElseEval
	BeginWhile: getline(line)
BeginEval: language eq "pl"
		Statement: chomp(line)
EndEval
		PrintLine: line
	EndWhile
EndEval
EndMain
EndProgram
