lscript 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/lscript.rb +58 -0
  3. metadata +43 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b62edc8871de0457c6b6f0cb245721d49f826d18
4
+ data.tar.gz: f160abe32923ed4d7551d33869bcbd4a3aedc001
5
+ SHA512:
6
+ metadata.gz: 602e999106400a3b2bf788a68429a88dfdd91208232e15e3b1a86ac2e27399b3e809118941be406d7126b192e8e992552cb0cfbe1be1385f6704fd1c4987cd82
7
+ data.tar.gz: 205e15602347ee8fd14d30b441cf688d21d6909cc9aadf53f957e441e1e5b099a2602bed7e0d84034fbbfed394226c66dbbaae5fcbf0dfd26e5184c9c3d4cc8d
@@ -0,0 +1,58 @@
1
+ def lscript(string)
2
+ variabels = Hash.new
3
+ while true
4
+ case string.slice!(0)
5
+ when 'g'
6
+ variabels[string.slice!(0)] = gets
7
+ when 'p'
8
+ puts variabels[string.slice!(0)]
9
+ when 'r'
10
+ variabels[string.slice!(0)] = lread(string)
11
+ when 'i'
12
+ #if true the code after runs, if false it gets eaten
13
+ if variabels[string.slice!(0)] == variabels[string.slice!(0)]
14
+ else
15
+ lread(string)
16
+ end
17
+ when '+'
18
+ variabels[string.slice!(0)] = variabels[string.slice!(0)] + variabels[string.slice!(0)]
19
+ when '-'
20
+ variabels[string.slice!(0)] = variabels[string.slice!(0)] - variabels[string.slice!(0)]
21
+ when nil
22
+ break
23
+ else
24
+ end
25
+ end
26
+ end
27
+ def lread(string)
28
+ ret = ""
29
+ until (s=string.slice!(0)) == ';'
30
+ ret += s
31
+ end
32
+ return ret
33
+ end
34
+
35
+ =begin
36
+ Welcome to lscript
37
+ spaces in code are optional, like with any other character that does not have any function it will be ignored
38
+
39
+ $ = single character variabel, a-z are recommended. 0-9 aswell as other characters without a script function can be used, but might break in future updates
40
+ _ text or code to read or run
41
+ ; defines end of text or code to read
42
+ g$ gets user input and stores in variabel $
43
+ p$ puts $
44
+ r$_; puts _; string into $
45
+ i$$_; if $ == $ runs _;
46
+ +$$$ combines second and third varaible into first
47
+ -$$$ subtracts second and third varaible into first, works best with numbers
48
+
49
+ Lets run trough an example
50
+ lscript("raWhat is your name?; pa rbHello ; gc +dbc pd")
51
+ raWhat is your name?; This will read[r] into variabel[a] the string[What is your name?] and stop reading at [;]
52
+ pa this will puts to console[p] the varaible[a]
53
+ rbHello ; this will read[r] into[b] the string[Hello ] and stop at [;] (notice the space after Hello, it is important for formating later)
54
+ gc this will gets[g] user input into the varaibel[c]
55
+ +dbc this will add[+] into varable[d] the other 2 variabels [b] and [c]
56
+ pd finally this will puts[p] the combined variable[d]
57
+ =end
58
+
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lscript
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Leddy231
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-07-12 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Very basic as it is, will be expanded more. Just for fun really
14
+ email:
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/lscript.rb
20
+ homepage:
21
+ licenses: []
22
+ metadata: {}
23
+ post_install_message:
24
+ rdoc_options: []
25
+ require_paths:
26
+ - lib
27
+ required_ruby_version: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - '>='
30
+ - !ruby/object:Gem::Version
31
+ version: '0'
32
+ required_rubygems_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - '>='
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ requirements: []
38
+ rubyforge_project:
39
+ rubygems_version: 2.6.4
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: A scripting language made in ruby
43
+ test_files: []