예제 #1
0
    def __init__(self, src ='', debug =False, blockDefs =None, debugData =None, **kwargs):
        """Creates a new instance of ClassTemplate."""
        self._log = ArgsUtils.getLogger(self, kwargs)

        self._debugData = debugData
        self._debug     = debug

        src = StringUtils.toUnicode(src)

        self._raw = src.replace('\r','')
        if ArgsUtils.get('stripSource', True, kwargs):
            self._raw = self._raw.strip('\n')

        self._analyzed  = False
        self._errors    = []
        self._blocks    = []
        self._bookmarks = []
        self._initialBlock = ArgsUtils.get('initialBlock', None, kwargs)

        if isinstance(blockDefs, BlockDefinition):
            self._blockDefs = {'root':blockDefs}
        elif isinstance(blockDefs, dict):
            self._blockDefs = blockDefs
        elif isinstance(blockDefs, list):
            self._blockDefs = {'root':blockDefs}
        else:
            self._blockDefs = {
                'root':[
                    BlockDefinition.createQuoteDef(BlockDefinition.BLOCKED),
                    BlockDefinition.createLiteralDef(BlockDefinition.BLOCKED),
                    BlockDefinition.createParensDef(),
                    BlockDefinition.createBracketsDef(),
                    BlockDefinition.createBracesDef(),
                    ],
                }
예제 #2
0
    def __init__(self, src ='', debug =False):
        """Creates a new instance of ClassTemplate."""
        blocks = {'root':[
            BlockDefinition.createTripleHashDef(BlockDefinition.BLOCKED),
            BlockDefinition.createHashDef(BlockDefinition.BLOCKED),
            BlockDefinition.createRegexDef(BlockDefinition.BLOCKED),
            BlockDefinition.createTripleQuotesDef(BlockDefinition.BLOCKED),
            BlockDefinition.createTripleLiteralsDef(BlockDefinition.BLOCKED),
            BlockDefinition.createQuoteDef(BlockDefinition.BLOCKED),
            BlockDefinition.createLiteralDef(BlockDefinition.BLOCKED),
            BlockDefinition.createParensDef(),
            BlockDefinition.createBracketsDef(),
            BlockDefinition.createBracesDef() ]}

        LineTextAnalyzer.__init__(self, src, debug, blocks)
        self._globalClasses = []
예제 #3
0
    def __init__(self, src ='', debug =False):
        """Creates a new instance of ClassTemplate."""
        blocks = {'root':[
            BlockDefinition.createTripleHashDef(BlockDefinition.BLOCKED),
            BlockDefinition.createHashDef(BlockDefinition.BLOCKED),
            BlockDefinition.createRegexDef(BlockDefinition.BLOCKED),
            BlockDefinition.createTripleQuotesDef(BlockDefinition.BLOCKED),
            BlockDefinition.createTripleLiteralsDef(BlockDefinition.BLOCKED),
            BlockDefinition.createQuoteDef(BlockDefinition.BLOCKED),
            BlockDefinition.createLiteralDef(BlockDefinition.BLOCKED),
            BlockDefinition.createParensDef(),
            BlockDefinition.createBracketsDef(),
            BlockDefinition.createBracesDef() ]}

        LineTextAnalyzer.__init__(self, src, debug, blocks)
        self._globalClasses = []
예제 #4
0
    def __init__(self,
                 src='',
                 debug=False,
                 blockDefs=None,
                 debugData=None,
                 **kwargs):
        """Creates a new instance of ClassTemplate."""
        self._log = ArgsUtils.getLogger(self, kwargs)

        self._debugData = debugData
        self._debug = debug

        src = StringUtils.toUnicode(src)

        self._raw = src.replace('\r', '')
        if ArgsUtils.get('stripSource', True, kwargs):
            self._raw = self._raw.strip('\n')

        self._analyzed = False
        self._errors = []
        self._blocks = []
        self._bookmarks = []
        self._initialBlock = ArgsUtils.get('initialBlock', None, kwargs)

        if isinstance(blockDefs, BlockDefinition):
            self._blockDefs = {'root': blockDefs}
        elif isinstance(blockDefs, dict):
            self._blockDefs = blockDefs
        elif isinstance(blockDefs, list):
            self._blockDefs = {'root': blockDefs}
        else:
            self._blockDefs = {
                'root': [
                    BlockDefinition.createQuoteDef(BlockDefinition.BLOCKED),
                    BlockDefinition.createLiteralDef(BlockDefinition.BLOCKED),
                    BlockDefinition.createParensDef(),
                    BlockDefinition.createBracketsDef(),
                    BlockDefinition.createBracesDef(),
                ],
            }