Beispiel #1
0
func serverMain() {
	cfgFilePath, err := assets.Locate(cfgFileName)
	if err != nil {
		tlog.Fatal("Cannot locate configuration file: ", err)
	}
	cfg, err := readConfigFile(cfgFilePath)
	if err != nil {
		tlog.Fatal("Cannot read configuration file: ", err)
	}

	hdm := hdm.NewHdm(cfg)
	space := hdm.NewSpace()

	textFile := nex.Path(nexsys.GetFileNex("main.go"), nexsys.TextFile)
	space.NewSurf().Add(textFile).Expand(100, nex.TopType)
	space.NewSurf().Add(parse.Parse("main.go")).Expand(100, nex.TopType)

	dir := "."
	ndir := nexsys.GetFileNex(dir)
	space.NewSurf().Add(ndir).Expand(2, nex.TopType)
	recursiveAddFile(space, ndir)

	netServer := netserv.NewServer(hdm.MasterChan())
	netServer.Start()
}
Beispiel #2
0
func init() {
	nex.RegisterElevation(File, func(n nex.Nex) nex.Nex {
		fnode, ok := n.(fileNex)
		if !ok {
			return nil
		}
		ext := filepath.Ext(fnode.path)
		if _, isin := langParseExtensions[ext]; isin {
			return parse.Parse(fnode.path).Nex
		}
		return nil
	})
}