How to use the tatsu.parsing.Parser function in TatSu

To help you get started, we’ve selected a few TatSu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github neogeny / TatSu / examples / javascript / sandbojs / parser / js_parser.py View on Github external
namechars='',
        **kwargs
    ):
        super(JavaScriptBuffer, self).__init__(
            text,
            whitespace=whitespace,
            nameguard=nameguard,
            comments_re=comments_re,
            eol_comments_re=eol_comments_re,
            ignorecase=ignorecase,
            namechars=namechars,
            **kwargs
        )


class JavaScriptParser(Parser):
    def __init__(
        self,
        whitespace=None,
        nameguard=None,
        comments_re='\\/\\*(.|[\\r\\n])*?\\*\\/',
        eol_comments_re='\\/\\/[^\\r\\n]*(\\r?\\n|\\r|$)',
        ignorecase=False,
        left_recursion=False,
        parseinfo=True,
        keywords=None,
        namechars='',
        buffer_class=JavaScriptBuffer,
        **kwargs
    ):
        if keywords is None:
            keywords = KEYWORDS
github neogeny / TatSu / examples / calc / v4 / calc_parser.py View on Github external
namechars='',
        **kwargs
    ):
        super(CalcBuffer, self).__init__(
            text,
            whitespace=whitespace,
            nameguard=nameguard,
            comments_re=comments_re,
            eol_comments_re=eol_comments_re,
            ignorecase=ignorecase,
            namechars=namechars,
            **kwargs
        )


class CalcParser(Parser):
    def __init__(
        self,
        whitespace=None,
        nameguard=None,
        comments_re=None,
        eol_comments_re=None,
        ignorecase=None,
        left_recursion=True,
        parseinfo=True,
        keywords=None,
        namechars='',
        buffer_class=CalcBuffer,
        **kwargs
    ):
        if keywords is None:
            keywords = KEYWORDS
github microsoft / TextWorld / textworld / textgen / parser.py View on Github external
namechars='',
        **kwargs
    ):
        super(TextGrammarBuffer, self).__init__(
            text,
            whitespace=whitespace,
            nameguard=nameguard,
            comments_re=comments_re,
            eol_comments_re=eol_comments_re,
            ignorecase=ignorecase,
            namechars=namechars,
            **kwargs
        )


class TextGrammarParser(Parser):
    def __init__(
        self,
        whitespace=re.compile('[\\t ]+'),
        nameguard=None,
        comments_re=None,
        eol_comments_re='^(#.*|\\s*)\\n',
        ignorecase=None,
        left_recursion=True,
        parseinfo=True,
        keywords=None,
        namechars='',
        buffer_class=TextGrammarBuffer,
        **kwargs
    ):
        if keywords is None:
            keywords = KEYWORDS
github neogeny / TatSu / examples / regex / parser_base.py View on Github external
namechars='',
        **kwargs
    ):
        super(RegexBuffer, self).__init__(
            text,
            whitespace=whitespace,
            nameguard=nameguard,
            comments_re=comments_re,
            eol_comments_re=eol_comments_re,
            ignorecase=ignorecase,
            namechars=namechars,
            **kwargs
        )


class RegexParser(Parser):
    def __init__(
        self,
        whitespace=None,
        nameguard=None,
        comments_re=None,
        eol_comments_re=None,
        ignorecase=None,
        left_recursion=True,
        parseinfo=True,
        keywords=None,
        namechars='',
        buffer_class=RegexBuffer,
        **kwargs
    ):
        if keywords is None:
            keywords = KEYWORDS
github microsoft / TextWorld / textworld / logic / parser.py View on Github external
namechars='',
        **kwargs
    ):
        super(GameLogicBuffer, self).__init__(
            text,
            whitespace=whitespace,
            nameguard=nameguard,
            comments_re=comments_re,
            eol_comments_re=eol_comments_re,
            ignorecase=ignorecase,
            namechars=namechars,
            **kwargs
        )


class GameLogicParser(Parser):
    def __init__(
        self,
        whitespace=None,
        nameguard=None,
        comments_re=None,
        eol_comments_re='#.*$',
        ignorecase=None,
        left_recursion=True,
        parseinfo=True,
        keywords=None,
        namechars='',
        buffer_class=GameLogicBuffer,
        **kwargs
    ):
        if keywords is None:
            keywords = KEYWORDS
github neogeny / TatSu / examples / calc / v6 / calc_parser.py View on Github external
namechars='',
        **kwargs
    ):
        super(CalcBuffer, self).__init__(
            text,
            whitespace=whitespace,
            nameguard=nameguard,
            comments_re=comments_re,
            eol_comments_re=eol_comments_re,
            ignorecase=ignorecase,
            namechars=namechars,
            **kwargs
        )


class CalcParser(Parser):
    def __init__(
        self,
        whitespace=None,
        nameguard=None,
        comments_re=None,
        eol_comments_re=None,
        ignorecase=None,
        left_recursion=True,
        parseinfo=True,
        keywords=None,
        namechars='',
        buffer_class=CalcBuffer,
        **kwargs
    ):
        if keywords is None:
            keywords = KEYWORDS
github neogeny / TatSu / examples / calc / v3 / calc_parser.py View on Github external
namechars='',
        **kwargs
    ):
        super(CalcBuffer, self).__init__(
            text,
            whitespace=whitespace,
            nameguard=nameguard,
            comments_re=comments_re,
            eol_comments_re=eol_comments_re,
            ignorecase=ignorecase,
            namechars=namechars,
            **kwargs
        )


class CalcParser(Parser):
    def __init__(
        self,
        whitespace=None,
        nameguard=None,
        comments_re=None,
        eol_comments_re=None,
        ignorecase=None,
        left_recursion=True,
        parseinfo=True,
        keywords=None,
        namechars='',
        buffer_class=CalcBuffer,
        **kwargs
    ):
        if keywords is None:
            keywords = KEYWORDS
github neogeny / TatSu / examples / calc / v2 / calc_parser.py View on Github external
namechars='',
        **kwargs
    ):
        super(CalcBuffer, self).__init__(
            text,
            whitespace=whitespace,
            nameguard=nameguard,
            comments_re=comments_re,
            eol_comments_re=eol_comments_re,
            ignorecase=ignorecase,
            namechars=namechars,
            **kwargs
        )


class CalcParser(Parser):
    def __init__(
        self,
        whitespace=None,
        nameguard=None,
        comments_re=None,
        eol_comments_re=None,
        ignorecase=None,
        left_recursion=True,
        parseinfo=True,
        keywords=None,
        namechars='',
        buffer_class=CalcBuffer,
        **kwargs
    ):
        if keywords is None:
            keywords = KEYWORDS
github HPAC / linnea / linnea / frontend / parser.py View on Github external
namechars='',
        **kwargs
    ):
        super(LinneaBuffer, self).__init__(
            text,
            whitespace=whitespace,
            nameguard=nameguard,
            comments_re=comments_re,
            eol_comments_re=eol_comments_re,
            ignorecase=ignorecase,
            namechars=namechars,
            **kwargs
        )


class LinneaParser(Parser):
    def __init__(
        self,
        whitespace=None,
        nameguard=None,
        comments_re=None,
        eol_comments_re='#.*?$',
        ignorecase=None,
        left_recursion=True,
        parseinfo=True,
        keywords=None,
        namechars='',
        buffer_class=LinneaBuffer,
        **kwargs
    ):
        if keywords is None:
            keywords = KEYWORDS
github neogeny / TatSu / tatsu / bootstrap.py View on Github external
namechars='',
        **kwargs
    ):
        super(EBNFBootstrapBuffer, self).__init__(
            text,
            whitespace=whitespace,
            nameguard=nameguard,
            comments_re=comments_re,
            eol_comments_re=eol_comments_re,
            ignorecase=ignorecase,
            namechars=namechars,
            **kwargs
        )


class EBNFBootstrapParser(Parser):
    def __init__(
        self,
        whitespace=None,
        nameguard=None,
        comments_re='\\(\\*((?:.|\\n)*?)\\*\\)',
        eol_comments_re='#([^\\n]*?)$',
        ignorecase=None,
        left_recursion=False,
        parseinfo=True,
        keywords=None,
        namechars='',
        buffer_class=EBNFBootstrapBuffer,
        **kwargs
    ):
        if keywords is None:
            keywords = KEYWORDS