forked from schierlm/Oberon2013Modifications
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Script.Tool.txt
88 lines (76 loc) · 2.84 KB
/
Script.Tool.txt
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
Script.Run
|> Script.Collect
|> ScriptUtils.ExpectFailure 44 ScriptUtils.Fail 44
|> System.Watch
||
Script.GoTo SomeLabel
Script.RunFile @ ~
Script.RunFile Example.Script ~
Script.RunFile Example.Script StartLabel ~
ScriptUtils.ClearLog
ScriptUtils.WriteLog "Hello"
ScriptUtils.WriteLog 3 "After three newlines"
ScriptUtils.WriteLog \ "No newline at end"
ScriptUtils.WriteLog * "Scrolling to new log message"
ScriptUtils.WriteLogRaw "This log message can be really long and also contain formatting
or even line breaks"
ScriptUtils.WriteLogRaw /You can use "different" separator characters, any non-space will work/
ScriptUtils.SortLines Example.Text
ScriptUtils.SortLines @
ScriptUtils.SortLines \ 5 @
ScriptUtils.SortLines \ # " " 4 @ (* files/modules *)
ScriptVars.Set Greeting "Hello, World!"
ScriptVars.ShowCopy ^
ScriptVars.ShowLive Greeting
ScriptVars.ShowCopy Greeting 7 -2 (* mark "World" *)
ScriptVars.SetChars Newline 13 ~
ScriptVars.SetRaw LongGreeting /I want to say hello to everybody in the whole world!/
ScriptVars.Load Sample "System.Tool"
ScriptVars.Store LongGreeting "Greeting.Text"
ScriptVars.Insert Greeting " again" 5
ScriptVars.Cut Trash Greeting 5 11
ScriptVars.Copy Place Greeting 7 -2
ScriptVars.Length Len Greeting
ScriptVars.CharCodeAt ExclamationMark Greeting -2
ScriptVars.Find Position Greeting 0 "orl"
ScriptVars.Replace Greeting 0 "o" 99 "u"
ScriptVars.CaptureLog Greeting ScriptUtils.WriteLog "Indirect Hello" ~
ScriptVars.CaptureError Answer ScriptUtils.Fail 42
System.Directory *.Bak
ScriptVars.CaptureViewer BakFiles - "System.Directory"
ScriptVars.Compare Len > 7 + ScriptUtils.WriteLog "Greeting is longer than 7"
ScriptVars.Expand ScriptUtils.WriteLogRaw 'The greeting is for %Place% and %Len% long %Newline%' %~
ScriptVars.ExpandLog ScriptUtils.WriteLog "%Greeting% (100%%)" %~
Script.Run
|> System.Directory *.Bak ~
|> ScriptVars.CaptureViewer FileList - "System.Directory" ~
|> ScriptVars.Expand System.DeleteFiles %FileList% ~ %~
||
Script.Run
|> RebuildToolBuilder.Build ~
|> ScriptVars.CaptureViewer Cmds - "Rebuild.Tool" ~
|> ScriptVars.SetChars NL 13 ~
:Loop|> ScriptVars.Find Pos Cmds 0 NL ~
|> ScriptVars.Compare Pos # 0 - Script.GoTo Done ~
|> ScriptVars.Cut Cmd Cmds 0 Pos ~
|> ScriptVars.Cut Trash Cmds 0 1 ~
|> ScriptVars.Expand %Cmd% %~
|> Script.Collect
|> Script.GoTo Loop ~
:Done|> ScriptUtils.WriteLog "Everything recompiled!" ~
||
Script.Run
|> RebuildToolBuilder.Build ~
|> ScriptVars.CaptureViewer Cmds - "Rebuild.Tool" ~
|> ScriptVars.SetChars NL 13 ~
|> ScriptBlocks.Begin
|> ScriptVars.Find Pos Cmds 0 NL ~
|> ScriptBlocks.If ScriptVars.Compare Pos # 0 - ScriptUtils.Fail 1 ~
|> ScriptVars.Cut Cmd Cmds 0 Pos ~
|> ScriptVars.Cut Trash Cmds 0 1 ~
|> ScriptVars.Expand %Cmd% %~
|> Script.Collect
|> ScriptBlocks.Again
|> ScriptBlocks.End
|> ScriptUtils.WriteLog "Everything recompiled!" ~
||