File: tokenizing.py

package info (click to toggle)
python-tatsu 5.15.1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 904 kB
  • sloc: python: 10,128; makefile: 54
file content (72 lines) | stat: -rw-r--r-- 1,536 bytes parent folder | download
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
from .exceptions import ParseError
from .util._common import _prints


class Tokenizer:
    def __init__(self, *args, **kwargs):
        super().__init__()

    def error(self, *args, **kwargs):
        raise ParseError(_prints(*args, **kwargs))

    @property
    def filename(self):
        raise NotImplementedError

    @property
    def ignorecase(self):
        raise NotImplementedError

    @property
    def pos(self):
        raise NotImplementedError

    def goto(self, pos):
        raise NotImplementedError

    def atend(self):
        raise NotImplementedError

    def ateol(self):
        raise NotImplementedError

    @property
    def current(self):
        raise NotImplementedError

    @property
    def token(self):
        return self.current

    def next(self):
        raise NotImplementedError

    def next_token(self):
        raise NotImplementedError

    def match(self, token):
        raise NotImplementedError

    def matchre(self, pattern):
        raise NotImplementedError

    def posline(self, pos):
        raise NotImplementedError

    def line_info(self, pos=None):
        raise NotImplementedError

    def get_lines(self, start=None, end=None):
        raise NotImplementedError

    def line_index(self, start=0, end=None):
        raise NotImplementedError

    def lookahead(self):
        raise NotImplementedError

    def lookahead_pos(self):
        if self.atend():
            return ''
        info = self.line_info()
        return '~%d:%d' % (info.line + 1, info.col + 1)