-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrepl_imports.go
2531 lines (2406 loc) · 120 KB
/
repl_imports.go
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// starting import: "github.com/rocky/go-fish"
package repl
import (
"bufio"
"bytes"
"code.google.com/p/go-columnize"
"encoding/binary"
"errors"
"flag"
"fmt"
"github.com/0xfaded/reflectext"
"github.com/mgutz/ansi"
"github.com/rocky/eval"
"go/ast"
"go/parser"
"go/scanner"
"go/token"
"io"
"io/ioutil"
"log"
"math"
"math/big"
"math/rand"
"os"
"os/exec"
"path/filepath"
"reflect"
"regexp"
"regexp/syntax"
"runtime"
"runtime/pprof"
"sort"
"strconv"
"strings"
"sync"
"sync/atomic"
"syscall"
"testing"
"text/tabwriter"
"time"
"unicode"
"unicode/utf8"
)
// EvalEnvironment adds to eval.Env those packages included
// with import "github.com/rocky/go-fish".
func EvalEnvironment() *eval.SimpleEnv {
var consts map[string] reflect.Value
var vars map[string] reflect.Value
var types map[string] reflect.Type
var funcs map[string] reflect.Value
var pkgs map[string] eval.Env = make(map[string] eval.Env)
consts = make(map[string] reflect.Value)
consts["MaxScanTokenSize"] = reflect.ValueOf(bufio.MaxScanTokenSize)
funcs = make(map[string] reflect.Value)
funcs["NewReaderSize"] = reflect.ValueOf(bufio.NewReaderSize)
funcs["NewReader"] = reflect.ValueOf(bufio.NewReader)
funcs["NewWriterSize"] = reflect.ValueOf(bufio.NewWriterSize)
funcs["NewWriter"] = reflect.ValueOf(bufio.NewWriter)
funcs["NewReadWriter"] = reflect.ValueOf(bufio.NewReadWriter)
funcs["NewScanner"] = reflect.ValueOf(bufio.NewScanner)
funcs["ScanBytes"] = reflect.ValueOf(bufio.ScanBytes)
funcs["ScanRunes"] = reflect.ValueOf(bufio.ScanRunes)
funcs["ScanLines"] = reflect.ValueOf(bufio.ScanLines)
funcs["ScanWords"] = reflect.ValueOf(bufio.ScanWords)
types = make(map[string] reflect.Type)
types["Reader"] = reflect.TypeOf(new(bufio.Reader)).Elem()
types["Writer"] = reflect.TypeOf(new(bufio.Writer)).Elem()
types["ReadWriter"] = reflect.TypeOf(new(bufio.ReadWriter)).Elem()
types["Scanner"] = reflect.TypeOf(new(bufio.Scanner)).Elem()
types["SplitFunc"] = reflect.TypeOf(new(bufio.SplitFunc)).Elem()
vars = make(map[string] reflect.Value)
vars["ErrInvalidUnreadByte"] = reflect.ValueOf(&bufio.ErrInvalidUnreadByte)
vars["ErrInvalidUnreadRune"] = reflect.ValueOf(&bufio.ErrInvalidUnreadRune)
vars["ErrBufferFull"] = reflect.ValueOf(&bufio.ErrBufferFull)
vars["ErrNegativeCount"] = reflect.ValueOf(&bufio.ErrNegativeCount)
vars["ErrTooLong"] = reflect.ValueOf(&bufio.ErrTooLong)
vars["ErrNegativeAdvance"] = reflect.ValueOf(&bufio.ErrNegativeAdvance)
vars["ErrAdvanceTooFar"] = reflect.ValueOf(&bufio.ErrAdvanceTooFar)
pkgs["bufio"] = &eval.SimpleEnv {
Consts: consts,
Funcs: funcs,
Types: types,
Vars: vars,
Pkgs: pkgs,
}
consts = make(map[string] reflect.Value)
consts["MinRead"] = reflect.ValueOf(bytes.MinRead)
funcs = make(map[string] reflect.Value)
funcs["NewBuffer"] = reflect.ValueOf(bytes.NewBuffer)
funcs["NewBufferString"] = reflect.ValueOf(bytes.NewBufferString)
funcs["Count"] = reflect.ValueOf(bytes.Count)
funcs["Contains"] = reflect.ValueOf(bytes.Contains)
funcs["Index"] = reflect.ValueOf(bytes.Index)
funcs["LastIndex"] = reflect.ValueOf(bytes.LastIndex)
funcs["IndexRune"] = reflect.ValueOf(bytes.IndexRune)
funcs["IndexAny"] = reflect.ValueOf(bytes.IndexAny)
funcs["LastIndexAny"] = reflect.ValueOf(bytes.LastIndexAny)
funcs["SplitN"] = reflect.ValueOf(bytes.SplitN)
funcs["SplitAfterN"] = reflect.ValueOf(bytes.SplitAfterN)
funcs["Split"] = reflect.ValueOf(bytes.Split)
funcs["SplitAfter"] = reflect.ValueOf(bytes.SplitAfter)
funcs["Fields"] = reflect.ValueOf(bytes.Fields)
funcs["FieldsFunc"] = reflect.ValueOf(bytes.FieldsFunc)
funcs["Join"] = reflect.ValueOf(bytes.Join)
funcs["HasPrefix"] = reflect.ValueOf(bytes.HasPrefix)
funcs["HasSuffix"] = reflect.ValueOf(bytes.HasSuffix)
funcs["Map"] = reflect.ValueOf(bytes.Map)
funcs["Repeat"] = reflect.ValueOf(bytes.Repeat)
funcs["ToUpper"] = reflect.ValueOf(bytes.ToUpper)
funcs["ToLower"] = reflect.ValueOf(bytes.ToLower)
funcs["ToTitle"] = reflect.ValueOf(bytes.ToTitle)
funcs["ToUpperSpecial"] = reflect.ValueOf(bytes.ToUpperSpecial)
funcs["ToLowerSpecial"] = reflect.ValueOf(bytes.ToLowerSpecial)
funcs["ToTitleSpecial"] = reflect.ValueOf(bytes.ToTitleSpecial)
funcs["Title"] = reflect.ValueOf(bytes.Title)
funcs["TrimLeftFunc"] = reflect.ValueOf(bytes.TrimLeftFunc)
funcs["TrimRightFunc"] = reflect.ValueOf(bytes.TrimRightFunc)
funcs["TrimFunc"] = reflect.ValueOf(bytes.TrimFunc)
funcs["TrimPrefix"] = reflect.ValueOf(bytes.TrimPrefix)
funcs["TrimSuffix"] = reflect.ValueOf(bytes.TrimSuffix)
funcs["IndexFunc"] = reflect.ValueOf(bytes.IndexFunc)
funcs["LastIndexFunc"] = reflect.ValueOf(bytes.LastIndexFunc)
funcs["Trim"] = reflect.ValueOf(bytes.Trim)
funcs["TrimLeft"] = reflect.ValueOf(bytes.TrimLeft)
funcs["TrimRight"] = reflect.ValueOf(bytes.TrimRight)
funcs["TrimSpace"] = reflect.ValueOf(bytes.TrimSpace)
funcs["Runes"] = reflect.ValueOf(bytes.Runes)
funcs["Replace"] = reflect.ValueOf(bytes.Replace)
funcs["EqualFold"] = reflect.ValueOf(bytes.EqualFold)
funcs["IndexByte"] = reflect.ValueOf(bytes.IndexByte)
funcs["Equal"] = reflect.ValueOf(bytes.Equal)
funcs["Compare"] = reflect.ValueOf(bytes.Compare)
funcs["NewReader"] = reflect.ValueOf(bytes.NewReader)
types = make(map[string] reflect.Type)
types["Buffer"] = reflect.TypeOf(new(bytes.Buffer)).Elem()
types["Reader"] = reflect.TypeOf(new(bytes.Reader)).Elem()
vars = make(map[string] reflect.Value)
vars["ErrTooLarge"] = reflect.ValueOf(&bytes.ErrTooLarge)
pkgs["bytes"] = &eval.SimpleEnv {
Consts: consts,
Funcs: funcs,
Types: types,
Vars: vars,
Pkgs: pkgs,
}
consts = make(map[string] reflect.Value)
consts["VERSION"] = reflect.ValueOf(columnize.VERSION)
funcs = make(map[string] reflect.Value)
funcs["DefaultOptions"] = reflect.ValueOf(columnize.DefaultOptions)
funcs["SetOptions"] = reflect.ValueOf(columnize.SetOptions)
funcs["CellSize"] = reflect.ValueOf(columnize.CellSize)
funcs["ToStringSliceFromIndexable"] = reflect.ValueOf(columnize.ToStringSliceFromIndexable)
funcs["ToStringSlice"] = reflect.ValueOf(columnize.ToStringSlice)
funcs["Columnize"] = reflect.ValueOf(columnize.Columnize)
funcs["ColumnizeS"] = reflect.ValueOf(columnize.ColumnizeS)
types = make(map[string] reflect.Type)
types["Opts_t"] = reflect.TypeOf(new(columnize.Opts_t)).Elem()
types["KeyValuePair_t"] = reflect.TypeOf(new(columnize.KeyValuePair_t)).Elem()
vars = make(map[string] reflect.Value)
pkgs["columnize"] = &eval.SimpleEnv {
Consts: consts,
Funcs: funcs,
Types: types,
Vars: vars,
Pkgs: pkgs,
}
consts = make(map[string] reflect.Value)
consts["MaxVarintLen16"] = reflect.ValueOf(binary.MaxVarintLen16)
consts["MaxVarintLen32"] = reflect.ValueOf(binary.MaxVarintLen32)
consts["MaxVarintLen64"] = reflect.ValueOf(binary.MaxVarintLen64)
funcs = make(map[string] reflect.Value)
funcs["Read"] = reflect.ValueOf(binary.Read)
funcs["Write"] = reflect.ValueOf(binary.Write)
funcs["Size"] = reflect.ValueOf(binary.Size)
funcs["PutUvarint"] = reflect.ValueOf(binary.PutUvarint)
funcs["Uvarint"] = reflect.ValueOf(binary.Uvarint)
funcs["PutVarint"] = reflect.ValueOf(binary.PutVarint)
funcs["Varint"] = reflect.ValueOf(binary.Varint)
funcs["ReadUvarint"] = reflect.ValueOf(binary.ReadUvarint)
funcs["ReadVarint"] = reflect.ValueOf(binary.ReadVarint)
types = make(map[string] reflect.Type)
types["ByteOrder"] = reflect.TypeOf(new(binary.ByteOrder)).Elem()
vars = make(map[string] reflect.Value)
vars["LittleEndian"] = reflect.ValueOf(&binary.LittleEndian)
vars["BigEndian"] = reflect.ValueOf(&binary.BigEndian)
pkgs["binary"] = &eval.SimpleEnv {
Consts: consts,
Funcs: funcs,
Types: types,
Vars: vars,
Pkgs: pkgs,
}
consts = make(map[string] reflect.Value)
funcs = make(map[string] reflect.Value)
funcs["New"] = reflect.ValueOf(errors.New)
types = make(map[string] reflect.Type)
vars = make(map[string] reflect.Value)
pkgs["errors"] = &eval.SimpleEnv {
Consts: consts,
Funcs: funcs,
Types: types,
Vars: vars,
Pkgs: pkgs,
}
consts = make(map[string] reflect.Value)
consts["ContinueOnError"] = reflect.ValueOf(flag.ContinueOnError)
consts["ExitOnError"] = reflect.ValueOf(flag.ExitOnError)
consts["PanicOnError"] = reflect.ValueOf(flag.PanicOnError)
funcs = make(map[string] reflect.Value)
funcs["VisitAll"] = reflect.ValueOf(flag.VisitAll)
funcs["Visit"] = reflect.ValueOf(flag.Visit)
funcs["Lookup"] = reflect.ValueOf(flag.Lookup)
funcs["Set"] = reflect.ValueOf(flag.Set)
funcs["PrintDefaults"] = reflect.ValueOf(flag.PrintDefaults)
funcs["NFlag"] = reflect.ValueOf(flag.NFlag)
funcs["Arg"] = reflect.ValueOf(flag.Arg)
funcs["NArg"] = reflect.ValueOf(flag.NArg)
funcs["Args"] = reflect.ValueOf(flag.Args)
funcs["BoolVar"] = reflect.ValueOf(flag.BoolVar)
funcs["Bool"] = reflect.ValueOf(flag.Bool)
funcs["IntVar"] = reflect.ValueOf(flag.IntVar)
funcs["Int"] = reflect.ValueOf(flag.Int)
funcs["Int64Var"] = reflect.ValueOf(flag.Int64Var)
funcs["Int64"] = reflect.ValueOf(flag.Int64)
funcs["UintVar"] = reflect.ValueOf(flag.UintVar)
funcs["Uint"] = reflect.ValueOf(flag.Uint)
funcs["Uint64Var"] = reflect.ValueOf(flag.Uint64Var)
funcs["Uint64"] = reflect.ValueOf(flag.Uint64)
funcs["StringVar"] = reflect.ValueOf(flag.StringVar)
funcs["String"] = reflect.ValueOf(flag.String)
funcs["Float64Var"] = reflect.ValueOf(flag.Float64Var)
funcs["Float64"] = reflect.ValueOf(flag.Float64)
funcs["DurationVar"] = reflect.ValueOf(flag.DurationVar)
funcs["Duration"] = reflect.ValueOf(flag.Duration)
funcs["Var"] = reflect.ValueOf(flag.Var)
funcs["Parse"] = reflect.ValueOf(flag.Parse)
funcs["Parsed"] = reflect.ValueOf(flag.Parsed)
funcs["NewFlagSet"] = reflect.ValueOf(flag.NewFlagSet)
types = make(map[string] reflect.Type)
types["Value"] = reflect.TypeOf(new(flag.Value)).Elem()
types["Getter"] = reflect.TypeOf(new(flag.Getter)).Elem()
types["ErrorHandling"] = reflect.TypeOf(new(flag.ErrorHandling)).Elem()
types["FlagSet"] = reflect.TypeOf(new(flag.FlagSet)).Elem()
types["Flag"] = reflect.TypeOf(new(flag.Flag)).Elem()
vars = make(map[string] reflect.Value)
vars["ErrHelp"] = reflect.ValueOf(&flag.ErrHelp)
vars["Usage"] = reflect.ValueOf(&flag.Usage)
vars["CommandLine"] = reflect.ValueOf(&flag.CommandLine)
pkgs["flag"] = &eval.SimpleEnv {
Consts: consts,
Funcs: funcs,
Types: types,
Vars: vars,
Pkgs: pkgs,
}
consts = make(map[string] reflect.Value)
funcs = make(map[string] reflect.Value)
funcs["Fprintf"] = reflect.ValueOf(fmt.Fprintf)
funcs["Printf"] = reflect.ValueOf(fmt.Printf)
funcs["Sprintf"] = reflect.ValueOf(fmt.Sprintf)
funcs["Errorf"] = reflect.ValueOf(fmt.Errorf)
funcs["Fprint"] = reflect.ValueOf(fmt.Fprint)
funcs["Print"] = reflect.ValueOf(fmt.Print)
funcs["Sprint"] = reflect.ValueOf(fmt.Sprint)
funcs["Fprintln"] = reflect.ValueOf(fmt.Fprintln)
funcs["Println"] = reflect.ValueOf(fmt.Println)
funcs["Sprintln"] = reflect.ValueOf(fmt.Sprintln)
funcs["Scan"] = reflect.ValueOf(fmt.Scan)
funcs["Scanln"] = reflect.ValueOf(fmt.Scanln)
funcs["Scanf"] = reflect.ValueOf(fmt.Scanf)
funcs["Sscan"] = reflect.ValueOf(fmt.Sscan)
funcs["Sscanln"] = reflect.ValueOf(fmt.Sscanln)
funcs["Sscanf"] = reflect.ValueOf(fmt.Sscanf)
funcs["Fscan"] = reflect.ValueOf(fmt.Fscan)
funcs["Fscanln"] = reflect.ValueOf(fmt.Fscanln)
funcs["Fscanf"] = reflect.ValueOf(fmt.Fscanf)
types = make(map[string] reflect.Type)
types["State"] = reflect.TypeOf(new(fmt.State)).Elem()
types["Formatter"] = reflect.TypeOf(new(fmt.Formatter)).Elem()
types["Stringer"] = reflect.TypeOf(new(fmt.Stringer)).Elem()
types["GoStringer"] = reflect.TypeOf(new(fmt.GoStringer)).Elem()
types["ScanState"] = reflect.TypeOf(new(fmt.ScanState)).Elem()
types["Scanner"] = reflect.TypeOf(new(fmt.Scanner)).Elem()
vars = make(map[string] reflect.Value)
pkgs["fmt"] = &eval.SimpleEnv {
Consts: consts,
Funcs: funcs,
Types: types,
Vars: vars,
Pkgs: pkgs,
}
consts = make(map[string] reflect.Value)
funcs = make(map[string] reflect.Value)
funcs["FuncOf"] = reflect.ValueOf(reflectext.FuncOf)
funcs["InterfaceOf"] = reflect.ValueOf(reflectext.InterfaceOf)
funcs["StructOf"] = reflect.ValueOf(reflectext.StructOf)
funcs["ArrayOf"] = reflect.ValueOf(reflectext.ArrayOf)
funcs["Name"] = reflect.ValueOf(reflectext.Name)
types = make(map[string] reflect.Type)
vars = make(map[string] reflect.Value)
vars["Available"] = reflect.ValueOf(&reflectext.Available)
pkgs["reflectext"] = &eval.SimpleEnv {
Consts: consts,
Funcs: funcs,
Types: types,
Vars: vars,
Pkgs: pkgs,
}
consts = make(map[string] reflect.Value)
consts["Reset"] = reflect.ValueOf(ansi.Reset)
funcs = make(map[string] reflect.Value)
funcs["ColorCode"] = reflect.ValueOf(ansi.ColorCode)
funcs["Color"] = reflect.ValueOf(ansi.Color)
funcs["ColorFunc"] = reflect.ValueOf(ansi.ColorFunc)
funcs["DisableColors"] = reflect.ValueOf(ansi.DisableColors)
types = make(map[string] reflect.Type)
vars = make(map[string] reflect.Value)
pkgs["ansi"] = &eval.SimpleEnv {
Consts: consts,
Funcs: funcs,
Types: types,
Vars: vars,
Pkgs: pkgs,
}
consts = make(map[string] reflect.Value)
consts["EnvUnknown"] = reflect.ValueOf(eval.EnvUnknown)
consts["EnvVar"] = reflect.ValueOf(eval.EnvVar)
consts["EnvFunc"] = reflect.ValueOf(eval.EnvFunc)
consts["EnvConst"] = reflect.ValueOf(eval.EnvConst)
funcs = make(map[string] reflect.Value)
funcs["ConstValueOf"] = reflect.ValueOf(eval.ConstValueOf)
funcs["SetCheckIdent"] = reflect.ValueOf(eval.SetCheckIdent)
funcs["SetEvalIdent"] = reflect.ValueOf(eval.SetEvalIdent)
funcs["SetCheckSelectorExpr"] = reflect.ValueOf(eval.SetCheckSelectorExpr)
funcs["SetEvalSelectorExpr"] = reflect.ValueOf(eval.SetEvalSelectorExpr)
funcs["CheckExpr"] = reflect.ValueOf(eval.CheckExpr)
funcs["CheckIdent"] = reflect.ValueOf(eval.CheckIdent)
funcs["CheckSelectorExpr"] = reflect.ValueOf(eval.CheckSelectorExpr)
funcs["CheckStmt"] = reflect.ValueOf(eval.CheckStmt)
funcs["NewConstInteger"] = reflect.ValueOf(eval.NewConstInteger)
funcs["NewConstFloat"] = reflect.ValueOf(eval.NewConstFloat)
funcs["NewConstImag"] = reflect.ValueOf(eval.NewConstImag)
funcs["NewConstRune"] = reflect.ValueOf(eval.NewConstRune)
funcs["NewConstInt64"] = reflect.ValueOf(eval.NewConstInt64)
funcs["NewConstUint64"] = reflect.ValueOf(eval.NewConstUint64)
funcs["NewConstFloat64"] = reflect.ValueOf(eval.NewConstFloat64)
funcs["NewConstComplex128"] = reflect.ValueOf(eval.NewConstComplex128)
funcs["MakeSimpleEnv"] = reflect.ValueOf(eval.MakeSimpleEnv)
funcs["Eval"] = reflect.ValueOf(eval.Eval)
funcs["EvalEnv"] = reflect.ValueOf(eval.EvalEnv)
funcs["Interpret"] = reflect.ValueOf(eval.Interpret)
funcs["ParseStmt"] = reflect.ValueOf(eval.ParseStmt)
funcs["EvalExpr"] = reflect.ValueOf(eval.EvalExpr)
funcs["EvalIdent"] = reflect.ValueOf(eval.EvalIdent)
funcs["EvalSelectorExpr"] = reflect.ValueOf(eval.EvalSelectorExpr)
funcs["Inspect"] = reflect.ValueOf(eval.Inspect)
funcs["InspectShort"] = reflect.ValueOf(eval.InspectShort)
funcs["InterpStmt"] = reflect.ValueOf(eval.InterpStmt)
funcs["FormatErrorPos"] = reflect.ValueOf(eval.FormatErrorPos)
types = make(map[string] reflect.Type)
types["Expr"] = reflect.TypeOf(new(eval.Expr)).Elem()
types["Stmt"] = reflect.TypeOf(new(eval.Stmt)).Elem()
types["BadExpr"] = reflect.TypeOf(new(eval.BadExpr)).Elem()
types["Ident"] = reflect.TypeOf(new(eval.Ident)).Elem()
types["Ellipsis"] = reflect.TypeOf(new(eval.Ellipsis)).Elem()
types["BasicLit"] = reflect.TypeOf(new(eval.BasicLit)).Elem()
types["FuncLit"] = reflect.TypeOf(new(eval.FuncLit)).Elem()
types["CompositeLit"] = reflect.TypeOf(new(eval.CompositeLit)).Elem()
types["ParenExpr"] = reflect.TypeOf(new(eval.ParenExpr)).Elem()
types["SelectorExpr"] = reflect.TypeOf(new(eval.SelectorExpr)).Elem()
types["IndexExpr"] = reflect.TypeOf(new(eval.IndexExpr)).Elem()
types["SliceExpr"] = reflect.TypeOf(new(eval.SliceExpr)).Elem()
types["TypeAssertExpr"] = reflect.TypeOf(new(eval.TypeAssertExpr)).Elem()
types["CallExpr"] = reflect.TypeOf(new(eval.CallExpr)).Elem()
types["StarExpr"] = reflect.TypeOf(new(eval.StarExpr)).Elem()
types["UnaryExpr"] = reflect.TypeOf(new(eval.UnaryExpr)).Elem()
types["BinaryExpr"] = reflect.TypeOf(new(eval.BinaryExpr)).Elem()
types["KeyValueExpr"] = reflect.TypeOf(new(eval.KeyValueExpr)).Elem()
types["ArrayType"] = reflect.TypeOf(new(eval.ArrayType)).Elem()
types["StructType"] = reflect.TypeOf(new(eval.StructType)).Elem()
types["FuncType"] = reflect.TypeOf(new(eval.FuncType)).Elem()
types["InterfaceType"] = reflect.TypeOf(new(eval.InterfaceType)).Elem()
types["MapType"] = reflect.TypeOf(new(eval.MapType)).Elem()
types["ChanType"] = reflect.TypeOf(new(eval.ChanType)).Elem()
types["Field"] = reflect.TypeOf(new(eval.Field)).Elem()
types["FieldList"] = reflect.TypeOf(new(eval.FieldList)).Elem()
types["AssignStmt"] = reflect.TypeOf(new(eval.AssignStmt)).Elem()
types["BranchStmt"] = reflect.TypeOf(new(eval.BranchStmt)).Elem()
types["CaseClause"] = reflect.TypeOf(new(eval.CaseClause)).Elem()
types["BlockStmt"] = reflect.TypeOf(new(eval.BlockStmt)).Elem()
types["EmptyStmt"] = reflect.TypeOf(new(eval.EmptyStmt)).Elem()
types["ExprStmt"] = reflect.TypeOf(new(eval.ExprStmt)).Elem()
types["IfStmt"] = reflect.TypeOf(new(eval.IfStmt)).Elem()
types["LabeledStmt"] = reflect.TypeOf(new(eval.LabeledStmt)).Elem()
types["ForStmt"] = reflect.TypeOf(new(eval.ForStmt)).Elem()
types["ReturnStmt"] = reflect.TypeOf(new(eval.ReturnStmt)).Elem()
types["SwitchStmt"] = reflect.TypeOf(new(eval.SwitchStmt)).Elem()
types["TypeSwitchStmt"] = reflect.TypeOf(new(eval.TypeSwitchStmt)).Elem()
types["BigComplex"] = reflect.TypeOf(new(eval.BigComplex)).Elem()
types["Byte"] = reflect.TypeOf(new(eval.Byte)).Elem()
types["CheckIdentFn"] = reflect.TypeOf(new(eval.CheckIdentFn)).Elem()
types["EvalIdentFn"] = reflect.TypeOf(new(eval.EvalIdentFn)).Elem()
types["CheckSelectorExprFn"] = reflect.TypeOf(new(eval.CheckSelectorExprFn)).Elem()
types["EvalSelectorExprFn"] = reflect.TypeOf(new(eval.EvalSelectorExprFn)).Elem()
types["ConstNumber"] = reflect.TypeOf(new(eval.ConstNumber)).Elem()
types["ConstType"] = reflect.TypeOf(new(eval.ConstType)).Elem()
types["ConstIntType"] = reflect.TypeOf(new(eval.ConstIntType)).Elem()
types["ConstShiftedIntType"] = reflect.TypeOf(new(eval.ConstShiftedIntType)).Elem()
types["ConstRuneType"] = reflect.TypeOf(new(eval.ConstRuneType)).Elem()
types["ConstFloatType"] = reflect.TypeOf(new(eval.ConstFloatType)).Elem()
types["ConstComplexType"] = reflect.TypeOf(new(eval.ConstComplexType)).Elem()
types["ConstStringType"] = reflect.TypeOf(new(eval.ConstStringType)).Elem()
types["ConstNilType"] = reflect.TypeOf(new(eval.ConstNilType)).Elem()
types["ConstBoolType"] = reflect.TypeOf(new(eval.ConstBoolType)).Elem()
types["EnvSource"] = reflect.TypeOf(new(eval.EnvSource)).Elem()
types["Env"] = reflect.TypeOf(new(eval.Env)).Elem()
types["SimpleEnv"] = reflect.TypeOf(new(eval.SimpleEnv)).Elem()
types["ErrBadBasicLit"] = reflect.TypeOf(new(eval.ErrBadBasicLit)).Elem()
types["ErrUndefined"] = reflect.TypeOf(new(eval.ErrUndefined)).Elem()
types["ErrInvalidIndirect"] = reflect.TypeOf(new(eval.ErrInvalidIndirect)).Elem()
types["ErrUndefinedFieldOrMethod"] = reflect.TypeOf(new(eval.ErrUndefinedFieldOrMethod)).Elem()
types["ErrCallNonFuncType"] = reflect.TypeOf(new(eval.ErrCallNonFuncType)).Elem()
types["ErrDuplicateArg"] = reflect.TypeOf(new(eval.ErrDuplicateArg)).Elem()
types["ErrBadReturnValue"] = reflect.TypeOf(new(eval.ErrBadReturnValue)).Elem()
types["ErrWrongNumberOfReturnValues"] = reflect.TypeOf(new(eval.ErrWrongNumberOfReturnValues)).Elem()
types["ErrWrongNumberOfArgs"] = reflect.TypeOf(new(eval.ErrWrongNumberOfArgs)).Elem()
types["ErrWrongArgType"] = reflect.TypeOf(new(eval.ErrWrongArgType)).Elem()
types["ErrInvalidEllipsisInCall"] = reflect.TypeOf(new(eval.ErrInvalidEllipsisInCall)).Elem()
types["ErrMissingValue"] = reflect.TypeOf(new(eval.ErrMissingValue)).Elem()
types["ErrMultiInSingleContext"] = reflect.TypeOf(new(eval.ErrMultiInSingleContext)).Elem()
types["ErrBadMapIndex"] = reflect.TypeOf(new(eval.ErrBadMapIndex)).Elem()
types["ErrNonIntegerIndex"] = reflect.TypeOf(new(eval.ErrNonIntegerIndex)).Elem()
types["ErrIndexOutOfBounds"] = reflect.TypeOf(new(eval.ErrIndexOutOfBounds)).Elem()
types["ErrInvalidIndexOperation"] = reflect.TypeOf(new(eval.ErrInvalidIndexOperation)).Elem()
types["ErrInvalidSliceIndex"] = reflect.TypeOf(new(eval.ErrInvalidSliceIndex)).Elem()
types["ErrInvalidSliceOperation"] = reflect.TypeOf(new(eval.ErrInvalidSliceOperation)).Elem()
types["ErrUnaddressableSliceOperand"] = reflect.TypeOf(new(eval.ErrUnaddressableSliceOperand)).Elem()
types["ErrInvalidIndex"] = reflect.TypeOf(new(eval.ErrInvalidIndex)).Elem()
types["ErrDivideByZero"] = reflect.TypeOf(new(eval.ErrDivideByZero)).Elem()
types["ErrInvalidBinaryOperation"] = reflect.TypeOf(new(eval.ErrInvalidBinaryOperation)).Elem()
types["ErrInvalidUnaryOperation"] = reflect.TypeOf(new(eval.ErrInvalidUnaryOperation)).Elem()
types["ErrInvalidAddressOf"] = reflect.TypeOf(new(eval.ErrInvalidAddressOf)).Elem()
types["ErrInvalidRecvFrom"] = reflect.TypeOf(new(eval.ErrInvalidRecvFrom)).Elem()
types["ErrBadConversion"] = reflect.TypeOf(new(eval.ErrBadConversion)).Elem()
types["ErrBadConstConversion"] = reflect.TypeOf(new(eval.ErrBadConstConversion)).Elem()
types["ErrTruncatedConstant"] = reflect.TypeOf(new(eval.ErrTruncatedConstant)).Elem()
types["ErrOverflowedConstant"] = reflect.TypeOf(new(eval.ErrOverflowedConstant)).Elem()
types["ErrUntypedNil"] = reflect.TypeOf(new(eval.ErrUntypedNil)).Elem()
types["ErrTypeUsedAsExpression"] = reflect.TypeOf(new(eval.ErrTypeUsedAsExpression)).Elem()
types["ErrUncomparableMapKey"] = reflect.TypeOf(new(eval.ErrUncomparableMapKey)).Elem()
types["ErrMissingMapKey"] = reflect.TypeOf(new(eval.ErrMissingMapKey)).Elem()
types["ErrBadMapKey"] = reflect.TypeOf(new(eval.ErrBadMapKey)).Elem()
types["ErrDuplicateMapKey"] = reflect.TypeOf(new(eval.ErrDuplicateMapKey)).Elem()
types["ErrBadMapValue"] = reflect.TypeOf(new(eval.ErrBadMapValue)).Elem()
types["ErrBadArrayKey"] = reflect.TypeOf(new(eval.ErrBadArrayKey)).Elem()
types["ErrArrayKeyOutOfBounds"] = reflect.TypeOf(new(eval.ErrArrayKeyOutOfBounds)).Elem()
types["ErrDuplicateArrayKey"] = reflect.TypeOf(new(eval.ErrDuplicateArrayKey)).Elem()
types["ErrBadArrayValue"] = reflect.TypeOf(new(eval.ErrBadArrayValue)).Elem()
types["ErrUnknownStructField"] = reflect.TypeOf(new(eval.ErrUnknownStructField)).Elem()
types["ErrInvalidStructField"] = reflect.TypeOf(new(eval.ErrInvalidStructField)).Elem()
types["ErrDuplicateStructField"] = reflect.TypeOf(new(eval.ErrDuplicateStructField)).Elem()
types["ErrMixedStructValues"] = reflect.TypeOf(new(eval.ErrMixedStructValues)).Elem()
types["ErrWrongNumberOfStructValues"] = reflect.TypeOf(new(eval.ErrWrongNumberOfStructValues)).Elem()
types["ErrMissingCompositeLitType"] = reflect.TypeOf(new(eval.ErrMissingCompositeLitType)).Elem()
types["ErrBadStructValue"] = reflect.TypeOf(new(eval.ErrBadStructValue)).Elem()
types["ErrInvalidTypeAssert"] = reflect.TypeOf(new(eval.ErrInvalidTypeAssert)).Elem()
types["ErrImpossibleTypeAssert"] = reflect.TypeOf(new(eval.ErrImpossibleTypeAssert)).Elem()
types["ErrBuiltinWrongNumberOfArgs"] = reflect.TypeOf(new(eval.ErrBuiltinWrongNumberOfArgs)).Elem()
types["ErrBuiltinWrongArgType"] = reflect.TypeOf(new(eval.ErrBuiltinWrongArgType)).Elem()
types["ErrBuiltinMismatchedArgs"] = reflect.TypeOf(new(eval.ErrBuiltinMismatchedArgs)).Elem()
types["ErrBuiltinNonTypeArg"] = reflect.TypeOf(new(eval.ErrBuiltinNonTypeArg)).Elem()
types["ErrBuiltinInvalidEllipsis"] = reflect.TypeOf(new(eval.ErrBuiltinInvalidEllipsis)).Elem()
types["ErrMakeBadType"] = reflect.TypeOf(new(eval.ErrMakeBadType)).Elem()
types["ErrMakeNonIntegerArg"] = reflect.TypeOf(new(eval.ErrMakeNonIntegerArg)).Elem()
types["ErrMakeLenGtrThanCap"] = reflect.TypeOf(new(eval.ErrMakeLenGtrThanCap)).Elem()
types["ErrAppendFirstArgNotSlice"] = reflect.TypeOf(new(eval.ErrAppendFirstArgNotSlice)).Elem()
types["ErrAppendFirstArgNotVariadic"] = reflect.TypeOf(new(eval.ErrAppendFirstArgNotVariadic)).Elem()
types["ErrCopyArgsMustBeSlices"] = reflect.TypeOf(new(eval.ErrCopyArgsMustBeSlices)).Elem()
types["ErrCopyArgsHaveDifferentEltTypes"] = reflect.TypeOf(new(eval.ErrCopyArgsHaveDifferentEltTypes)).Elem()
types["ErrDeleteFirstArgNotMap"] = reflect.TypeOf(new(eval.ErrDeleteFirstArgNotMap)).Elem()
types["ErrStupidShift"] = reflect.TypeOf(new(eval.ErrStupidShift)).Elem()
types["ErrNonNameInDeclaration"] = reflect.TypeOf(new(eval.ErrNonNameInDeclaration)).Elem()
types["ErrNoNewNamesInDeclaration"] = reflect.TypeOf(new(eval.ErrNoNewNamesInDeclaration)).Elem()
types["ErrCannotAssignToUnaddressable"] = reflect.TypeOf(new(eval.ErrCannotAssignToUnaddressable)).Elem()
types["ErrCannotAssignToType"] = reflect.TypeOf(new(eval.ErrCannotAssignToType)).Elem()
types["ErrAssignCountMismatch"] = reflect.TypeOf(new(eval.ErrAssignCountMismatch)).Elem()
types["ErrNonBoolCondition"] = reflect.TypeOf(new(eval.ErrNonBoolCondition)).Elem()
types["ErrInvalidCase"] = reflect.TypeOf(new(eval.ErrInvalidCase)).Elem()
types["ErrNonInterfaceTypeSwitch"] = reflect.TypeOf(new(eval.ErrNonInterfaceTypeSwitch)).Elem()
types["ErrImpossibleTypeCase"] = reflect.TypeOf(new(eval.ErrImpossibleTypeCase)).Elem()
types["State"] = reflect.TypeOf(new(eval.State)).Elem()
types["PanicUser"] = reflect.TypeOf(new(eval.PanicUser)).Elem()
types["PanicDivideByZero"] = reflect.TypeOf(new(eval.PanicDivideByZero)).Elem()
types["PanicInvalidDereference"] = reflect.TypeOf(new(eval.PanicInvalidDereference)).Elem()
types["PanicIndexOutOfBounds"] = reflect.TypeOf(new(eval.PanicIndexOutOfBounds)).Elem()
types["PanicSliceOutOfBounds"] = reflect.TypeOf(new(eval.PanicSliceOutOfBounds)).Elem()
types["PanicInterfaceConversion"] = reflect.TypeOf(new(eval.PanicInterfaceConversion)).Elem()
types["PanicUncomparableType"] = reflect.TypeOf(new(eval.PanicUncomparableType)).Elem()
types["PanicUnhashableType"] = reflect.TypeOf(new(eval.PanicUnhashableType)).Elem()
types["Rune"] = reflect.TypeOf(new(eval.Rune)).Elem()
types["UntypedNil"] = reflect.TypeOf(new(eval.UntypedNil)).Elem()
vars = make(map[string] reflect.Value)
vars["ByteType"] = reflect.ValueOf(&eval.ByteType)
vars["ConstInt"] = reflect.ValueOf(&eval.ConstInt)
vars["ConstShiftedInt"] = reflect.ValueOf(&eval.ConstShiftedInt)
vars["ConstRune"] = reflect.ValueOf(&eval.ConstRune)
vars["ConstFloat"] = reflect.ValueOf(&eval.ConstFloat)
vars["ConstComplex"] = reflect.ValueOf(&eval.ConstComplex)
vars["ConstString"] = reflect.ValueOf(&eval.ConstString)
vars["ConstNil"] = reflect.ValueOf(&eval.ConstNil)
vars["ConstBool"] = reflect.ValueOf(&eval.ConstBool)
vars["EvalNil"] = reflect.ValueOf(&eval.EvalNil)
vars["RuneType"] = reflect.ValueOf(&eval.RuneType)
pkgs["eval"] = &eval.SimpleEnv {
Consts: consts,
Funcs: funcs,
Types: types,
Vars: vars,
Pkgs: pkgs,
}
consts = make(map[string] reflect.Value)
funcs = make(map[string] reflect.Value)
funcs["AddAlias"] = reflect.ValueOf(AddAlias)
funcs["AddToCategory"] = reflect.ValueOf(AddToCategory)
funcs["LookupCmd"] = reflect.ValueOf(LookupCmd)
funcs["Errmsg"] = reflect.ValueOf(Errmsg)
funcs["MsgNoCr"] = reflect.ValueOf(MsgNoCr)
funcs["Msg"] = reflect.ValueOf(Msg)
funcs["Section"] = reflect.ValueOf(Section)
funcs["PrintSorted"] = reflect.ValueOf(PrintSorted)
funcs["HistoryFile"] = reflect.ValueOf(HistoryFile)
funcs["SimpleReadLine"] = reflect.ValueOf(SimpleReadLine)
funcs["SimpleInspect"] = reflect.ValueOf(SimpleInspect)
funcs["MakeEvalEnv"] = reflect.ValueOf(MakeEvalEnv)
funcs["REPL"] = reflect.ValueOf(REPL)
funcs["EvalEnvironment"] = reflect.ValueOf(EvalEnvironment)
funcs["AddSubCommand"] = reflect.ValueOf(AddSubCommand)
funcs["ListSubCommandArgs"] = reflect.ValueOf(ListSubCommandArgs)
funcs["HelpSubCommand"] = reflect.ValueOf(HelpSubCommand)
funcs["UnknownSubCommand"] = reflect.ValueOf(UnknownSubCommand)
funcs["SubcmdMgrCommand"] = reflect.ValueOf(SubcmdMgrCommand)
funcs["ArgCountOK"] = reflect.ValueOf(ArgCountOK)
funcs["GetInt"] = reflect.ValueOf(GetInt)
funcs["GetUInt"] = reflect.ValueOf(GetUInt)
types = make(map[string] reflect.Type)
types["CmdFunc"] = reflect.TypeOf(new(CmdFunc)).Elem()
types["CmdInfo"] = reflect.TypeOf(new(CmdInfo)).Elem()
types["ReadLineFnType"] = reflect.TypeOf(new(ReadLineFnType)).Elem()
types["InspectFnType"] = reflect.TypeOf(new(InspectFnType)).Elem()
types["SubcmdFunc"] = reflect.TypeOf(new(SubcmdFunc)).Elem()
types["SubcmdInfo"] = reflect.TypeOf(new(SubcmdInfo)).Elem()
types["SubcmdMap"] = reflect.TypeOf(new(SubcmdMap)).Elem()
types["SubcmdMgr"] = reflect.TypeOf(new(SubcmdMgr)).Elem()
types["NumError"] = reflect.TypeOf(new(NumError)).Elem()
vars = make(map[string] reflect.Value)
vars["Cmds"] = reflect.ValueOf(&Cmds)
vars["Aliases"] = reflect.ValueOf(&Aliases)
vars["Categories"] = reflect.ValueOf(&Categories)
vars["CmdLine"] = reflect.ValueOf(&CmdLine)
vars["Highlight"] = reflect.ValueOf(&Highlight)
vars["Maxwidth"] = reflect.ValueOf(&Maxwidth)
vars["GOFISH_RESTART_CMD"] = reflect.ValueOf(&GOFISH_RESTART_CMD)
vars["Input"] = reflect.ValueOf(&Input)
vars["LeaveREPL"] = reflect.ValueOf(&LeaveREPL)
vars["ExitCode"] = reflect.ValueOf(&ExitCode)
vars["Env"] = reflect.ValueOf(&Env)
vars["Subcmds"] = reflect.ValueOf(&Subcmds)
pkgs["repl"] = &eval.SimpleEnv {
Consts: consts,
Funcs: funcs,
Types: types,
Vars: vars,
Pkgs: pkgs,
}
consts = make(map[string] reflect.Value)
consts["SEND"] = reflect.ValueOf(ast.SEND)
consts["RECV"] = reflect.ValueOf(ast.RECV)
consts["FilterFuncDuplicates"] = reflect.ValueOf(ast.FilterFuncDuplicates)
consts["FilterUnassociatedComments"] = reflect.ValueOf(ast.FilterUnassociatedComments)
consts["FilterImportDuplicates"] = reflect.ValueOf(ast.FilterImportDuplicates)
consts["Bad"] = reflect.ValueOf(ast.Bad)
consts["Pkg"] = reflect.ValueOf(ast.Pkg)
consts["Con"] = reflect.ValueOf(ast.Con)
consts["Typ"] = reflect.ValueOf(ast.Typ)
consts["Var"] = reflect.ValueOf(ast.Var)
consts["Fun"] = reflect.ValueOf(ast.Fun)
consts["Lbl"] = reflect.ValueOf(ast.Lbl)
funcs = make(map[string] reflect.Value)
funcs["NewIdent"] = reflect.ValueOf(ast.NewIdent)
funcs["IsExported"] = reflect.ValueOf(ast.IsExported)
funcs["NewCommentMap"] = reflect.ValueOf(ast.NewCommentMap)
funcs["FileExports"] = reflect.ValueOf(ast.FileExports)
funcs["PackageExports"] = reflect.ValueOf(ast.PackageExports)
funcs["FilterDecl"] = reflect.ValueOf(ast.FilterDecl)
funcs["FilterFile"] = reflect.ValueOf(ast.FilterFile)
funcs["FilterPackage"] = reflect.ValueOf(ast.FilterPackage)
funcs["MergePackageFiles"] = reflect.ValueOf(ast.MergePackageFiles)
funcs["SortImports"] = reflect.ValueOf(ast.SortImports)
funcs["NotNilFilter"] = reflect.ValueOf(ast.NotNilFilter)
funcs["Fprint"] = reflect.ValueOf(ast.Fprint)
funcs["Print"] = reflect.ValueOf(ast.Print)
funcs["NewPackage"] = reflect.ValueOf(ast.NewPackage)
funcs["NewScope"] = reflect.ValueOf(ast.NewScope)
funcs["NewObj"] = reflect.ValueOf(ast.NewObj)
funcs["Walk"] = reflect.ValueOf(ast.Walk)
funcs["Inspect"] = reflect.ValueOf(ast.Inspect)
types = make(map[string] reflect.Type)
types["Node"] = reflect.TypeOf(new(ast.Node)).Elem()
types["Expr"] = reflect.TypeOf(new(ast.Expr)).Elem()
types["Stmt"] = reflect.TypeOf(new(ast.Stmt)).Elem()
types["Decl"] = reflect.TypeOf(new(ast.Decl)).Elem()
types["Comment"] = reflect.TypeOf(new(ast.Comment)).Elem()
types["CommentGroup"] = reflect.TypeOf(new(ast.CommentGroup)).Elem()
types["Field"] = reflect.TypeOf(new(ast.Field)).Elem()
types["FieldList"] = reflect.TypeOf(new(ast.FieldList)).Elem()
types["BadExpr"] = reflect.TypeOf(new(ast.BadExpr)).Elem()
types["Ident"] = reflect.TypeOf(new(ast.Ident)).Elem()
types["Ellipsis"] = reflect.TypeOf(new(ast.Ellipsis)).Elem()
types["BasicLit"] = reflect.TypeOf(new(ast.BasicLit)).Elem()
types["FuncLit"] = reflect.TypeOf(new(ast.FuncLit)).Elem()
types["CompositeLit"] = reflect.TypeOf(new(ast.CompositeLit)).Elem()
types["ParenExpr"] = reflect.TypeOf(new(ast.ParenExpr)).Elem()
types["SelectorExpr"] = reflect.TypeOf(new(ast.SelectorExpr)).Elem()
types["IndexExpr"] = reflect.TypeOf(new(ast.IndexExpr)).Elem()
types["SliceExpr"] = reflect.TypeOf(new(ast.SliceExpr)).Elem()
types["TypeAssertExpr"] = reflect.TypeOf(new(ast.TypeAssertExpr)).Elem()
types["CallExpr"] = reflect.TypeOf(new(ast.CallExpr)).Elem()
types["StarExpr"] = reflect.TypeOf(new(ast.StarExpr)).Elem()
types["UnaryExpr"] = reflect.TypeOf(new(ast.UnaryExpr)).Elem()
types["BinaryExpr"] = reflect.TypeOf(new(ast.BinaryExpr)).Elem()
types["KeyValueExpr"] = reflect.TypeOf(new(ast.KeyValueExpr)).Elem()
types["ChanDir"] = reflect.TypeOf(new(ast.ChanDir)).Elem()
types["ArrayType"] = reflect.TypeOf(new(ast.ArrayType)).Elem()
types["StructType"] = reflect.TypeOf(new(ast.StructType)).Elem()
types["FuncType"] = reflect.TypeOf(new(ast.FuncType)).Elem()
types["InterfaceType"] = reflect.TypeOf(new(ast.InterfaceType)).Elem()
types["MapType"] = reflect.TypeOf(new(ast.MapType)).Elem()
types["ChanType"] = reflect.TypeOf(new(ast.ChanType)).Elem()
types["BadStmt"] = reflect.TypeOf(new(ast.BadStmt)).Elem()
types["DeclStmt"] = reflect.TypeOf(new(ast.DeclStmt)).Elem()
types["EmptyStmt"] = reflect.TypeOf(new(ast.EmptyStmt)).Elem()
types["LabeledStmt"] = reflect.TypeOf(new(ast.LabeledStmt)).Elem()
types["ExprStmt"] = reflect.TypeOf(new(ast.ExprStmt)).Elem()
types["SendStmt"] = reflect.TypeOf(new(ast.SendStmt)).Elem()
types["IncDecStmt"] = reflect.TypeOf(new(ast.IncDecStmt)).Elem()
types["AssignStmt"] = reflect.TypeOf(new(ast.AssignStmt)).Elem()
types["GoStmt"] = reflect.TypeOf(new(ast.GoStmt)).Elem()
types["DeferStmt"] = reflect.TypeOf(new(ast.DeferStmt)).Elem()
types["ReturnStmt"] = reflect.TypeOf(new(ast.ReturnStmt)).Elem()
types["BranchStmt"] = reflect.TypeOf(new(ast.BranchStmt)).Elem()
types["BlockStmt"] = reflect.TypeOf(new(ast.BlockStmt)).Elem()
types["IfStmt"] = reflect.TypeOf(new(ast.IfStmt)).Elem()
types["CaseClause"] = reflect.TypeOf(new(ast.CaseClause)).Elem()
types["SwitchStmt"] = reflect.TypeOf(new(ast.SwitchStmt)).Elem()
types["TypeSwitchStmt"] = reflect.TypeOf(new(ast.TypeSwitchStmt)).Elem()
types["CommClause"] = reflect.TypeOf(new(ast.CommClause)).Elem()
types["SelectStmt"] = reflect.TypeOf(new(ast.SelectStmt)).Elem()
types["ForStmt"] = reflect.TypeOf(new(ast.ForStmt)).Elem()
types["RangeStmt"] = reflect.TypeOf(new(ast.RangeStmt)).Elem()
types["Spec"] = reflect.TypeOf(new(ast.Spec)).Elem()
types["ImportSpec"] = reflect.TypeOf(new(ast.ImportSpec)).Elem()
types["ValueSpec"] = reflect.TypeOf(new(ast.ValueSpec)).Elem()
types["TypeSpec"] = reflect.TypeOf(new(ast.TypeSpec)).Elem()
types["BadDecl"] = reflect.TypeOf(new(ast.BadDecl)).Elem()
types["GenDecl"] = reflect.TypeOf(new(ast.GenDecl)).Elem()
types["FuncDecl"] = reflect.TypeOf(new(ast.FuncDecl)).Elem()
types["File"] = reflect.TypeOf(new(ast.File)).Elem()
types["Package"] = reflect.TypeOf(new(ast.Package)).Elem()
types["CommentMap"] = reflect.TypeOf(new(ast.CommentMap)).Elem()
types["Filter"] = reflect.TypeOf(new(ast.Filter)).Elem()
types["MergeMode"] = reflect.TypeOf(new(ast.MergeMode)).Elem()
types["FieldFilter"] = reflect.TypeOf(new(ast.FieldFilter)).Elem()
types["Importer"] = reflect.TypeOf(new(ast.Importer)).Elem()
types["Scope"] = reflect.TypeOf(new(ast.Scope)).Elem()
types["Object"] = reflect.TypeOf(new(ast.Object)).Elem()
types["ObjKind"] = reflect.TypeOf(new(ast.ObjKind)).Elem()
types["Visitor"] = reflect.TypeOf(new(ast.Visitor)).Elem()
vars = make(map[string] reflect.Value)
pkgs["ast"] = &eval.SimpleEnv {
Consts: consts,
Funcs: funcs,
Types: types,
Vars: vars,
Pkgs: pkgs,
}
consts = make(map[string] reflect.Value)
consts["PackageClauseOnly"] = reflect.ValueOf(parser.PackageClauseOnly)
consts["ImportsOnly"] = reflect.ValueOf(parser.ImportsOnly)
consts["ParseComments"] = reflect.ValueOf(parser.ParseComments)
consts["Trace"] = reflect.ValueOf(parser.Trace)
consts["DeclarationErrors"] = reflect.ValueOf(parser.DeclarationErrors)
consts["SpuriousErrors"] = reflect.ValueOf(parser.SpuriousErrors)
consts["AllErrors"] = reflect.ValueOf(parser.AllErrors)
funcs = make(map[string] reflect.Value)
funcs["ParseFile"] = reflect.ValueOf(parser.ParseFile)
funcs["ParseDir"] = reflect.ValueOf(parser.ParseDir)
funcs["ParseExpr"] = reflect.ValueOf(parser.ParseExpr)
types = make(map[string] reflect.Type)
types["Mode"] = reflect.TypeOf(new(parser.Mode)).Elem()
vars = make(map[string] reflect.Value)
pkgs["parser"] = &eval.SimpleEnv {
Consts: consts,
Funcs: funcs,
Types: types,
Vars: vars,
Pkgs: pkgs,
}
consts = make(map[string] reflect.Value)
consts["ScanComments"] = reflect.ValueOf(scanner.ScanComments)
funcs = make(map[string] reflect.Value)
funcs["PrintError"] = reflect.ValueOf(scanner.PrintError)
types = make(map[string] reflect.Type)
types["Error"] = reflect.TypeOf(new(scanner.Error)).Elem()
types["ErrorList"] = reflect.TypeOf(new(scanner.ErrorList)).Elem()
types["ErrorHandler"] = reflect.TypeOf(new(scanner.ErrorHandler)).Elem()
types["Scanner"] = reflect.TypeOf(new(scanner.Scanner)).Elem()
types["Mode"] = reflect.TypeOf(new(scanner.Mode)).Elem()
vars = make(map[string] reflect.Value)
pkgs["scanner"] = &eval.SimpleEnv {
Consts: consts,
Funcs: funcs,
Types: types,
Vars: vars,
Pkgs: pkgs,
}
consts = make(map[string] reflect.Value)
consts["NoPos"] = reflect.ValueOf(token.NoPos)
consts["ILLEGAL"] = reflect.ValueOf(token.ILLEGAL)
consts["EOF"] = reflect.ValueOf(token.EOF)
consts["COMMENT"] = reflect.ValueOf(token.COMMENT)
consts["IDENT"] = reflect.ValueOf(token.IDENT)
consts["INT"] = reflect.ValueOf(token.INT)
consts["FLOAT"] = reflect.ValueOf(token.FLOAT)
consts["IMAG"] = reflect.ValueOf(token.IMAG)
consts["CHAR"] = reflect.ValueOf(token.CHAR)
consts["STRING"] = reflect.ValueOf(token.STRING)
consts["ADD"] = reflect.ValueOf(token.ADD)
consts["SUB"] = reflect.ValueOf(token.SUB)
consts["MUL"] = reflect.ValueOf(token.MUL)
consts["QUO"] = reflect.ValueOf(token.QUO)
consts["REM"] = reflect.ValueOf(token.REM)
consts["AND"] = reflect.ValueOf(token.AND)
consts["OR"] = reflect.ValueOf(token.OR)
consts["XOR"] = reflect.ValueOf(token.XOR)
consts["SHL"] = reflect.ValueOf(token.SHL)
consts["SHR"] = reflect.ValueOf(token.SHR)
consts["AND_NOT"] = reflect.ValueOf(token.AND_NOT)
consts["ADD_ASSIGN"] = reflect.ValueOf(token.ADD_ASSIGN)
consts["SUB_ASSIGN"] = reflect.ValueOf(token.SUB_ASSIGN)
consts["MUL_ASSIGN"] = reflect.ValueOf(token.MUL_ASSIGN)
consts["QUO_ASSIGN"] = reflect.ValueOf(token.QUO_ASSIGN)
consts["REM_ASSIGN"] = reflect.ValueOf(token.REM_ASSIGN)
consts["AND_ASSIGN"] = reflect.ValueOf(token.AND_ASSIGN)
consts["OR_ASSIGN"] = reflect.ValueOf(token.OR_ASSIGN)
consts["XOR_ASSIGN"] = reflect.ValueOf(token.XOR_ASSIGN)
consts["SHL_ASSIGN"] = reflect.ValueOf(token.SHL_ASSIGN)
consts["SHR_ASSIGN"] = reflect.ValueOf(token.SHR_ASSIGN)
consts["AND_NOT_ASSIGN"] = reflect.ValueOf(token.AND_NOT_ASSIGN)
consts["LAND"] = reflect.ValueOf(token.LAND)
consts["LOR"] = reflect.ValueOf(token.LOR)
consts["ARROW"] = reflect.ValueOf(token.ARROW)
consts["INC"] = reflect.ValueOf(token.INC)
consts["DEC"] = reflect.ValueOf(token.DEC)
consts["EQL"] = reflect.ValueOf(token.EQL)
consts["LSS"] = reflect.ValueOf(token.LSS)
consts["GTR"] = reflect.ValueOf(token.GTR)
consts["ASSIGN"] = reflect.ValueOf(token.ASSIGN)
consts["NOT"] = reflect.ValueOf(token.NOT)
consts["NEQ"] = reflect.ValueOf(token.NEQ)
consts["LEQ"] = reflect.ValueOf(token.LEQ)
consts["GEQ"] = reflect.ValueOf(token.GEQ)
consts["DEFINE"] = reflect.ValueOf(token.DEFINE)
consts["ELLIPSIS"] = reflect.ValueOf(token.ELLIPSIS)
consts["LPAREN"] = reflect.ValueOf(token.LPAREN)
consts["LBRACK"] = reflect.ValueOf(token.LBRACK)
consts["LBRACE"] = reflect.ValueOf(token.LBRACE)
consts["COMMA"] = reflect.ValueOf(token.COMMA)
consts["PERIOD"] = reflect.ValueOf(token.PERIOD)
consts["RPAREN"] = reflect.ValueOf(token.RPAREN)
consts["RBRACK"] = reflect.ValueOf(token.RBRACK)
consts["RBRACE"] = reflect.ValueOf(token.RBRACE)
consts["SEMICOLON"] = reflect.ValueOf(token.SEMICOLON)
consts["COLON"] = reflect.ValueOf(token.COLON)
consts["BREAK"] = reflect.ValueOf(token.BREAK)
consts["CASE"] = reflect.ValueOf(token.CASE)
consts["CHAN"] = reflect.ValueOf(token.CHAN)
consts["CONST"] = reflect.ValueOf(token.CONST)
consts["CONTINUE"] = reflect.ValueOf(token.CONTINUE)
consts["DEFAULT"] = reflect.ValueOf(token.DEFAULT)
consts["DEFER"] = reflect.ValueOf(token.DEFER)
consts["ELSE"] = reflect.ValueOf(token.ELSE)
consts["FALLTHROUGH"] = reflect.ValueOf(token.FALLTHROUGH)
consts["FOR"] = reflect.ValueOf(token.FOR)
consts["FUNC"] = reflect.ValueOf(token.FUNC)
consts["GO"] = reflect.ValueOf(token.GO)
consts["GOTO"] = reflect.ValueOf(token.GOTO)
consts["IF"] = reflect.ValueOf(token.IF)
consts["IMPORT"] = reflect.ValueOf(token.IMPORT)
consts["INTERFACE"] = reflect.ValueOf(token.INTERFACE)
consts["MAP"] = reflect.ValueOf(token.MAP)
consts["PACKAGE"] = reflect.ValueOf(token.PACKAGE)
consts["RANGE"] = reflect.ValueOf(token.RANGE)
consts["RETURN"] = reflect.ValueOf(token.RETURN)
consts["SELECT"] = reflect.ValueOf(token.SELECT)
consts["STRUCT"] = reflect.ValueOf(token.STRUCT)
consts["SWITCH"] = reflect.ValueOf(token.SWITCH)
consts["TYPE"] = reflect.ValueOf(token.TYPE)
consts["VAR"] = reflect.ValueOf(token.VAR)
consts["LowestPrec"] = reflect.ValueOf(token.LowestPrec)
consts["UnaryPrec"] = reflect.ValueOf(token.UnaryPrec)
consts["HighestPrec"] = reflect.ValueOf(token.HighestPrec)
funcs = make(map[string] reflect.Value)
funcs["NewFileSet"] = reflect.ValueOf(token.NewFileSet)
funcs["Lookup"] = reflect.ValueOf(token.Lookup)
types = make(map[string] reflect.Type)
types["Position"] = reflect.TypeOf(new(token.Position)).Elem()
types["Pos"] = reflect.TypeOf(new(token.Pos)).Elem()
types["File"] = reflect.TypeOf(new(token.File)).Elem()
types["FileSet"] = reflect.TypeOf(new(token.FileSet)).Elem()
types["Token"] = reflect.TypeOf(new(token.Token)).Elem()
vars = make(map[string] reflect.Value)
pkgs["token"] = &eval.SimpleEnv {
Consts: consts,
Funcs: funcs,
Types: types,
Vars: vars,
Pkgs: pkgs,
}
consts = make(map[string] reflect.Value)
funcs = make(map[string] reflect.Value)
funcs["WriteString"] = reflect.ValueOf(io.WriteString)
funcs["ReadAtLeast"] = reflect.ValueOf(io.ReadAtLeast)
funcs["ReadFull"] = reflect.ValueOf(io.ReadFull)
funcs["CopyN"] = reflect.ValueOf(io.CopyN)
funcs["Copy"] = reflect.ValueOf(io.Copy)
funcs["LimitReader"] = reflect.ValueOf(io.LimitReader)
funcs["NewSectionReader"] = reflect.ValueOf(io.NewSectionReader)
funcs["TeeReader"] = reflect.ValueOf(io.TeeReader)
funcs["MultiReader"] = reflect.ValueOf(io.MultiReader)
funcs["MultiWriter"] = reflect.ValueOf(io.MultiWriter)
funcs["Pipe"] = reflect.ValueOf(io.Pipe)
types = make(map[string] reflect.Type)
types["Reader"] = reflect.TypeOf(new(io.Reader)).Elem()
types["Writer"] = reflect.TypeOf(new(io.Writer)).Elem()
types["Closer"] = reflect.TypeOf(new(io.Closer)).Elem()
types["Seeker"] = reflect.TypeOf(new(io.Seeker)).Elem()
types["ReadWriter"] = reflect.TypeOf(new(io.ReadWriter)).Elem()
types["ReadCloser"] = reflect.TypeOf(new(io.ReadCloser)).Elem()
types["WriteCloser"] = reflect.TypeOf(new(io.WriteCloser)).Elem()
types["ReadWriteCloser"] = reflect.TypeOf(new(io.ReadWriteCloser)).Elem()
types["ReadSeeker"] = reflect.TypeOf(new(io.ReadSeeker)).Elem()
types["WriteSeeker"] = reflect.TypeOf(new(io.WriteSeeker)).Elem()
types["ReadWriteSeeker"] = reflect.TypeOf(new(io.ReadWriteSeeker)).Elem()
types["ReaderFrom"] = reflect.TypeOf(new(io.ReaderFrom)).Elem()
types["WriterTo"] = reflect.TypeOf(new(io.WriterTo)).Elem()
types["ReaderAt"] = reflect.TypeOf(new(io.ReaderAt)).Elem()
types["WriterAt"] = reflect.TypeOf(new(io.WriterAt)).Elem()
types["ByteReader"] = reflect.TypeOf(new(io.ByteReader)).Elem()
types["ByteScanner"] = reflect.TypeOf(new(io.ByteScanner)).Elem()
types["ByteWriter"] = reflect.TypeOf(new(io.ByteWriter)).Elem()
types["RuneReader"] = reflect.TypeOf(new(io.RuneReader)).Elem()
types["RuneScanner"] = reflect.TypeOf(new(io.RuneScanner)).Elem()
types["LimitedReader"] = reflect.TypeOf(new(io.LimitedReader)).Elem()
types["SectionReader"] = reflect.TypeOf(new(io.SectionReader)).Elem()
types["PipeReader"] = reflect.TypeOf(new(io.PipeReader)).Elem()
types["PipeWriter"] = reflect.TypeOf(new(io.PipeWriter)).Elem()
vars = make(map[string] reflect.Value)
vars["ErrShortWrite"] = reflect.ValueOf(&io.ErrShortWrite)
vars["ErrShortBuffer"] = reflect.ValueOf(&io.ErrShortBuffer)
vars["EOF"] = reflect.ValueOf(&io.EOF)
vars["ErrUnexpectedEOF"] = reflect.ValueOf(&io.ErrUnexpectedEOF)
vars["ErrNoProgress"] = reflect.ValueOf(&io.ErrNoProgress)
vars["ErrClosedPipe"] = reflect.ValueOf(&io.ErrClosedPipe)
pkgs["io"] = &eval.SimpleEnv {
Consts: consts,
Funcs: funcs,
Types: types,
Vars: vars,
Pkgs: pkgs,
}
consts = make(map[string] reflect.Value)
funcs = make(map[string] reflect.Value)
funcs["ReadAll"] = reflect.ValueOf(ioutil.ReadAll)
funcs["ReadFile"] = reflect.ValueOf(ioutil.ReadFile)
funcs["WriteFile"] = reflect.ValueOf(ioutil.WriteFile)
funcs["ReadDir"] = reflect.ValueOf(ioutil.ReadDir)
funcs["NopCloser"] = reflect.ValueOf(ioutil.NopCloser)
funcs["TempFile"] = reflect.ValueOf(ioutil.TempFile)
funcs["TempDir"] = reflect.ValueOf(ioutil.TempDir)
types = make(map[string] reflect.Type)
vars = make(map[string] reflect.Value)
vars["Discard"] = reflect.ValueOf(&ioutil.Discard)
pkgs["ioutil"] = &eval.SimpleEnv {
Consts: consts,
Funcs: funcs,
Types: types,
Vars: vars,
Pkgs: pkgs,
}
consts = make(map[string] reflect.Value)
consts["Ldate"] = reflect.ValueOf(log.Ldate)
consts["Ltime"] = reflect.ValueOf(log.Ltime)
consts["Lmicroseconds"] = reflect.ValueOf(log.Lmicroseconds)
consts["Llongfile"] = reflect.ValueOf(log.Llongfile)
consts["Lshortfile"] = reflect.ValueOf(log.Lshortfile)
consts["LstdFlags"] = reflect.ValueOf(log.LstdFlags)
funcs = make(map[string] reflect.Value)
funcs["New"] = reflect.ValueOf(log.New)
funcs["SetOutput"] = reflect.ValueOf(log.SetOutput)
funcs["Flags"] = reflect.ValueOf(log.Flags)
funcs["SetFlags"] = reflect.ValueOf(log.SetFlags)
funcs["Prefix"] = reflect.ValueOf(log.Prefix)
funcs["SetPrefix"] = reflect.ValueOf(log.SetPrefix)
funcs["Print"] = reflect.ValueOf(log.Print)
funcs["Printf"] = reflect.ValueOf(log.Printf)
funcs["Println"] = reflect.ValueOf(log.Println)
funcs["Fatal"] = reflect.ValueOf(log.Fatal)
funcs["Fatalf"] = reflect.ValueOf(log.Fatalf)
funcs["Fatalln"] = reflect.ValueOf(log.Fatalln)
funcs["Panic"] = reflect.ValueOf(log.Panic)
funcs["Panicf"] = reflect.ValueOf(log.Panicf)
funcs["Panicln"] = reflect.ValueOf(log.Panicln)
types = make(map[string] reflect.Type)
types["Logger"] = reflect.TypeOf(new(log.Logger)).Elem()
vars = make(map[string] reflect.Value)
pkgs["log"] = &eval.SimpleEnv {
Consts: consts,
Funcs: funcs,
Types: types,
Vars: vars,
Pkgs: pkgs,
}
consts = make(map[string] reflect.Value)
consts["E"] = reflect.ValueOf(math.E)
consts["Pi"] = reflect.ValueOf(math.Pi)
consts["Phi"] = reflect.ValueOf(math.Phi)
consts["Sqrt2"] = reflect.ValueOf(math.Sqrt2)
consts["SqrtE"] = reflect.ValueOf(math.SqrtE)
consts["SqrtPi"] = reflect.ValueOf(math.SqrtPi)
consts["SqrtPhi"] = reflect.ValueOf(math.SqrtPhi)
consts["Ln2"] = reflect.ValueOf(math.Ln2)
consts["Log2E"] = reflect.ValueOf(math.Log2E)