How to use the pyleri.elements.java_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 / token.py View on Github external
    @java_export
    def _run_export_java(self, java_indent, indent, enums, classes, gid):
        return 'new Token({}"{}")'.format(
            '' if gid is None else 'Ids.{}, '.format(gid),
            self._token)
github transceptor-technology / pyleri / pyleri / keyword.py View on Github external
    @java_export
    def _run_export_java(self, c_indent, indent, enums, classes, gid):
        return 'new Keyword({}"{}", {})'.format(
            '' if gid is None else 'Ids.{}, '.format(gid),
            self._keyword,
            'true' if self._ign_case else 'false')
github transceptor-technology / pyleri / pyleri / repeat.py View on Github external
    @java_export
    def _run_export_java(self, java_indent, indent, enums, classes, gid):
        return 'new Repeat({}{}, {}, {})'.format(
            '' if gid is None else 'Ids.{}, '.format(gid),
            self._element._export_java(java_indent, indent, enums, classes),
            self._min,
            self._max or 'null')
github transceptor-technology / pyleri / pyleri / optional.py View on Github external
    @java_export
    def _run_export_java(self, java_indent, indent, enums, classes, gid):
        return 'new Optional({}{})'.format(
            '' if gid is None else 'Ids.{}, '.format(gid),
            self._element._export_java(java_indent, indent, enums, classes))
github transceptor-technology / pyleri / pyleri / list.py View on Github external
    @java_export
    def _run_export_java(self, java_indent, indent, enums, classes, gid):
        return 'new List({}{}, {}, {}, {}, {})'.format(
            '' if gid is None else 'Ids.{}, '.format(gid),
            self._element._export_java(java_indent, indent, enums, classes),
            self._delimiter._export_java(java_indent, indent, enums, classes),
            self._min,
            self._max or 'null',
            'true' if self._opt else 'false')
github transceptor-technology / pyleri / pyleri / regex.py View on Github external
    @java_export
    def _run_export_java(self, java_indent, indent, enums, classes, gid):
        if self._compiled.flags & re.IGNORECASE:
            classes.add('java.util.regex.Pattern')
            return 'new Regex({}Pattern.compile("{}", {}))'.format(
                '' if gid is None else 'Ids.{}, '.format(gid),
                self._compiled.pattern
                    .replace('\\', '\\\\')
                    .replace('\'', '\\\'')
                    .replace('\\"', '"')
                    .replace('"', '\\"'),
                'Pattern.CASE_INSENSITIVE')

        return 'new Regex({}"{}")'.format(
            '' if gid is None else 'Ids.{}, '.format(gid),
            self._compiled.pattern
                .replace('\\', '\\\\')
github transceptor-technology / pyleri / pyleri / choice.py View on Github external
    @java_export
    def _run_export_java(self, java_indent, indent, enums, classes, gid):
        new_indent = indent + 1
        value = ',\n'.join(['{indent}{elem}'.format(
            indent=java_indent * new_indent,
            elem=elem._export_java(
                java_indent,
                new_indent,
                enums,
                classes)) for elem in self._elements])
        return 'new Choice({gid}\n{mg},\n{val}\n{indent})'.format(
            gid='' if gid is None else '\n{indent}Ids.{gid},'.format(
                indent=java_indent * (indent + 1),
                gid=gid),
            mg='{indent}{mg}'.format(
                indent=java_indent * (indent + 1),
                mg=('false', 'true')[
github transceptor-technology / pyleri / pyleri / tokens.py View on Github external
    @java_export
    def _run_export_java(self, java_indent, indent, enums, classes, gid):
        return 'new Tokens({}"{}")'.format(
            '' if gid is None else 'Ids.{}, '.format(gid),
            ' '.join(self._tokens))