Exemplo n.º 1
0
Arquivo: factory.py Projeto: uxmal/idc
    def _parse(self, lexer):
        '''Creates a new term by parsing a string.'''

        p = Parser(lexer)
        try:
            return p.term()
        except antlr.ANTLRException, exc:
            raise exception.ParseError(str(exc))
Exemplo n.º 2
0
Arquivo: factory.py Projeto: uxmal/idc
    def match(self, pattern, term):
        '''Matches the term to a string pattern and a list of arguments.
		'''
        assert isinstance(pattern, basestring)
        from aterm.match import Parser, Match
        p = Parser(lexer.Lexer(pattern))
        try:
            matcher = p.term()
        except antlr.ANTLRException, exc:
            raise exception.ParseError(str(exc))
Exemplo n.º 3
0
Arquivo: factory.py Projeto: uxmal/idc
    def make(self, pattern, *args, **kargs):
        '''Creates a new term from a string pattern and a list of arguments.
		First the string pattern is parsed, then the holes in
		the pattern are filled with the supplied arguments.
		'''
        assert isinstance(pattern, basestring)
        from aterm.build import Parser
        p = Parser(lexer.Lexer(pattern))
        try:
            builder = p.term()
        except antlr.ANTLRException, exc:
            raise exception.ParseError(str(exc))
Exemplo n.º 4
0
Arquivo: factory.py Projeto: uxmal/idc
 def handleVar(self, name):
     raise exception.ParseError('variable in term')
Exemplo n.º 5
0
Arquivo: factory.py Projeto: uxmal/idc
 def handleWildcard(self):
     raise exception.ParseError('wildcard in term')