-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCSSHelper.fs
More file actions
130 lines (113 loc) · 3.55 KB
/
CSSHelper.fs
File metadata and controls
130 lines (113 loc) · 3.55 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
[<AutoOpen>]
module Failess.CSS
open System
open System.IO
open System.Text.RegularExpressions
(* F# Operators Priority Table:
|,',',||,&,&&,< op, >op, =, |op, &op,&&& , |||, ^^^, ~~~,
<<<, >>>,^ op,::,- op, +op, (binary),* op, /op, %op,** op,
prefix operators (+op, -op, %, %%, &, &&, !op, ~op) *)
let prediction =
String.Format(
"""/*--------------------------------------------*/
/* This file is generated with Failess {0} */
/*--------------------------------------------*/
""", failessVersion)
let inline (~+.) st =
match st with
| [] -> ""
| [ _ ] -> sprintf " { %s }" st.Head
| _ ->
let pars =
[for s in st ->
sprintf "%s%s"
<| tab
<| s]
sprintf " {%s%s%s%s}"
<| System.Environment.NewLine
<| String.Join(System.Environment.NewLine, pars)
<| System.Environment.NewLine
<| tab
let inline (@) el st =
sprintf "%s { %s }" el st
let inline (-|) el st =
sprintf "%s%s"
<| el
<| +. st
let inline (@@) el st =
match el with
| [] -> ""
| [ _ ] -> el.Head @ st
| _ -> String.Join(", ", el) @ st
let inline (=|) el st =
match el with
| [] -> ""
| [ _ ] -> el.Head -| st
| _ -> String.Join(", ", el) -| st
let inline (--) el st =
sprintf "%s: %s;"
<| el
<| st.ToString()
let inline (-/) el st =
sprintf "%s: %s;"
<| el
<| String.Join(" ", (st : string list))
let inline (-+) el st =
sprintf "%s: %s;"
<| el
<| String.Join(", ", (st : string list))
let inline (%) el p =
sprintf "%s:%s" el p
let inline (~%) a = sprintf ":%s" a
(* override here T_T *)
let inline (-.) el p =
sprintf "%s.%s" el p
let inline (~-.) a = sprintf ".%s" a
let inline (~+) a = sprintf " %s" a
let inline ($) a b = sprintf "%s, %s" a b
(* . operators *)
let inline (.>) a b = sprintf "%s > %s" a b
let inline (.<) a b = sprintf "%s < %s" a b
let inline (><) a b = sprintf "%s*%s" a b
let inline (<<) el els =
let tree str =
let lines =
[for line in Regex.Split(str, "\r\n") ->
match line with
| line when line.StartsWith(tab) -> line
| _ -> el + line]
String.Join(System.Environment.NewLine, lines)
let fall = [for e : string in els ->
match e with
| e when e.Contains("*") ->
let ells = e.Split('*')
String.Join(", ",
[for ell in ells ->
tree ell])
| _ -> tree e]
String.Join(System.Environment.NewLine, fall)
let SS triller =
let plaincss =
triller
|> Seq.map(fun str ->
match pasteNewLine with
| false -> s str
| true -> sprintf "%s%s"
<| System.Environment.NewLine
<| s str)
match obfuscation with
| true -> obfuscate plaincss
| false -> String.Join(System.Environment.NewLine, plaincss)
exception InnerError of string
let CSS file triller =
if File.Exists file then
File.WriteAllText(file, (prediction + ( SS triller )))
else
printfn "file %s doesn't exists, create it? (Y/N)" file
let rec checkA() =
match Console.ReadLine() with
| "Y" -> File.WriteAllText(file, (prediction + ( SS triller )))
| "N" -> ()
| _ -> printfn "what?"; checkA()
checkA()
let CSSS triller = CSS "site.css" triller