From ffe4e20af0e78aa8dd454e3c0b1d056f283b8652 Mon Sep 17 00:00:00 2001 From: GooseDB Date: Sat, 19 Oct 2019 23:36:16 +0300 Subject: [PATCH 1/4] prolog --- resources/prolog.ascii | 19 +++++++++++++++++++ src/main.rs | 6 ++++++ 2 files changed, 25 insertions(+) create mode 100644 resources/prolog.ascii diff --git a/resources/prolog.ascii b/resources/prolog.ascii new file mode 100644 index 000000000..8ea6c8454 --- /dev/null +++ b/resources/prolog.ascii @@ -0,0 +1,19 @@ + + -/oydmNNNNNNNmdh: yh+ + :smNNNNNNNNNNNNNNNN+ yhhhh+. + `+mNNNNNNNNNNNNNNNNNNN+ yNNNNNNy- + /mNNNNNNNNNNNNNNNNNNNNN+ yNNNNNNNNs` + sNNNNNNNNNNNNNNNNNNNNNNN+ yNNNNNNNNNd. + sNNNNNNNNNdso++oydNNNNNNN+ yNNNNNNNNNNd. + /NNNNNNNNs..+s+. .sNNNNN+ yNNNNNNNNNNNy + hNNNNNNN/ smN+ . /NNNN+ yNNNNNNNNNNNN- + NNNNNNNd +NNNo y+ hNNN+ yNNNNNNNNNNNN+ + NNNNNNNs +mNNNds+sdN+ yNNNs sNNNNNNNNNNNN+ + hNNNNNNs `sNNNNNNNNs :NNNNm. `smNNNNNNNNNN- + :NNNNNNs .+yhhs+.`omNNNNNm/ `.---oNNNNh + sNNNNNs -++++ooshNNNNNNNNNNmyo++++yyyym. + sNNNNs oNNNNNNNNNNNNNNNNNNNNNNNNNNNNd. + /ooos oNNNNNNNNNNNNNNNNNNNNNNNNNNNs` + oos oNNNNNNNNNNNNNNNNNNNNNNNNNy- + os -smNNNNNNNNNNNNNNNNNNNmh+. + -/oydmNNNNNNNmdhs+:` diff --git a/src/main.rs b/src/main.rs index 4c31a8225..7d09620e3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -382,6 +382,7 @@ enum Language { Lua, Nim, ObjectiveC, + Prolog, PureScript, Python, R, @@ -426,6 +427,7 @@ impl fmt::Display for Language { Language::Lua => write!(f, "Lua"), Language::Nim => write!(f, "Nim"), Language::ObjectiveC => write!(f, "Objective-C"), + Language::Prolog => write!(f, "Prolog"), Language::PureScript => write!(f, "PureScript"), Language::Python => write!(f, "Python"), Language::R => write!(f, "R"), @@ -949,6 +951,7 @@ impl From for Language { tokei::LanguageType::Lua => Language::Lua, tokei::LanguageType::Nim => Language::Nim, tokei::LanguageType::ObjectiveC => Language::ObjectiveC, + tokei::LanguageType::Prolog => Language::Prolog, tokei::LanguageType::PureScript => Language::PureScript, tokei::LanguageType::Python => Language::Python, tokei::LanguageType::R => Language::R, @@ -994,6 +997,7 @@ fn get_all_language_types() -> Vec { tokei::LanguageType::Lua, tokei::LanguageType::Nim, tokei::LanguageType::ObjectiveC, + tokei::LanguageType::Prolog, tokei::LanguageType::PureScript, tokei::LanguageType::Python, tokei::LanguageType::R, @@ -1045,6 +1049,7 @@ impl Info { Language::Lua => include_str!("../resources/lua.ascii"), Language::Nim => include_str!("../resources/nim.ascii"), Language::ObjectiveC => include_str!("../resources/objectivec.ascii"), + Language::Prolog => include_str!("../resources/prolog.ascii"), Language::PureScript => include_str!("../resources/purescript.ascii"), Language::Python => include_str!("../resources/python.ascii"), Language::R => include_str!("../resources/r.ascii"), @@ -1097,6 +1102,7 @@ impl Info { Language::Lua => vec![Color::Blue], Language::Nim => vec![Color::Yellow, Color::BrightWhite], Language::ObjectiveC => vec![Color::BrightBlue, Color::Blue], + Language::Prolog => vec![Color::White], Language::PureScript => vec![Color::White], Language::Python => vec![Color::Blue, Color::Yellow], Language::R => vec![Color::White, Color::Blue], From 8d801e34469ddc91e4991f96638ec72e563283a1 Mon Sep 17 00:00:00 2001 From: GooseDB Date: Thu, 24 Oct 2019 22:21:12 +0300 Subject: [PATCH 2/4] a new ascii --- resources/prolog.ascii | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/resources/prolog.ascii b/resources/prolog.ascii index 8ea6c8454..fc8cedacd 100644 --- a/resources/prolog.ascii +++ b/resources/prolog.ascii @@ -1,19 +1,22 @@ + + + ?- write("Hello , Prolog + "), n_factorial (0,1 ).n_facto + rial(N, F):-N #>0,N1#=N -1,n_factori + al(N1,F1),F#=N *F1.bin_se arch(Elt,List,R + esult):-length(List,N),bin _search_inner(El + t, List,1,N,Result).bin_sea rch_inner(Elt,Lis + t,J,J,J):- nth(J,List,Elt). bin_search_inner ( + Elt,List,B egin,End, Mid):-BeginElt,NewEnd is + Mid-1,bin_search_inner(Elt,Lis + ,Begin, NewEnd, Result ). - -/oydmNNNNNNNmdh: yh+ - :smNNNNNNNNNNNNNNNN+ yhhhh+. - `+mNNNNNNNNNNNNNNNNNNN+ yNNNNNNy- - /mNNNNNNNNNNNNNNNNNNNNN+ yNNNNNNNNs` - sNNNNNNNNNNNNNNNNNNNNNNN+ yNNNNNNNNNd. - sNNNNNNNNNdso++oydNNNNNNN+ yNNNNNNNNNNd. - /NNNNNNNNs..+s+. .sNNNNN+ yNNNNNNNNNNNy - hNNNNNNN/ smN+ . /NNNN+ yNNNNNNNNNNNN- - NNNNNNNd +NNNo y+ hNNN+ yNNNNNNNNNNNN+ - NNNNNNNs +mNNNds+sdN+ yNNNs sNNNNNNNNNNNN+ - hNNNNNNs `sNNNNNNNNs :NNNNm. `smNNNNNNNNNN- - :NNNNNNs .+yhhs+.`omNNNNNm/ `.---oNNNNh - sNNNNNs -++++ooshNNNNNNNNNNmyo++++yyyym. - sNNNNs oNNNNNNNNNNNNNNNNNNNNNNNNNNNNd. - /ooos oNNNNNNNNNNNNNNNNNNNNNNNNNNNs` - oos oNNNNNNNNNNNNNNNNNNNNNNNNNy- - os -smNNNNNNNNNNNNNNNNNNNmh+. - -/oydmNNNNNNNmdhs+:` From e95582a3f13fdbaba2f76c887fdf1fe1452e70c6 Mon Sep 17 00:00:00 2001 From: GooseDB Date: Thu, 24 Oct 2019 23:04:26 +0300 Subject: [PATCH 3/4] add new lang in code --- src/language.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/language.rs b/src/language.rs index c61b234c0..367523711 100644 --- a/src/language.rs +++ b/src/language.rs @@ -32,6 +32,7 @@ pub enum Language { ObjectiveC, Perl, Php, + Prolog, PureScript, Python, R, @@ -83,6 +84,7 @@ impl std::fmt::Display for Language { Language::Scala => write!(f, "Scala"), Language::Shell => write!(f, "Shell"), Language::Swift => write!(f, "Swift"), + Language::Prolog => write!(f, "Prolog"), Language::Perl => write!(f, "Perl"), Language::Php => write!(f, "Php"), Language::Tcl => write!(f, "Tcl"), @@ -123,6 +125,7 @@ impl From for Language { tokei::LanguageType::Lua => Language::Lua, tokei::LanguageType::Nim => Language::Nim, tokei::LanguageType::ObjectiveC => Language::ObjectiveC, + tokei::LanguageType::Prolog => Language::Prolog, tokei::LanguageType::Perl => Language::Perl, tokei::LanguageType::Php => Language::Php, tokei::LanguageType::PureScript => Language::PureScript, @@ -172,6 +175,7 @@ impl Language { Language::ObjectiveC => include_str!("../resources/objectivec.ascii"), Language::Perl => include_str!("../resources/perl.ascii"), Language::Php => include_str!("../resources/php.ascii"), + Language::Prolog => include_str!("../resource/prolog.ascii"), Language::PureScript => include_str!("../resources/purescript.ascii"), Language::Python => include_str!("../resources/python.ascii"), Language::R => include_str!("../resources/r.ascii"), @@ -218,6 +222,7 @@ impl Language { Language::ObjectiveC => vec![Color::BrightBlue, Color::Blue], Language::Perl => vec![Color::BrightBlue], Language::Php => vec![Color::BrightWhite], + Language::Prolog => vec![Color::White], Language::PureScript => vec![Color::White], Language::Python => vec![Color::Blue, Color::Yellow], Language::R => vec![Color::White, Color::Blue], @@ -318,6 +323,7 @@ fn get_all_language_types() -> Vec { tokei::LanguageType::ObjectiveC, tokei::LanguageType::Perl, tokei::LanguageType::Php, + tokei::LanguageType::Prolog, tokei::LanguageType::PureScript, tokei::LanguageType::Python, tokei::LanguageType::R, From 8331d04c6d9d0cf770662581c17dc4f0d43fedc6 Mon Sep 17 00:00:00 2001 From: GooseDB Date: Fri, 25 Oct 2019 00:34:16 +0300 Subject: [PATCH 4/4] colors --- resources/prolog.ascii | 40 ++++++++++++++++++---------------------- src/language.rs | 4 ++-- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/resources/prolog.ascii b/resources/prolog.ascii index fc8cedacd..9de00323f 100644 --- a/resources/prolog.ascii +++ b/resources/prolog.ascii @@ -1,22 +1,18 @@ - - - ?- write("Hello , Prolog - "), n_factorial (0,1 ).n_facto - rial(N, F):-N #>0,N1#=N -1,n_factori - al(N1,F1),F#=N *F1.bin_se arch(Elt,List,R - esult):-length(List,N),bin _search_inner(El - t, List,1,N,Result).bin_sea rch_inner(Elt,Lis - t,J,J,J):- nth(J,List,Elt). bin_search_inner ( - Elt,List,B egin,End, Mid):-BeginElt,NewEnd is - Mid-1,bin_search_inner(Elt,Lis - ,Begin, NewEnd, Result ). - +{0} bin_search(Elt,Li{1}st,{0}Re +{0} sult):-length(List,N{1}), {0}bin_se +{0} arch_inner(Elt,List,1,N{1},Re{0}sult).bi +{0} n_search_inner(Elt,List,{1}J,J{0},J):-nth(J +{0} ,List,Elt).bin_search_inn{1}er({0}Elt,List,Be +{0} gin,End,M{1}id):-Begin{0} < End,{1}Mid{0} is (Begin+E +{0} nd) div 2{1},n({0}thMid,L{1}is{0}t,Elt){1}.bi{0}n_search_inn +{0} er(Elt,L{1}is{0}t,B{1}egin,{0}End{1},R{0}esul{1}t):{0}-Begin < End, +{0} Mid is ({1}De{0}gi{1}n+En{0}d) {1}d{0}i{1}v{0} 2,nt{1}h(M{0}id,List,MidEl +{0} t),MidEl{1}t<{0}El{1}t,NewBeg{0}i{1}n i{0}s M{1}id+{0}1,bin_search_ +{0} inner(El{1}t,L{0}ist{1},Ne{0}wBeg{1}in{0},End,{1}Result). bin{0}_se +{0} arch_inn{1}er(E{0}lt,List,{1}Be{0}gin,End{1},Result):-Be{0}gi +{0} nElt,NewEnd is Mid-1,b +{0} in_s{1}ear{0}ch_inner(Elt,List,Begin,NewEn +{0} d,R{1}esu{0}lt).n_factorial(0,1).n_fact +{0} o{1}ria{0}l(N,F):-N #>0,N1#=N-1,n_f +{0} {1}ac{0}torial(N1,F1),F#=N *F1. diff --git a/src/language.rs b/src/language.rs index 367523711..f8a13b241 100644 --- a/src/language.rs +++ b/src/language.rs @@ -175,7 +175,7 @@ impl Language { Language::ObjectiveC => include_str!("../resources/objectivec.ascii"), Language::Perl => include_str!("../resources/perl.ascii"), Language::Php => include_str!("../resources/php.ascii"), - Language::Prolog => include_str!("../resource/prolog.ascii"), + Language::Prolog => include_str!("../resources/prolog.ascii"), Language::PureScript => include_str!("../resources/purescript.ascii"), Language::Python => include_str!("../resources/python.ascii"), Language::R => include_str!("../resources/r.ascii"), @@ -222,7 +222,7 @@ impl Language { Language::ObjectiveC => vec![Color::BrightBlue, Color::Blue], Language::Perl => vec![Color::BrightBlue], Language::Php => vec![Color::BrightWhite], - Language::Prolog => vec![Color::White], + Language::Prolog => vec![Color::Blue, Color::Red], Language::PureScript => vec![Color::White], Language::Python => vec![Color::Blue, Color::Yellow], Language::R => vec![Color::White, Color::Blue],