Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #========================================================
- #**Lite Elite Programming Language
- #========================================================
- #**Narzew
- #**09.12.2012
- #**Version 1.1
- #========================================================
- #**Versions :
- #**09.12.2012 => v 1.0
- #**09.12.2012 => v 1.1
- #========================================================
- #**Changes in 1.1
- #**3 new methods, self in methods object, shortcuts
- #========================================================
- #========================================================
- #**License:
- #**GPL with some changes :
- #**Share & use free where you want, but you must give credit to original
- #**author in visible place.
- #**All plugins/mods etc please send to authors email (narzew at gmail.com),
- #**to make this software better and better.
- #**User can't change this license.
- #**This license are for all plugins and mods
- #**Original author (Narzew) can change this license when he wants.
- #**Using => accepting this license
- #========================================================
- #========================================================
- #**Licencja :
- #**GPL z kilkoma zmianami :
- #**Rozprzestrzeniaj & używaj gdzie chcesz, ale musisz dać nazwę
- #**oryginalnego autora w widocznym miejscu
- #**Wszelkie pluginy/mody itp. proszę wysyłać mi na e-mail (narzew at gmail.com),
- #**w celu ulepszenia rozwoju oprogramowania
- #**Użytkownik nie może zmienić licencji
- #**Do pluginów itp. też się tyczy ta licencja.
- #**Autor oryginału (Narzew) ma prawo zmienić licencję w każdym czasie.
- #**Używając akceptujesz tą licencję.
- #========================================================
- $code = "" # Zmienna kodu / Code variable
- tt = true # Skrót od true / True shortcut
- fl = false # Skrót od false / False shortcut
- nl = nil # Skrót od nil / Nil shortcut
- sl = self # Skrót od self / Self shortcut
- #========================================================
- #**Lista instrukcji :
- #**Instructions list :
- #**mt(x,y,z) => metoda / method
- #**cb(x,y,z,e) => warunek / conditional branch
- #**wh(x,y) => pętla while / while loop
- #**ut(x,y) => pętla until / until loop
- #**md(x,y) => moduł / module
- #**cl(x,y) => klasa / class
- #**as(x,y) => alias / alias
- #**bg(x,y,z) => główna pętla (begin) / main loop (begin)
- #**ev(x) => ewaluacja code / code eval
- #**ex => wywołanie kodu / code evaluation
- #**cs => wyczyszczenie codu / code clear
- #**ss(x) => zapisanie kodu do pliku / save code to file
- #========================================================
- #**New in 1.1
- #========================================================
- #**se => zwykły koniec / standalone end
- #**sm(x) => zwyczajny moduł / standalone module
- #**sc(x) => zwyczajna klasa / standalone class
- #========================================================
- #========================================================
- #**mt(x,y,z)
- #**Metoda
- #**Method
- #**x => nazwa (ciąg)
- #**x => name (string)
- #**y => argumenty (tablica) [argument1,argument2] (opcjonalnie)
- #**y => arguments (array) [argument1, argument2] (optional)
- #**z => treść metody (ciąg)
- #**z => method data (string)
- #========================================================
- def mt(x,y,z,s=false)
- if s == false
- $code << "def #{x}("
- else
- $code << "def self.#{x}("
- end
- a = y.size
- b = 0
- unless y == nil
- y.each{|x|
- b += 1
- $code << "#{x}"
- $code << "," if b != a
- }
- end
- $code << ")\n#{z}\nend\n"
- end
- #========================================================
- #**cb(x,y,z,e)
- #**Warunek
- #**Conditional branch
- #**x => warunek (ciąg)
- #**x => branch (string)
- #**y => instrukcje jeśli spełniony (ciąg)
- #**y => instructions when true (string)
- #**z => instrukcje jeśli niespełniony (ciąg, opcjonalnie)
- #**z => instructions when false (string, optional)
- #**e => elsify w tablicy asocjacyjnej {warunek => instrukcje} (opcjonalnie)
- #**e => elsifs in assoc table [elsif => instr] (optional)
- #========================================================
- def cb(x,y,z=nil,e={})
- $code << "if #{x}\n#{y}\n"
- unless z == {}
- e.each{|a,b|
- $code << "elsif #{a}\n#{b}\n"
- }
- end
- unless z == nil
- $code << "else\n#{z}\n"
- end
- $code << "end\n"
- end
- #========================================================
- #**wh(x,y)
- #**While
- #**x => warunek
- #**x => branch
- #**y => instrukcje
- #**y => instructions
- #**Dopóki warunek jest spełnione, wykonuj instrukcje (sprawdzany na początku)
- #**Until branch is true, do instructions (check at the start)
- #========================================================
- def wh(x,y)
- $code << "while #{x}\n#{y}\nend\n"
- end
- #========================================================
- #**ut(x,y)
- #**Until
- #**x => warunek
- #**x=> branch
- #**y => instrukcje
- #**y => instructions
- #**Dopóki warunek jest spełnione, wykonuj instrukcje (sprawdzany na końcu)
- #**Until branch is true, do instructions (check at the end)
- #========================================================
- def ut(x,y)
- $code << "until #{x}\n#{y}\nend\n"
- end
- #========================================================
- #**md(x,y)
- #**Moduł
- #**Module
- #**x => nazwa modułu
- #**x => module name
- #**y => treść modułu
- #**y => module data
- #========================================================
- def md(x,y)
- $code << "module #{x}\n#{y}\nend\n"
- end
- #========================================================
- #**cl(x,y)
- #**Klasa
- #**Class
- #**x => nazwa klasy
- #**x => class name
- #**y => treść klasy
- #**y => class data
- #========================================================
- def cl(x,y)
- $code << "class #{x}\n#{y}\nend\n"
- end
- #========================================================
- #**as(x,y)
- #**Alias
- #**x => wcześniejsza metoda
- #**x => previous method
- #**y => nowa nazwa metody
- #**y => new method
- #========================================================
- def as(x,y)
- $code << "alias #{x} #{y}\n"
- end
- #========================================================
- #**bg(x,y,z)
- #**Główna metoda (begin)
- #**Main method (begin)
- #**x => treść głównej metody
- #**x => main method code
- #**y => treść warunku rescue (opcjonalnie)
- #**y => rescue branch code (optional)
- #**z => treść warunku ensure (opcjonalnie)
- #**z => ensure branch code (optional)
- #========================================================
- def bg(x,y=nil,z=nil)
- $code << "begin\n#{x}\n"
- unless y == nil
- $code << "rescue\n#{y}\n"
- end
- unless z == nil
- $code << "ensure\n#{z}\n"
- end
- $code << "end\n"
- end
- #========================================================
- #**ev(x,y)
- #**Eval
- #**x => code
- #**x => kod
- #========================================================
- def ev(x)
- $code << "#{x}\n"
- end
- #========================================================
- #**ex
- #**Wykonuje kod
- #**Executes a code
- #========================================================
- def ex
- eval($code)
- end
- #========================================================
- #**cs
- #**Czyści kod
- #**Clears a code
- #========================================================
- def cs
- $code = ""
- end
- #========================================================
- #**ss(x)
- #**x=> plik
- #**x => filename
- #**Zapisuje kod
- #**Saves a code
- #========================================================
- def ss(x)
- file = File.open(x, 'wb')
- file.write($code)
- file.close
- end
- #========================================================
- #**se
- #**Zwyczajny koniec
- #**Standalone end
- #========================================================
- def se
- $code << "end\n"
- end
- #========================================================
- #**sc(x)
- #**x => klasa
- #**x => class
- #**Start klasy
- #**Class start
- #========================================================
- def sc(x)
- $code << "class #{x}\n"
- end
- #========================================================
- #**sm(x)
- #**x => moduł
- #**x => module
- #**Start modułu
- #**Module start
- #========================================================
- def sm(x)
- $code << "module #{x}\n"
- end
- #========================================================
- #**Koniec skryptu
- #**End of script
- #========================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement