BrainMachine /

#!/usr/bin/env python

from LangDef import LangDef
from LangParse import LangParse
import NameSpace
import RunState
import VarDefine

class MainBrain():
    def __init__(self):
        self.langDef = None
        self.globalns = NameSpace.ModuleNS('DefaultModule')

    def DefineInLang(self, strLang):
        assert not self.langDef
        self.langDef = LangDef()

    def ReadInBuf(self, strSrc):
        assert self.langDef
        #pos = 0
        #while pos < len(strSrc):
        #    pos = self.langDef.MainParse(pos, strSrc, self.globalns)
        lp = LangParse(strSrc, pos=0)
        lp.langdef = self.langDef #weak ref
        lp.ns = self.globalns

    def DefineOutLang(self, strLang):

    def Output(self):
        for s in self.globalns.Output():
            yield s

    def OutputCpp(self):
        for s in self.globalns.OutputCpp():
            yield s

    def Run(self):
        runstate = RunState.RunState(self.globalns, None)

        value = VarDefine.Value('string', '__main__')
        var = VarDefine.NameToken('__name__')
        runstate.SetVarValue(var, value)

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.