Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@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)
@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')
@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')
@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))
@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')
@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('\\', '\\\\')
@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')[
@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))