How to use the pyleri.elements.go_export function in pyleri

To help you get started, we’ve selected a few pyleri 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 transceptor-technology / pyleri / pyleri / regex.py View on Github external
    @go_export
    def _run_export_go(self, go_indent, indent, enums, gid):
        pattern = self._compiled.pattern.replace('`', '` + "`" + `')
        if self._compiled.flags & re.IGNORECASE:
            pattern = '(?i)' + pattern
        return 'goleri.NewRegex({}, regexp.MustCompile(`{}`))'.format(
            gid,
            pattern)
github transceptor-technology / pyleri / pyleri / choice.py View on Github external
    @go_export
    def _run_export_go(self, go_indent, indent, enums, gid):
        new_indent = indent + 1
        value = ',\n'.join(['{indent}{elem}'.format(
            indent=go_indent * new_indent,
            elem=elem._export_go(
                go_indent,
                new_indent,
                enums)) for elem in self._elements])
        return 'goleri.NewChoice(\n{gid},\n{mg},\n{val},\n{indent})'.format(
            gid='{indent}{gid}'.format(
                indent=go_indent * (indent + 1),
                gid=gid),
            mg='{indent}{mg}'.format(
                indent=go_indent * (indent + 1),
                mg=('false', 'true')[
                    self._get_node_result == self._most_greedy_result]),
github transceptor-technology / pyleri / pyleri / token.py View on Github external
    @go_export
    def _run_export_go(self, go_indent, indent, enums, gid):
        return 'goleri.NewToken({}, "{}")'.format(
            gid,
            self._token)
github transceptor-technology / pyleri / pyleri / list.py View on Github external
    @go_export
    def _run_export_go(self, go_indent, indent, enums, gid):
        return 'goleri.NewList({}, {}, {}, {}, {}, {})'.format(
            gid,
            self._element._export_go(go_indent, indent, enums),
            self._delimiter._export_go(go_indent, indent, enums),
            self._min,
            self._max or '0',
            'true' if self._opt else 'false')
github transceptor-technology / pyleri / pyleri / tokens.py View on Github external
    @go_export
    def _run_export_go(self, go_indent, indent, enums, gid):
        return 'goleri.NewTokens({}, "{}")'.format(
            gid,
            ' '.join(self._tokens))
github transceptor-technology / pyleri / pyleri / repeat.py View on Github external
    @go_export
    def _run_export_go(self, go_indent, indent, enums, gid):
        return 'goleri.NewRepeat({}, {}, {}, {})'.format(
            gid,
            self._element._export_go(go_indent, indent, enums),
            self._min,
            self._max or '0')
github transceptor-technology / pyleri / pyleri / optional.py View on Github external
    @go_export
    def _run_export_go(self, go_indent, indent, enums, gid):
        return 'goleri.NewOptional({}, {})'.format(
            gid,
            self._element._export_go(go_indent, indent, enums))
github transceptor-technology / pyleri / pyleri / keyword.py View on Github external
    @go_export
    def _run_export_go(self, go_indent, indent, enums, gid):
        return 'goleri.NewKeyword({}, "{}", {})'.format(
            gid,
            self._keyword,
            'true' if self._ign_case else 'false')