Top Level Namespace

Instance Method Summary collapse

Instance Method Details

#lread(string) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/lscript.rb', line 27

def lread(string)
	ret = ""
	until (s=string.slice!(0)) == ';'
		ret += s
	end
	return ret
end

#lscript(string) ⇒ Object



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/lscript.rb', line 1

def lscript(string)
	variabels = Hash.new
	while true
		case string.slice!(0)
			when 'g'
				variabels[string.slice!(0)] = gets
			when 'p'
				puts variabels[string.slice!(0)]
			when 'r'
				variabels[string.slice!(0)] = lread(string)
			when 'i'
			#if true the code after runs, if false it gets eaten
			if variabels[string.slice!(0)] == variabels[string.slice!(0)]
			else
				lread(string)
			end
			when '+'
				variabels[string.slice!(0)] = variabels[string.slice!(0)] + variabels[string.slice!(0)]
			when '-'
				variabels[string.slice!(0)] = variabels[string.slice!(0)] - variabels[string.slice!(0)]
			when nil
				break
			else
		end
	end
end