Sha256: e3d6799b1c0b0c67ce35007bbda4d265f13ac6cb3e970381a55e1c55f2f7376c

Contents?: true

Size: 1.05 KB

Versions: 19

Compression:

Stored size: 1.05 KB

Contents

class Token
	
	module PostTestDo

		def postTestFinalize pi
			if !requireArg?
				raise Error.new("descrepant post test clause")
			end
			@argEnd = pi
			closeSentence pi
			(d = (w = pi.parent).wrapped.orgEntity).iteratorCand = nil
			toReplace = "break " + case w.str
			when "while"
				"unless "
			when "until"
				"if "
			end
			Token.addMod w.range, toReplace
			if (v = d.dnext).kind == :on_symbeg && label = v.var_label
				d.defClsFirstSententence.first.setIteratorLabelVar label
				Token.addMod d.range, 
					"begin
						#{label} = ItratorLabel.new
						while true
							begin
								#{label}.setLast((".gsub(/\n/, ";").gsub(/\s+/, " ")
				res =			"))
							rescue #{label}.exNext
								next
							rescue #{label}.exRedo
								redo
							end
						end
						#{label}.res #nil or something in case iterator
					rescue #{label}.exBreak
						#{label}.res
					end".gsub(/\n/, ";").gsub(/\s+/, " ")
			else
				Token.addMod d.range, "while true;" # "do" -> "while true;"
				res = ";end;"
			end
			pi.spop
			Token.addMod pi.ipos, res
		end
	
	end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
YkLib-0.1.8.9 lib/Yk/indenter/post_test.rb
YkLib-0.1.8.8 lib/Yk/indenter/post_test.rb
YkLib-0.1.8.7 lib/Yk/indenter/post_test.rb
YkLib-0.1.8.6 lib/Yk/indenter/post_test.rb
YkLib-0.1.8.5 lib/Yk/indenter/post_test.rb
YkLib-0.1.8.4 lib/Yk/indenter/post_test.rb
YkLib-0.1.8.3 lib/Yk/indenter/post_test.rb
YkLib-0.1.8.2 lib/Yk/indenter/post_test.rb
YkLib-0.1.8.1 lib/Yk/indenter/post_test.rb
YkLib-0.1.8 lib/Yk/indenter/post_test.rb
YkLib-0.1.7.1 lib/Yk/indenter/post_test.rb
YkLib-0.1.7 lib/Yk/indenter/post_test.rb
YkLib-0.1.6 lib/Yk/indenter/post_test.rb
YkLib-0.1.5 lib/Yk/indenter/post_test.rb
YkLib-0.1.4 lib/Yk/indenter/post_test.rb
YkLib-0.1.3 lib/Yk/indenter/post_test.rb
YkLib-0.1.2 lib/Yk/indenter/post_test.rb
YkLib-0.1.1 lib/Yk/indenter/post_test.rb
YkLib-0.1.0 lib/YkLib/Yk/indenter/post_test.rb