code
stringlengths 501
5.19M
| package
stringlengths 2
81
| path
stringlengths 9
304
| filename
stringlengths 4
145
|
---|---|---|---|
from collections import namedtuple
from zmei_generator.domain.extensions import Extendable
from zmei_generator.domain.frozen import FrozenClass
from zmei_generator.generator.imports import ImportSet
from zmei_generator.parser.errors import GlobalScopeValidationError as ValidationException
class ApplicationDef(Extendable, FrozenClass):
# app_name: str
# models: Dict[str, ModelDef]
def __init__(self, app_name: str) -> None:
super().__init__()
self.application = None
self.app_name = app_name
self.translatable = False
self.models = {}
self.pages = {}
self.page_imports = ImportSet()
self.model_imports = ImportSet()
self.deps = []
self._apps = [app_name]
self.extensions = []
self._freeze()
def pages_support(self, extension_cls):
for page in self.pages.values():
if page.supports(extension_cls):
return True
return False
def pages_with(self, extension_cls):
return [page for page in self.pages.values() if page.supports(extension_cls)]
def models_support(self, extension_cls):
for model in self.models.values():
if model.supports(extension_cls):
return True
return False
def models_with(self, extension_cls):
return [model for model in self.models.values() if model.supports(extension_cls)]
def resolve_page(self, page_name_def):
if '.' in page_name_def:
if not self.application:
raise ValidationException(
'Application have no application assigned. Can not resolve reference.')
app_name, page_name = page_name_def.split('.', maxsplit=2)
if app_name not in self.application.applications:
raise ValidationException(
f'Unknown application: {app_name}, when trying to resolve model name "{page_name_def}". '
f'Available apps are: {",".join(self.application.applications)}')
try:
return self.application.applications[app_name].pages[page_name]
except KeyError:
raise ValidationException(
f'Unknown page: "{page_name}" in app "{app_name}" '
f'Available pages are: {",".join(self.application.applications[app_name].pages.keys())}')
else:
try:
return self.pages[page_name_def]
except KeyError:
raise ValidationException(
f'Unknown page: "{page_name_def}" in app "{self.app_name}" '
f'Available pages are: {",".join(self.pages.keys())}')
def resolve_model(self, model_name_def):
try:
if '.' in model_name_def:
if not self.application:
raise ValidationException(
'Application have no application assigned. Can not resolve reference.')
app_name, model_name = model_name_def.split('.', maxsplit=2)
if app_name not in self.application.applications:
raise ValidationException(
f'Unknown application: {app_name}, when trying to resolve model name "{model_name_def}". '
f'Available apps are: {",".join(self.application.applications)}')
return self.application.applications[app_name].models[
model_name]
else:
return self.models[model_name_def]
except KeyError:
raise ValidationException('Reference to unknown model: #{}'.format(model_name_def))
def add_deps(self, deps):
for dep in deps:
if dep not in self.deps:
self.deps.append(dep)
def add_apps(self, apps):
for app in apps:
if app not in self._apps:
self._apps.append(app)
@property
def has_sitemap(self):
for key, page in self.pages.items():
if page.has_sitemap:
return True
return False
@property
def apps(self):
app_names = self._apps
return app_names
def page_list(self):
return list(self.pages.values())
def post_process(self):
for col in self.models.values():
col.post_process()
def post_process_extensions(self):
for extension in self.extensions:
extension.post_process()
def get_required_apps(self):
all_apps = []
for col in self.models.values():
all_apps.extend(col.get_required_apps())
for extension in self.extensions:
all_apps.extend(extension.get_required_apps())
return list(set(all_apps))
def get_required_deps(self):
all_deps = []
for col in self.models.values():
all_deps.extend(col.get_required_deps())
for extension in self.extensions:
all_deps.extend(extension.get_required_deps())
return list(set(all_deps))
def get_required_urls(self):
all_urls = []
for col in self.models.values():
all_urls.extend(col.get_required_urls())
for extension in self.extensions:
all_urls.extend(extension.get_required_urls())
return all_urls
def get_required_settings(self):
all_settings = {}
for col in self.models.values():
all_settings.update(col.get_required_settings())
for extension in self.extensions:
all_settings.update(extension.get_required_settings())
return all_settings
FieldDeclaration = namedtuple('FieldDeclaration', ['import_def', 'declaration']) | zmei-cli | /zmei-cli-2.1.10.tar.gz/zmei-cli-2.1.10/zmei_generator/domain/application_def.py | application_def.py |
import re
from termcolor import colored
from zmei_generator.domain.extensions import Extendable
from zmei_generator.parser.errors import GlobalScopeValidationError as ValidationException
class PageExpression(Extendable):
def __init__(self, key, expression, page) -> None:
super().__init__()
self.expression = expression
self.page = page
self.key = key
self.or_404 = False
self.cache_type = None
self.cache_expr = None
self.serialize = False
self.model_name = None
self.model_descriptor = None
self.model_many = None
self.model_dict = None
if '@cached_as' in self.expression:
self.cache_type = 'cached_as'
elif '@cached' in self.expression:
self.cache_type = 'cached'
if self.cache_type:
self.expression, self.cache_expr = self.expression.split('@' + self.cache_type)
self.expression = self.expression.strip()
self.cache_expr = self.cache_expr.strip()
if self.cache_expr == '':
self.cache_expr = '()'
if not (self.cache_expr.startswith('(') and self.cache_expr.endswith(')')):
raise ValidationException('Cache expression must be surrounded with () in expression: {}, parsed cache expr: {}'.format(
expression,
self.cache_expr
))
self.expression = '{me.cache_type}{me.cache_expr}(lambda: {me.expression})'.format(me=self)
if '@or_404' in self.expression:
self.expression = self.expression.replace('@or_404', '')
self.or_404 = True
# @rest.xxx
m = re.search('@rest(\.([_a-zA-Z0-9]+))?', self.expression)
if m:
self.expression = self.expression.replace(m.group(0), '')
self.serialize = True
self.model_descriptor = m.group(2)
self.or_404 = True
# @rest.xxx
m = re.search('#([_a-zA-Z0-9_]+(\.[_a-zA-Z0-9_]+)?)(\[\]|\{\})?\s*$', self.expression)
if m:
self.expression = self.expression.replace(m.group(0), '')
self.model_name = m.group(1)
self.model_many = m.group(3) == '[]'
self.model_dict = m.group(3) == '{}'
if self.serialize:
if self.model_descriptor:
self.expression = f'serialize({self.expression}, "{self.model_descriptor}")'
else:
self.expression = f'serialize({self.expression})'
def get_annotation_with_braces(self, annot):
exp = self.expression
try:
idx = exp.index(annot)
except ValueError:
return
if not idx: # if it's in 0 position we also don't care
return
try:
if exp[idx + len(annot)] != '(':
return
except IndexError:
pass
new_exp = exp[:idx]
pos = 0
braces_level = 1
start_pos = idx + len(annot) + 1
for char in exp[start_pos:]:
if char == ')':
braces_level -= 1
if char == '(':
braces_level += 1
pos += 1
if braces_level == 0:
new_exp += exp[idx + start_pos + pos:]
break
if braces_level > 0:
return
exp_inside = self.expression[start_pos: start_pos + pos -1]
self.expression = new_exp.strip()
return exp_inside
def find_model_by_ref(self, ref):
try:
return self.page.application.models[ref]
except KeyError:
raise ValidationException(
'Can not parese page expression. Model not found by ref: {} when parsing page: {}\n\n'
'[..{}..]\n...\n{}: {}\n'.format(
'#' + ref,
self.page.name,
self.page.name,
self.key,
self.expression.replace('#' + ref, colored('#' + ref, 'white', 'on_red'))
))
def get_imports(self):
imports = []
for match in re.findall(r'#(\w+)\.', self.expression):
col = self.find_model_by_ref(match)
imports.append(('{}.models'.format(col.application.app_name), col.class_name))
if self.or_404:
imports.append(('django.core.exceptions', 'ObjectDoesNotExist'))
imports.append(('django.http', 'Http404'))
if self.cache_type:
imports.append(('cacheops', self.cache_type))
if 'get_language(' in self.expression:
imports.append(('django.utils.translation', 'get_language'))
if 'thumb(' in self.expression:
imports.append(('cratis_filer.utils', 'thumb'))
if self.serialize:
imports.append(('zmei.serializer', 'serialize'))
return imports
def render_python_code(self):
def replace_col_names(match):
return '{}.objects.'.format(self.find_model_by_ref(match.group(1)).class_name)
expr = self.expression.strip()
expr = re.sub(r'#(\w+)\.', replace_col_names, expr)
def replace_params(match):
param = match.group(1)
if param not in self.page.uri_params:
raise ValidationException(
'Can not parese page expression. Parameter not found: #{}'.format(param))
return "self.kwargs['{}']".format(param)
expr = re.sub(r'<(\w+)>', replace_params, expr)
return expr | zmei-cli | /zmei-cli-2.1.10.tar.gz/zmei-cli-2.1.10/zmei_generator/domain/page_expression.py | page_expression.py |
import re
from functools import lru_cache
from zmei_generator.contrib.web.extensions.page.block import BlockPlaceholder
from zmei_generator.domain.extensions import Extendable, PageExtension
from zmei_generator.domain.frozen import FrozenClass
from zmei_generator.parser.errors import GlobalScopeValidationError as ValidationException
class PageFunction(Extendable):
def __init__(self) -> None:
super().__init__()
self.name = None
self.args = None
self.out_args = None
self.body = None
def render_python_args(self, out=False):
return ', '.join(self.get_remote_args() if not out else self.out_args)
def is_data_arg(self, arg):
if arg.startswith('.'):
return True
return False
def get_remote_args(self):
return [x for x in self.args if not self.is_data_arg(x)]
def get_data_args(self):
return [x[1:] for x in self.args if self.is_data_arg(x)]
@property
def has_data_arg(self):
for arg in self.args:
if self.is_data_arg(arg):
return True
return False
@property
def python_name(self):
return f'_remote__{self.name}'
class PageDef(Extendable, FrozenClass):
def __init__(self, application, override=False) -> None:
super().__init__()
self.override = override
# self.raw_ = parse_result
self._parent = None
""":type: ApplicationDef"""
self.application = application
# self.rss = None
# self.auth = False
self.extension_bases = ['ZmeiDataViewMixin']
self.auto_page = False
self.template = True
self.name = None
self.extend_name = False
self.parent_name = None
self.parsed_template_name = None
self.parsed_template_expr = None
self.page_code = None
self.functions = None
self.allow_merge = False
# error handler for:
self.handlers = []
self.allow_post = False
if self.parent_name and self.parent_name not in self.application.pages:
raise ValidationException('Parent "{}" for page "{}" does not exist'.format(self.parent_name, self.name))
self.uri_params = []
self.children = []
self.imports = []
self.options = {}
self.methods = {}
# self.menus = {}
self.blocks = {}
# self.cruds = {}
# self.react = False
# self.react_components = {}
# self.page_component_name = None
# self.react_pages = {}
self.functions = {}
self.template_libs = []
# self.crud_views = {}
self.forms = {}
# self.themed_files = {}
# self._flutter = False
# self.react = False
# self.react_client = False
# self.react_server = False
# self.stream = False
self.defined_url_alias = None
self._uri = None
self.defined_uri = None
self.has_uri = False
self._i18n = False
# self.crud_overrides = {}
self.page_items = {}
self._freeze()
def get_template_libs(self):
return set(self.template_libs)
def add_form(self, name, definition):
self.forms[name] = definition
def get_blocks(self, platform=None):
filtered = {}
for area, blocks in self.blocks.items():
for ext in self.get_extensions():
if isinstance(ext, PageExtension):
blocks = ext.filter_blocks(area, blocks, platform)
if len(blocks):
filtered[area] = blocks
return filtered
def add_block(self, area, block, append=False):
if area not in self.blocks:
self.blocks[area] = []
if append:
for index, _block in enumerate(self.blocks[area]):
if isinstance(_block, BlockPlaceholder):
self.blocks[area].insert(index, block)
return
self.blocks[area].append(block)
def get_uri_params(self):
params = self.uri_params.copy()
if self.parent_name:
params += self.get_parent().get_uri_params()
return params
def get_extension_bases(self):
parent = self.get_parent()
if parent:
if 'ZmeiDataViewMixin' in self.extension_bases:
self.extension_bases.remove('ZmeiDataViewMixin')
if len(self.functions):
if parent:
if 'ZmeiDataViewMixin' in parent.extension_bases:
parent.extension_bases.remove('ZmeiDataViewMixin')
if 'ZmeiRemoteInvocationViewMixin' not in parent.extension_bases:
parent.extension_bases.append('ZmeiRemoteInvocationViewMixin')
else:
if 'ZmeiDataViewMixin' in self.extension_bases:
self.extension_bases.remove('ZmeiDataViewMixin')
if 'ZmeiRemoteInvocationViewMixin' not in self.extension_bases:
self.extension_bases.append('ZmeiRemoteInvocationViewMixin')
if not parent:
return self.extension_bases
all_bases = self.get_parent().get_all_bases()
bases_collected = [x for x in self.extension_bases if x not in all_bases]
for extension in self._extensions.values(): # type: PageExtension
if isinstance(extension, PageExtension):
bases_collected = extension.get_extension_bases(bases_collected)
return bases_collected
def get_all_bases(self):
bases = self.extension_bases.copy()
if self.parent_name:
bases += self.get_parent().get_all_bases()
return bases
def get_parent(self):
if self.parent_name:
if not self._parent:
self._parent = self.application.resolve_page(self.parent_name)
return self._parent
def merge(self, page):
for area, blocks in page.blocks.items():
if area in self.blocks:
self.blocks[area] = blocks + self.blocks[area]
else:
self.blocks[area] = blocks
def _find_params(self, match):
param = match.group(1)
expr = match.group(3) or '[^\/]+'
self.uri_params.append(param)
return '(?P<{}>{})'.format(param, expr)
@property
def i18n(self):
if self._i18n:
return True
parent = self.get_parent()
if parent:
return parent.i18n
return False
@property
def uri(self):
_uri = self._uri
if not _uri:
return
if _uri.startswith('.'):
_uri = _uri[1:]
parent = self.get_parent()
if parent:
if parent.uri:
_uri = '/'.join([parent.uri, _uri])
_uri = re.sub('/+', '/', _uri)
return _uri
def set_uri(self, uri):
self.defined_uri = uri
self.has_uri = bool(uri)
if uri:
if uri.startswith('$'):
uri = uri[1:]
self._i18n = True
self._uri = re.sub(r'<(\w+)(\s*:\s*([^\>]+))?>', self._find_params, uri)
# TODO: restore?
# def get_parent_flutter(self):
# if self._flutter and self.flutter.include_child:
# return self._flutter
#
# if self.get_parent():
# return self.get_parent().get_parent_flutter()
#
# @property
# @lru_cache(maxsize=1)
# def flutter(self):
# if self._flutter:
# return self._flutter
#
# if self.get_parent():
# return self.get_parent().get_parent_flutter()
@property
def own_item_names(self):
names = []
for key in self.page_items.keys():
if key.startswith('_'):
key = key[1:]
names.append(key)
return list(names)
@property
def url_alias(self):
return self.defined_url_alias or self.name
@property
def parent_view_name(self):
if not self.parent_name:
return 'TemplateView'
return self.application.resolve_page(self.parent_name).view_name
def get_imports(self):
imports = self.imports
if len(self.functions): # or self._flutter:
imports.append(('app.utils.rest', 'ZmeiRemoteInvocationViewMixin'))
imports.append(('app.utils.views', 'ZmeiDataViewMixin'))
parent = self.get_parent()
if parent and parent.application != self.application:
imports.append((f'{parent.application.app_name}.views', parent.view_name))
return imports
@property
def has_functions(self):
if len(self.functions):
return True
if self.get_parent():
return self.get_parent().has_functions
return False
# TODO: restore?
# @property
# def has_streams(self):
# if self.stream:
# return True
#
# if self.get_parent():
# return self.get_parent().has_streams
#
# return False
#
# @property
# def streaming_page(self):
# if self.stream:
# return self
#
# if self.get_parent():
# return self.get_parent().streaming_page
#
# return None
@property
def has_data(self):
return len(self.page_item_names_with_parents)
@property
def has_sitemap(self):
return self.sitemap_expr is not None
@property
def view_name(self):
return '{}{}View'.format(
''.join([x.capitalize() for x in self.application.app_name.split('_')]),
''.join([x.capitalize() for x in self.name.split('_')])
)
def list_own_or_parent_extensions(self, cls):
extensions = []
if self.get_parent():
extensions.extend(self.get_parent().list_own_or_parent_extensions(cls))
if self.supports(cls):
extensions.append(self[cls])
return extensions
def list_own_or_parent_functions(self):
functions = {}
if self.get_parent():
functions.update(self.get_parent().list_own_or_parent_functions())
functions.update(self.functions)
return functions
def get_own_or_parent_extension(self, cls):
if self.supports(cls):
return self[cls]
if self.get_parent():
return self.get_parent().get_own_or_parent_extension(cls)
return None
@property
def urls_line(self):
_uri = self.uri
uri = _uri[1:] if _uri.startswith('/') else _uri
return '^{}$'.format(uri)
@property
def page_item_names_with_parents(self):
names = self.page_item_names
parent = self.get_parent()
if parent:
names += parent.page_item_names_with_parents
return set(names)
@property
def page_item_names(self):
names = ['url']
for key in self.page_items.keys():
if key.startswith('_'):
key = key[1:]
names.append(key)
return list(names)
def render_method_headers(self, use_data=False, use_parent=False, use_url=False, use_request=False):
code = ""
if use_data or use_parent:
code += "data = self._get_data()\n"
if use_parent:
code += "parent = type('parent', (object,), data)\n"
if use_request:
code += "request = self.request\n"
if use_url:
code += "url = type('url', (object,), self.kwargs)\n"
if len(code) > 0:
code += "\n"
return code
def render_page_code(self):
code = ""
for key, item in self.page_items.items():
indent = 0
inherited = False
# private variables
if key.startswith('_'):
key = key[1:]
indent = 4
inherited = True
code += "if not inherited:\n"
if not item.or_404:
code += " " * indent + key + " = " + item.render_python_code() + "\n"
else:
code += " " * indent + "try:\n"
code += " " * indent + " " + key + " = " + item.render_python_code() + "\n"
code += " " * indent + "except ObjectDoesNotExist:\n"
code += " " * indent + " raise Http404\n"
if inherited:
code += "else:\n"
code += " " * indent + key + " = None\n"
code += self.page_code or ''
code = self.render_method_headers(
use_data=False,
use_parent=False,
use_request=False,
use_url=False,
) + code
if len(code.strip()) == 0:
return ''
return code
@property
def defined_template_name(self):
"""
Returns name of template if it is not an expression
"""
if self.parsed_template_expr:
return None
elif self.parsed_template_name:
return '{}'.format(self.parsed_template_name)
else:
return '{}/{}.html'.format(self.application.app_name, self.name)
def render_template_name_expr(self):
if not self.template:
return ''
if not self.parsed_template_expr:
return 'template_name = "{tpl}"'.format(tpl=self.defined_template_name)
code = self.parsed_template_expr
code = "def get_template_names(self):\n" + self.render_method_headers(
use_data='data.' in code,
use_parent=False,
use_request='request.' in code,
use_url='url' in code,
) + 'return [' + code + ']\n'
return code
def render_method_expr(self, method_code):
code = method_code
code = self.render_method_headers(
use_data='data.' in code,
use_parent=False,
use_request='request.' in code,
use_url='url.' in code,
) + code + '\n'
return code | zmei-cli | /zmei-cli-2.1.10.tar.gz/zmei-cli-2.1.10/zmei_generator/domain/page_def.py | page_def.py |
class Extension(object):
extension_many = False
def post_process(self):
pass
def get_required_apps(self):
return []
def get_required_deps(self):
return []
def get_required_settings(self):
return {}
def get_required_urls(self):
return []
@classmethod
def write_settings(cls, apps, f):
pass
@classmethod
def generate(cls, apps, target_path):
pass
def format_extension_value(self, current_value):
"""
:param current_value:
:param extension: Extension
:return:
"""
return self
def get_extension_type(self):
"""
:param current_value:
:param extension: Extension
:return:
"""
return type(self)
class ApplicationExtension(Extension):
def __init__(self, application):
super().__init__()
application.register_extension(self)
self.application = application
class ModelExtension(Extension):
def __init__(self, model) -> None:
super().__init__()
model.register_extension(self)
self.model = model
class PageExtension(Extension):
def __init__(self, page) -> None:
super().__init__()
self.page = page
@property
def can_inherit(self):
return False
def filter_blocks(self, area, blocks, platform):
return blocks
def get_extension_bases(self, bases):
return bases
class Extendable(object):
def __init__(self) -> None:
super().__init__()
self._extensions = {}
def register_extension(self, extension: Extension):
_type = extension.get_extension_type()
self._extensions[_type] = extension.format_extension_value(self._extensions.get(_type))
def supports(self, cls):
return cls in self._extensions
def get_extensions(self):
return self._extensions.values()
def __getitem__(self, cls):
if cls in self._extensions:
return self._extensions[cls]
raise IndexError(f'{self} does not support {cls} extension') | zmei-cli | /zmei-cli-2.1.10.tar.gz/zmei-cli-2.1.10/zmei_generator/domain/extensions.py | extensions.py |
from zmei_generator.domain.extensions import Extendable
from zmei_generator.domain.frozen import FrozenClass
from zmei_generator.parser.errors import GlobalScopeValidationError as ValidationException
class ModelDef(Extendable, FrozenClass):
#
# ref: str
# name: str
# fields: Dict[str, FieldDef]
# rest: False
# translatable: False
def __init__(self, application) -> None:
super().__init__()
# self.raw_ = parse_result
""":type: ApplicationDef"""
self.application = application
self.ref = None
self.short_ref = self.ref
self.name = None
self.name_plural = None
self.extend_name = False
self.to_string = None
self.polymorphic = False
self.parent = None
self.child_models = []
self.fields = {}
self.translatable = False
self.mixin_classes = []
self.validators = []
self.signal_handlers = []
self.tree = False
self.tree_polymorphic_list = False
self.sortable = False
self.sortable_field = None
self.date_hierarchy = None
self._freeze()
def post_process(self):
for field in list(self.fields.values()):
field.post_process()
def set_parent(self, parent):
if parent not in self.application.models:
raise ValidationException(
'Model "{}" marked as parent for "{}", but not yet loaded or do not exist.'.format(
parent, self.ref
))
self.parent = self.application.models[parent] # type: ModelDef
if self.parent.parent:
raise ValidationException(
'Model "{}" marked as parent for "{}", but it\'s already has parent. Multilevel polymorphism is not supported yet.'.format(
parent, self.ref
))
self.parent.polymorphic = True
self.parent.child_models.append(self)
if self.parent.translatable:
self.translatable = True
@property
def model_class_declaration(self):
classes = []
if self.parent:
classes.append(self.parent.class_name)
elif self.polymorphic:
if self.tree:
classes.append('PolymorphicMPTTModel')
else:
classes.append('PolymorphicModel')
elif self.tree:
classes.append('MPTTModel')
if not classes:
classes.append('models.Model')
return ', '.join(classes)
@property
def child_model_classes(self):
if not self.polymorphic:
return []
return [x.class_name for x in self.child_models]
def check_field_exists(self, field_name):
fields = self.expand_field_pattern(field_name)
return len(fields) > 0
def expand_field_pattern(self, field_pattern):
fields = []
# if local_only
if field_pattern.startswith('.'):
field_pattern = field_pattern[1:]
else:
if self.parent:
fields += self.parent.expand_field_pattern(field_pattern)
if field_pattern.endswith('*'):
prefix = field_pattern[:-1]
for key in self.fields.keys():
if key.startswith(prefix):
fields.append(key)
elif field_pattern.startswith('*'):
suffix = field_pattern[1:]
for key in self.fields.keys():
if key.endswith(suffix):
fields.append(key)
elif field_pattern in self.fields:
fields.append(field_pattern)
return fields
def filter_fields(self, filter_spec, include_refs=False, field_set=None):
allow_parents = filter_spec[0] != '.*'
if not field_set:
if not include_refs:
fields = self.own_fields
if allow_parents and self.parent:
fields = tuple(self.parent.own_fields) + tuple(fields)
else:
fields = self.fields.values()
if allow_parents and self.parent:
fields = tuple(self.parent.fields.values()) + tuple(fields)
else:
fields = field_set
if filter_spec[0] in ('*', '.*'):
exclude_list = []
for item in filter_spec[1:]:
if item[0] != '^':
raise ValidationException(
'If * used in field list, then all other fields should start with ^ (exclude)')
new_fields = self.expand_field_pattern(item[1:])
if not new_fields:
raise ValidationException(
'Field name specified for exclude: "{}" does not exist'.format(item[1:]))
exclude_list += new_fields
return [field for field in fields if field.name not in exclude_list]
else:
include_list = []
for item in filter_spec:
if item == '*':
raise ValidationException('* maybe used only as first item in field list')
if item[0] == '^':
raise ValidationException('^ maybe used only with * as first item in field list')
new_fields = self.expand_field_pattern(item)
if not new_fields:
raise ValidationException(
'Field name specified for include: "{}" does not exist'.format(item))
include_list += new_fields
return [field for field in fields if field.name in include_list]
@property
def class_name(self):
class_name = ''.join([x.capitalize() for x in self.ref.split('_')])
# if not self.parent:
return class_name
# else:
# return '{}{}'.format(self.parent.class_name, class_name)
@property
def fqdn(self):
return '.'.join([self.application.app_name, self.class_name])
@property
def display_field(self):
for field in self.fields.values():
if field.display_field:
return field
@property
def all_fields(self):
return self.fields.values()
@property
def all_and_inherited_fields_map(self):
if not self.parent:
return self.fields
all_fields = {}
all_fields.update(self.parent.fields)
all_fields.update(self.fields)
return all_fields
@property
def own_fields(self):
return [field for field in self.fields.values() if field.type_name not in ['ref']]
@property
def own_fields_non_expr(self):
return [field for field in self.fields.values() if field.type_name not in ['ref', 'expr']]
@property
def expression_fields(self):
admin_list = [x.slug for x in self.admin_list]
return [field for field in self.fields.values() if field.type_name == 'expr' and field.slug not in admin_list]
@property
def prepopulated_fields(self):
prepopulated = {}
for field in self.all_and_inherited_fields_map.values():
info = field.get_prepopulated_from()
if info:
prepopulated[field.name] = info
return prepopulated
@property
def translatable_fields(self):
return [field for field in self.own_fields if field.translatable]
@property
def expression_fields(self):
from zmei_generator.contrib.web.fields.expression import ExpressionFieldDef
return [field for field in self.fields.values() if isinstance(field, ExpressionFieldDef)]
@property
def read_only_fields(self):
return [x for x in self.expression_fields if x in self.all_fields]
@property
def relation_fields(self):
from zmei_generator.contrib.web.fields.relation import RelationDef
return [field for field in self.own_fields if isinstance(field, RelationDef)]
def get_required_apps(self):
all_apps = []
for field in self.all_fields:
all_apps.extend(field.get_required_apps())
if self.polymorphic:
all_apps.append('polymorphic')
return all_apps
def get_required_deps(self):
all_deps = []
for field in self.all_fields:
all_deps.extend(field.get_required_deps())
if self.polymorphic:
all_deps.append('django-polymorphic')
return all_deps
def get_required_urls(self):
all_urls = []
for field in self.all_fields:
all_urls.extend(field.get_required_urls())
return all_urls
def get_required_settings(self):
all_settings = {}
for field in self.all_fields:
all_settings.update(field.get_required_settings())
return all_settings | zmei-cli | /zmei-cli-2.1.10.tar.gz/zmei-cli-2.1.10/zmei_generator/domain/model_def.py | model_def.py |
from zmei_generator.domain.extensions import Extendable
from zmei_generator.domain.model_def import ModelDef
class FieldConfig(object):
type_name = None
name = None
verbose_name = None
field_help = None
required = None
not_null = None
unique = None
index = None
display_field = None
translatable = None
comment = None
type_opts = {}
class FieldDef(Extendable):
def __init__(self, model: ModelDef, field: FieldConfig) -> None:
super().__init__()
self.field_config = field
self.model = model
self.type_name = field.type_name
self.name = None
self.verbose_name = None
self.help = None
self.required = None
self.not_null = None
self.unique = None
self.index = None
self.display_field = None
self.translatable = None
self.comment = None
self.read_only = False
self.inline = False
self.extension_args = None
self.extension_args_append = False
self.options = None
def load_field_config(self):
field = self.field_config
self.name = field.name
self.verbose_name = field.verbose_name
self.help = field.field_help
self.required = field.required
self.not_null = field.not_null
self.unique = field.unique
self.index = field.index
self.display_field = field.display_field
self.translatable = field.translatable
self.comment = field.comment.strip() if field.comment else None
if self.translatable:
self.model.translatable = True
self.model.application.translatable = True
self.options = field.type_opts
def post_process(self):
pass
def prepare_field_arguemnts(self, own_args=None):
if not self.extension_args_append and self.extension_args:
return {'_': self.extension_args}
args = {}
if self.verbose_name:
args['verbose_name'] = self.verbose_name
else:
args['verbose_name'] = self.name.replace('_', ' ').capitalize()
if self.help:
args['help_text'] = self.help
if not self.not_null:
args['null'] = True
args['blank'] = not self.required
if self.unique:
args['unique'] = True
if self.index:
args['db_index'] = True
if own_args:
args.update(own_args)
if self.extension_args:
args['_'] = self.extension_args
return args
def parse_options(self):
self.options = {}
def get_model_field(self):
raise NotImplementedError('Field "{}" ({}) is not yet implemented.'.format(self.type_name, type(self)))
def get_flutter_field(self):
return 'dynamic'
def get_flutter_from_json(self, name):
return f"data['{name}']"
def get_admin_widget(self):
return None
def get_prepopulated_from(self):
return None
def get_rest_field(self):
return None
def get_rest_inline_model(self):
return None
def get_required_apps(self):
return []
def get_required_deps(self):
return []
def get_required_settings(self):
return {}
def get_required_urls(self):
return []
@property
def admin_list_renderer(self):
return None | zmei-cli | /zmei-cli-2.1.10.tar.gz/zmei-cli-2.1.10/zmei_generator/domain/field_def.py | field_def.py |
import atexit
import os
import signal
from pprint import pprint
import click
import pkg_resources
from termcolor import colored
from time import sleep
from zmei_generator.cli.server import zmei_generate
from zmei_generator.generator.grammar import build_parser, is_parser_declaration_changed
from zmei_generator.generator.utils import StopGenerator
from zmei_generator.parser.errors import ValidationError
from .utils import collect_files, extract_files, collect_app_names, migrate_db, install_deps, remove_db, \
wait_for_file_changes, run_django, run_webpack, npm_install, get_watch_paths, run_celery, run_livereload, \
flutter_install
@click.group()
def main(**args):
pass
def run_command(cmd, show=False):
print(cmd)
if not show:
os.system(cmd)
@main.group()
@click.option('--debug-port', default=None, help='Connect to pydevd port')
@click.option('--src', default='.', help='Sources path')
@click.option('--dst', default='.', help='Target path')
def gen(debug_port, **args):
if debug_port:
import pydevd
pydevd.settrace('localhost', port=int(debug_port), stdoutToServer=True, stderrToServer=True)
# ensure_logged_in()
pass
@main.command(help='Generate parser definition')
def build():
build_parser()
@gen.command(help='Generate and start app')
@click.option('--port', default='8000', help='Django host:port to run on')
@click.option('--ip', default='127.0.0.1', help='Django host:port to run on')
@click.option('--public', is_flag=True, help='Run django on 0.0.0.0')
@click.option('--live', default=False, is_flag=True, help='Reload browser on changes')
@click.option('--celery', default=False, is_flag=True, help='Run with celery')
def up(**args):
gen(up=True, **args)
@gen.command(help='Run application')
@click.option('--nodejs', is_flag=True, help='Initialize nodejs dependencies')
@click.option('--celery', is_flag=True, help='Run celery worker & beat')
@click.option('--watch', is_flag=True, help='Watch for changes')
@click.option('--webpack', is_flag=True, help='Run webpack with reload when generation ends')
@click.option('--port', default='8000', help='Django host:port to run on')
@click.option('--ip', default=None, help='Django host:port to run on')
@click.option('--public', is_flag=True, help='Run django on 0.0.0.0')
def app_run(**kwargs):
gen(run=True, **kwargs)
@gen.command(help='Just generate the code')
@click.argument('app', nargs=-1)
@click.option('--public', is_flag=True, help='Run django on 0.0.0.0')
def generate(app=None, **args):
gen(app=app or [], **args)
@gen.command(help='Install project dependencies')
def install():
gen(install=True)
@gen.group(help='Database related commands')
def db(**args):
pass
@db.command(help='Creates database migrations and apply them')
@click.argument('app', nargs=-1)
def migrate(app, **args):
gen(auto=True, app=app)
@db.command(help='db remove + db migrate')
@click.argument('app', nargs=-1)
def rebuild(app, **args):
gen(rebuild=True, app=app)
@db.command(help='Rollback all the migrations')
@click.argument('app', nargs=-1)
def remove(app, **args):
gen(remove=True, app=app)
def gen(auto=False,
src='.',
dst='.',
install=False,
rebuild=False,
remove=False,
app=None,
run=False,
live=False,
webpack=False,
nodejs=False,
celery=False,
public=None,
ip=None,
port=8000,
watch=False,
up=False
):
if rebuild:
auto = True
remove = True
if public:
try:
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
ip = s.getsockname()[0]
s.close()
except Exception as e:
print(f'Can not run on public port: {e}')
return
elif not ip:
ip = '127.0.0.1'
host = '{}:{}'.format(ip, port)
os.environ.setdefault('ZMEI_SERVER_IP', str(ip))
os.environ.setdefault('ZMEI_SERVER_PORT', str(port))
os.environ.setdefault('ZMEI_SERVER_HOST', str(host))
if up:
install = True
auto = True
watch = True
run = True
if not app or len(app) == 0:
app = collect_app_names()
# Generate parser if something new is installed
if is_parser_declaration_changed():
if not build_parser():
print('Can not generate parser definition, sorry.')
return
src = os.path.realpath(src)
dst = os.path.realpath(dst)
livereload_process = None
django_process = None
webpack_process = None
celery_process = None
def emergency_stop():
if livereload_process:
os.killpg(os.getpgid(livereload_process.pid), signal.SIGTERM)
if django_process:
os.killpg(os.getpgid(django_process.pid), signal.SIGTERM)
if webpack_process:
os.killpg(os.getpgid(webpack_process.pid), signal.SIGTERM)
if celery_process:
os.killpg(os.getpgid(celery_process.pid), signal.SIGTERM)
sleep(1)
print('\n')
atexit.register(emergency_stop)
for i in wait_for_file_changes(get_watch_paths(), watch=watch):
print('--------------------------------------------')
print('Generating ...')
print('--------------------------------------------')
files = collect_files(src)
try:
files = zmei_generate(files, models=app)
except (NotImplementedError, ValidationError) as e:
print(e)
continue
except StopGenerator as e:
print(e.description)
continue
changed = extract_files(dst, files)
if up and os.path.exists('react'):
webpack = True
nodejs = True
if nodejs and os.path.exists('react'):
npm_install()
if remove:
remove_db(apps=app)
if install or rebuild:
django_process = install_deps(django_process)
if os.path.exists('flutter'):
flutter_install()
if auto and (changed.models or not django_process):
migrate_db(apps=app)
if run and live and not livereload_process:
livereload_process = run_livereload()
if run and not django_process:
django_process = run_django(run_host=host)
# if webpack and not webpack_process:
# webpack_process = run_webpack()
if celery:
# restart celery process on changes
if celery_process:
os.killpg(os.getpgid(celery_process.pid), signal.SIGTERM)
celery_process = run_celery()
if watch:
print(colored('> ', 'white', 'on_blue'), 'Watching for changes...')
def run():
main() | zmei-cli | /zmei-cli-2.1.10.tar.gz/zmei-cli-2.1.10/zmei_generator/cli/main.py | main.py |
import _thread
import hashlib
import io
import json
import os
import re
import signal
import subprocess
import sys
import threading
import zipfile
from contextlib import contextmanager
from difflib import Differ
from glob import glob
from io import BytesIO
from select import select
import click
import readchar
from itertools import chain
from shutil import rmtree
from termcolor import colored
from time import sleep
@contextmanager
def chdir(path):
cwd = os.getcwd()
os.chdir(path)
yield
os.chdir(cwd)
PACKAGE_JSON_TOKEN = '__generated__'
def expand__files_json(file_mapping):
realpath = os.getcwd()
for record in file_mapping:
if record['kind'] == 'file':
pathname = os.path.realpath(record['path'])
if not pathname.startswith(realpath):
print(colored(f"Attempt to write file out of working "
f"directory: {record['path']}", 'white', 'on_red'), ' ')
return
if not os.path.exists(pathname):
with open(pathname, 'w') as f:
f.write(record['source'])
print(colored(' + ', 'blue', 'on_green'), ' ', record['path'])
yield record['path']
else:
print(colored(f"Unsupported file record: {record['kind']}", 'red', 'on_yellow'), ' ')
def write_generated_file(path, source):
# special hack for settings.py->SECRET_KEY
if path.endswith('app/_settings.py'):
if os.path.exists(path):
with open(path, 'r') as f:
found = re.search('^SECRET_KEY\s*=.*$', f.read(), flags=re.MULTILINE)
if found:
current_key = found.group(0)
new_key = re.search('^\s*SECRET_KEY\s*=.*$', source, flags=re.MULTILINE).group(0)
source = source.replace(new_key, current_key)
dirname = os.path.dirname(path)
if dirname and len(dirname) and not os.path.exists(dirname):
os.makedirs(dirname)
chksum = source_hash(source)
tag = f"generated: {chksum}"
source_prefix = ''
if path.endswith('.py') or path.endswith('.yaml') or path.endswith('.yml') or path.endswith('_requirements.txt')\
or path.endswith('requirements.prod.txt') or path.endswith('Dockerfile') or path.endswith('nginx.conf') \
or path.endswith('.ini'):
# settings.py is specially designed to be overriden
if not path.endswith('app/settings.py') \
and not path.endswith('app/tasks.py') \
and not path.endswith('app/urls.py'):
source_prefix = f"# {tag}\n\n"
elif path.endswith('.js') or path.endswith('.jsx') or path.endswith('.dart'):
source_prefix = f"//# {tag}\n\n"
elif path.endswith('.md'):
source_prefix = f"<!-- # {tag} -->\n\n"
elif path.endswith('package.json'):
chksum = source_hash(json.dumps(json.loads(source), indent=4))
source = json.dumps({**json.loads(source), **{PACKAGE_JSON_TOKEN: chksum}}, indent=4)
elif ('/templates/' in path or '/themes/' in path) and path.endswith('.html'):
source_prefix = f"{{# {tag} #}}\n\n"
if os.path.exists(path):
real_source, generated, changed, file_checksum = is_generated_file(path)
if generated:
if changed:
if sys.stdout.isatty():
parts = path.split('/')
print_path = colored(' ? ', 'white', 'on_red') + ' ' + '/'.join(parts[:-1]) + '/'
print_path += colored(parts[-1], 'yellow')
valid = False
answer = None
while not valid:
print(f'{print_path}\nFile is modified. Should I remove "generated" marker? \n'
f'(o = overwrite, d = show diff, a = abort, i = ignore, y = remove marker) [i]: ', end='')
answer = readchar.readchar()
if answer == 'd':
for line in Differ().compare(
real_source.splitlines(keepends=True),
source.splitlines(keepends=True)
):
if line[0] in ('+', '-'):
line = {'+': colored(line, 'green'), '-': colored(line, 'red')}[line[0]]
sys.stdout.write(line)
valid = answer in ['o', 'i', 'y']
if answer == 'a' or ord(answer) in (3, 4):
raise KeyboardInterrupt
if answer.strip() == '':
answer = 'i'
valid = True
if not valid and answer != 'd':
print(ord(answer))
print('Invalid input.')
print('\n')
if answer == 'o':
pass # overwrite
elif answer == 'y':
source = real_source
source_prefix = ''
else:
return
else:
print(colored(' ! ', 'white', 'on_red'), ' ', path)
return
else:
if file_checksum == chksum:
return # already up to date
else:
# print(f'skip: {path}')
return # file intentionally overridden. Do not overwrite!
if not os.path.exists(path):
print(colored(' + ', 'blue', 'on_green'), ' ', path)
else:
print(colored(' ~ ', 'blue', 'on_cyan'), ' ', path)
with open(path, 'w') as f:
if source_prefix:
f.write(source_prefix)
f.write(source)
# print(f'write: {path}')
return True
def is_generated_file(path):
"""
Checks if file is generated, and is it changed
:param path:
:return: real_source, generated, changed, checksum
"""
with open(path, 'r') as f:
content = f.read()
if path.endswith('package.json'):
try:
data = json.loads(content)
except Exception as e:
print('Can not read package.json. That\'s shouldn\'t happen as file is auto-generated.', e)
data = {}
try:
file_chk_expected = data[PACKAGE_JSON_TOKEN]
except KeyError:
return content, False, False, None
data = json.loads(content)
if PACKAGE_JSON_TOKEN in data:
del data[PACKAGE_JSON_TOKEN]
real_source = json.dumps(data, indent=4)
else:
match = re.match('^(<!--\s*)?({|//)?# generated: ([a-f0-9]{32})( #})?(\s*-->)?\n\n', content)
if not match:
return content, False, False, None
file_chk_expected = match.group(3)
real_source = content[len(match.group(0)):]
file_chk_real = source_hash(real_source)
if file_chk_expected != file_chk_real:
return real_source, True, True, file_chk_real # checksum failed. Changed by hands?
else:
return real_source, True, False, file_chk_real
def source_hash(source):
hash_md5 = hashlib.md5()
source = source.strip()
hash_md5.update(source.encode())
return hash_md5.hexdigest()
def copy_generated_tree(source_path, target_path, glob_expr="**/*"):
files = []
with chdir(source_path):
for file in glob(glob_expr, recursive=True):
with open(file, 'r') as f:
files.append((file, f.read()))
with chdir(target_path):
for path, source in files:
write_generated_file(path, source)
def clean_up_generated_files(path, file_list, remove_root=False):
for file in os.listdir(path):
if file.startswith('.'):
continue
if file == 'node_modules':
continue
fullpath = os.path.join(path, file)
if os.path.isdir(fullpath):
clean_up_generated_files(fullpath, file_list, remove_root=True)
else:
if file[0] != '.' and file.split('.')[-1] in ('js', 'jsx', 'py', 'html', 'dart'):
real_source, generated, changed, file_checksum = is_generated_file(fullpath)
if generated and (fullpath not in file_list):
if changed:
print(colored('skip:', 'red', 'on_yellow'), ' ', fullpath)
else:
print(colored(' - ', 'white', 'on_red'), ' ', fullpath)
os.unlink(fullpath)
if len(os.listdir(path)) == 0 and remove_root:
os.rmdir(path)
print(colored('delete:', 'white', 'on_red'), ' ', path)
class FileChangeSet(object):
def __init__(self):
self.changed_files = []
self.models = False
self.templates = False
self.requirements = False
self.other = False
def append(self, path):
req_file = os.environ.get('ZMEI_REQUIREMENTS_FILE', 'requirements.txt')
self.changed_files.append(path)
if path.endswith('models.py'):
self.models = True
return
if path.endswith('.html'):
self.templates = True
return
# both 'requirements.txt' and '_requirements.txt'
if path.endswith(req_file):
self.requirements = True
return
self.other = True
def extract_files(dst, file_bytes):
req_file = os.environ.get('ZMEI_REQUIREMENTS_FILE', 'requirements.txt')
changed_files = FileChangeSet()
files = zipfile.ZipFile(BytesIO(file_bytes), mode='r', compression=zipfile.ZIP_LZMA)
file_mapping = None
for path in files.namelist():
if path == 'requirements.txt':
path = req_file
if path == '__files.json':
file_mapping = json.loads(files.read(path).decode())
continue
full_path = os.path.join(dst, path)
if write_generated_file(full_path, files.read(path).decode()):
changed_files.append(full_path)
file_list = [f"./{x}" for x in files.namelist()]
if file_mapping:
file_list += [f"./{x}" for x in expand__files_json(file_mapping)]
clean_up_generated_files('.', file_list)
return changed_files
def collect_files(src):
with chdir(src):
f = io.BytesIO()
files = zipfile.ZipFile(f, mode='w', compression=zipfile.ZIP_LZMA)
for path in get_collect_paths():
real_source, generated, changed, checksum = is_generated_file(path)
if not generated or changed:
files.write(path)
files.close()
f.seek(0)
return f.getvalue()
def get_collect_paths():
paths = []
paths += list(glob('*.col'))
paths += list(glob('col/*.col'))
paths += list(glob('col/**/*.col', recursive=True))
# paths += list(glob('react/src/**/*.jsx', recursive=True))
# paths += list(glob('react/*.js'))
# paths += list(glob('react/*.json'))
return set(paths)
def get_watch_paths():
paths = []
paths += list(glob('*.col'))
paths += list(glob('col/*.col'))
paths += list(glob('col/**/*.col', recursive=True))
paths += list(glob('col/**/*.html', recursive=True))
# paths += list(glob('react/src/**/*.js', recursive=True))
# paths += list(glob('react/src/**/*.jsx', recursive=True))
# paths += list(glob('react/*.js'))
paths += list(glob('react/*.json'))
return set(paths)
def collect_app_names():
models = []
for filename in get_collect_paths():
if os.path.isfile(filename) and filename.endswith('.col'):
if not re.match('^(col/)?[a-zA-Z][a-zA-Z0-9_]+\.col$', filename):
print('Model file has incorrect name: {}'.format(filename))
if filename.startswith('col/'):
filename = filename[4:]
app_name = filename[0:-4]
models.append(app_name)
return models
def migrate_db(apps, features=None):
print(colored('> ', 'white', 'on_blue'), 'Migrating database')
django_command = get_django_command(features)
db_apps = [app for app in apps if os.path.exists(f'{app}/models.py')]
try:
subprocess.run('{} makemigrations {}'.format(django_command, ' '.join(db_apps)), shell=True, check=True)
except subprocess.CalledProcessError:
pass
try:
subprocess.run('{} migrate'.format(django_command), shell=True, check=True)
except subprocess.CalledProcessError:
pass
def run_django(features=None, run_host='127.0.0.1:8000'):
print(colored('> ', 'white', 'on_blue'), 'Starting django')
if os.path.exists('flutter/'):
if run_host.startswith('127.0.0.1:'):
print(colored('NB! you have a flutter application, but running django on a '
f'local interface {run_host}. Flutter application is '
f'not able to connect to api! use "--public": zmei gen up --public', 'white', 'on_red'))
else:
print(colored(f'Flutter api is accessible on {run_host}. Make sure to connect '
f'phone to the same wifi network as your computer, if running on a real device.', 'white',
'on_blue')),
django_command = get_django_command(features, )
options = ''
if os.path.exists('app/settings_dev.py'):
options = ' --settings app.settings_dev'
full_command = '{} runserver {}{}'.format(django_command, run_host, options)
print(full_command)
return subprocess.Popen(full_command, preexec_fn=os.setsid, shell=True)
def run_livereload():
if not os.path.exists('app/settings_dev.py'):
with open('app/settings_dev.py', 'w') as f:
f.write("""
from .settings import *
INSTALLED_APPS += [
'livereload',
]
MIDDLEWARE += [
'livereload.middleware.LiveReloadScript',
]
""")
os.system('pip install django-livereload-server')
print(colored('> ', 'white', 'on_blue'), 'Starting livereload server')
return subprocess.Popen('python manage.py livereload --settings app.settings_dev', preexec_fn=os.setsid, shell=True)
def run_webpack():
print(colored('> ', 'white', 'on_blue'), 'Starting webpack')
webpack_command = './node_modules/.bin/webpack -w'
print(webpack_command)
return subprocess.Popen('{}'.format(webpack_command), shell=True, cwd='react', preexec_fn=os.setsid)
def run_celery():
print(colored('> ', 'white', 'on_blue'), 'Starting celery')
webpack_command = 'celery -A app worker -B -E -l info'
print(webpack_command)
return subprocess.Popen('{}'.format(webpack_command), shell=True, preexec_fn=os.setsid)
def npm_install():
if is_req_file_changed('react/package.json'):
print(colored('> ', 'white', 'on_blue'), 'Installing nodejs dependencies ...')
cmd = 'npm install'
print(cmd)
if subprocess.run('{}'.format(cmd), shell=True, cwd='react', check=True):
mark_req_file_installed('react/package.json')
def flutter_install():
if not os.path.exists('flutter/.metadata'):
os.system('flutter create --project-name app flutter/')
def remove_db(apps, features=None):
django_command = get_django_command(features)
for app_name in apps:
if not os.path.exists(f'{app_name}/migrations'):
continue
filename = '{}.col'.format(app_name)
if not os.path.exists(filename):
print('No such model: {}'.format(app_name))
app_name = app_name
print(colored('> ', 'white', 'on_blue'), 'Unapplying migrations')
subprocess.run('{} migrate {} zero'.format(django_command, app_name), shell=True, check=True)
print(colored('> ', 'white', 'on_blue'), 'Removing migrations')
rmtree('{}/migrations'.format(app_name))
def get_django_command(features):
django_command = 'python manage.py'
return django_command
def is_req_file_changed(filename):
hash = files_hash([filename])
cache_filename = f'.zmei-cache/{filename}'
if os.path.exists(cache_filename):
with open(cache_filename) as f:
stored_hash = f.read()
if stored_hash == hash:
return False
return True
def mark_req_file_installed(filename):
hash = files_hash([filename])
cache_filename = f'.zmei-cache/{filename}'
dirname = os.path.dirname(cache_filename)
if not os.path.exists(dirname):
os.makedirs(dirname)
with open(cache_filename, 'w') as f:
f.write(hash)
def install_deps(django_process):
req_file = os.environ.get('ZMEI_REQUIREMNETS_FILE', 'requirements.txt')
if is_req_file_changed(req_file) or is_req_file_changed('_requirements.txt'):
if django_process:
os.killpg(os.getpgid(django_process.pid), signal.SIGTERM)
django_process = None
print(colored('> ', 'white', 'on_blue'), 'Installing pip dependencies...')
if subprocess.run(f'pip install -r {req_file}', shell=True, check=True):
mark_req_file_installed(req_file)
mark_req_file_installed('_requirements.txt')
return django_process
def wait_for_file_changes(paths, initial=True, watch=True):
if initial:
yield
if watch:
initial_hash = files_hash(paths)
while True:
# try:
sleep(3)
new_hash = files_hash(paths)
if initial_hash != new_hash:
initial_hash = new_hash
yield
# except KeyboardInterrupt:
# print('Reloading ... (hit ctrl+c twice to stop process)')
# yield
def files_hash(paths):
hash_md5 = hashlib.md5()
for filename in paths:
try:
with open(filename, "rb") as f:
for chunk in iter(lambda: f.read(2 ** 20), b""):
hash_md5.update(chunk)
except (FileNotFoundError, IOError):
pass
return hash_md5.hexdigest() | zmei-cli | /zmei-cli-2.1.10.tar.gz/zmei-cli-2.1.10/zmei_generator/cli/utils.py | utils.py |
import io
import os
import tempfile
import zipfile
from glob import glob
from io import BytesIO
from os.path import dirname
from shutil import rmtree, copytree, copyfile
import pkg_resources
def zmei_generate(zip_bytes, models):
# TODO: remove zip packing/unpacking. It comes from old remote protocol.
# TODO: NOw it is not needed anymore.
with tempfile.TemporaryDirectory() as target_path:
request_files = extract_files(target_path, zip_bytes)
do_generate(target_path, models)
zip_file = collect_files(target_path, request_files)
return zip_file.getvalue()
def collect_files(target_path, request_files):
paths = set(glob(f'{target_path}/**/*.*', recursive=True))
paths.update(glob(f'{target_path}/**/.*', recursive=True))
paths.update(glob(f'{target_path}/**/Dockerfile', recursive=True))
paths.update(glob(f'{target_path}/**/.babelrc', recursive=True))
paths.update(glob(f'{target_path}/**/.dockerignore', recursive=True))
paths = [x for x in paths if '__pycache__' not in x]
# # remove prefix
tpl = len(f'{target_path}/')
paths = set([x[tpl:] for x in paths])
f = io.BytesIO()
files = zipfile.ZipFile(f, mode='w', compression=zipfile.ZIP_LZMA)
for path in (paths - request_files):
files.write(f'{target_path}/{path}', arcname=path)
files.close()
#
f.seek(0)
return f
def do_generate(target_path, app_names):
from zmei_generator.generator.application import ZmeiProjectParser
from zmei_generator.generator.utils import StopGenerator
app_parser = ZmeiProjectParser()
for app_name in app_names:
filename = '{}.col'.format(app_name)
if not os.path.exists(os.path.join(target_path, 'col/' + filename)):
if not os.path.exists(os.path.join(target_path, filename)):
raise StopGenerator('File col/{filename} or {filename} do not exist'.format(filename=filename))
else:
filename = 'col/' + filename
with open(os.path.join(target_path, filename)) as f:
app_parser.add_file(filename, f.read())
# application = parser.populate_application_and_errors(app_name)
application = app_parser.parse()
copy_skeleton_files(target_path)
for entry_point in pkg_resources.iter_entry_points('zmei.generator'):
generate = entry_point.load()
generate(target_path, application)
def copy_skeleton_files(target_path):
skeleton_dir = os.path.join(os.path.realpath(dirname(__file__)), 'skeleton')
app_dir = os.path.join(target_path, 'app')
manage_py = os.path.join(target_path, 'manage.py')
if os.path.exists(app_dir):
rmtree(app_dir)
if os.path.exists(manage_py):
os.unlink(manage_py)
copytree(os.path.join(skeleton_dir, 'app'), app_dir)
copyfile(os.path.join(skeleton_dir, 'manage.py'), manage_py)
return skeleton_dir
def extract_files(target_path, zip_data):
files = BytesIO(zip_data)
files = zipfile.ZipFile(files, mode='r', compression=zipfile.ZIP_LZMA)
files.extractall(path=target_path)
return set(files.namelist()) | zmei-cli | /zmei-cli-2.1.10.tar.gz/zmei-cli-2.1.10/zmei_generator/cli/server.py | server.py |
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '5%)z2n2io_m7%&=(y6s#s(1#$qx@1!w!2(_s+5(u*78$mh9lye'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'app.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'app.wsgi.application'
# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/
STATIC_URL = '/static/' | zmei-cli | /zmei-cli-2.1.10.tar.gz/zmei-cli-2.1.10/zmei_generator/cli/skeleton/app/settings.py | settings.py |
import hashlib
import itertools
import os
import shutil
import sys
import pkg_resources
def collect_items(entry_point, display_name):
keywords_name_map = {}
keywords_value_map = {}
keywords = {}
for entry_point in pkg_resources.iter_entry_points(entry_point):
data = entry_point.load()
for name, value in data.items():
if name in keywords_name_map:
print(f'Conflict: can not redefine {display_name} name "{name}"({entry_point.name}). '
f'it is already defined by entry point "{keywords_name_map[name]}"')
if value in keywords_value_map:
print(f'Conflict: can not redefine {display_name} value "{value}"({entry_point.name}). '
f'it is already defined by entry point "{keywords_value_map[value]}"')
keywords_name_map[name] = entry_point.name
keywords_value_map[value] = entry_point.name
keywords[name] = value
return keywords
def collect_files(entry_point, target_path):
file_map = {}
file_2_entry_point = {}
for entry_point in pkg_resources.iter_entry_points(entry_point):
try:
data = entry_point.load()
base_dir = os.path.dirname(sys.modules[entry_point.module_name].__file__)
for name, file_path in data.items():
file_name = os.path.basename(file_path)
target_file = os.path.join(target_path, file_name)
source_file = os.path.join(base_dir, file_path)
if os.path.exists(target_file):
print(f'Conflict: file with name {file_name} already exist in target directory {target_path}')
if file_name in file_2_entry_point:
print(f'Conflict: file with name {file_name} already added by entry point {file_2_entry_point[file_name]}')
file_map[name] = source_file, target_file
file_2_entry_point[file_name] = entry_point.name
except ImportError:
pass
return file_map
def gen(generator_path, grammar_path, target_path):
grammar_path = grammar_path
target_path = target_path
lexerSrc = f'{grammar_path}/ZmeiLangSimpleLexer.g4'
parserSrc = f'{grammar_path}/ZmeiLangParser.g4'
package = 'zmei_generator.parser.gen'
antlr_jar = f'{generator_path}/lib/antlr/antlr-4.7.2-complete.jar'
antlr = f'CLASSPATH="{antlr_jar}:." java -jar {antlr_jar}'
print('Generating parser...')
lexer_cmd = f'{antlr} -Dlanguage=Python3 -o {target_path} -package {package} -lib {os.path.realpath(grammar_path)} -listener {os.path.realpath(lexerSrc)}'
print(lexer_cmd)
if os.system(lexer_cmd) != 0:
return False
parser_cmd = f'{antlr} -Dlanguage=Python3 -o {target_path} -package {package} -lib {os.path.realpath(target_path)} -listener {os.path.realpath(parserSrc)}'
print(parser_cmd)
if os.system(parser_cmd) != 0:
return False
return True
def replace_in_file(file, markers):
with open(file, 'r') as f:
content = f.read()
for marker, replacement in markers.items():
content = content.replace(marker, replacement)
with open(file, 'w') as f:
f.write(content)
import zmei_generator
generator_path = os.path.dirname(zmei_generator.__file__)
chk_txt = os.path.join(generator_path, 'parser/gen/grammar/chk.txt')
def get_definition_hash():
hash_md5 = hashlib.md5()
for ep in [f'zmei.grammar.{x}' for x in ['tokens', 'keywords', 'pages', 'models', 'app']]:
for entry_point in pkg_resources.iter_entry_points(ep):
hash_md5.update(str(entry_point).encode())
return hash_md5.hexdigest()
def is_parser_declaration_changed():
if not os.path.exists(chk_txt):
return True
with open(chk_txt) as f:
if f.read() != get_definition_hash():
return True
def write_declaration_hash():
with open(chk_txt, 'w') as f:
f.write(get_definition_hash())
def build_parser():
keywords = collect_items('zmei.grammar.keywords', 'keyword')
tokens = collect_items('zmei.grammar.tokens', 'token')
source_path = f'{generator_path}/ext/grammar'
target_path = f'{generator_path}/parser/gen/grammar'
if os.path.exists(target_path):
shutil.rmtree(target_path)
pages = collect_files('zmei.grammar.pages', target_path)
applications = collect_files('zmei.grammar.app', target_path)
models = collect_files('zmei.grammar.models', target_path)
shutil.copytree(source_path, target_path)
for source_file, target_file in itertools.chain.from_iterable(
map(lambda x: x.values(), (pages, models, applications))):
shutil.copy(source_file, target_file)
replace_in_file(f'{generator_path}/parser/gen/grammar/PageExtension.g4', {
'// {EXTENSION_IMPORTS}': ',\n '.join([os.path.basename(x[0])[:-3] for x in pages.values()]),
'// {EXTENSION_ANNOT}': ' ' + '\n |'.join(pages.keys()),
})
replace_in_file(f'{generator_path}/parser/gen/grammar/ModelExtension.g4', {
'// {EXTENSION_IMPORTS}': ',\n '.join([os.path.basename(x[0])[:-3] for x in models.values()]),
'// {EXTENSION_ANNOT}': ' ' + '\n |'.join(models.keys()),
})
replace_in_file(f'{generator_path}/parser/gen/grammar/AppExtension.g4', {
'// {EXTENSION_IMPORTS}': ',\n '.join([os.path.basename(x[0])[:-3] for x in applications.values()]),
'// {EXTENSION_ANNOT}': ' ' + '\n |'.join(applications.keys()),
})
replace_in_file(f'{generator_path}/parser/gen/grammar/ZmeiLangSimpleLexer.g4', {
'// {KEYWORDS}': '\n'.join([f"{name}: '{val}';" for name, val in keywords.items()]),
'// {TOKENS}': '\n'.join([f"{name}: '{val}';" for name, val in tokens.items()]),
})
replace_in_file(f'{generator_path}/parser/gen/grammar/Base.g4', {
'// {KEYWORDS}': '|' + '\n |'.join(keywords.keys()),
})
if not gen(generator_path, target_path, os.path.dirname(target_path)):
return False
write_declaration_hash()
return True | zmei-cli | /zmei-cli-2.1.10.tar.gz/zmei-cli-2.1.10/zmei_generator/generator/grammar.py | grammar.py |
import os
import re
import autopep8
import jinja2
import pkg_resources
from jinja2 import Environment, FileSystemBytecodeCache, ChoiceLoader, FileSystemLoader, ModuleLoader
from jinja2 import PackageLoader
from termcolor import colored
from zmei_generator.generator.imports import ImportSet
def indent_text(nr, text):
inds = (' ' * nr)
return inds + ('\n' + inds).join(text.splitlines())
def package_to_path(package_name):
"""
Convert package name to relative directory name
:param package_name:
:return:
"""
return package_name.replace('.', os.path.sep)
def render_local_template(tpl_path, context):
path, filename = os.path.split(tpl_path)
return jinja2.Environment(
loader=jinja2.FileSystemLoader(path or './')
).get_template(filename).render(context)
def fill_file(file_path, context, template=None):
data = render_local_template(template or file_path, context)
with open(file_path, 'w') as f:
f.write(data)
def field_names(fields, admin=False):
names = []
for field in fields:
if admin and field.admin_list_renderer:
names.append('get_{}'.format(field.name))
else:
names.append(field.name)
return format_names(names)
def format_names(names):
if not names:
return ''
return "'{}'".format("', '".join(names))
def to_name(ref):
return ' '.join([x.capitalize() for x in ref.split('_')])
def include_block(block):
template = block_env.get_template(block.template_name)
return template.render(**block.fields)
class ThemeConfig(object):
theme = 'default'
loaders = []
local_templates = os.path.join(os.getcwd(), 'col/templates')
if os.path.exists(local_templates):
loaders.append(FileSystemLoader(local_templates))
loaders.append(PackageLoader('zmei_generator', 'templates'))
for entry_point in pkg_resources.iter_entry_points('zmei.templates'):
loaders.append(FileSystemLoader(entry_point.load().__path__._path))
loader = ChoiceLoader(loaders)
block_env = Environment(loader=loader,
variable_start_string='<{',
variable_end_string='}>',
block_start_string='<%',
block_end_string='%>'
)
bcc = FileSystemBytecodeCache()
env = Environment(
loader=loader,
bytecode_cache=bcc
)
def to_camel_case(val):
val = to_camel_case_class(val)
val = val[0].lower() + val[1:]
return val
def to_camel_case_class(val):
return ''.join([x.capitalize() for x in val.split('_')])
env.filters['camel_case'] = to_camel_case
env.filters['camel_case_class'] = to_camel_case_class
env.filters['field_names'] = field_names
env.filters['format_names'] = format_names
env.filters['to_name'] = to_name
env.filters['repr'] = repr
env.globals['include_block'] = include_block
NO_PEP = os.environ.get('NOFORMAT')
def generate_file(target_path, filename, template_name, context=None, raw=False):
"""
Generates a new file using Jinja2 template
:param dirname:
:param template_name:
:param context:
:return:
"""
filename = os.path.join(target_path, filename)
dirname = os.path.dirname(filename)
if len(dirname) and not os.path.exists(dirname):
os.makedirs(dirname)
with open(filename, 'w') as f:
if not raw:
rendered = render_template(template_name, context=context)
else:
rendered = render_file(template_name)
if not NO_PEP and filename.endswith('.py'):
rendered = autopep8.fix_code(rendered)
f.write(rendered)
def render_template(template_name, context=None):
context = context or {}
if template_name.startswith('theme/'):
template_name = f'theme/{ThemeConfig.theme}/{template_name[6:]}'
if '[' in template_name:
match = re.match('^([^\[]+)\[([^\]]+)\](.*)$', template_name)
if match:
names = [
''.join([match.group(1), match.group(2), match.group(3)]),
''.join([match.group(1), match.group(3)]),
]
else:
names = [template_name]
print(names)
template = None
while len(names):
try:
tpl = names.pop()
template = env.get_template(tpl)
except jinja2.exceptions.TemplateNotFound:
pass
if not template:
raise jinja2.exceptions.TemplateNotFound(f'Template not found: {template_name}')
else:
template = env.get_template(template_name)
return template.render(**context)
def render_file(template_name):
return loader.get_source(env, template_name)[0]
def format_file(target_path, filename):
filename = os.path.join(target_path, filename)
with open(filename, 'r') as f:
code = f.read()
with open(filename, 'w') as f:
f.write(autopep8.fix_code(code))
def generate_urls_file(target_path, app_name, application, pages, i18n=False):
url_imports = ImportSet()
url_imports.add('django.conf.urls', 'url')
for page in pages:
url_imports.add('.views', page.view_name)
context = {
'i18n': i18n,
'package_name': app_name,
'application': application,
'pages': pages,
'url_imports': url_imports.import_sting(),
}
filepath = os.path.join(package_to_path(app_name), 'urls_i18n.py' if i18n else 'urls.py')
generate_file(target_path, filepath, 'urls.py.tpl', context)
def generate_package(package_name, path=None):
if not path:
path = os.getcwd()
if not isinstance(package_name, list):
parts = package_name.split('.')
else:
parts = package_name
dirname = os.path.join(path, parts[0])
if not os.path.exists(dirname):
os.mkdir(dirname)
if not os.path.exists(os.path.join(dirname, '__init__.py')):
with open(os.path.join(dirname, '__init__.py'), 'w+') as f:
f.write('\n\n')
if len(parts) > 1:
generate_package(parts[1:], dirname)
class StopGenerator(Exception):
def __init__(self, description=None, *args) -> None:
super().__init__(*args)
self.description = description or 'Unknown fail'
def handle_parse_exception(e, parsed_string, subject):
out = []
# out.append(str(type(e)))
out.append(colored('{}, error: {}'.format(subject, e), 'white', 'on_red'))
out.append('-' * 100)
for nr, line in enumerate(parsed_string.splitlines()):
if nr < e.lineno - 5:
if out[-1] != '...':
out.append('...')
continue
if nr > e.lineno + 5:
if out[-1] != '...':
out.append('...')
continue
if (nr + 1) == e.lineno:
try:
before = line[:e.col]
char = line[e.col]
after = line[e.col + 1:]
except IndexError:
out.append(colored('{0:04d}| {1}'.format(nr + 1, line), 'white', 'on_red'))
continue
line = before + colored(char, 'white', 'on_blue') + after
out.append(colored('{0:04d}| {1}'.format(nr + 1, line), 'white', 'on_red'))
else:
out.append('{0:04d}| {1}'.format(nr + 1, line))
out.append('-' * 100)
raise StopGenerator('\n'.join(out))
def gen_args(args, raw_args=None):
if not raw_args:
raw_args = []
_args = []
for key, val in args.items():
if key == '_':
_args.append(val)
else:
if key not in raw_args:
val = repr(val)
if key in ('verbose_name', 'help_text'):
val = '_({})'.format(val)
_args.append('{}={}'.format(key, val))
return ', '.join(_args)
def to_camel_case_classname(name):
return ''.join([x.capitalize() for x in name.split('_')])
def to_camel_case(name):
parts = []
for idx, part in enumerate(name.split('_')):
if idx != 0:
part = part.capitalize()
parts.append(part)
return ''.join(parts)
def format_uri(uri):
return uri.replace('(?P<', ':').replace('>[^\/]+)', '')
def list_apps():
for filename in os.listdir('.'):
if os.path.isfile(filename) and filename.endswith('.col'):
if not re.match('^[a-zA-Z][a-zA-Z0-9_]+\.col$', filename):
continue
yield filename[0:-4] | zmei-cli | /zmei-cli-2.1.10.tar.gz/zmei-cli-2.1.10/zmei_generator/generator/utils.py | utils.py |
from functools import reduce
class ImportSet(object):
def __init__(self) -> None:
self.imports = {}
super().__init__()
def add(self, source, *what):
if source not in self.imports:
self.imports[source] = []
for one in what:
self.imports[source].append(one)
def find_import_source(self, what):
for import_from, whats in self.imports.items():
if what in whats:
return import_from, what
if f'*{what}' in whats:
return import_from, f'*{what}'
return None, None
def import_sting(self):
items = self.get_items()
def format_expr(source, what):
expr = 'import {}'.format(', '.join(what))
if source:
expr = 'from {} {}'.format(source, expr)
return expr
return '\n'.join([format_expr(source, what) for source, what in items])
def get_items(self):
def simplify(imports, b):
if b == '*':
imports = [x for x in imports if ' as ' in x]
if '*' in imports and ' as ' not in b:
return imports
if b in imports:
return imports
return imports + [b]
# NB! source maybe None as well, so can not be sorted easily
return [(source, reduce(simplify, values, [])) for source, values in self.imports.items()]
def import_sting_js(self):
items = self.get_items()
grouped = {}
ungrouped = {}
for source, what_items in items:
for what in what_items:
if what[0] == '*' and ' as ' not in what:
if source not in grouped:
grouped[source] = set()
grouped[source].add(what[1:])
else:
if source not in ungrouped:
ungrouped[source] = set()
ungrouped[source].add(what)
stm = []
for source, what in grouped.items():
what = sorted(what)
stm.append("import {{{}}} from '{}';".format(', '.join(what), source))
for source, what in ungrouped.items():
stm.append("import {} from '{}';".format(', '.join(what), source))
return '\n'.join(stm)
def __str__(self) -> str:
return self.import_sting() | zmei-cli | /zmei-cli-2.1.10.tar.gz/zmei-cli-2.1.10/zmei_generator/generator/imports.py | imports.py |
import pkg_resources
from zmei_generator.domain.application_def import ApplicationDef
from zmei_generator.domain.page_def import PageDef
from zmei_generator.parser.gen.ZmeiLangParser import ZmeiLangParser
from zmei_generator.parser.utils import BaseListener
parsers = []
for entry_point in pkg_resources.iter_entry_points('zmei.parser.stage3'):
parsers += entry_point.load()
parsers.append(BaseListener)
class PageExtensionListener(*parsers):
def __init__(self, application: ApplicationDef) -> None:
super().__init__(application)
self.page = None # type: PageDef
self.parent = None
self.extend_name = False
self.last_crud_descriptor = None
self.page_stack = []
self.last_crud_descriptor_stack = []
def enterPage(self, ctx: ZmeiLangParser.PageContext):
self.page = PageDef(self.application)
def enterPage_name(self, ctx: ZmeiLangParser.Page_nameContext):
name = ctx.getText()
if self.parent and self.extend_name:
name = f'{self.parent}_{name}'
self.page = self.application.pages[name]
def enterPage_base(self, ctx: ZmeiLangParser.Page_baseContext):
self.extend_name = ctx.getText()[-2] == '~'
self.parent = ctx.getText()[:-2]
def exitPage(self, ctx: ZmeiLangParser.PageContext):
self.page = None
self.parent = None
self.extend_name = None
# crud special
def enterAn_crud(self, ctx: ZmeiLangParser.An_crudContext):
self.last_crud_descriptor_stack.append(self.last_crud_descriptor)
if ctx.an_crud_params().an_crud_descriptor():
self.last_crud_descriptor = ctx.an_crud_params().an_crud_descriptor().getText()
else:
self.last_crud_descriptor = None
enterAn_crud_create = enterAn_crud
enterAn_crud_delete = enterAn_crud
enterAn_crud_detail = enterAn_crud
enterAn_crud_edit = enterAn_crud
def exitAn_crud(self, ctx: ZmeiLangParser.An_crudContext):
self.last_crud_descriptor = self.last_crud_descriptor_stack.pop()
exitAn_crud_create = enterAn_crud
exitAn_crud_delete = enterAn_crud
exitAn_crud_detail = enterAn_crud
exitAn_crud_edit = enterAn_crud
def enterAn_crud_page_override(self, ctx: ZmeiLangParser.An_crud_page_overrideContext):
page = self.page
self.page_stack.append(self.page)
crud_name = ctx.an_crud_view_name().getText()
if self.last_crud_descriptor:
name_suffix = f'_{self.last_crud_descriptor}'
else:
name_suffix = ''
crud_page_name = f"{page.name}{name_suffix}_{crud_name}"
self.page = page.application.pages[crud_page_name]
def exitAn_crud_page_override(self, ctx: ZmeiLangParser.An_crud_page_overrideContext):
self.page = self.page_stack.pop() | zmei-cli | /zmei-cli-2.1.10.tar.gz/zmei-cli-2.1.10/zmei_generator/parser/populate_page_extensions.py | populate_page_extensions.py |
from antlr4 import *
from antlr4.error.ErrorListener import ErrorListener
from zmei_generator.domain.application_def import ApplicationDef
from zmei_generator.generator.utils import handle_parse_exception
from zmei_generator.parser.errors import ValidationError
from zmei_generator.parser.populate import PartsCollectorListener
from zmei_generator.parser.populate_model_extensions import ModelExtensionListener
from zmei_generator.parser.populate_page_extensions import PageExtensionListener
from .gen.ZmeiLangSimpleLexer import ZmeiLangSimpleLexer
from .gen.ZmeiLangParser import ZmeiLangParser
class ExceptionErrorListener(ErrorListener):
def syntaxError(self, recognizer, offendingSymbol, line, column, msg, e):
raise ValidationError(line, column, msg)
class ZmeiParser(object):
def __init__(self) -> None:
super().__init__()
self.tree = None
self.walker = ParseTreeWalker()
self.filename = None
self.string = None
def parse_file(self, filename, fail_on_error=True):
self.filename = filename
try:
return self.parse(FileStream(filename, encoding='utf8'), fail_on_error=fail_on_error)
except ValidationError as e:
with open(filename, 'r', encoding='utf8') as f:
config = f.read()
handle_parse_exception(e, config, 'Error parsing col file ' + filename)
def parse_string(self, string, fail_on_error=True):
self.string = string
try:
return self.parse(InputStream(string), fail_on_error=fail_on_error)
except ValidationError as e:
handle_parse_exception(e, string, 'Error parsing col file')
def parse(self, stream, fail_on_error=True):
lexer = ZmeiLangSimpleLexer(stream)
stream = CommonTokenStream(lexer)
parser = ZmeiLangParser(stream)
if fail_on_error:
parser.addErrorListener(ExceptionErrorListener())
self.tree = parser.col_file()
return self.tree
def populate_application(self, app_name='noname'):
app = self.build_application(app_name)
self.process_application(app)
app.post_process()
self.process_model_extensions(app)
self.process_page_extensions(app)
app.post_process_extensions()
return app
def process_page_extensions(self, app):
page_extension_listener = PageExtensionListener(app)
self.walker.walk(page_extension_listener, self.tree)
def process_model_extensions(self, app):
model_extension_listener = ModelExtensionListener(app)
self.walker.walk(model_extension_listener, self.tree)
def process_application(self, app):
listener = PartsCollectorListener(app)
self.walker.walk(listener, self.tree)
def build_application(self, app_name):
app = ApplicationDef(app_name)
return app
def populate_application_and_errors(self, *args, **kwargs):
try:
return self.populate_application(*args, **kwargs)
except ValidationError as e:
if self.filename:
with open(self.filename, 'r', encoding='utf8') as f:
config = f.read()
handle_parse_exception(e, config, 'Error processing col file ' + self.filename)
else:
config = self.string
handle_parse_exception(e, config, 'Error processing col file')
def collect_stats(self, stats_listener):
self.walker.walk(stats_listener, self.tree) | zmei-cli | /zmei-cli-2.1.10.tar.gz/zmei-cli-2.1.10/zmei_generator/parser/parser.py | parser.py |
from antlr4 import *
from io import StringIO
from typing.io import TextIO
import sys
def serializedATN():
with StringIO() as buf:
buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\u00a1")
buf.write("\u05db\b\1\b\1\b\1\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6")
buf.write("\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f")
buf.write("\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22")
buf.write("\t\22\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27")
buf.write("\4\30\t\30\4\31\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35")
buf.write("\t\35\4\36\t\36\4\37\t\37\4 \t \4!\t!\4\"\t\"\4#\t#\4")
buf.write("$\t$\4%\t%\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t+\4,\t")
buf.write(",\4-\t-\4.\t.\4/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63")
buf.write("\t\63\4\64\t\64\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\4")
buf.write("9\t9\4:\t:\4;\t;\4<\t<\4=\t=\4>\t>\4?\t?\4@\t@\4A\tA\4")
buf.write("B\tB\4C\tC\4D\tD\4E\tE\4F\tF\4G\tG\4H\tH\4I\tI\4J\tJ\4")
buf.write("K\tK\4L\tL\4M\tM\4N\tN\4O\tO\4P\tP\4Q\tQ\4R\tR\4S\tS\4")
buf.write("T\tT\4U\tU\4V\tV\4W\tW\4X\tX\4Y\tY\4Z\tZ\4[\t[\4\\\t\\")
buf.write("\4]\t]\4^\t^\4_\t_\4`\t`\4a\ta\4b\tb\4c\tc\4d\td\4e\t")
buf.write("e\4f\tf\4g\tg\4h\th\4i\ti\4j\tj\4k\tk\4l\tl\4m\tm\4n\t")
buf.write("n\4o\to\4p\tp\4q\tq\4r\tr\4s\ts\4t\tt\4u\tu\4v\tv\4w\t")
buf.write("w\4x\tx\4y\ty\4z\tz\4{\t{\4|\t|\4}\t}\4~\t~\4\177\t\177")
buf.write("\4\u0080\t\u0080\4\u0081\t\u0081\4\u0082\t\u0082\4\u0083")
buf.write("\t\u0083\4\u0084\t\u0084\4\u0085\t\u0085\4\u0086\t\u0086")
buf.write("\4\u0087\t\u0087\4\u0088\t\u0088\4\u0089\t\u0089\4\u008a")
buf.write("\t\u008a\4\u008b\t\u008b\4\u008c\t\u008c\4\u008d\t\u008d")
buf.write("\4\u008e\t\u008e\4\u008f\t\u008f\4\u0090\t\u0090\4\u0091")
buf.write("\t\u0091\4\u0092\t\u0092\4\u0093\t\u0093\4\u0094\t\u0094")
buf.write("\4\u0095\t\u0095\4\u0096\t\u0096\4\u0097\t\u0097\4\u0098")
buf.write("\t\u0098\4\u0099\t\u0099\4\u009a\t\u009a\4\u009b\t\u009b")
buf.write("\4\u009c\t\u009c\4\u009d\t\u009d\4\u009e\t\u009e\4\u009f")
buf.write("\t\u009f\4\u00a0\t\u00a0\4\u00a1\t\u00a1\4\u00a2\t\u00a2")
buf.write("\4\u00a3\t\u00a3\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\3\3\3\3")
buf.write("\3\3\3\3\3\3\3\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\5\3\5")
buf.write("\3\5\3\5\3\5\3\5\3\5\3\5\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3")
buf.write("\6\3\6\3\6\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\b\3\b\3\b")
buf.write("\3\b\3\b\3\t\3\t\3\t\3\t\3\t\3\t\3\n\3\n\3\n\3\n\3\n\3")
buf.write("\n\3\n\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\f\3\f")
buf.write("\3\f\3\f\3\f\3\f\3\f\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3")
buf.write("\r\3\r\3\r\3\r\3\r\3\r\3\16\3\16\3\16\3\16\3\16\3\16\3")
buf.write("\16\3\16\3\16\3\16\3\16\3\16\3\16\3\16\3\17\3\17\3\17")
buf.write("\3\17\3\17\3\17\3\17\3\20\3\20\3\20\3\21\3\21\3\21\3\21")
buf.write("\3\21\3\21\3\22\3\22\3\22\3\22\3\22\3\23\3\23\3\23\3\23")
buf.write("\3\23\3\23\3\24\3\24\3\24\3\24\3\24\3\24\3\25\3\25\3\25")
buf.write("\3\25\3\25\3\25\3\25\3\25\3\25\3\25\3\25\3\25\3\25\3\26")
buf.write("\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\27")
buf.write("\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27")
buf.write("\3\27\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30")
buf.write("\3\30\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31")
buf.write("\3\31\3\31\3\31\3\32\3\32\3\32\3\32\3\32\3\32\3\33\3\33")
buf.write("\3\33\3\33\3\33\3\33\3\33\3\34\3\34\3\34\3\34\3\34\3\34")
buf.write("\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\36")
buf.write("\3\36\3\36\3\36\3\36\3\36\3\37\3\37\3\37\3\37\3\37\3\37")
buf.write("\3 \3 \3 \3 \3 \3 \3 \3 \3 \3 \3 \3!\3!\3!\3!\3!\3!\3")
buf.write("!\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"")
buf.write("\3#\3#\3#\3#\3#\3#\3#\3#\3#\3#\3#\3#\3#\3$\3$\3$\3$\3")
buf.write("$\3$\3$\3$\3$\3$\3$\3$\3%\3%\3%\3%\3%\3%\3%\3%\3%\3%\3")
buf.write("%\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&\3\'\3\'\3\'\3\'\3\'\3")
buf.write("\'\3\'\3(\3(\3(\3(\3(\3(\3(\3)\3)\3)\3)\3)\3)\3)\3)\3")
buf.write(")\3)\3*\3*\3*\3*\3*\3*\3*\3+\3+\3+\3+\3+\3+\3,\3,\3,\3")
buf.write(",\3,\3,\3,\3,\3-\3-\3-\3-\3-\3-\3.\3.\3.\3.\3.\3/\3/\3")
buf.write("/\3/\3/\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3")
buf.write("\60\3\60\3\61\3\61\3\61\3\61\3\61\3\61\3\62\3\62\3\62")
buf.write("\3\62\3\62\3\62\3\62\3\62\3\63\3\63\3\63\3\63\3\63\3\64")
buf.write("\3\64\3\64\3\64\3\64\3\64\3\64\3\64\3\64\3\65\3\65\3\65")
buf.write("\3\65\3\65\3\65\3\65\3\65\3\65\3\65\3\65\3\65\3\66\3\66")
buf.write("\3\66\3\66\3\66\3\66\3\66\3\66\3\66\3\66\3\66\3\66\3\67")
buf.write("\3\67\3\67\3\67\3\67\3\67\38\38\38\38\38\39\39\39\39\3")
buf.write("9\39\39\39\39\39\39\39\3:\3:\3:\3:\3:\3:\3:\3:\3:\3:\3")
buf.write(":\3;\3;\3;\3;\3;\3;\3;\3;\3;\3;\3;\3;\3;\3<\3<\3<\3<\3")
buf.write("<\3<\3<\3<\3<\3<\3<\3<\3<\3<\3<\3<\3<\3<\3<\3=\3=\3=\3")
buf.write("=\3>\3>\3>\3>\3?\3?\3?\3?\3?\3@\3@\3@\3@\3@\3A\3A\3A\3")
buf.write("A\3B\3B\3B\3B\3B\3B\3B\3B\3C\3C\3C\3C\3C\3D\3D\3D\3D\3")
buf.write("D\3D\3D\3D\3E\3E\3E\3E\3E\3E\3F\3F\3F\3F\3F\3F\3F\3F\3")
buf.write("G\3G\3G\3G\3G\3G\3G\3H\3H\3H\3H\3H\3H\3H\3H\3H\3I\3I\3")
buf.write("I\3I\3I\3I\3I\3I\3I\3I\3I\3I\3I\3I\3I\3I\3J\3J\3J\3J\3")
buf.write("J\3J\3K\3K\3K\3K\3K\3K\3K\3K\3K\3K\3K\3L\3L\3L\3L\3L\3")
buf.write("L\3L\3L\3L\3L\3M\3M\3M\3M\3M\3N\3N\3N\3N\3N\3N\3N\3N\3")
buf.write("N\3N\3N\3N\3O\3O\3O\3O\3O\3O\3O\3O\3O\3O\3O\3P\3P\3P\3")
buf.write("P\3P\3P\3P\3P\3P\3Q\3Q\3Q\3Q\3Q\3Q\3Q\3Q\3Q\3Q\3Q\3Q\3")
buf.write("R\3R\3R\3R\3R\3R\3S\3S\3S\3S\3S\3S\3S\3S\3S\3S\3T\3T\3")
buf.write("T\3T\3T\3T\3T\3T\3T\3U\3U\3U\3U\3U\3U\3U\3U\3U\3U\3U\3")
buf.write("U\3V\3V\3V\3V\3V\3V\3V\3W\3W\3W\3W\3W\3X\3X\3X\3X\3X\3")
buf.write("X\3X\3Y\3Y\3Y\3Y\3Y\3Y\3Y\3Z\3Z\3Z\3Z\3Z\3[\3[\3[\3[\3")
buf.write("[\3\\\3\\\3\\\3\\\3\\\3\\\3\\\3\\\3\\\3\\\3\\\3\\\3\\")
buf.write("\3\\\3\\\3\\\3\\\3\\\3]\3]\3]\3]\3^\3^\3^\3_\3_\3_\3_")
buf.write("\3_\3_\3_\3_\3`\3`\3`\3`\3`\3`\3`\3`\3a\3a\3a\3a\3a\3")
buf.write("a\3a\3a\3a\3a\3a\3a\3b\3b\3b\3b\3b\3b\3b\3c\3c\3c\3c\3")
buf.write("c\3d\3d\3d\3d\3d\3d\3d\3d\3d\3d\3d\3e\3e\3e\3e\3e\3e\3")
buf.write("e\3e\3e\3f\3f\3f\3f\3f\3f\3f\3f\3f\3f\3g\3g\3g\3g\3g\3")
buf.write("g\3h\3h\3h\3h\3h\3i\3i\3i\3i\3i\3i\3j\3j\3j\3j\3j\3k\3")
buf.write("k\3k\3k\3k\3k\3k\3k\3k\3k\3l\3l\3l\3l\3l\3m\3m\3m\3m\3")
buf.write("m\3n\3n\3n\3n\3n\3n\3n\3n\3n\3n\3o\3o\3o\3o\3o\3o\3o\3")
buf.write("o\3o\3o\3o\3o\3o\3o\3p\3p\3p\3p\3p\3p\3p\3p\3p\3p\3p\3")
buf.write("p\3q\3q\3q\3q\3q\3q\3q\3q\3q\3q\3q\3q\3r\3r\3r\3r\3r\3")
buf.write("r\3r\3s\3s\3s\3s\3s\3s\3s\3t\3t\3t\3u\3u\3u\3u\5u\u0504")
buf.write("\nu\3v\3v\3v\3v\3v\3v\3v\3v\3v\5v\u050f\nv\3w\3w\3x\5")
buf.write("x\u0514\nx\3x\3x\5x\u0518\nx\3y\3y\7y\u051c\ny\fy\16y")
buf.write("\u051f\13y\3z\3z\7z\u0523\nz\fz\16z\u0526\13z\3{\3{\3")
buf.write("{\3{\3|\3|\3}\3}\3~\3~\3\177\3\177\3\u0080\3\u0080\3\u0081")
buf.write("\3\u0081\3\u0082\3\u0082\3\u0083\3\u0083\3\u0084\3\u0084")
buf.write("\3\u0085\3\u0085\3\u0086\3\u0086\3\u0087\3\u0087\3\u0088")
buf.write("\3\u0088\3\u0089\3\u0089\3\u008a\3\u008a\3\u008b\3\u008b")
buf.write("\3\u008c\3\u008c\3\u008d\3\u008d\3\u008e\3\u008e\3\u008f")
buf.write("\3\u008f\3\u0090\3\u0090\3\u0091\3\u0091\3\u0092\3\u0092")
buf.write("\3\u0092\3\u0092\3\u0092\3\u0092\7\u0092\u055e\n\u0092")
buf.write("\f\u0092\16\u0092\u0561\13\u0092\3\u0092\3\u0092\3\u0093")
buf.write("\3\u0093\3\u0093\3\u0093\3\u0093\3\u0093\7\u0093\u056b")
buf.write("\n\u0093\f\u0093\16\u0093\u056e\13\u0093\3\u0093\3\u0093")
buf.write("\3\u0094\3\u0094\3\u0094\3\u0094\3\u0094\3\u0094\3\u0094")
buf.write("\3\u0095\7\u0095\u057a\n\u0095\f\u0095\16\u0095\u057d")
buf.write("\13\u0095\3\u0095\3\u0095\5\u0095\u0581\n\u0095\3\u0096")
buf.write("\3\u0096\3\u0096\3\u0096\7\u0096\u0587\n\u0096\f\u0096")
buf.write("\16\u0096\u058a\13\u0096\3\u0096\3\u0096\3\u0096\3\u0096")
buf.write("\3\u0096\3\u0097\3\u0097\3\u0098\3\u0098\3\u0098\3\u0098")
buf.write("\3\u0099\3\u0099\3\u0099\3\u0099\5\u0099\u059b\n\u0099")
buf.write("\3\u0099\3\u0099\3\u009a\3\u009a\3\u009a\3\u009a\7\u009a")
buf.write("\u05a3\n\u009a\f\u009a\16\u009a\u05a6\13\u009a\3\u009a")
buf.write("\3\u009a\3\u009b\3\u009b\3\u009b\3\u009b\7\u009b\u05ae")
buf.write("\n\u009b\f\u009b\16\u009b\u05b1\13\u009b\3\u009b\3\u009b")
buf.write("\3\u009c\3\u009c\3\u009c\7\u009c\u05b8\n\u009c\f\u009c")
buf.write("\16\u009c\u05bb\13\u009c\3\u009c\3\u009c\3\u009d\3\u009d")
buf.write("\3\u009e\3\u009e\3\u009e\3\u009e\3\u009e\3\u009f\6\u009f")
buf.write("\u05c7\n\u009f\r\u009f\16\u009f\u05c8\3\u009f\3\u009f")
buf.write("\3\u00a0\3\u00a0\3\u00a1\3\u00a1\3\u00a1\3\u00a1\3\u00a2")
buf.write("\6\u00a2\u05d4\n\u00a2\r\u00a2\16\u00a2\u05d5\3\u00a2")
buf.write("\3\u00a2\3\u00a3\3\u00a3\4\u057b\u0588\2\u00a4\5\3\7\4")
buf.write("\t\5\13\6\r\7\17\b\21\t\23\n\25\13\27\f\31\r\33\16\35")
buf.write("\17\37\20!\21#\22%\23\'\24)\25+\26-\27/\30\61\31\63\32")
buf.write("\65\33\67\349\35;\36=\37? A!C\"E#G$I%K&M\'O(Q)S*U+W,Y")
buf.write("-[.]/_\60a\61c\62e\63g\64i\65k\66m\67o8q9s:u;w<y={>}?")
buf.write("\177@\u0081A\u0083B\u0085C\u0087D\u0089E\u008bF\u008d")
buf.write("G\u008fH\u0091I\u0093J\u0095K\u0097L\u0099M\u009bN\u009d")
buf.write("O\u009fP\u00a1Q\u00a3R\u00a5S\u00a7T\u00a9U\u00abV\u00ad")
buf.write("W\u00afX\u00b1Y\u00b3Z\u00b5[\u00b7\\\u00b9]\u00bb^\u00bd")
buf.write("_\u00bf`\u00c1a\u00c3b\u00c5c\u00c7d\u00c9e\u00cbf\u00cd")
buf.write("g\u00cfh\u00d1i\u00d3j\u00d5k\u00d7l\u00d9m\u00dbn\u00dd")
buf.write("o\u00dfp\u00e1q\u00e3r\u00e5s\u00e7t\u00e9u\u00ebv\u00ed")
buf.write("w\u00ef\2\u00f1x\u00f3y\u00f5z\u00f7{\u00f9|\u00fb}\u00fd")
buf.write("~\u00ff\177\u0101\u0080\u0103\u0081\u0105\u0082\u0107")
buf.write("\u0083\u0109\u0084\u010b\u0085\u010d\u0086\u010f\u0087")
buf.write("\u0111\u0088\u0113\u0089\u0115\u008a\u0117\u008b\u0119")
buf.write("\u008c\u011b\u008d\u011d\u008e\u011f\u008f\u0121\u0090")
buf.write("\u0123\u0091\u0125\u0092\u0127\u0093\u0129\u0094\u012b")
buf.write("\2\u012d\u0095\u012f\u0096\u0131\u0097\u0133\u0098\u0135")
buf.write("\u0099\u0137\u009a\u0139\u009b\u013b\u009c\u013d\u00a1")
buf.write("\u013f\u009d\u0141\u009e\u0143\u009f\u0145\2\u0147\u00a0")
buf.write("\5\2\3\4\f\5\2C\\aac|\6\2\62;C\\aac|\3\2\63;\3\2\62;\5")
buf.write("\2\f\f\17\17$$\5\2\f\f\17\17))\n\2\u00b9\u00b9\u0302\u0371")
buf.write("\u2041\u2042\u2072\u2191\u2c02\u2ff1\u3003\ud801\uf902")
buf.write("\ufdd1\ufdf2\uffff\4\2}}\177\177\3\2\f\f\4\2\f\f==\2\u05ed")
buf.write("\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r")
buf.write("\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3")
buf.write("\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2\2\33\3\2\2\2\2\35\3\2")
buf.write("\2\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2\2\2\2%\3\2\2\2\2\'")
buf.write("\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2\2\2")
buf.write("\61\3\2\2\2\2\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2\2\2\29")
buf.write("\3\2\2\2\2;\3\2\2\2\2=\3\2\2\2\2?\3\2\2\2\2A\3\2\2\2\2")
buf.write("C\3\2\2\2\2E\3\2\2\2\2G\3\2\2\2\2I\3\2\2\2\2K\3\2\2\2")
buf.write("\2M\3\2\2\2\2O\3\2\2\2\2Q\3\2\2\2\2S\3\2\2\2\2U\3\2\2")
buf.write("\2\2W\3\2\2\2\2Y\3\2\2\2\2[\3\2\2\2\2]\3\2\2\2\2_\3\2")
buf.write("\2\2\2a\3\2\2\2\2c\3\2\2\2\2e\3\2\2\2\2g\3\2\2\2\2i\3")
buf.write("\2\2\2\2k\3\2\2\2\2m\3\2\2\2\2o\3\2\2\2\2q\3\2\2\2\2s")
buf.write("\3\2\2\2\2u\3\2\2\2\2w\3\2\2\2\2y\3\2\2\2\2{\3\2\2\2\2")
buf.write("}\3\2\2\2\2\177\3\2\2\2\2\u0081\3\2\2\2\2\u0083\3\2\2")
buf.write("\2\2\u0085\3\2\2\2\2\u0087\3\2\2\2\2\u0089\3\2\2\2\2\u008b")
buf.write("\3\2\2\2\2\u008d\3\2\2\2\2\u008f\3\2\2\2\2\u0091\3\2\2")
buf.write("\2\2\u0093\3\2\2\2\2\u0095\3\2\2\2\2\u0097\3\2\2\2\2\u0099")
buf.write("\3\2\2\2\2\u009b\3\2\2\2\2\u009d\3\2\2\2\2\u009f\3\2\2")
buf.write("\2\2\u00a1\3\2\2\2\2\u00a3\3\2\2\2\2\u00a5\3\2\2\2\2\u00a7")
buf.write("\3\2\2\2\2\u00a9\3\2\2\2\2\u00ab\3\2\2\2\2\u00ad\3\2\2")
buf.write("\2\2\u00af\3\2\2\2\2\u00b1\3\2\2\2\2\u00b3\3\2\2\2\2\u00b5")
buf.write("\3\2\2\2\2\u00b7\3\2\2\2\2\u00b9\3\2\2\2\2\u00bb\3\2\2")
buf.write("\2\2\u00bd\3\2\2\2\2\u00bf\3\2\2\2\2\u00c1\3\2\2\2\2\u00c3")
buf.write("\3\2\2\2\2\u00c5\3\2\2\2\2\u00c7\3\2\2\2\2\u00c9\3\2\2")
buf.write("\2\2\u00cb\3\2\2\2\2\u00cd\3\2\2\2\2\u00cf\3\2\2\2\2\u00d1")
buf.write("\3\2\2\2\2\u00d3\3\2\2\2\2\u00d5\3\2\2\2\2\u00d7\3\2\2")
buf.write("\2\2\u00d9\3\2\2\2\2\u00db\3\2\2\2\2\u00dd\3\2\2\2\2\u00df")
buf.write("\3\2\2\2\2\u00e1\3\2\2\2\2\u00e3\3\2\2\2\2\u00e5\3\2\2")
buf.write("\2\2\u00e7\3\2\2\2\2\u00e9\3\2\2\2\2\u00eb\3\2\2\2\2\u00ed")
buf.write("\3\2\2\2\2\u00f1\3\2\2\2\2\u00f3\3\2\2\2\2\u00f5\3\2\2")
buf.write("\2\2\u00f7\3\2\2\2\2\u00f9\3\2\2\2\2\u00fb\3\2\2\2\2\u00fd")
buf.write("\3\2\2\2\2\u00ff\3\2\2\2\2\u0101\3\2\2\2\2\u0103\3\2\2")
buf.write("\2\2\u0105\3\2\2\2\2\u0107\3\2\2\2\2\u0109\3\2\2\2\2\u010b")
buf.write("\3\2\2\2\2\u010d\3\2\2\2\2\u010f\3\2\2\2\2\u0111\3\2\2")
buf.write("\2\2\u0113\3\2\2\2\2\u0115\3\2\2\2\2\u0117\3\2\2\2\2\u0119")
buf.write("\3\2\2\2\2\u011b\3\2\2\2\2\u011d\3\2\2\2\2\u011f\3\2\2")
buf.write("\2\2\u0121\3\2\2\2\2\u0123\3\2\2\2\2\u0125\3\2\2\2\2\u0127")
buf.write("\3\2\2\2\2\u0129\3\2\2\2\2\u012d\3\2\2\2\2\u012f\3\2\2")
buf.write("\2\2\u0131\3\2\2\2\2\u0133\3\2\2\2\2\u0135\3\2\2\2\2\u0137")
buf.write("\3\2\2\2\2\u0139\3\2\2\2\2\u013b\3\2\2\2\3\u013d\3\2\2")
buf.write("\2\3\u013f\3\2\2\2\3\u0141\3\2\2\2\4\u0143\3\2\2\2\4\u0145")
buf.write("\3\2\2\2\4\u0147\3\2\2\2\5\u0149\3\2\2\2\7\u0150\3\2\2")
buf.write("\2\t\u0156\3\2\2\2\13\u015e\3\2\2\2\r\u0166\3\2\2\2\17")
buf.write("\u0170\3\2\2\2\21\u0178\3\2\2\2\23\u017d\3\2\2\2\25\u0183")
buf.write("\3\2\2\2\27\u018a\3\2\2\2\31\u0192\3\2\2\2\33\u0199\3")
buf.write("\2\2\2\35\u01a7\3\2\2\2\37\u01b5\3\2\2\2!\u01bc\3\2\2")
buf.write("\2#\u01bf\3\2\2\2%\u01c5\3\2\2\2\'\u01ca\3\2\2\2)\u01d0")
buf.write("\3\2\2\2+\u01d6\3\2\2\2-\u01e3\3\2\2\2/\u01ee\3\2\2\2")
buf.write("\61\u01fb\3\2\2\2\63\u0206\3\2\2\2\65\u0213\3\2\2\2\67")
buf.write("\u0219\3\2\2\29\u0220\3\2\2\2;\u0226\3\2\2\2=\u0230\3")
buf.write("\2\2\2?\u0236\3\2\2\2A\u023c\3\2\2\2C\u0247\3\2\2\2E\u024e")
buf.write("\3\2\2\2G\u025b\3\2\2\2I\u0268\3\2\2\2K\u0274\3\2\2\2")
buf.write("M\u027f\3\2\2\2O\u0289\3\2\2\2Q\u0290\3\2\2\2S\u0297\3")
buf.write("\2\2\2U\u02a1\3\2\2\2W\u02a8\3\2\2\2Y\u02ae\3\2\2\2[\u02b6")
buf.write("\3\2\2\2]\u02bc\3\2\2\2_\u02c1\3\2\2\2a\u02c6\3\2\2\2")
buf.write("c\u02d1\3\2\2\2e\u02d7\3\2\2\2g\u02df\3\2\2\2i\u02e4\3")
buf.write("\2\2\2k\u02ed\3\2\2\2m\u02f9\3\2\2\2o\u0305\3\2\2\2q\u030b")
buf.write("\3\2\2\2s\u0310\3\2\2\2u\u031c\3\2\2\2w\u0327\3\2\2\2")
buf.write("y\u0334\3\2\2\2{\u0347\3\2\2\2}\u034b\3\2\2\2\177\u034f")
buf.write("\3\2\2\2\u0081\u0354\3\2\2\2\u0083\u0359\3\2\2\2\u0085")
buf.write("\u035d\3\2\2\2\u0087\u0365\3\2\2\2\u0089\u036a\3\2\2\2")
buf.write("\u008b\u0372\3\2\2\2\u008d\u0378\3\2\2\2\u008f\u0380\3")
buf.write("\2\2\2\u0091\u0387\3\2\2\2\u0093\u0390\3\2\2\2\u0095\u03a0")
buf.write("\3\2\2\2\u0097\u03a6\3\2\2\2\u0099\u03b1\3\2\2\2\u009b")
buf.write("\u03bb\3\2\2\2\u009d\u03c0\3\2\2\2\u009f\u03cc\3\2\2\2")
buf.write("\u00a1\u03d7\3\2\2\2\u00a3\u03e0\3\2\2\2\u00a5\u03ec\3")
buf.write("\2\2\2\u00a7\u03f2\3\2\2\2\u00a9\u03fc\3\2\2\2\u00ab\u0405")
buf.write("\3\2\2\2\u00ad\u0411\3\2\2\2\u00af\u0418\3\2\2\2\u00b1")
buf.write("\u041d\3\2\2\2\u00b3\u0424\3\2\2\2\u00b5\u042b\3\2\2\2")
buf.write("\u00b7\u0430\3\2\2\2\u00b9\u0435\3\2\2\2\u00bb\u0447\3")
buf.write("\2\2\2\u00bd\u044b\3\2\2\2\u00bf\u044e\3\2\2\2\u00c1\u0456")
buf.write("\3\2\2\2\u00c3\u045e\3\2\2\2\u00c5\u046a\3\2\2\2\u00c7")
buf.write("\u0471\3\2\2\2\u00c9\u0476\3\2\2\2\u00cb\u0481\3\2\2\2")
buf.write("\u00cd\u048a\3\2\2\2\u00cf\u0494\3\2\2\2\u00d1\u049a\3")
buf.write("\2\2\2\u00d3\u049f\3\2\2\2\u00d5\u04a5\3\2\2\2\u00d7\u04aa")
buf.write("\3\2\2\2\u00d9\u04b4\3\2\2\2\u00db\u04b9\3\2\2\2\u00dd")
buf.write("\u04be\3\2\2\2\u00df\u04c8\3\2\2\2\u00e1\u04d6\3\2\2\2")
buf.write("\u00e3\u04e2\3\2\2\2\u00e5\u04ee\3\2\2\2\u00e7\u04f5\3")
buf.write("\2\2\2\u00e9\u04fc\3\2\2\2\u00eb\u0503\3\2\2\2\u00ed\u050e")
buf.write("\3\2\2\2\u00ef\u0510\3\2\2\2\u00f1\u0517\3\2\2\2\u00f3")
buf.write("\u0519\3\2\2\2\u00f5\u0520\3\2\2\2\u00f7\u0527\3\2\2\2")
buf.write("\u00f9\u052b\3\2\2\2\u00fb\u052d\3\2\2\2\u00fd\u052f\3")
buf.write("\2\2\2\u00ff\u0531\3\2\2\2\u0101\u0533\3\2\2\2\u0103\u0535")
buf.write("\3\2\2\2\u0105\u0537\3\2\2\2\u0107\u0539\3\2\2\2\u0109")
buf.write("\u053b\3\2\2\2\u010b\u053d\3\2\2\2\u010d\u053f\3\2\2\2")
buf.write("\u010f\u0541\3\2\2\2\u0111\u0543\3\2\2\2\u0113\u0545\3")
buf.write("\2\2\2\u0115\u0547\3\2\2\2\u0117\u0549\3\2\2\2\u0119\u054b")
buf.write("\3\2\2\2\u011b\u054d\3\2\2\2\u011d\u054f\3\2\2\2\u011f")
buf.write("\u0551\3\2\2\2\u0121\u0553\3\2\2\2\u0123\u0555\3\2\2\2")
buf.write("\u0125\u0557\3\2\2\2\u0127\u0564\3\2\2\2\u0129\u0571\3")
buf.write("\2\2\2\u012b\u057b\3\2\2\2\u012d\u0582\3\2\2\2\u012f\u0590")
buf.write("\3\2\2\2\u0131\u0592\3\2\2\2\u0133\u059a\3\2\2\2\u0135")
buf.write("\u059e\3\2\2\2\u0137\u05a9\3\2\2\2\u0139\u05b4\3\2\2\2")
buf.write("\u013b\u05be\3\2\2\2\u013d\u05c0\3\2\2\2\u013f\u05c6\3")
buf.write("\2\2\2\u0141\u05cc\3\2\2\2\u0143\u05ce\3\2\2\2\u0145\u05d3")
buf.write("\3\2\2\2\u0147\u05d9\3\2\2\2\u0149\u014a\7B\2\2\u014a")
buf.write("\u014b\7c\2\2\u014b\u014c\7f\2\2\u014c\u014d\7o\2\2\u014d")
buf.write("\u014e\7k\2\2\u014e\u014f\7p\2\2\u014f\6\3\2\2\2\u0150")
buf.write("\u0151\7B\2\2\u0151\u0152\7u\2\2\u0152\u0153\7w\2\2\u0153")
buf.write("\u0154\7k\2\2\u0154\u0155\7v\2\2\u0155\b\3\2\2\2\u0156")
buf.write("\u0157\7B\2\2\u0157\u0158\7e\2\2\u0158\u0159\7g\2\2\u0159")
buf.write("\u015a\7n\2\2\u015a\u015b\7g\2\2\u015b\u015c\7t\2\2\u015c")
buf.write("\u015d\7{\2\2\u015d\n\3\2\2\2\u015e\u015f\7B\2\2\u015f")
buf.write("\u0160\7u\2\2\u0160\u0161\7v\2\2\u0161\u0162\7t\2\2\u0162")
buf.write("\u0163\7g\2\2\u0163\u0164\7c\2\2\u0164\u0165\7o\2\2\u0165")
buf.write("\f\3\2\2\2\u0166\u0167\7B\2\2\u0167\u0168\7e\2\2\u0168")
buf.write("\u0169\7j\2\2\u0169\u016a\7c\2\2\u016a\u016b\7p\2\2\u016b")
buf.write("\u016c\7p\2\2\u016c\u016d\7g\2\2\u016d\u016e\7n\2\2\u016e")
buf.write("\u016f\7u\2\2\u016f\16\3\2\2\2\u0170\u0171\7B\2\2\u0171")
buf.write("\u0172\7f\2\2\u0172\u0173\7q\2\2\u0173\u0174\7e\2\2\u0174")
buf.write("\u0175\7m\2\2\u0175\u0176\7g\2\2\u0176\u0177\7t\2\2\u0177")
buf.write("\20\3\2\2\2\u0178\u0179\7B\2\2\u0179\u017a\7c\2\2\u017a")
buf.write("\u017b\7r\2\2\u017b\u017c\7k\2\2\u017c\22\3\2\2\2\u017d")
buf.write("\u017e\7B\2\2\u017e\u017f\7t\2\2\u017f\u0180\7g\2\2\u0180")
buf.write("\u0181\7u\2\2\u0181\u0182\7v\2\2\u0182\24\3\2\2\2\u0183")
buf.write("\u0184\7B\2\2\u0184\u0185\7h\2\2\u0185\u0186\7k\2\2\u0186")
buf.write("\u0187\7n\2\2\u0187\u0188\7g\2\2\u0188\u0189\7t\2\2\u0189")
buf.write("\26\3\2\2\2\u018a\u018b\7B\2\2\u018b\u018c\7i\2\2\u018c")
buf.write("\u018d\7k\2\2\u018d\u018e\7v\2\2\u018e\u018f\7n\2\2\u018f")
buf.write("\u0190\7c\2\2\u0190\u0191\7d\2\2\u0191\30\3\2\2\2\u0192")
buf.write("\u0193\7B\2\2\u0193\u0194\7t\2\2\u0194\u0195\7g\2\2\u0195")
buf.write("\u0196\7c\2\2\u0196\u0197\7e\2\2\u0197\u0198\7v\2\2\u0198")
buf.write("\32\3\2\2\2\u0199\u019a\7B\2\2\u019a\u019b\7t\2\2\u019b")
buf.write("\u019c\7g\2\2\u019c\u019d\7c\2\2\u019d\u019e\7e\2\2\u019e")
buf.write("\u019f\7v\2\2\u019f\u01a0\7a\2\2\u01a0\u01a1\7e\2\2\u01a1")
buf.write("\u01a2\7n\2\2\u01a2\u01a3\7k\2\2\u01a3\u01a4\7g\2\2\u01a4")
buf.write("\u01a5\7p\2\2\u01a5\u01a6\7v\2\2\u01a6\34\3\2\2\2\u01a7")
buf.write("\u01a8\7B\2\2\u01a8\u01a9\7t\2\2\u01a9\u01aa\7g\2\2\u01aa")
buf.write("\u01ab\7c\2\2\u01ab\u01ac\7e\2\2\u01ac\u01ad\7v\2\2\u01ad")
buf.write("\u01ae\7a\2\2\u01ae\u01af\7u\2\2\u01af\u01b0\7g\2\2\u01b0")
buf.write("\u01b1\7t\2\2\u01b1\u01b2\7x\2\2\u01b2\u01b3\7g\2\2\u01b3")
buf.write("\u01b4\7t\2\2\u01b4\36\3\2\2\2\u01b5\u01b6\7B\2\2\u01b6")
buf.write("\u01b7\7v\2\2\u01b7\u01b8\7j\2\2\u01b8\u01b9\7g\2\2\u01b9")
buf.write("\u01ba\7o\2\2\u01ba\u01bb\7g\2\2\u01bb \3\2\2\2\u01bc")
buf.write("\u01bd\7B\2\2\u01bd\u01be\7B\2\2\u01be\"\3\2\2\2\u01bf")
buf.write("\u01c0\7B\2\2\u01c0\u01c1\7h\2\2\u01c1\u01c2\7k\2\2\u01c2")
buf.write("\u01c3\7n\2\2\u01c3\u01c4\7g\2\2\u01c4$\3\2\2\2\u01c5")
buf.write("\u01c6\7B\2\2\u01c6\u01c7\7i\2\2\u01c7\u01c8\7g\2\2\u01c8")
buf.write("\u01c9\7v\2\2\u01c9&\3\2\2\2\u01ca\u01cb\7B\2\2\u01cb")
buf.write("\u01cc\7o\2\2\u01cc\u01cd\7g\2\2\u01cd\u01ce\7p\2\2\u01ce")
buf.write("\u01cf\7w\2\2\u01cf(\3\2\2\2\u01d0\u01d1\7B\2\2\u01d1")
buf.write("\u01d2\7e\2\2\u01d2\u01d3\7t\2\2\u01d3\u01d4\7w\2\2\u01d4")
buf.write("\u01d5\7f\2\2\u01d5*\3\2\2\2\u01d6\u01d7\7B\2\2\u01d7")
buf.write("\u01d8\7e\2\2\u01d8\u01d9\7t\2\2\u01d9\u01da\7w\2\2\u01da")
buf.write("\u01db\7f\2\2\u01db\u01dc\7a\2\2\u01dc\u01dd\7f\2\2\u01dd")
buf.write("\u01de\7g\2\2\u01de\u01df\7v\2\2\u01df\u01e0\7c\2\2\u01e0")
buf.write("\u01e1\7k\2\2\u01e1\u01e2\7n\2\2\u01e2,\3\2\2\2\u01e3")
buf.write("\u01e4\7B\2\2\u01e4\u01e5\7e\2\2\u01e5\u01e6\7t\2\2\u01e6")
buf.write("\u01e7\7w\2\2\u01e7\u01e8\7f\2\2\u01e8\u01e9\7a\2\2\u01e9")
buf.write("\u01ea\7n\2\2\u01ea\u01eb\7k\2\2\u01eb\u01ec\7u\2\2\u01ec")
buf.write("\u01ed\7v\2\2\u01ed.\3\2\2\2\u01ee\u01ef\7B\2\2\u01ef")
buf.write("\u01f0\7e\2\2\u01f0\u01f1\7t\2\2\u01f1\u01f2\7w\2\2\u01f2")
buf.write("\u01f3\7f\2\2\u01f3\u01f4\7a\2\2\u01f4\u01f5\7f\2\2\u01f5")
buf.write("\u01f6\7g\2\2\u01f6\u01f7\7n\2\2\u01f7\u01f8\7g\2\2\u01f8")
buf.write("\u01f9\7v\2\2\u01f9\u01fa\7g\2\2\u01fa\60\3\2\2\2\u01fb")
buf.write("\u01fc\7B\2\2\u01fc\u01fd\7e\2\2\u01fd\u01fe\7t\2\2\u01fe")
buf.write("\u01ff\7w\2\2\u01ff\u0200\7f\2\2\u0200\u0201\7a\2\2\u0201")
buf.write("\u0202\7g\2\2\u0202\u0203\7f\2\2\u0203\u0204\7k\2\2\u0204")
buf.write("\u0205\7v\2\2\u0205\62\3\2\2\2\u0206\u0207\7B\2\2\u0207")
buf.write("\u0208\7e\2\2\u0208\u0209\7t\2\2\u0209\u020a\7w\2\2\u020a")
buf.write("\u020b\7f\2\2\u020b\u020c\7a\2\2\u020c\u020d\7e\2\2\u020d")
buf.write("\u020e\7t\2\2\u020e\u020f\7g\2\2\u020f\u0210\7c\2\2\u0210")
buf.write("\u0211\7v\2\2\u0211\u0212\7g\2\2\u0212\64\3\2\2\2\u0213")
buf.write("\u0214\7B\2\2\u0214\u0215\7r\2\2\u0215\u0216\7q\2\2\u0216")
buf.write("\u0217\7u\2\2\u0217\u0218\7v\2\2\u0218\66\3\2\2\2\u0219")
buf.write("\u021a\7B\2\2\u021a\u021b\7g\2\2\u021b\u021c\7t\2\2\u021c")
buf.write("\u021d\7t\2\2\u021d\u021e\7q\2\2\u021e\u021f\7t\2\2\u021f")
buf.write("8\3\2\2\2\u0220\u0221\7B\2\2\u0221\u0222\7c\2\2\u0222")
buf.write("\u0223\7w\2\2\u0223\u0224\7v\2\2\u0224\u0225\7j\2\2\u0225")
buf.write(":\3\2\2\2\u0226\u0227\7B\2\2\u0227\u0228\7o\2\2\u0228")
buf.write("\u0229\7c\2\2\u0229\u022a\7t\2\2\u022a\u022b\7m\2\2\u022b")
buf.write("\u022c\7f\2\2\u022c\u022d\7q\2\2\u022d\u022e\7y\2\2\u022e")
buf.write("\u022f\7p\2\2\u022f<\3\2\2\2\u0230\u0231\7B\2\2\u0231")
buf.write("\u0232\7j\2\2\u0232\u0233\7v\2\2\u0233\u0234\7o\2\2\u0234")
buf.write("\u0235\7n\2\2\u0235>\3\2\2\2\u0236\u0237\7B\2\2\u0237")
buf.write("\u0238\7v\2\2\u0238\u0239\7t\2\2\u0239\u023a\7g\2\2\u023a")
buf.write("\u023b\7g\2\2\u023b@\3\2\2\2\u023c\u023d\7B\2\2\u023d")
buf.write("\u023e\7f\2\2\u023e\u023f\7c\2\2\u023f\u0240\7v\2\2\u0240")
buf.write("\u0241\7g\2\2\u0241\u0242\7a\2\2\u0242\u0243\7v\2\2\u0243")
buf.write("\u0244\7t\2\2\u0244\u0245\7g\2\2\u0245\u0246\7g\2\2\u0246")
buf.write("B\3\2\2\2\u0247\u0248\7B\2\2\u0248\u0249\7o\2\2\u0249")
buf.write("\u024a\7k\2\2\u024a\u024b\7z\2\2\u024b\u024c\7k\2\2\u024c")
buf.write("\u024d\7p\2\2\u024dD\3\2\2\2\u024e\u024f\7B\2\2\u024f")
buf.write("\u0250\7o\2\2\u0250\u0251\7\64\2\2\u0251\u0252\7o\2\2")
buf.write("\u0252\u0253\7a\2\2\u0253\u0254\7e\2\2\u0254\u0255\7j")
buf.write("\2\2\u0255\u0256\7c\2\2\u0256\u0257\7p\2\2\u0257\u0258")
buf.write("\7i\2\2\u0258\u0259\7g\2\2\u0259\u025a\7f\2\2\u025aF\3")
buf.write("\2\2\2\u025b\u025c\7B\2\2\u025c\u025d\7r\2\2\u025d\u025e")
buf.write("\7q\2\2\u025e\u025f\7u\2\2\u025f\u0260\7v\2\2\u0260\u0261")
buf.write("\7a\2\2\u0261\u0262\7f\2\2\u0262\u0263\7g\2\2\u0263\u0264")
buf.write("\7n\2\2\u0264\u0265\7g\2\2\u0265\u0266\7v\2\2\u0266\u0267")
buf.write("\7g\2\2\u0267H\3\2\2\2\u0268\u0269\7B\2\2\u0269\u026a")
buf.write("\7r\2\2\u026a\u026b\7t\2\2\u026b\u026c\7g\2\2\u026c\u026d")
buf.write("\7a\2\2\u026d\u026e\7f\2\2\u026e\u026f\7g\2\2\u026f\u0270")
buf.write("\7n\2\2\u0270\u0271\7g\2\2\u0271\u0272\7v\2\2\u0272\u0273")
buf.write("\7g\2\2\u0273J\3\2\2\2\u0274\u0275\7B\2\2\u0275\u0276")
buf.write("\7r\2\2\u0276\u0277\7q\2\2\u0277\u0278\7u\2\2\u0278\u0279")
buf.write("\7v\2\2\u0279\u027a\7a\2\2\u027a\u027b\7u\2\2\u027b\u027c")
buf.write("\7c\2\2\u027c\u027d\7x\2\2\u027d\u027e\7g\2\2\u027eL\3")
buf.write("\2\2\2\u027f\u0280\7B\2\2\u0280\u0281\7r\2\2\u0281\u0282")
buf.write("\7t\2\2\u0282\u0283\7g\2\2\u0283\u0284\7a\2\2\u0284\u0285")
buf.write("\7u\2\2\u0285\u0286\7c\2\2\u0286\u0287\7x\2\2\u0287\u0288")
buf.write("\7g\2\2\u0288N\3\2\2\2\u0289\u028a\7B\2\2\u028a\u028b")
buf.write("\7e\2\2\u028b\u028c\7n\2\2\u028c\u028d\7g\2\2\u028d\u028e")
buf.write("\7c\2\2\u028e\u028f\7p\2\2\u028fP\3\2\2\2\u0290\u0291")
buf.write("\7B\2\2\u0291\u0292\7q\2\2\u0292\u0293\7t\2\2\u0293\u0294")
buf.write("\7f\2\2\u0294\u0295\7g\2\2\u0295\u0296\7t\2\2\u0296R\3")
buf.write("\2\2\2\u0297\u0298\7B\2\2\u0298\u0299\7u\2\2\u0299\u029a")
buf.write("\7q\2\2\u029a\u029b\7t\2\2\u029b\u029c\7v\2\2\u029c\u029d")
buf.write("\7c\2\2\u029d\u029e\7d\2\2\u029e\u029f\7n\2\2\u029f\u02a0")
buf.write("\7g\2\2\u02a0T\3\2\2\2\u02a1\u02a2\7B\2\2\u02a2\u02a3")
buf.write("\7n\2\2\u02a3\u02a4\7c\2\2\u02a4\u02a5\7p\2\2\u02a5\u02a6")
buf.write("\7i\2\2\u02a6\u02a7\7u\2\2\u02a7V\3\2\2\2\u02a8\u02a9")
buf.write("\7d\2\2\u02a9\u02aa\7c\2\2\u02aa\u02ab\7u\2\2\u02ab\u02ac")
buf.write("\7k\2\2\u02ac\u02ad\7e\2\2\u02adX\3\2\2\2\u02ae\u02af")
buf.write("\7u\2\2\u02af\u02b0\7g\2\2\u02b0\u02b1\7u\2\2\u02b1\u02b2")
buf.write("\7u\2\2\u02b2\u02b3\7k\2\2\u02b3\u02b4\7q\2\2\u02b4\u02b5")
buf.write("\7p\2\2\u02b5Z\3\2\2\2\u02b6\u02b7\7v\2\2\u02b7\u02b8")
buf.write("\7q\2\2\u02b8\u02b9\7m\2\2\u02b9\u02ba\7g\2\2\u02ba\u02bb")
buf.write("\7p\2\2\u02bb\\\3\2\2\2\u02bc\u02bd\7v\2\2\u02bd\u02be")
buf.write("\7g\2\2\u02be\u02bf\7z\2\2\u02bf\u02c0\7v\2\2\u02c0^\3")
buf.write("\2\2\2\u02c1\u02c2\7j\2\2\u02c2\u02c3\7v\2\2\u02c3\u02c4")
buf.write("\7o\2\2\u02c4\u02c5\7n\2\2\u02c5`\3\2\2\2\u02c6\u02c7")
buf.write("\7j\2\2\u02c7\u02c8\7v\2\2\u02c8\u02c9\7o\2\2\u02c9\u02ca")
buf.write("\7n\2\2\u02ca\u02cb\7a\2\2\u02cb\u02cc\7o\2\2\u02cc\u02cd")
buf.write("\7g\2\2\u02cd\u02ce\7f\2\2\u02ce\u02cf\7k\2\2\u02cf\u02d0")
buf.write("\7c\2\2\u02d0b\3\2\2\2\u02d1\u02d2\7h\2\2\u02d2\u02d3")
buf.write("\7n\2\2\u02d3\u02d4\7q\2\2\u02d4\u02d5\7c\2\2\u02d5\u02d6")
buf.write("\7v\2\2\u02d6d\3\2\2\2\u02d7\u02d8\7f\2\2\u02d8\u02d9")
buf.write("\7g\2\2\u02d9\u02da\7e\2\2\u02da\u02db\7k\2\2\u02db\u02dc")
buf.write("\7o\2\2\u02dc\u02dd\7c\2\2\u02dd\u02de\7n\2\2\u02def\3")
buf.write("\2\2\2\u02df\u02e0\7f\2\2\u02e0\u02e1\7c\2\2\u02e1\u02e2")
buf.write("\7v\2\2\u02e2\u02e3\7g\2\2\u02e3h\3\2\2\2\u02e4\u02e5")
buf.write("\7f\2\2\u02e5\u02e6\7c\2\2\u02e6\u02e7\7v\2\2\u02e7\u02e8")
buf.write("\7g\2\2\u02e8\u02e9\7v\2\2\u02e9\u02ea\7k\2\2\u02ea\u02eb")
buf.write("\7o\2\2\u02eb\u02ec\7g\2\2\u02ecj\3\2\2\2\u02ed\u02ee")
buf.write("\7e\2\2\u02ee\u02ef\7t\2\2\u02ef\u02f0\7g\2\2\u02f0\u02f1")
buf.write("\7c\2\2\u02f1\u02f2\7v\2\2\u02f2\u02f3\7g\2\2\u02f3\u02f4")
buf.write("\7a\2\2\u02f4\u02f5\7v\2\2\u02f5\u02f6\7k\2\2\u02f6\u02f7")
buf.write("\7o\2\2\u02f7\u02f8\7g\2\2\u02f8l\3\2\2\2\u02f9\u02fa")
buf.write("\7w\2\2\u02fa\u02fb\7r\2\2\u02fb\u02fc\7f\2\2\u02fc\u02fd")
buf.write("\7c\2\2\u02fd\u02fe\7v\2\2\u02fe\u02ff\7g\2\2\u02ff\u0300")
buf.write("\7a\2\2\u0300\u0301\7v\2\2\u0301\u0302\7k\2\2\u0302\u0303")
buf.write("\7o\2\2\u0303\u0304\7g\2\2\u0304n\3\2\2\2\u0305\u0306")
buf.write("\7k\2\2\u0306\u0307\7o\2\2\u0307\u0308\7c\2\2\u0308\u0309")
buf.write("\7i\2\2\u0309\u030a\7g\2\2\u030ap\3\2\2\2\u030b\u030c")
buf.write("\7h\2\2\u030c\u030d\7k\2\2\u030d\u030e\7n\2\2\u030e\u030f")
buf.write("\7g\2\2\u030fr\3\2\2\2\u0310\u0311\7h\2\2\u0311\u0312")
buf.write("\7k\2\2\u0312\u0313\7n\2\2\u0313\u0314\7g\2\2\u0314\u0315")
buf.write("\7t\2\2\u0315\u0316\7a\2\2\u0316\u0317\7k\2\2\u0317\u0318")
buf.write("\7o\2\2\u0318\u0319\7c\2\2\u0319\u031a\7i\2\2\u031a\u031b")
buf.write("\7g\2\2\u031bt\3\2\2\2\u031c\u031d\7h\2\2\u031d\u031e")
buf.write("\7k\2\2\u031e\u031f\7n\2\2\u031f\u0320\7g\2\2\u0320\u0321")
buf.write("\7t\2\2\u0321\u0322\7a\2\2\u0322\u0323\7h\2\2\u0323\u0324")
buf.write("\7k\2\2\u0324\u0325\7n\2\2\u0325\u0326\7g\2\2\u0326v\3")
buf.write("\2\2\2\u0327\u0328\7h\2\2\u0328\u0329\7k\2\2\u0329\u032a")
buf.write("\7n\2\2\u032a\u032b\7g\2\2\u032b\u032c\7t\2\2\u032c\u032d")
buf.write("\7a\2\2\u032d\u032e\7h\2\2\u032e\u032f\7q\2\2\u032f\u0330")
buf.write("\7n\2\2\u0330\u0331\7f\2\2\u0331\u0332\7g\2\2\u0332\u0333")
buf.write("\7t\2\2\u0333x\3\2\2\2\u0334\u0335\7h\2\2\u0335\u0336")
buf.write("\7k\2\2\u0336\u0337\7n\2\2\u0337\u0338\7g\2\2\u0338\u0339")
buf.write("\7t\2\2\u0339\u033a\7a\2\2\u033a\u033b\7k\2\2\u033b\u033c")
buf.write("\7o\2\2\u033c\u033d\7c\2\2\u033d\u033e\7i\2\2\u033e\u033f")
buf.write("\7g\2\2\u033f\u0340\7a\2\2\u0340\u0341\7h\2\2\u0341\u0342")
buf.write("\7q\2\2\u0342\u0343\7n\2\2\u0343\u0344\7f\2\2\u0344\u0345")
buf.write("\7g\2\2\u0345\u0346\7t\2\2\u0346z\3\2\2\2\u0347\u0348")
buf.write("\7u\2\2\u0348\u0349\7v\2\2\u0349\u034a\7t\2\2\u034a|\3")
buf.write("\2\2\2\u034b\u034c\7k\2\2\u034c\u034d\7p\2\2\u034d\u034e")
buf.write("\7v\2\2\u034e~\3\2\2\2\u034f\u0350\7u\2\2\u0350\u0351")
buf.write("\7n\2\2\u0351\u0352\7w\2\2\u0352\u0353\7i\2\2\u0353\u0080")
buf.write("\3\2\2\2\u0354\u0355\7d\2\2\u0355\u0356\7q\2\2\u0356\u0357")
buf.write("\7q\2\2\u0357\u0358\7n\2\2\u0358\u0082\3\2\2\2\u0359\u035a")
buf.write("\7q\2\2\u035a\u035b\7p\2\2\u035b\u035c\7g\2\2\u035c\u0084")
buf.write("\3\2\2\2\u035d\u035e\7q\2\2\u035e\u035f\7p\2\2\u035f\u0360")
buf.write("\7g\2\2\u0360\u0361\7\64\2\2\u0361\u0362\7q\2\2\u0362")
buf.write("\u0363\7p\2\2\u0363\u0364\7g\2\2\u0364\u0086\3\2\2\2\u0365")
buf.write("\u0366\7o\2\2\u0366\u0367\7c\2\2\u0367\u0368\7p\2\2\u0368")
buf.write("\u0369\7{\2\2\u0369\u0088\3\2\2\2\u036a\u036b\7e\2\2\u036b")
buf.write("\u036c\7j\2\2\u036c\u036d\7q\2\2\u036d\u036e\7k\2\2\u036e")
buf.write("\u036f\7e\2\2\u036f\u0370\7g\2\2\u0370\u0371\7u\2\2\u0371")
buf.write("\u008a\3\2\2\2\u0372\u0373\7v\2\2\u0373\u0374\7j\2\2\u0374")
buf.write("\u0375\7g\2\2\u0375\u0376\7o\2\2\u0376\u0377\7g\2\2\u0377")
buf.write("\u008c\3\2\2\2\u0378\u0379\7k\2\2\u0379\u037a\7p\2\2\u037a")
buf.write("\u037b\7u\2\2\u037b\u037c\7v\2\2\u037c\u037d\7c\2\2\u037d")
buf.write("\u037e\7n\2\2\u037e\u037f\7n\2\2\u037f\u008e\3\2\2\2\u0380")
buf.write("\u0381\7j\2\2\u0381\u0382\7g\2\2\u0382\u0383\7c\2\2\u0383")
buf.write("\u0384\7f\2\2\u0384\u0385\7g\2\2\u0385\u0386\7t\2\2\u0386")
buf.write("\u0090\3\2\2\2\u0387\u0388\7u\2\2\u0388\u0389\7g\2\2\u0389")
buf.write("\u038a\7t\2\2\u038a\u038b\7x\2\2\u038b\u038c\7k\2\2\u038c")
buf.write("\u038d\7e\2\2\u038d\u038e\7g\2\2\u038e\u038f\7u\2\2\u038f")
buf.write("\u0092\3\2\2\2\u0390\u0391\7u\2\2\u0391\u0392\7g\2\2\u0392")
buf.write("\u0393\7n\2\2\u0393\u0394\7g\2\2\u0394\u0395\7p\2\2\u0395")
buf.write("\u0396\7k\2\2\u0396\u0397\7w\2\2\u0397\u0398\7o\2\2\u0398")
buf.write("\u0399\7a\2\2\u0399\u039a\7r\2\2\u039a\u039b\7{\2\2\u039b")
buf.write("\u039c\7v\2\2\u039c\u039d\7g\2\2\u039d\u039e\7u\2\2\u039e")
buf.write("\u039f\7v\2\2\u039f\u0094\3\2\2\2\u03a0\u03a1\7e\2\2\u03a1")
buf.write("\u03a2\7j\2\2\u03a2\u03a3\7k\2\2\u03a3\u03a4\7n\2\2\u03a4")
buf.write("\u03a5\7f\2\2\u03a5\u0096\3\2\2\2\u03a6\u03a7\7h\2\2\u03a7")
buf.write("\u03a8\7k\2\2\u03a8\u03a9\7n\2\2\u03a9\u03aa\7v\2\2\u03aa")
buf.write("\u03ab\7g\2\2\u03ab\u03ac\7t\2\2\u03ac\u03ad\7a\2\2\u03ad")
buf.write("\u03ae\7q\2\2\u03ae\u03af\7w\2\2\u03af\u03b0\7v\2\2\u03b0")
buf.write("\u0098\3\2\2\2\u03b1\u03b2\7h\2\2\u03b2\u03b3\7k\2\2\u03b3")
buf.write("\u03b4\7n\2\2\u03b4\u03b5\7v\2\2\u03b5\u03b6\7g\2\2\u03b6")
buf.write("\u03b7\7t\2\2\u03b7\u03b8\7a\2\2\u03b8\u03b9\7k\2\2\u03b9")
buf.write("\u03ba\7p\2\2\u03ba\u009a\3\2\2\2\u03bb\u03bc\7r\2\2\u03bc")
buf.write("\u03bd\7c\2\2\u03bd\u03be\7i\2\2\u03be\u03bf\7g\2\2\u03bf")
buf.write("\u009c\3\2\2\2\u03c0\u03c1\7n\2\2\u03c1\u03c2\7k\2\2\u03c2")
buf.write("\u03c3\7p\2\2\u03c3\u03c4\7m\2\2\u03c4\u03c5\7a\2\2\u03c5")
buf.write("\u03c6\7u\2\2\u03c6\u03c7\7w\2\2\u03c7\u03c8\7h\2\2\u03c8")
buf.write("\u03c9\7h\2\2\u03c9\u03ca\7k\2\2\u03ca\u03cb\7z\2\2\u03cb")
buf.write("\u009e\3\2\2\2\u03cc\u03cd\7w\2\2\u03cd\u03ce\7t\2\2\u03ce")
buf.write("\u03cf\7n\2\2\u03cf\u03d0\7a\2\2\u03d0\u03d1\7r\2\2\u03d1")
buf.write("\u03d2\7t\2\2\u03d2\u03d3\7g\2\2\u03d3\u03d4\7h\2\2\u03d4")
buf.write("\u03d5\7k\2\2\u03d5\u03d6\7z\2\2\u03d6\u00a0\3\2\2\2\u03d7")
buf.write("\u03d8\7e\2\2\u03d8\u03d9\7c\2\2\u03d9\u03da\7p\2\2\u03da")
buf.write("\u03db\7a\2\2\u03db\u03dc\7g\2\2\u03dc\u03dd\7f\2\2\u03dd")
buf.write("\u03de\7k\2\2\u03de\u03df\7v\2\2\u03df\u00a2\3\2\2\2\u03e0")
buf.write("\u03e1\7q\2\2\u03e1\u03e2\7d\2\2\u03e2\u03e3\7l\2\2\u03e3")
buf.write("\u03e4\7g\2\2\u03e4\u03e5\7e\2\2\u03e5\u03e6\7v\2\2\u03e6")
buf.write("\u03e7\7a\2\2\u03e7\u03e8\7g\2\2\u03e8\u03e9\7z\2\2\u03e9")
buf.write("\u03ea\7r\2\2\u03ea\u03eb\7t\2\2\u03eb\u00a4\3\2\2\2\u03ec")
buf.write("\u03ed\7d\2\2\u03ed\u03ee\7n\2\2\u03ee\u03ef\7q\2\2\u03ef")
buf.write("\u03f0\7e\2\2\u03f0\u03f1\7m\2\2\u03f1\u00a6\3\2\2\2\u03f2")
buf.write("\u03f3\7k\2\2\u03f3\u03f4\7v\2\2\u03f4\u03f5\7g\2\2\u03f5")
buf.write("\u03f6\7o\2\2\u03f6\u03f7\7a\2\2\u03f7\u03f8\7p\2\2\u03f8")
buf.write("\u03f9\7c\2\2\u03f9\u03fa\7o\2\2\u03fa\u03fb\7g\2\2\u03fb")
buf.write("\u00a8\3\2\2\2\u03fc\u03fd\7r\2\2\u03fd\u03fe\7m\2\2\u03fe")
buf.write("\u03ff\7a\2\2\u03ff\u0400\7r\2\2\u0400\u0401\7c\2\2\u0401")
buf.write("\u0402\7t\2\2\u0402\u0403\7c\2\2\u0403\u0404\7o\2\2\u0404")
buf.write("\u00aa\3\2\2\2\u0405\u0406\7n\2\2\u0406\u0407\7k\2\2\u0407")
buf.write("\u0408\7u\2\2\u0408\u0409\7v\2\2\u0409\u040a\7a\2\2\u040a")
buf.write("\u040b\7h\2\2\u040b\u040c\7k\2\2\u040c\u040d\7g\2\2\u040d")
buf.write("\u040e\7n\2\2\u040e\u040f\7f\2\2\u040f\u0410\7u\2\2\u0410")
buf.write("\u00ac\3\2\2\2\u0411\u0412\7f\2\2\u0412\u0413\7g\2\2\u0413")
buf.write("\u0414\7n\2\2\u0414\u0415\7g\2\2\u0415\u0416\7v\2\2\u0416")
buf.write("\u0417\7g\2\2\u0417\u00ae\3\2\2\2\u0418\u0419\7g\2\2\u0419")
buf.write("\u041a\7f\2\2\u041a\u041b\7k\2\2\u041b\u041c\7v\2\2\u041c")
buf.write("\u00b0\3\2\2\2\u041d\u041e\7e\2\2\u041e\u041f\7t\2\2\u041f")
buf.write("\u0420\7g\2\2\u0420\u0421\7c\2\2\u0421\u0422\7v\2\2\u0422")
buf.write("\u0423\7g\2\2\u0423\u00b2\3\2\2\2\u0424\u0425\7f\2\2\u0425")
buf.write("\u0426\7g\2\2\u0426\u0427\7v\2\2\u0427\u0428\7c\2\2\u0428")
buf.write("\u0429\7k\2\2\u0429\u042a\7n\2\2\u042a\u00b4\3\2\2\2\u042b")
buf.write("\u042c\7u\2\2\u042c\u042d\7m\2\2\u042d\u042e\7k\2\2\u042e")
buf.write("\u042f\7r\2\2\u042f\u00b6\3\2\2\2\u0430\u0431\7h\2\2\u0431")
buf.write("\u0432\7t\2\2\u0432\u0433\7q\2\2\u0433\u0434\7o\2\2\u0434")
buf.write("\u00b8\3\2\2\2\u0435\u0436\7-\2\2\u0436\u0437\7r\2\2\u0437")
buf.write("\u0438\7q\2\2\u0438\u0439\7n\2\2\u0439\u043a\7{\2\2\u043a")
buf.write("\u043b\7o\2\2\u043b\u043c\7q\2\2\u043c\u043d\7t\2\2\u043d")
buf.write("\u043e\7r\2\2\u043e\u043f\7j\2\2\u043f\u0440\7k\2\2\u0440")
buf.write("\u0441\7e\2\2\u0441\u0442\7a\2\2\u0442\u0443\7n\2\2\u0443")
buf.write("\u0444\7k\2\2\u0444\u0445\7u\2\2\u0445\u0446\7v\2\2\u0446")
buf.write("\u00ba\3\2\2\2\u0447\u0448\7e\2\2\u0448\u0449\7u\2\2\u0449")
buf.write("\u044a\7u\2\2\u044a\u00bc\3\2\2\2\u044b\u044c\7l\2\2\u044c")
buf.write("\u044d\7u\2\2\u044d\u00be\3\2\2\2\u044e\u044f\7v\2\2\u044f")
buf.write("\u0450\7c\2\2\u0450\u0451\7d\2\2\u0451\u0452\7w\2\2\u0452")
buf.write("\u0453\7n\2\2\u0453\u0454\7c\2\2\u0454\u0455\7t\2\2\u0455")
buf.write("\u00c0\3\2\2\2\u0456\u0457\7u\2\2\u0457\u0458\7v\2\2\u0458")
buf.write("\u0459\7c\2\2\u0459\u045a\7e\2\2\u045a\u045b\7m\2\2\u045b")
buf.write("\u045c\7g\2\2\u045c\u045d\7f\2\2\u045d\u00c2\3\2\2\2\u045e")
buf.write("\u045f\7r\2\2\u045f\u0460\7q\2\2\u0460\u0461\7n\2\2\u0461")
buf.write("\u0462\7{\2\2\u0462\u0463\7o\2\2\u0463\u0464\7q\2\2\u0464")
buf.write("\u0465\7t\2\2\u0465\u0466\7r\2\2\u0466\u0467\7j\2\2\u0467")
buf.write("\u0468\7k\2\2\u0468\u0469\7e\2\2\u0469\u00c4\3\2\2\2\u046a")
buf.write("\u046b\7k\2\2\u046b\u046c\7p\2\2\u046c\u046d\7n\2\2\u046d")
buf.write("\u046e\7k\2\2\u046e\u046f\7p\2\2\u046f\u0470\7g\2\2\u0470")
buf.write("\u00c6\3\2\2\2\u0471\u0472\7v\2\2\u0472\u0473\7{\2\2\u0473")
buf.write("\u0474\7r\2\2\u0474\u0475\7g\2\2\u0475\u00c8\3\2\2\2\u0476")
buf.write("\u0477\7w\2\2\u0477\u0478\7u\2\2\u0478\u0479\7g\2\2\u0479")
buf.write("\u047a\7t\2\2\u047a\u047b\7a\2\2\u047b\u047c\7h\2\2\u047c")
buf.write("\u047d\7k\2\2\u047d\u047e\7g\2\2\u047e\u047f\7n\2\2\u047f")
buf.write("\u0480\7f\2\2\u0480\u00ca\3\2\2\2\u0481\u0482\7c\2\2\u0482")
buf.write("\u0483\7p\2\2\u0483\u0484\7p\2\2\u0484\u0485\7q\2\2\u0485")
buf.write("\u0486\7v\2\2\u0486\u0487\7c\2\2\u0487\u0488\7v\2\2\u0488")
buf.write("\u0489\7g\2\2\u0489\u00cc\3\2\2\2\u048a\u048b\7q\2\2\u048b")
buf.write("\u048c\7p\2\2\u048c\u048d\7a\2\2\u048d\u048e\7e\2\2\u048e")
buf.write("\u048f\7t\2\2\u048f\u0490\7g\2\2\u0490\u0491\7c\2\2\u0491")
buf.write("\u0492\7v\2\2\u0492\u0493\7g\2\2\u0493\u00ce\3\2\2\2\u0494")
buf.write("\u0495\7s\2\2\u0495\u0496\7w\2\2\u0496\u0497\7g\2\2\u0497")
buf.write("\u0498\7t\2\2\u0498\u0499\7{\2\2\u0499\u00d0\3\2\2\2\u049a")
buf.write("\u049b\7c\2\2\u049b\u049c\7w\2\2\u049c\u049d\7v\2\2\u049d")
buf.write("\u049e\7j\2\2\u049e\u00d2\3\2\2\2\u049f\u04a0\7e\2\2\u04a0")
buf.write("\u04a1\7q\2\2\u04a1\u04a2\7w\2\2\u04a2\u04a3\7p\2\2\u04a3")
buf.write("\u04a4\7v\2\2\u04a4\u00d4\3\2\2\2\u04a5\u04a6\7k\2\2\u04a6")
buf.write("\u04a7\7\63\2\2\u04a7\u04a8\7:\2\2\u04a8\u04a9\7p\2\2")
buf.write("\u04a9\u00d6\3\2\2\2\u04aa\u04ab\7g\2\2\u04ab\u04ac\7")
buf.write("z\2\2\u04ac\u04ad\7v\2\2\u04ad\u04ae\7g\2\2\u04ae\u04af")
buf.write("\7p\2\2\u04af\u04b0\7u\2\2\u04b0\u04b1\7k\2\2\u04b1\u04b2")
buf.write("\7q\2\2\u04b2\u04b3\7p\2\2\u04b3\u00d8\3\2\2\2\u04b4\u04b5")
buf.write("\7v\2\2\u04b5\u04b6\7c\2\2\u04b6\u04b7\7d\2\2\u04b7\u04b8")
buf.write("\7u\2\2\u04b8\u00da\3\2\2\2\u04b9\u04ba\7n\2\2\u04ba\u04bb")
buf.write("\7k\2\2\u04bb\u04bc\7u\2\2\u04bc\u04bd\7v\2\2\u04bd\u00dc")
buf.write("\3\2\2\2\u04be\u04bf\7t\2\2\u04bf\u04c0\7g\2\2\u04c0\u04c1")
buf.write("\7c\2\2\u04c1\u04c2\7f\2\2\u04c2\u04c3\7a\2\2\u04c3\u04c4")
buf.write("\7q\2\2\u04c4\u04c5\7p\2\2\u04c5\u04c6\7n\2\2\u04c6\u04c7")
buf.write("\7{\2\2\u04c7\u00de\3\2\2\2\u04c8\u04c9\7n\2\2\u04c9\u04ca")
buf.write("\7k\2\2\u04ca\u04cb\7u\2\2\u04cb\u04cc\7v\2\2\u04cc\u04cd")
buf.write("\7a\2\2\u04cd\u04ce\7g\2\2\u04ce\u04cf\7f\2\2\u04cf\u04d0")
buf.write("\7k\2\2\u04d0\u04d1\7v\2\2\u04d1\u04d2\7c\2\2\u04d2\u04d3")
buf.write("\7d\2\2\u04d3\u04d4\7n\2\2\u04d4\u04d5\7g\2\2\u04d5\u00e0")
buf.write("\3\2\2\2\u04d6\u04d7\7n\2\2\u04d7\u04d8\7k\2\2\u04d8\u04d9")
buf.write("\7u\2\2\u04d9\u04da\7v\2\2\u04da\u04db\7a\2\2\u04db\u04dc")
buf.write("\7h\2\2\u04dc\u04dd\7k\2\2\u04dd\u04de\7n\2\2\u04de\u04df")
buf.write("\7v\2\2\u04df\u04e0\7g\2\2\u04e0\u04e1\7t\2\2\u04e1\u00e2")
buf.write("\3\2\2\2\u04e2\u04e3\7n\2\2\u04e3\u04e4\7k\2\2\u04e4\u04e5")
buf.write("\7u\2\2\u04e5\u04e6\7v\2\2\u04e6\u04e7\7a\2\2\u04e7\u04e8")
buf.write("\7u\2\2\u04e8\u04e9\7g\2\2\u04e9\u04ea\7c\2\2\u04ea\u04eb")
buf.write("\7t\2\2\u04eb\u04ec\7e\2\2\u04ec\u04ed\7j\2\2\u04ed\u00e4")
buf.write("\3\2\2\2\u04ee\u04ef\7h\2\2\u04ef\u04f0\7k\2\2\u04f0\u04f1")
buf.write("\7g\2\2\u04f1\u04f2\7n\2\2\u04f2\u04f3\7f\2\2\u04f3\u04f4")
buf.write("\7u\2\2\u04f4\u00e6\3\2\2\2\u04f5\u04f6\7k\2\2\u04f6\u04f7")
buf.write("\7o\2\2\u04f7\u04f8\7r\2\2\u04f8\u04f9\7q\2\2\u04f9\u04fa")
buf.write("\7t\2\2\u04fa\u04fb\7v\2\2\u04fb\u00e8\3\2\2\2\u04fc\u04fd")
buf.write("\7c\2\2\u04fd\u04fe\7u\2\2\u04fe\u00ea\3\2\2\2\u04ff\u0504")
buf.write("\7t\2\2\u0500\u0501\7t\2\2\u0501\u0504\7y\2\2\u0502\u0504")
buf.write("\7y\2\2\u0503\u04ff\3\2\2\2\u0503\u0500\3\2\2\2\u0503")
buf.write("\u0502\3\2\2\2\u0504\u00ec\3\2\2\2\u0505\u0506\7v\2\2")
buf.write("\u0506\u0507\7t\2\2\u0507\u0508\7w\2\2\u0508\u050f\7g")
buf.write("\2\2\u0509\u050a\7h\2\2\u050a\u050b\7c\2\2\u050b\u050c")
buf.write("\7n\2\2\u050c\u050d\7u\2\2\u050d\u050f\7g\2\2\u050e\u0505")
buf.write("\3\2\2\2\u050e\u0509\3\2\2\2\u050f\u00ee\3\2\2\2\u0510")
buf.write("\u0511\13\2\2\2\u0511\u00f0\3\2\2\2\u0512\u0514\7\17\2")
buf.write("\2\u0513\u0512\3\2\2\2\u0513\u0514\3\2\2\2\u0514\u0515")
buf.write("\3\2\2\2\u0515\u0518\7\f\2\2\u0516\u0518\7\17\2\2\u0517")
buf.write("\u0513\3\2\2\2\u0517\u0516\3\2\2\2\u0518\u00f2\3\2\2\2")
buf.write("\u0519\u051d\t\2\2\2\u051a\u051c\t\3\2\2\u051b\u051a\3")
buf.write("\2\2\2\u051c\u051f\3\2\2\2\u051d\u051b\3\2\2\2\u051d\u051e")
buf.write("\3\2\2\2\u051e\u00f4\3\2\2\2\u051f\u051d\3\2\2\2\u0520")
buf.write("\u0524\t\4\2\2\u0521\u0523\t\5\2\2\u0522\u0521\3\2\2\2")
buf.write("\u0523\u0526\3\2\2\2\u0524\u0522\3\2\2\2\u0524\u0525\3")
buf.write("\2\2\2\u0525\u00f6\3\2\2\2\u0526\u0524\3\2\2\2\u0527\u0528")
buf.write("\5\u00f5z\2\u0528\u0529\7z\2\2\u0529\u052a\5\u00f5z\2")
buf.write("\u052a\u00f8\3\2\2\2\u052b\u052c\7>\2\2\u052c\u00fa\3")
buf.write("\2\2\2\u052d\u052e\7@\2\2\u052e\u00fc\3\2\2\2\u052f\u0530")
buf.write("\7<\2\2\u0530\u00fe\3\2\2\2\u0531\u0532\7`\2\2\u0532\u0100")
buf.write("\3\2\2\2\u0533\u0534\7*\2\2\u0534\u0102\3\2\2\2\u0535")
buf.write("\u0536\7+\2\2\u0536\u0104\3\2\2\2\u0537\u0538\7]\2\2\u0538")
buf.write("\u0106\3\2\2\2\u0539\u053a\7_\2\2\u053a\u0108\3\2\2\2")
buf.write("\u053b\u053c\7A\2\2\u053c\u010a\3\2\2\2\u053d\u053e\7")
buf.write("a\2\2\u053e\u010c\3\2\2\2\u053f\u0540\7/\2\2\u0540\u010e")
buf.write("\3\2\2\2\u0541\u0542\7.\2\2\u0542\u0110\3\2\2\2\u0543")
buf.write("\u0544\7\60\2\2\u0544\u0112\3\2\2\2\u0545\u0546\7%\2\2")
buf.write("\u0546\u0114\3\2\2\2\u0547\u0548\7\61\2\2\u0548\u0116")
buf.write("\3\2\2\2\u0549\u054a\7?\2\2\u054a\u0118\3\2\2\2\u054b")
buf.write("\u054c\7&\2\2\u054c\u011a\3\2\2\2\u054d\u054e\7(\2\2\u054e")
buf.write("\u011c\3\2\2\2\u054f\u0550\7#\2\2\u0550\u011e\3\2\2\2")
buf.write("\u0551\u0552\7,\2\2\u0552\u0120\3\2\2\2\u0553\u0554\7")
buf.write("\u0080\2\2\u0554\u0122\3\2\2\2\u0555\u0556\7~\2\2\u0556")
buf.write("\u0124\3\2\2\2\u0557\u055f\7$\2\2\u0558\u055e\n\6\2\2")
buf.write("\u0559\u055a\7^\2\2\u055a\u055e\7^\2\2\u055b\u055c\7^")
buf.write("\2\2\u055c\u055e\7$\2\2\u055d\u0558\3\2\2\2\u055d\u0559")
buf.write("\3\2\2\2\u055d\u055b\3\2\2\2\u055e\u0561\3\2\2\2\u055f")
buf.write("\u055d\3\2\2\2\u055f\u0560\3\2\2\2\u0560\u0562\3\2\2\2")
buf.write("\u0561\u055f\3\2\2\2\u0562\u0563\7$\2\2\u0563\u0126\3")
buf.write("\2\2\2\u0564\u056c\7)\2\2\u0565\u056b\n\7\2\2\u0566\u0567")
buf.write("\7^\2\2\u0567\u056b\7^\2\2\u0568\u0569\7^\2\2\u0569\u056b")
buf.write("\7)\2\2\u056a\u0565\3\2\2\2\u056a\u0566\3\2\2\2\u056a")
buf.write("\u0568\3\2\2\2\u056b\u056e\3\2\2\2\u056c\u056a\3\2\2\2")
buf.write("\u056c\u056d\3\2\2\2\u056d\u056f\3\2\2\2\u056e\u056c\3")
buf.write("\2\2\2\u056f\u0570\7)\2\2\u0570\u0128\3\2\2\2\u0571\u0572")
buf.write("\7\61\2\2\u0572\u0573\7\61\2\2\u0573\u0574\3\2\2\2\u0574")
buf.write("\u0575\5\u012b\u0095\2\u0575\u0576\3\2\2\2\u0576\u0577")
buf.write("\b\u0094\2\2\u0577\u012a\3\2\2\2\u0578\u057a\13\2\2\2")
buf.write("\u0579\u0578\3\2\2\2\u057a\u057d\3\2\2\2\u057b\u057c\3")
buf.write("\2\2\2\u057b\u0579\3\2\2\2\u057c\u0580\3\2\2\2\u057d\u057b")
buf.write("\3\2\2\2\u057e\u0581\5\u00f1x\2\u057f\u0581\7\2\2\3\u0580")
buf.write("\u057e\3\2\2\2\u0580\u057f\3\2\2\2\u0581\u012c\3\2\2\2")
buf.write("\u0582\u0583\7\61\2\2\u0583\u0584\7,\2\2\u0584\u0588\3")
buf.write("\2\2\2\u0585\u0587\13\2\2\2\u0586\u0585\3\2\2\2\u0587")
buf.write("\u058a\3\2\2\2\u0588\u0589\3\2\2\2\u0588\u0586\3\2\2\2")
buf.write("\u0589\u058b\3\2\2\2\u058a\u0588\3\2\2\2\u058b\u058c\7")
buf.write(",\2\2\u058c\u058d\7\61\2\2\u058d\u058e\3\2\2\2\u058e\u058f")
buf.write("\b\u0096\2\2\u058f\u012e\3\2\2\2\u0590\u0591\t\b\2\2\u0591")
buf.write("\u0130\3\2\2\2\u0592\u0593\7\"\2\2\u0593\u0594\3\2\2\2")
buf.write("\u0594\u0595\b\u0098\2\2\u0595\u0132\3\2\2\2\u0596\u0597")
buf.write("\7>\2\2\u0597\u059b\7>\2\2\u0598\u0599\7>\2\2\u0599\u059b")
buf.write("\7B\2\2\u059a\u0596\3\2\2\2\u059a\u0598\3\2\2\2\u059b")
buf.write("\u059c\3\2\2\2\u059c\u059d\b\u0099\3\2\u059d\u0134\3\2")
buf.write("\2\2\u059e\u059f\7<\2\2\u059f\u05a0\7?\2\2\u05a0\u05a4")
buf.write("\3\2\2\2\u05a1\u05a3\5\u0131\u0098\2\u05a2\u05a1\3\2\2")
buf.write("\2\u05a3\u05a6\3\2\2\2\u05a4\u05a2\3\2\2\2\u05a4\u05a5")
buf.write("\3\2\2\2\u05a5\u05a7\3\2\2\2\u05a6\u05a4\3\2\2\2\u05a7")
buf.write("\u05a8\b\u009a\4\2\u05a8\u0136\3\2\2\2\u05a9\u05aa\7B")
buf.write("\2\2\u05aa\u05ab\7?\2\2\u05ab\u05af\3\2\2\2\u05ac\u05ae")
buf.write("\5\u0131\u0098\2\u05ad\u05ac\3\2\2\2\u05ae\u05b1\3\2\2")
buf.write("\2\u05af\u05ad\3\2\2\2\u05af\u05b0\3\2\2\2\u05b0\u05b2")
buf.write("\3\2\2\2\u05b1\u05af\3\2\2\2\u05b2\u05b3\b\u009b\4\2\u05b3")
buf.write("\u0138\3\2\2\2\u05b4\u05b9\7}\2\2\u05b5\u05b8\5\u0139")
buf.write("\u009c\2\u05b6\u05b8\n\t\2\2\u05b7\u05b5\3\2\2\2\u05b7")
buf.write("\u05b6\3\2\2\2\u05b8\u05bb\3\2\2\2\u05b9\u05b7\3\2\2\2")
buf.write("\u05b9\u05ba\3\2\2\2\u05ba\u05bc\3\2\2\2\u05bb\u05b9\3")
buf.write("\2\2\2\u05bc\u05bd\7\177\2\2\u05bd\u013a\3\2\2\2\u05be")
buf.write("\u05bf\5\u00efw\2\u05bf\u013c\3\2\2\2\u05c0\u05c1\7\f")
buf.write("\2\2\u05c1\u05c2\3\2\2\2\u05c2\u05c3\b\u009e\5\2\u05c3")
buf.write("\u05c4\b\u009e\6\2\u05c4\u013e\3\2\2\2\u05c5\u05c7\n\n")
buf.write("\2\2\u05c6\u05c5\3\2\2\2\u05c7\u05c8\3\2\2\2\u05c8\u05c6")
buf.write("\3\2\2\2\u05c8\u05c9\3\2\2\2\u05c9\u05ca\3\2\2\2\u05ca")
buf.write("\u05cb\b\u009f\6\2\u05cb\u0140\3\2\2\2\u05cc\u05cd\5\u00ef")
buf.write("w\2\u05cd\u0142\3\2\2\2\u05ce\u05cf\7=\2\2\u05cf\u05d0")
buf.write("\3\2\2\2\u05d0\u05d1\b\u00a1\6\2\u05d1\u0144\3\2\2\2\u05d2")
buf.write("\u05d4\n\13\2\2\u05d3\u05d2\3\2\2\2\u05d4\u05d5\3\2\2")
buf.write("\2\u05d5\u05d3\3\2\2\2\u05d5\u05d6\3\2\2\2\u05d6\u05d7")
buf.write("\3\2\2\2\u05d7\u05d8\b\u00a2\7\2\u05d8\u0146\3\2\2\2\u05d9")
buf.write("\u05da\5\u00efw\2\u05da\u0148\3\2\2\2\31\2\3\4\u0503\u050e")
buf.write("\u0513\u0517\u051d\u0524\u055d\u055f\u056a\u056c\u057b")
buf.write("\u0580\u0588\u059a\u05a4\u05af\u05b7\u05b9\u05c8\u05d5")
buf.write("\b\2\3\2\7\4\2\7\3\2\tx\2\6\2\2\t\u009d\2")
return buf.getvalue()
class ZmeiLangSimpleLexer(Lexer):
atn = ATNDeserializer().deserialize(serializedATN())
decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]
PYTHON_LINE = 1
PYTHON_EXPR = 2
AN_ADMIN = 1
AN_SUIT = 2
AN_CELERY = 3
AN_STREAM = 4
AN_CHANNELS = 5
AN_DOCKER = 6
AN_API = 7
AN_REST = 8
AN_FILER = 9
AN_GITLAB = 10
AN_REACT = 11
AN_REACT_CLIENT = 12
AN_REACT_SERVER = 13
AN_THEME = 14
AN_PRIORITY = 15
AN_FILE = 16
AN_GET = 17
AN_MENU = 18
AN_CRUD = 19
AN_CRUD_DETAIL = 20
AN_CRUD_LIST = 21
AN_CRUD_DELETE = 22
AN_CRUD_EDIT = 23
AN_CRUD_CREATE = 24
AN_POST = 25
AN_ERROR = 26
AN_AUTH = 27
AN_MARKDOWN = 28
AN_HTML = 29
AN_TREE = 30
AN_DATE_TREE = 31
AN_MIXIN = 32
AN_M2M_CHANGED = 33
AN_POST_DELETE = 34
AN_PRE_DELETE = 35
AN_POST_SAVE = 36
AN_PRE_SAVE = 37
AN_CLEAN = 38
AN_ORDER = 39
AN_SORTABLE = 40
AN_LANGS = 41
KW_AUTH_TYPE_BASIC = 42
KW_AUTH_TYPE_SESSION = 43
KW_AUTH_TYPE_TOKEN = 44
COL_FIELD_TYPE_LONGTEXT = 45
COL_FIELD_TYPE_HTML = 46
COL_FIELD_TYPE_HTML_MEDIA = 47
COL_FIELD_TYPE_FLOAT = 48
COL_FIELD_TYPE_DECIMAL = 49
COL_FIELD_TYPE_DATE = 50
COL_FIELD_TYPE_DATETIME = 51
COL_FIELD_TYPE_CREATE_TIME = 52
COL_FIELD_TYPE_UPDATE_TIME = 53
COL_FIELD_TYPE_IMAGE = 54
COL_FIELD_TYPE_FILE = 55
COL_FIELD_TYPE_FILER_IMAGE = 56
COL_FIELD_TYPE_FILER_FILE = 57
COL_FIELD_TYPE_FILER_FOLDER = 58
COL_FIELD_TYPE_FILER_IMAGE_FOLDER = 59
COL_FIELD_TYPE_TEXT = 60
COL_FIELD_TYPE_INT = 61
COL_FIELD_TYPE_SLUG = 62
COL_FIELD_TYPE_BOOL = 63
COL_FIELD_TYPE_ONE = 64
COL_FIELD_TYPE_ONE2ONE = 65
COL_FIELD_TYPE_MANY = 66
COL_FIELD_CHOICES = 67
KW_THEME = 68
KW_INSTALL = 69
KW_HEADER = 70
KW_SERVICES = 71
KW_SELENIUM_PYTEST = 72
KW_CHILD = 73
KW_FILTER_OUT = 74
KW_FILTER_IN = 75
KW_PAGE = 76
KW_LINK_SUFFIX = 77
KW_URL_PREFIX = 78
KW_CAN_EDIT = 79
KW_OBJECT_EXPR = 80
KW_BLOCK = 81
KW_ITEM_NAME = 82
KW_PK_PARAM = 83
KW_LIST_FIELDS = 84
KW_DELETE = 85
KW_EDIT = 86
KW_CREATE = 87
KW_DETAIL = 88
KW_SKIP = 89
KW_FROM = 90
KW_POLY_LIST = 91
KW_CSS = 92
KW_JS = 93
KW_INLINE_TYPE_TABULAR = 94
KW_INLINE_TYPE_STACKED = 95
KW_INLINE_TYPE_POLYMORPHIC = 96
KW_INLINE = 97
KW_TYPE = 98
KW_USER_FIELD = 99
KW_ANNOTATE = 100
KW_ON_CREATE = 101
KW_QUERY = 102
KW_AUTH = 103
KW_COUNT = 104
KW_I18N = 105
KW_EXTENSION = 106
KW_TABS = 107
KW_LIST = 108
KW_READ_ONLY = 109
KW_LIST_EDITABLE = 110
KW_LIST_FILTER = 111
KW_LIST_SEARCH = 112
KW_FIELDS = 113
KW_IMPORT = 114
KW_AS = 115
WRITE_MODE = 116
BOOL = 117
NL = 118
ID = 119
DIGIT = 120
SIZE2D = 121
LT = 122
GT = 123
COLON = 124
EXCLUDE = 125
BRACE_OPEN = 126
BRACE_CLOSE = 127
SQ_BRACE_OPEN = 128
SQ_BRACE_CLOSE = 129
QUESTION_MARK = 130
UNDERSCORE = 131
DASH = 132
COMA = 133
DOT = 134
HASH = 135
SLASH = 136
EQUALS = 137
DOLLAR = 138
AMP = 139
EXCLAM = 140
STAR = 141
APPROX = 142
PIPE = 143
STRING_DQ = 144
STRING_SQ = 145
COMMENT_LINE = 146
COMMENT_BLOCK = 147
UNICODE = 148
WS = 149
COL_FIELD_CALCULATED = 150
ASSIGN = 151
ASSIGN_STATIC = 152
CODE_BLOCK = 153
ERRCHAR = 154
PYTHON_CODE = 155
PYTHON_LINE_ERRCHAR = 156
PYTHON_LINE_END = 157
PYTHON_EXPR_ERRCHAR = 158
PYTHON_LINE_NL = 159
channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ]
modeNames = [ "DEFAULT_MODE", "PYTHON_LINE", "PYTHON_EXPR" ]
literalNames = [ "<INVALID>",
"'@admin'", "'@suit'", "'@celery'", "'@stream'", "'@channels'",
"'@docker'", "'@api'", "'@rest'", "'@filer'", "'@gitlab'", "'@react'",
"'@react_client'", "'@react_server'", "'@theme'", "'@@'", "'@file'",
"'@get'", "'@menu'", "'@crud'", "'@crud_detail'", "'@crud_list'",
"'@crud_delete'", "'@crud_edit'", "'@crud_create'", "'@post'",
"'@error'", "'@auth'", "'@markdown'", "'@html'", "'@tree'",
"'@date_tree'", "'@mixin'", "'@m2m_changed'", "'@post_delete'",
"'@pre_delete'", "'@post_save'", "'@pre_save'", "'@clean'",
"'@order'", "'@sortable'", "'@langs'", "'basic'", "'session'",
"'token'", "'text'", "'html'", "'html_media'", "'float'", "'decimal'",
"'date'", "'datetime'", "'create_time'", "'update_time'", "'image'",
"'file'", "'filer_image'", "'filer_file'", "'filer_folder'",
"'filer_image_folder'", "'str'", "'int'", "'slug'", "'bool'",
"'one'", "'one2one'", "'many'", "'choices'", "'theme'", "'install'",
"'header'", "'services'", "'selenium_pytest'", "'child'", "'filter_out'",
"'filter_in'", "'page'", "'link_suffix'", "'url_prefix'", "'can_edit'",
"'object_expr'", "'block'", "'item_name'", "'pk_param'", "'list_fields'",
"'delete'", "'edit'", "'create'", "'detail'", "'skip'", "'from'",
"'+polymorphic_list'", "'css'", "'js'", "'tabular'", "'stacked'",
"'polymorphic'", "'inline'", "'type'", "'user_field'", "'annotate'",
"'on_create'", "'query'", "'auth'", "'count'", "'i18n'", "'extension'",
"'tabs'", "'list'", "'read_only'", "'list_editable'", "'list_filter'",
"'list_search'", "'fields'", "'import'", "'as'", "'<'", "'>'",
"':'", "'^'", "'('", "')'", "'['", "']'", "'?'", "'_'", "'-'",
"','", "'.'", "'#'", "'/'", "'='", "'$'", "'&'", "'!'", "'*'",
"'~'", "'|'", "' '", "';'", "'\n'" ]
symbolicNames = [ "<INVALID>",
"AN_ADMIN", "AN_SUIT", "AN_CELERY", "AN_STREAM", "AN_CHANNELS",
"AN_DOCKER", "AN_API", "AN_REST", "AN_FILER", "AN_GITLAB", "AN_REACT",
"AN_REACT_CLIENT", "AN_REACT_SERVER", "AN_THEME", "AN_PRIORITY",
"AN_FILE", "AN_GET", "AN_MENU", "AN_CRUD", "AN_CRUD_DETAIL",
"AN_CRUD_LIST", "AN_CRUD_DELETE", "AN_CRUD_EDIT", "AN_CRUD_CREATE",
"AN_POST", "AN_ERROR", "AN_AUTH", "AN_MARKDOWN", "AN_HTML",
"AN_TREE", "AN_DATE_TREE", "AN_MIXIN", "AN_M2M_CHANGED", "AN_POST_DELETE",
"AN_PRE_DELETE", "AN_POST_SAVE", "AN_PRE_SAVE", "AN_CLEAN",
"AN_ORDER", "AN_SORTABLE", "AN_LANGS", "KW_AUTH_TYPE_BASIC",
"KW_AUTH_TYPE_SESSION", "KW_AUTH_TYPE_TOKEN", "COL_FIELD_TYPE_LONGTEXT",
"COL_FIELD_TYPE_HTML", "COL_FIELD_TYPE_HTML_MEDIA", "COL_FIELD_TYPE_FLOAT",
"COL_FIELD_TYPE_DECIMAL", "COL_FIELD_TYPE_DATE", "COL_FIELD_TYPE_DATETIME",
"COL_FIELD_TYPE_CREATE_TIME", "COL_FIELD_TYPE_UPDATE_TIME",
"COL_FIELD_TYPE_IMAGE", "COL_FIELD_TYPE_FILE", "COL_FIELD_TYPE_FILER_IMAGE",
"COL_FIELD_TYPE_FILER_FILE", "COL_FIELD_TYPE_FILER_FOLDER",
"COL_FIELD_TYPE_FILER_IMAGE_FOLDER", "COL_FIELD_TYPE_TEXT",
"COL_FIELD_TYPE_INT", "COL_FIELD_TYPE_SLUG", "COL_FIELD_TYPE_BOOL",
"COL_FIELD_TYPE_ONE", "COL_FIELD_TYPE_ONE2ONE", "COL_FIELD_TYPE_MANY",
"COL_FIELD_CHOICES", "KW_THEME", "KW_INSTALL", "KW_HEADER",
"KW_SERVICES", "KW_SELENIUM_PYTEST", "KW_CHILD", "KW_FILTER_OUT",
"KW_FILTER_IN", "KW_PAGE", "KW_LINK_SUFFIX", "KW_URL_PREFIX",
"KW_CAN_EDIT", "KW_OBJECT_EXPR", "KW_BLOCK", "KW_ITEM_NAME",
"KW_PK_PARAM", "KW_LIST_FIELDS", "KW_DELETE", "KW_EDIT", "KW_CREATE",
"KW_DETAIL", "KW_SKIP", "KW_FROM", "KW_POLY_LIST", "KW_CSS",
"KW_JS", "KW_INLINE_TYPE_TABULAR", "KW_INLINE_TYPE_STACKED",
"KW_INLINE_TYPE_POLYMORPHIC", "KW_INLINE", "KW_TYPE", "KW_USER_FIELD",
"KW_ANNOTATE", "KW_ON_CREATE", "KW_QUERY", "KW_AUTH", "KW_COUNT",
"KW_I18N", "KW_EXTENSION", "KW_TABS", "KW_LIST", "KW_READ_ONLY",
"KW_LIST_EDITABLE", "KW_LIST_FILTER", "KW_LIST_SEARCH", "KW_FIELDS",
"KW_IMPORT", "KW_AS", "WRITE_MODE", "BOOL", "NL", "ID", "DIGIT",
"SIZE2D", "LT", "GT", "COLON", "EXCLUDE", "BRACE_OPEN", "BRACE_CLOSE",
"SQ_BRACE_OPEN", "SQ_BRACE_CLOSE", "QUESTION_MARK", "UNDERSCORE",
"DASH", "COMA", "DOT", "HASH", "SLASH", "EQUALS", "DOLLAR",
"AMP", "EXCLAM", "STAR", "APPROX", "PIPE", "STRING_DQ", "STRING_SQ",
"COMMENT_LINE", "COMMENT_BLOCK", "UNICODE", "WS", "COL_FIELD_CALCULATED",
"ASSIGN", "ASSIGN_STATIC", "CODE_BLOCK", "ERRCHAR", "PYTHON_CODE",
"PYTHON_LINE_ERRCHAR", "PYTHON_LINE_END", "PYTHON_EXPR_ERRCHAR",
"PYTHON_LINE_NL" ]
ruleNames = [ "AN_ADMIN", "AN_SUIT", "AN_CELERY", "AN_STREAM", "AN_CHANNELS",
"AN_DOCKER", "AN_API", "AN_REST", "AN_FILER", "AN_GITLAB",
"AN_REACT", "AN_REACT_CLIENT", "AN_REACT_SERVER", "AN_THEME",
"AN_PRIORITY", "AN_FILE", "AN_GET", "AN_MENU", "AN_CRUD",
"AN_CRUD_DETAIL", "AN_CRUD_LIST", "AN_CRUD_DELETE", "AN_CRUD_EDIT",
"AN_CRUD_CREATE", "AN_POST", "AN_ERROR", "AN_AUTH", "AN_MARKDOWN",
"AN_HTML", "AN_TREE", "AN_DATE_TREE", "AN_MIXIN", "AN_M2M_CHANGED",
"AN_POST_DELETE", "AN_PRE_DELETE", "AN_POST_SAVE", "AN_PRE_SAVE",
"AN_CLEAN", "AN_ORDER", "AN_SORTABLE", "AN_LANGS", "KW_AUTH_TYPE_BASIC",
"KW_AUTH_TYPE_SESSION", "KW_AUTH_TYPE_TOKEN", "COL_FIELD_TYPE_LONGTEXT",
"COL_FIELD_TYPE_HTML", "COL_FIELD_TYPE_HTML_MEDIA", "COL_FIELD_TYPE_FLOAT",
"COL_FIELD_TYPE_DECIMAL", "COL_FIELD_TYPE_DATE", "COL_FIELD_TYPE_DATETIME",
"COL_FIELD_TYPE_CREATE_TIME", "COL_FIELD_TYPE_UPDATE_TIME",
"COL_FIELD_TYPE_IMAGE", "COL_FIELD_TYPE_FILE", "COL_FIELD_TYPE_FILER_IMAGE",
"COL_FIELD_TYPE_FILER_FILE", "COL_FIELD_TYPE_FILER_FOLDER",
"COL_FIELD_TYPE_FILER_IMAGE_FOLDER", "COL_FIELD_TYPE_TEXT",
"COL_FIELD_TYPE_INT", "COL_FIELD_TYPE_SLUG", "COL_FIELD_TYPE_BOOL",
"COL_FIELD_TYPE_ONE", "COL_FIELD_TYPE_ONE2ONE", "COL_FIELD_TYPE_MANY",
"COL_FIELD_CHOICES", "KW_THEME", "KW_INSTALL", "KW_HEADER",
"KW_SERVICES", "KW_SELENIUM_PYTEST", "KW_CHILD", "KW_FILTER_OUT",
"KW_FILTER_IN", "KW_PAGE", "KW_LINK_SUFFIX", "KW_URL_PREFIX",
"KW_CAN_EDIT", "KW_OBJECT_EXPR", "KW_BLOCK", "KW_ITEM_NAME",
"KW_PK_PARAM", "KW_LIST_FIELDS", "KW_DELETE", "KW_EDIT",
"KW_CREATE", "KW_DETAIL", "KW_SKIP", "KW_FROM", "KW_POLY_LIST",
"KW_CSS", "KW_JS", "KW_INLINE_TYPE_TABULAR", "KW_INLINE_TYPE_STACKED",
"KW_INLINE_TYPE_POLYMORPHIC", "KW_INLINE", "KW_TYPE",
"KW_USER_FIELD", "KW_ANNOTATE", "KW_ON_CREATE", "KW_QUERY",
"KW_AUTH", "KW_COUNT", "KW_I18N", "KW_EXTENSION", "KW_TABS",
"KW_LIST", "KW_READ_ONLY", "KW_LIST_EDITABLE", "KW_LIST_FILTER",
"KW_LIST_SEARCH", "KW_FIELDS", "KW_IMPORT", "KW_AS", "WRITE_MODE",
"BOOL", "ERR", "NL", "ID", "DIGIT", "SIZE2D", "LT", "GT",
"COLON", "EXCLUDE", "BRACE_OPEN", "BRACE_CLOSE", "SQ_BRACE_OPEN",
"SQ_BRACE_CLOSE", "QUESTION_MARK", "UNDERSCORE", "DASH",
"COMA", "DOT", "HASH", "SLASH", "EQUALS", "DOLLAR", "AMP",
"EXCLAM", "STAR", "APPROX", "PIPE", "STRING_DQ", "STRING_SQ",
"COMMENT_LINE", "REST_OF_LINE", "COMMENT_BLOCK", "UNICODE",
"WS", "COL_FIELD_CALCULATED", "ASSIGN", "ASSIGN_STATIC",
"CODE_BLOCK", "ERRCHAR", "PYTHON_LINE_NL", "PYTHON_CODE",
"PYTHON_LINE_ERRCHAR", "PYTHON_LINE_END", "PYTHON_EXPR_CODE",
"PYTHON_EXPR_ERRCHAR" ]
grammarFileName = "ZmeiLangSimpleLexer.g4"
def __init__(self, input=None, output:TextIO = sys.stdout):
super().__init__(input, output)
self.checkVersion("4.7.2")
self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache())
self._actions = None
self._predicates = None | zmei-cli | /zmei-cli-2.1.10.tar.gz/zmei-cli-2.1.10/zmei_generator/parser/gen/ZmeiLangSimpleLexer.py | ZmeiLangSimpleLexer.py |
from antlr4 import *
from io import StringIO
from typing.io import TextIO
import sys
def serializedATN():
with StringIO() as buf:
buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\u00a1")
buf.write("\u09d2\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7")
buf.write("\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\4\16")
buf.write("\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22\4\23\t\23")
buf.write("\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31")
buf.write("\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36")
buf.write("\4\37\t\37\4 \t \4!\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t")
buf.write("&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t+\4,\t,\4-\t-\4.\t.\4")
buf.write("/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63\t\63\4\64\t\64")
buf.write("\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\4:\t:\4;\t")
buf.write(";\4<\t<\4=\t=\4>\t>\4?\t?\4@\t@\4A\tA\4B\tB\4C\tC\4D\t")
buf.write("D\4E\tE\4F\tF\4G\tG\4H\tH\4I\tI\4J\tJ\4K\tK\4L\tL\4M\t")
buf.write("M\4N\tN\4O\tO\4P\tP\4Q\tQ\4R\tR\4S\tS\4T\tT\4U\tU\4V\t")
buf.write("V\4W\tW\4X\tX\4Y\tY\4Z\tZ\4[\t[\4\\\t\\\4]\t]\4^\t^\4")
buf.write("_\t_\4`\t`\4a\ta\4b\tb\4c\tc\4d\td\4e\te\4f\tf\4g\tg\4")
buf.write("h\th\4i\ti\4j\tj\4k\tk\4l\tl\4m\tm\4n\tn\4o\to\4p\tp\4")
buf.write("q\tq\4r\tr\4s\ts\4t\tt\4u\tu\4v\tv\4w\tw\4x\tx\4y\ty\4")
buf.write("z\tz\4{\t{\4|\t|\4}\t}\4~\t~\4\177\t\177\4\u0080\t\u0080")
buf.write("\4\u0081\t\u0081\4\u0082\t\u0082\4\u0083\t\u0083\4\u0084")
buf.write("\t\u0084\4\u0085\t\u0085\4\u0086\t\u0086\4\u0087\t\u0087")
buf.write("\4\u0088\t\u0088\4\u0089\t\u0089\4\u008a\t\u008a\4\u008b")
buf.write("\t\u008b\4\u008c\t\u008c\4\u008d\t\u008d\4\u008e\t\u008e")
buf.write("\4\u008f\t\u008f\4\u0090\t\u0090\4\u0091\t\u0091\4\u0092")
buf.write("\t\u0092\4\u0093\t\u0093\4\u0094\t\u0094\4\u0095\t\u0095")
buf.write("\4\u0096\t\u0096\4\u0097\t\u0097\4\u0098\t\u0098\4\u0099")
buf.write("\t\u0099\4\u009a\t\u009a\4\u009b\t\u009b\4\u009c\t\u009c")
buf.write("\4\u009d\t\u009d\4\u009e\t\u009e\4\u009f\t\u009f\4\u00a0")
buf.write("\t\u00a0\4\u00a1\t\u00a1\4\u00a2\t\u00a2\4\u00a3\t\u00a3")
buf.write("\4\u00a4\t\u00a4\4\u00a5\t\u00a5\4\u00a6\t\u00a6\4\u00a7")
buf.write("\t\u00a7\4\u00a8\t\u00a8\4\u00a9\t\u00a9\4\u00aa\t\u00aa")
buf.write("\4\u00ab\t\u00ab\4\u00ac\t\u00ac\4\u00ad\t\u00ad\4\u00ae")
buf.write("\t\u00ae\4\u00af\t\u00af\4\u00b0\t\u00b0\4\u00b1\t\u00b1")
buf.write("\4\u00b2\t\u00b2\4\u00b3\t\u00b3\4\u00b4\t\u00b4\4\u00b5")
buf.write("\t\u00b5\4\u00b6\t\u00b6\4\u00b7\t\u00b7\4\u00b8\t\u00b8")
buf.write("\4\u00b9\t\u00b9\4\u00ba\t\u00ba\4\u00bb\t\u00bb\4\u00bc")
buf.write("\t\u00bc\4\u00bd\t\u00bd\4\u00be\t\u00be\4\u00bf\t\u00bf")
buf.write("\4\u00c0\t\u00c0\4\u00c1\t\u00c1\4\u00c2\t\u00c2\4\u00c3")
buf.write("\t\u00c3\4\u00c4\t\u00c4\4\u00c5\t\u00c5\4\u00c6\t\u00c6")
buf.write("\4\u00c7\t\u00c7\4\u00c8\t\u00c8\4\u00c9\t\u00c9\4\u00ca")
buf.write("\t\u00ca\4\u00cb\t\u00cb\4\u00cc\t\u00cc\4\u00cd\t\u00cd")
buf.write("\4\u00ce\t\u00ce\4\u00cf\t\u00cf\4\u00d0\t\u00d0\4\u00d1")
buf.write("\t\u00d1\4\u00d2\t\u00d2\4\u00d3\t\u00d3\4\u00d4\t\u00d4")
buf.write("\4\u00d5\t\u00d5\4\u00d6\t\u00d6\4\u00d7\t\u00d7\4\u00d8")
buf.write("\t\u00d8\4\u00d9\t\u00d9\4\u00da\t\u00da\4\u00db\t\u00db")
buf.write("\4\u00dc\t\u00dc\4\u00dd\t\u00dd\4\u00de\t\u00de\4\u00df")
buf.write("\t\u00df\4\u00e0\t\u00e0\4\u00e1\t\u00e1\4\u00e2\t\u00e2")
buf.write("\4\u00e3\t\u00e3\4\u00e4\t\u00e4\4\u00e5\t\u00e5\4\u00e6")
buf.write("\t\u00e6\4\u00e7\t\u00e7\4\u00e8\t\u00e8\4\u00e9\t\u00e9")
buf.write("\4\u00ea\t\u00ea\4\u00eb\t\u00eb\4\u00ec\t\u00ec\4\u00ed")
buf.write("\t\u00ed\4\u00ee\t\u00ee\4\u00ef\t\u00ef\4\u00f0\t\u00f0")
buf.write("\4\u00f1\t\u00f1\4\u00f2\t\u00f2\4\u00f3\t\u00f3\4\u00f4")
buf.write("\t\u00f4\4\u00f5\t\u00f5\4\u00f6\t\u00f6\4\u00f7\t\u00f7")
buf.write("\4\u00f8\t\u00f8\4\u00f9\t\u00f9\4\u00fa\t\u00fa\4\u00fb")
buf.write("\t\u00fb\4\u00fc\t\u00fc\4\u00fd\t\u00fd\4\u00fe\t\u00fe")
buf.write("\4\u00ff\t\u00ff\4\u0100\t\u0100\4\u0101\t\u0101\4\u0102")
buf.write("\t\u0102\4\u0103\t\u0103\4\u0104\t\u0104\4\u0105\t\u0105")
buf.write("\4\u0106\t\u0106\4\u0107\t\u0107\4\u0108\t\u0108\4\u0109")
buf.write("\t\u0109\4\u010a\t\u010a\4\u010b\t\u010b\4\u010c\t\u010c")
buf.write("\4\u010d\t\u010d\4\u010e\t\u010e\4\u010f\t\u010f\4\u0110")
buf.write("\t\u0110\4\u0111\t\u0111\4\u0112\t\u0112\4\u0113\t\u0113")
buf.write("\4\u0114\t\u0114\4\u0115\t\u0115\4\u0116\t\u0116\4\u0117")
buf.write("\t\u0117\4\u0118\t\u0118\3\2\7\2\u0232\n\2\f\2\16\2\u0235")
buf.write("\13\2\3\2\7\2\u0238\n\2\f\2\16\2\u023b\13\2\3\2\7\2\u023e")
buf.write("\n\2\f\2\16\2\u0241\13\2\3\2\5\2\u0244\n\2\3\2\6\2\u0247")
buf.write("\n\2\r\2\16\2\u0248\5\2\u024b\n\2\3\2\7\2\u024e\n\2\f")
buf.write("\2\16\2\u0251\13\2\3\2\5\2\u0254\n\2\3\2\6\2\u0257\n\2")
buf.write("\r\2\16\2\u0258\5\2\u025b\n\2\3\2\7\2\u025e\n\2\f\2\16")
buf.write("\2\u0261\13\2\3\2\3\2\3\3\6\3\u0266\n\3\r\3\16\3\u0267")
buf.write("\3\4\6\4\u026b\n\4\r\4\16\4\u026c\3\5\3\5\3\6\3\6\3\7")
buf.write("\3\7\5\7\u0275\n\7\3\7\3\7\3\7\6\7\u027a\n\7\r\7\16\7")
buf.write("\u027b\3\b\5\b\u027f\n\b\3\b\3\b\3\t\3\t\3\t\7\t\u0286")
buf.write("\n\t\f\t\16\t\u0289\13\t\3\n\3\n\3\n\5\n\u028e\n\n\3\n")
buf.write("\5\n\u0291\n\n\3\13\3\13\3\f\3\f\3\r\3\r\3\16\3\16\3\17")
buf.write("\3\17\3\17\7\17\u029e\n\17\f\17\16\17\u02a1\13\17\3\20")
buf.write("\3\20\3\20\3\20\5\20\u02a7\n\20\3\20\3\20\3\21\5\21\u02ac")
buf.write("\n\21\3\21\3\21\3\21\3\21\7\21\u02b2\n\21\f\21\16\21\u02b5")
buf.write("\13\21\3\21\3\21\3\21\5\21\u02ba\n\21\3\21\7\21\u02bd")
buf.write("\n\21\f\21\16\21\u02c0\13\21\5\21\u02c2\n\21\3\22\5\22")
buf.write("\u02c5\n\22\3\22\3\22\5\22\u02c9\n\22\3\23\3\23\3\23\3")
buf.write("\23\3\24\3\24\5\24\u02d1\n\24\3\25\3\25\3\25\3\25\3\26")
buf.write("\3\26\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27")
buf.write("\5\27\u02e3\n\27\3\30\3\30\3\30\3\30\3\30\5\30\u02ea\n")
buf.write("\30\3\31\3\31\3\32\3\32\3\32\5\32\u02f1\n\32\3\33\3\33")
buf.write("\3\33\5\33\u02f6\n\33\3\34\3\34\3\34\5\34\u02fb\n\34\3")
buf.write("\35\3\35\3\35\5\35\u0300\n\35\3\36\3\36\3\36\7\36\u0305")
buf.write("\n\36\f\36\16\36\u0308\13\36\3\36\5\36\u030b\n\36\3\36")
buf.write("\7\36\u030e\n\36\f\36\16\36\u0311\13\36\3\36\6\36\u0314")
buf.write("\n\36\r\36\16\36\u0315\3\36\7\36\u0319\n\36\f\36\16\36")
buf.write("\u031c\13\36\3\36\3\36\3\37\3\37\3 \3 \3 \7 \u0325\n ")
buf.write("\f \16 \u0328\13 \3 \5 \u032b\n \3 \7 \u032e\n \f \16")
buf.write(" \u0331\13 \3 \3 \5 \u0335\n \7 \u0337\n \f \16 \u033a")
buf.write("\13 \3 \7 \u033d\n \f \16 \u0340\13 \3 \3 \3!\3!\3!\7")
buf.write("!\u0347\n!\f!\16!\u034a\13!\3!\3!\3!\7!\u034f\n!\f!\16")
buf.write("!\u0352\13!\5!\u0354\n!\3!\7!\u0357\n!\f!\16!\u035a\13")
buf.write("!\3!\3!\3\"\7\"\u035f\n\"\f\"\16\"\u0362\13\"\3\"\3\"")
buf.write("\3\"\7\"\u0367\n\"\f\"\16\"\u036a\13\"\3\"\3\"\5\"\u036e")
buf.write("\n\"\7\"\u0370\n\"\f\"\16\"\u0373\13\"\3\"\7\"\u0376\n")
buf.write("\"\f\"\16\"\u0379\13\"\3\"\5\"\u037c\n\"\3#\3#\3$\3$\7")
buf.write("$\u0382\n$\f$\16$\u0385\13$\3$\3$\7$\u0389\n$\f$\16$\u038c")
buf.write("\13$\3$\3$\3$\7$\u0391\n$\f$\16$\u0394\13$\3$\3$\3$\7")
buf.write("$\u0399\n$\f$\16$\u039c\13$\3$\3$\5$\u03a0\n$\7$\u03a2")
buf.write("\n$\f$\16$\u03a5\13$\5$\u03a7\n$\3$\7$\u03aa\n$\f$\16")
buf.write("$\u03ad\13$\3$\3$\7$\u03b1\n$\f$\16$\u03b4\13$\3%\3%\3")
buf.write("%\3&\3&\3&\3&\6&\u03bd\n&\r&\16&\u03be\3\'\3\'\3\'\3\'")
buf.write("\6\'\u03c5\n\'\r\'\16\'\u03c6\3(\3(\3(\3(\6(\u03cd\n(")
buf.write("\r(\16(\u03ce\3)\7)\u03d2\n)\f)\16)\u03d5\13)\3)\3)\3")
buf.write(")\3)\3*\3*\3+\3+\3+\3+\5+\u03e1\n+\3,\3,\3,\3,\3-\3-\3")
buf.write(".\3.\3.\3.\3.\3.\3.\5.\u03f0\n.\3.\3.\3/\3/\3\60\3\60")
buf.write("\3\60\5\60\u03f9\n\60\3\61\3\61\3\61\3\61\3\61\3\62\3")
buf.write("\62\3\62\7\62\u0403\n\62\f\62\16\62\u0406\13\62\3\63\3")
buf.write("\63\5\63\u040a\n\63\3\63\7\63\u040d\n\63\f\63\16\63\u0410")
buf.write("\13\63\3\63\7\63\u0413\n\63\f\63\16\63\u0416\13\63\3\63")
buf.write("\7\63\u0419\n\63\f\63\16\63\u041c\13\63\3\63\7\63\u041f")
buf.write("\n\63\f\63\16\63\u0422\13\63\3\63\7\63\u0425\n\63\f\63")
buf.write("\16\63\u0428\13\63\3\64\3\64\3\64\6\64\u042d\n\64\r\64")
buf.write("\16\64\u042e\3\64\5\64\u0432\n\64\3\65\3\65\5\65\u0436")
buf.write("\n\65\3\65\3\65\5\65\u043a\n\65\3\65\3\65\3\65\3\66\3")
buf.write("\66\3\66\3\66\6\66\u0443\n\66\r\66\16\66\u0444\3\67\3")
buf.write("\67\3\67\3\67\5\67\u044b\n\67\38\38\38\58\u0450\n8\39")
buf.write("\39\39\39\39\59\u0457\n9\3:\3:\3;\7;\u045c\n;\f;\16;\u045f")
buf.write("\13;\3;\3;\5;\u0463\n;\3;\5;\u0466\n;\3;\5;\u0469\n;\3")
buf.write(";\6;\u046c\n;\r;\16;\u046d\3;\5;\u0471\n;\3<\3<\5<\u0475")
buf.write("\n<\3<\3<\3<\5<\u047a\n<\3<\3<\3<\5<\u047f\n<\3=\3=\3")
buf.write(">\5>\u0484\n>\3>\3>\3?\3?\3?\3@\3@\3A\3A\3A\3B\3B\3C\3")
buf.write("C\3D\6D\u0495\nD\rD\16D\u0496\3D\3D\5D\u049b\nD\3E\3E")
buf.write("\3E\3F\3F\3F\3G\3G\3H\3H\3I\3I\3I\3I\3I\3I\3I\3I\3I\3")
buf.write("I\3I\3I\3I\3I\3I\3I\3I\3I\5I\u04b9\nI\3J\3J\3K\3K\3L\3")
buf.write("L\3M\3M\3N\3N\3O\3O\3P\3P\3Q\3Q\3R\3R\3S\3S\3T\3T\3U\3")
buf.write("U\3V\3V\3V\3V\3V\5V\u04d8\nV\3V\3V\5V\u04dc\nV\3W\3W\3")
buf.write("X\3X\3X\3X\3X\7X\u04e5\nX\fX\16X\u04e8\13X\3Y\5Y\u04eb")
buf.write("\nY\3Y\3Y\3Z\3Z\3Z\5Z\u04f2\nZ\3[\3[\3[\3\\\3\\\3\\\3")
buf.write("\\\3\\\5\\\u04fc\n\\\3]\3]\3]\3]\3]\7]\u0503\n]\f]\16")
buf.write("]\u0506\13]\3^\5^\u0509\n^\3^\3^\3_\3_\3_\5_\u0510\n_")
buf.write("\3`\3`\3`\3a\3a\3a\3a\3a\3b\3b\3b\7b\u051d\nb\fb\16b\u0520")
buf.write("\13b\3c\3c\3d\3d\3d\3d\3d\5d\u0529\nd\3e\3e\3f\3f\3f\3")
buf.write("f\3f\5f\u0532\nf\3g\3g\3h\3h\3h\7h\u0539\nh\fh\16h\u053c")
buf.write("\13h\3i\3i\3i\3i\3j\3j\3k\3k\3k\3l\7l\u0548\nl\fl\16l")
buf.write("\u054b\13l\3m\3m\3m\3n\3n\3n\5n\u0553\nn\3n\3n\5n\u0557")
buf.write("\nn\3n\5n\u055a\nn\3n\3n\3o\3o\3p\3p\3q\3q\3r\3r\3s\3")
buf.write("s\3s\3s\3t\3t\3t\3t\3t\3t\3t\3t\3t\3t\3t\3t\3t\3t\3t\5")
buf.write("t\u0579\nt\3u\3u\3u\3u\3u\3u\3u\3u\3u\3u\3u\3u\3u\3u\7")
buf.write("u\u0589\nu\fu\16u\u058c\13u\3u\7u\u058f\nu\fu\16u\u0592")
buf.write("\13u\3u\5u\u0595\nu\3u\7u\u0598\nu\fu\16u\u059b\13u\3")
buf.write("v\3v\3v\7v\u05a0\nv\fv\16v\u05a3\13v\3v\3v\3v\7v\u05a8")
buf.write("\nv\fv\16v\u05ab\13v\3v\7v\u05ae\nv\fv\16v\u05b1\13v\3")
buf.write("w\3w\3w\3w\3w\7w\u05b8\nw\fw\16w\u05bb\13w\3x\3x\3y\3")
buf.write("y\3z\3z\3z\3z\3z\7z\u05c6\nz\fz\16z\u05c9\13z\3{\3{\3")
buf.write("{\3{\3{\3{\3{\7{\u05d2\n{\f{\16{\u05d5\13{\3{\5{\u05d8")
buf.write("\n{\3|\3|\3}\3}\3}\3}\3~\3~\3\177\3\177\3\177\3\177\3")
buf.write("\u0080\3\u0080\3\u0080\3\u0080\3\u0081\3\u0081\3\u0081")
buf.write("\3\u0081\3\u0081\7\u0081\u05ef\n\u0081\f\u0081\16\u0081")
buf.write("\u05f2\13\u0081\3\u0082\3\u0082\5\u0082\u05f6\n\u0082")
buf.write("\3\u0082\3\u0082\3\u0082\3\u0082\3\u0083\3\u0083\3\u0084")
buf.write("\3\u0084\3\u0085\3\u0085\3\u0085\3\u0085\7\u0085\u0604")
buf.write("\n\u0085\f\u0085\16\u0085\u0607\13\u0085\3\u0086\3\u0086")
buf.write("\3\u0086\3\u0086\7\u0086\u060d\n\u0086\f\u0086\16\u0086")
buf.write("\u0610\13\u0086\3\u0087\3\u0087\3\u0087\3\u0087\7\u0087")
buf.write("\u0616\n\u0087\f\u0087\16\u0087\u0619\13\u0087\3\u0088")
buf.write("\3\u0088\3\u0088\3\u0088\7\u0088\u061f\n\u0088\f\u0088")
buf.write("\16\u0088\u0622\13\u0088\3\u0089\3\u0089\3\u0089\3\u0089")
buf.write("\7\u0089\u0628\n\u0089\f\u0089\16\u0089\u062b\13\u0089")
buf.write("\3\u008a\3\u008a\3\u008a\3\u008a\7\u008a\u0631\n\u008a")
buf.write("\f\u008a\16\u008a\u0634\13\u008a\3\u008b\3\u008b\3\u008b")
buf.write("\3\u008b\3\u008b\3\u008b\7\u008b\u063c\n\u008b\f\u008b")
buf.write("\16\u008b\u063f\13\u008b\5\u008b\u0641\n\u008b\3\u008b")
buf.write("\3\u008b\5\u008b\u0645\n\u008b\3\u008c\3\u008c\3\u008d")
buf.write("\3\u008d\3\u008e\3\u008e\3\u008e\5\u008e\u064e\n\u008e")
buf.write("\3\u008e\3\u008e\3\u008e\3\u008e\5\u008e\u0654\n\u008e")
buf.write("\3\u008f\3\u008f\3\u008f\3\u008f\7\u008f\u065a\n\u008f")
buf.write("\f\u008f\16\u008f\u065d\13\u008f\3\u0090\3\u0090\3\u0090")
buf.write("\3\u0090\3\u0090\3\u0090\3\u0090\3\u0090\3\u0090\3\u0090")
buf.write("\3\u0090\3\u0090\3\u0090\7\u0090\u066c\n\u0090\f\u0090")
buf.write("\16\u0090\u066f\13\u0090\3\u0091\3\u0091\3\u0092\3\u0092")
buf.write("\3\u0092\3\u0092\7\u0092\u0677\n\u0092\f\u0092\16\u0092")
buf.write("\u067a\13\u0092\3\u0093\3\u0093\3\u0093\3\u0093\7\u0093")
buf.write("\u0680\n\u0093\f\u0093\16\u0093\u0683\13\u0093\3\u0094")
buf.write("\3\u0094\3\u0094\7\u0094\u0688\n\u0094\f\u0094\16\u0094")
buf.write("\u068b\13\u0094\3\u0095\3\u0095\5\u0095\u068f\n\u0095")
buf.write("\3\u0095\3\u0095\7\u0095\u0693\n\u0095\f\u0095\16\u0095")
buf.write("\u0696\13\u0095\3\u0096\3\u0096\5\u0096\u069a\n\u0096")
buf.write("\3\u0096\3\u0096\7\u0096\u069e\n\u0096\f\u0096\16\u0096")
buf.write("\u06a1\13\u0096\3\u0097\3\u0097\5\u0097\u06a5\n\u0097")
buf.write("\3\u0097\3\u0097\7\u0097\u06a9\n\u0097\f\u0097\16\u0097")
buf.write("\u06ac\13\u0097\3\u0098\3\u0098\3\u0098\3\u0098\7\u0098")
buf.write("\u06b2\n\u0098\f\u0098\16\u0098\u06b5\13\u0098\3\u0099")
buf.write("\3\u0099\3\u0099\3\u0099\7\u0099\u06bb\n\u0099\f\u0099")
buf.write("\16\u0099\u06be\13\u0099\3\u009a\3\u009a\3\u009a\3\u009a")
buf.write("\5\u009a\u06c4\n\u009a\3\u009a\7\u009a\u06c7\n\u009a\f")
buf.write("\u009a\16\u009a\u06ca\13\u009a\3\u009b\3\u009b\3\u009c")
buf.write("\3\u009c\3\u009c\3\u009c\3\u009c\7\u009c\u06d3\n\u009c")
buf.write("\f\u009c\16\u009c\u06d6\13\u009c\3\u009c\3\u009c\3\u009d")
buf.write("\3\u009d\3\u009d\3\u009d\5\u009d\u06de\n\u009d\3\u009e")
buf.write("\3\u009e\3\u009f\3\u009f\3\u00a0\3\u00a0\3\u00a1\3\u00a1")
buf.write("\3\u00a1\3\u00a1\7\u00a1\u06ea\n\u00a1\f\u00a1\16\u00a1")
buf.write("\u06ed\13\u00a1\3\u00a2\3\u00a2\3\u00a2\3\u00a2\5\u00a2")
buf.write("\u06f3\n\u00a2\3\u00a3\3\u00a3\3\u00a4\3\u00a4\3\u00a5")
buf.write("\3\u00a5\3\u00a5\3\u00a5\3\u00a5\6\u00a5\u06fe\n\u00a5")
buf.write("\r\u00a5\16\u00a5\u06ff\3\u00a6\3\u00a6\3\u00a6\3\u00a6")
buf.write("\3\u00a6\3\u00a7\3\u00a7\3\u00a8\3\u00a8\3\u00a8\3\u00a8")
buf.write("\3\u00a8\3\u00a9\3\u00a9\3\u00a9\7\u00a9\u0711\n\u00a9")
buf.write("\f\u00a9\16\u00a9\u0714\13\u00a9\3\u00aa\3\u00aa\3\u00aa")
buf.write("\3\u00ab\3\u00ab\3\u00ab\3\u00ac\3\u00ac\3\u00ac\3\u00ac")
buf.write("\3\u00ac\5\u00ac\u0721\n\u00ac\3\u00ad\3\u00ad\3\u00ae")
buf.write("\3\u00ae\3\u00ae\3\u00ae\3\u00ae\3\u00af\3\u00af\3\u00af")
buf.write("\3\u00af\3\u00af\3\u00b0\3\u00b0\3\u00b1\3\u00b1\3\u00b1")
buf.write("\3\u00b2\3\u00b2\3\u00b2\3\u00b3\3\u00b3\3\u00b3\3\u00b4")
buf.write("\3\u00b4\3\u00b4\3\u00b5\3\u00b5\3\u00b5\3\u00b5\3\u00b5")
buf.write("\3\u00b6\3\u00b6\3\u00b7\3\u00b7\7\u00b7\u0746\n\u00b7")
buf.write("\f\u00b7\16\u00b7\u0749\13\u00b7\3\u00b7\3\u00b7\7\u00b7")
buf.write("\u074d\n\u00b7\f\u00b7\16\u00b7\u0750\13\u00b7\3\u00b8")
buf.write("\3\u00b8\5\u00b8\u0754\n\u00b8\3\u00b8\3\u00b8\5\u00b8")
buf.write("\u0758\n\u00b8\3\u00b8\3\u00b8\5\u00b8\u075c\n\u00b8\3")
buf.write("\u00b8\3\u00b8\5\u00b8\u0760\n\u00b8\5\u00b8\u0762\n\u00b8")
buf.write("\3\u00b8\3\u00b8\5\u00b8\u0766\n\u00b8\3\u00b9\3\u00b9")
buf.write("\3\u00b9\5\u00b9\u076b\n\u00b9\3\u00b9\3\u00b9\3\u00b9")
buf.write("\3\u00b9\3\u00ba\3\u00ba\3\u00ba\3\u00bb\3\u00bb\3\u00bc")
buf.write("\3\u00bc\5\u00bc\u0778\n\u00bc\3\u00bd\3\u00bd\3\u00bd")
buf.write("\7\u00bd\u077d\n\u00bd\f\u00bd\16\u00bd\u0780\13\u00bd")
buf.write("\3\u00be\3\u00be\3\u00be\3\u00be\3\u00be\6\u00be\u0787")
buf.write("\n\u00be\r\u00be\16\u00be\u0788\3\u00bf\5\u00bf\u078c")
buf.write("\n\u00bf\3\u00bf\3\u00bf\3\u00c0\3\u00c0\3\u00c0\6\u00c0")
buf.write("\u0793\n\u00c0\r\u00c0\16\u00c0\u0794\3\u00c1\3\u00c1")
buf.write("\3\u00c1\3\u00c1\3\u00c2\3\u00c2\5\u00c2\u079d\n\u00c2")
buf.write("\3\u00c3\3\u00c3\3\u00c3\6\u00c3\u07a2\n\u00c3\r\u00c3")
buf.write("\16\u00c3\u07a3\3\u00c3\5\u00c3\u07a7\n\u00c3\5\u00c3")
buf.write("\u07a9\n\u00c3\3\u00c4\3\u00c4\3\u00c5\7\u00c5\u07ae\n")
buf.write("\u00c5\f\u00c5\16\u00c5\u07b1\13\u00c5\3\u00c5\7\u00c5")
buf.write("\u07b4\n\u00c5\f\u00c5\16\u00c5\u07b7\13\u00c5\3\u00c5")
buf.write("\5\u00c5\u07ba\n\u00c5\3\u00c5\7\u00c5\u07bd\n\u00c5\f")
buf.write("\u00c5\16\u00c5\u07c0\13\u00c5\3\u00c5\7\u00c5\u07c3\n")
buf.write("\u00c5\f\u00c5\16\u00c5\u07c6\13\u00c5\3\u00c6\3\u00c6")
buf.write("\3\u00c7\3\u00c7\3\u00c7\3\u00c7\6\u00c7\u07ce\n\u00c7")
buf.write("\r\u00c7\16\u00c7\u07cf\3\u00c7\5\u00c7\u07d3\n\u00c7")
buf.write("\3\u00c8\3\u00c8\3\u00c9\3\u00c9\3\u00ca\3\u00ca\3\u00ca")
buf.write("\5\u00ca\u07dc\n\u00ca\3\u00ca\3\u00ca\5\u00ca\u07e0\n")
buf.write("\u00ca\3\u00ca\6\u00ca\u07e3\n\u00ca\r\u00ca\16\u00ca")
buf.write("\u07e4\3\u00ca\5\u00ca\u07e8\n\u00ca\3\u00cb\3\u00cb\3")
buf.write("\u00cc\3\u00cc\3\u00cc\7\u00cc\u07ef\n\u00cc\f\u00cc\16")
buf.write("\u00cc\u07f2\13\u00cc\3\u00cd\5\u00cd\u07f5\n\u00cd\3")
buf.write("\u00cd\3\u00cd\3\u00ce\3\u00ce\3\u00ce\3\u00ce\3\u00ce")
buf.write("\3\u00ce\3\u00ce\3\u00ce\3\u00ce\3\u00ce\3\u00ce\3\u00ce")
buf.write("\3\u00ce\3\u00ce\3\u00ce\3\u00ce\3\u00ce\5\u00ce\u080a")
buf.write("\n\u00ce\3\u00cf\3\u00cf\3\u00cf\3\u00cf\6\u00cf\u0810")
buf.write("\n\u00cf\r\u00cf\16\u00cf\u0811\3\u00cf\3\u00cf\3\u00d0")
buf.write("\3\u00d0\5\u00d0\u0818\n\u00d0\3\u00d0\5\u00d0\u081b\n")
buf.write("\u00d0\3\u00d0\5\u00d0\u081e\n\u00d0\3\u00d0\5\u00d0\u0821")
buf.write("\n\u00d0\3\u00d1\3\u00d1\5\u00d1\u0825\n\u00d1\3\u00d2")
buf.write("\3\u00d2\3\u00d3\3\u00d3\3\u00d3\3\u00d3\3\u00d3\3\u00d3")
buf.write("\7\u00d3\u082f\n\u00d3\f\u00d3\16\u00d3\u0832\13\u00d3")
buf.write("\5\u00d3\u0834\n\u00d3\3\u00d4\3\u00d4\3\u00d5\3\u00d5")
buf.write("\3\u00d5\5\u00d5\u083b\n\u00d5\3\u00d5\3\u00d5\5\u00d5")
buf.write("\u083f\n\u00d5\3\u00d5\5\u00d5\u0842\n\u00d5\3\u00d6\3")
buf.write("\u00d6\3\u00d7\3\u00d7\3\u00d8\3\u00d8\3\u00d8\3\u00d8")
buf.write("\3\u00d9\3\u00d9\3\u00d9\5\u00d9\u084f\n\u00d9\3\u00d9")
buf.write("\3\u00d9\3\u00da\3\u00da\3\u00db\3\u00db\3\u00db\5\u00db")
buf.write("\u0858\n\u00db\3\u00db\3\u00db\3\u00dc\3\u00dc\3\u00dd")
buf.write("\3\u00dd\3\u00dd\3\u00de\3\u00de\3\u00de\3\u00df\3\u00df")
buf.write("\5\u00df\u0866\n\u00df\3\u00df\3\u00df\7\u00df\u086a\n")
buf.write("\u00df\f\u00df\16\u00df\u086d\13\u00df\3\u00df\3\u00df")
buf.write("\5\u00df\u0871\n\u00df\3\u00df\3\u00df\3\u00df\3\u00df")
buf.write("\3\u00df\3\u00df\3\u00df\3\u00df\3\u00df\3\u00df\3\u00df")
buf.write("\3\u00df\3\u00df\3\u00df\3\u00df\7\u00df\u0882\n\u00df")
buf.write("\f\u00df\16\u00df\u0885\13\u00df\3\u00df\7\u00df\u0888")
buf.write("\n\u00df\f\u00df\16\u00df\u088b\13\u00df\3\u00df\3\u00df")
buf.write("\5\u00df\u088f\n\u00df\3\u00df\7\u00df\u0892\n\u00df\f")
buf.write("\u00df\16\u00df\u0895\13\u00df\3\u00df\7\u00df\u0898\n")
buf.write("\u00df\f\u00df\16\u00df\u089b\13\u00df\3\u00df\7\u00df")
buf.write("\u089e\n\u00df\f\u00df\16\u00df\u08a1\13\u00df\3\u00df")
buf.write("\3\u00df\3\u00e0\3\u00e0\7\u00e0\u08a7\n\u00e0\f\u00e0")
buf.write("\16\u00e0\u08aa\13\u00e0\3\u00e0\3\u00e0\7\u00e0\u08ae")
buf.write("\n\u00e0\f\u00e0\16\u00e0\u08b1\13\u00e0\3\u00e0\3\u00e0")
buf.write("\7\u00e0\u08b5\n\u00e0\f\u00e0\16\u00e0\u08b8\13\u00e0")
buf.write("\3\u00e0\3\u00e0\7\u00e0\u08bc\n\u00e0\f\u00e0\16\u00e0")
buf.write("\u08bf\13\u00e0\3\u00e1\3\u00e1\3\u00e2\3\u00e2\3\u00e2")
buf.write("\3\u00e2\5\u00e2\u08c7\n\u00e2\3\u00e2\3\u00e2\3\u00e2")
buf.write("\3\u00e2\3\u00e3\3\u00e3\3\u00e4\3\u00e4\3\u00e4\3\u00e4")
buf.write("\5\u00e4\u08d3\n\u00e4\3\u00e4\3\u00e4\3\u00e4\3\u00e4")
buf.write("\3\u00e5\3\u00e5\3\u00e6\3\u00e6\5\u00e6\u08dd\n\u00e6")
buf.write("\3\u00e7\3\u00e7\3\u00e8\3\u00e8\3\u00e8\3\u00e8\3\u00e9")
buf.write("\3\u00e9\3\u00e9\3\u00e9\3\u00ea\3\u00ea\3\u00eb\3\u00eb")
buf.write("\3\u00eb\3\u00eb\3\u00ec\3\u00ec\3\u00ed\3\u00ed\3\u00ed")
buf.write("\3\u00ed\3\u00ee\3\u00ee\3\u00ee\3\u00ee\5\u00ee\u08f9")
buf.write("\n\u00ee\3\u00ef\3\u00ef\3\u00ef\3\u00ef\5\u00ef\u08ff")
buf.write("\n\u00ef\3\u00f0\3\u00f0\3\u00f0\3\u00f0\3\u00f1\3\u00f1")
buf.write("\3\u00f1\3\u00f1\3\u00f2\3\u00f2\3\u00f2\3\u00f2\3\u00f3")
buf.write("\3\u00f3\3\u00f3\7\u00f3\u0910\n\u00f3\f\u00f3\16\u00f3")
buf.write("\u0913\13\u00f3\3\u00f4\3\u00f4\3\u00f5\3\u00f5\3\u00f5")
buf.write("\3\u00f5\3\u00f6\3\u00f6\3\u00f6\3\u00f6\3\u00f7\3\u00f7")
buf.write("\3\u00f8\3\u00f8\3\u00f8\3\u00f8\3\u00f9\3\u00f9\3\u00fa")
buf.write("\3\u00fa\3\u00fa\7\u00fa\u092a\n\u00fa\f\u00fa\16\u00fa")
buf.write("\u092d\13\u00fa\3\u00fb\3\u00fb\5\u00fb\u0931\n\u00fb")
buf.write("\3\u00fc\3\u00fc\5\u00fc\u0935\n\u00fc\3\u00fc\5\u00fc")
buf.write("\u0938\n\u00fc\3\u00fd\3\u00fd\3\u00fe\3\u00fe\3\u00fe")
buf.write("\3\u00fe\3\u00ff\3\u00ff\3\u00ff\7\u00ff\u0943\n\u00ff")
buf.write("\f\u00ff\16\u00ff\u0946\13\u00ff\3\u0100\3\u0100\3\u0101")
buf.write("\3\u0101\5\u0101\u094c\n\u0101\3\u0101\5\u0101\u094f\n")
buf.write("\u0101\3\u0102\3\u0102\5\u0102\u0953\n\u0102\3\u0103\3")
buf.write("\u0103\5\u0103\u0957\n\u0103\3\u0104\3\u0104\3\u0104\3")
buf.write("\u0105\3\u0105\3\u0105\3\u0106\3\u0106\3\u0106\3\u0107")
buf.write("\3\u0107\3\u0107\3\u0107\3\u0107\7\u0107\u0967\n\u0107")
buf.write("\f\u0107\16\u0107\u096a\13\u0107\3\u0107\6\u0107\u096d")
buf.write("\n\u0107\r\u0107\16\u0107\u096e\3\u0107\7\u0107\u0972")
buf.write("\n\u0107\f\u0107\16\u0107\u0975\13\u0107\3\u0107\3\u0107")
buf.write("\3\u0108\3\u0108\3\u0109\5\u0109\u097c\n\u0109\3\u0109")
buf.write("\7\u0109\u097f\n\u0109\f\u0109\16\u0109\u0982\13\u0109")
buf.write("\3\u0109\5\u0109\u0985\n\u0109\3\u0109\3\u0109\3\u0109")
buf.write("\5\u0109\u098a\n\u0109\3\u0109\7\u0109\u098d\n\u0109\f")
buf.write("\u0109\16\u0109\u0990\13\u0109\3\u010a\3\u010a\3\u010a")
buf.write("\5\u010a\u0995\n\u010a\3\u010b\3\u010b\3\u010c\3\u010c")
buf.write("\3\u010c\3\u010c\7\u010c\u099d\n\u010c\f\u010c\16\u010c")
buf.write("\u09a0\13\u010c\3\u010c\3\u010c\3\u010d\3\u010d\3\u010d")
buf.write("\3\u010d\3\u010e\3\u010e\3\u010f\3\u010f\3\u010f\5\u010f")
buf.write("\u09ad\n\u010f\3\u0110\3\u0110\3\u0111\3\u0111\3\u0111")
buf.write("\3\u0111\3\u0111\3\u0112\3\u0112\3\u0112\5\u0112\u09b9")
buf.write("\n\u0112\3\u0112\3\u0112\3\u0113\3\u0113\3\u0113\5\u0113")
buf.write("\u09c0\n\u0113\3\u0114\3\u0114\3\u0114\3\u0115\3\u0115")
buf.write("\3\u0116\3\u0116\5\u0116\u09c9\n\u0116\3\u0117\3\u0117")
buf.write("\3\u0117\3\u0117\3\u0117\3\u0118\3\u0118\3\u0118\2\2\u0119")
buf.write("\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \"$&(*,.\60\62")
buf.write("\64\668:<>@BDFHJLNPRTVXZ\\^`bdfhjlnprtvxz|~\u0080\u0082")
buf.write("\u0084\u0086\u0088\u008a\u008c\u008e\u0090\u0092\u0094")
buf.write("\u0096\u0098\u009a\u009c\u009e\u00a0\u00a2\u00a4\u00a6")
buf.write("\u00a8\u00aa\u00ac\u00ae\u00b0\u00b2\u00b4\u00b6\u00b8")
buf.write("\u00ba\u00bc\u00be\u00c0\u00c2\u00c4\u00c6\u00c8\u00ca")
buf.write("\u00cc\u00ce\u00d0\u00d2\u00d4\u00d6\u00d8\u00da\u00dc")
buf.write("\u00de\u00e0\u00e2\u00e4\u00e6\u00e8\u00ea\u00ec\u00ee")
buf.write("\u00f0\u00f2\u00f4\u00f6\u00f8\u00fa\u00fc\u00fe\u0100")
buf.write("\u0102\u0104\u0106\u0108\u010a\u010c\u010e\u0110\u0112")
buf.write("\u0114\u0116\u0118\u011a\u011c\u011e\u0120\u0122\u0124")
buf.write("\u0126\u0128\u012a\u012c\u012e\u0130\u0132\u0134\u0136")
buf.write("\u0138\u013a\u013c\u013e\u0140\u0142\u0144\u0146\u0148")
buf.write("\u014a\u014c\u014e\u0150\u0152\u0154\u0156\u0158\u015a")
buf.write("\u015c\u015e\u0160\u0162\u0164\u0166\u0168\u016a\u016c")
buf.write("\u016e\u0170\u0172\u0174\u0176\u0178\u017a\u017c\u017e")
buf.write("\u0180\u0182\u0184\u0186\u0188\u018a\u018c\u018e\u0190")
buf.write("\u0192\u0194\u0196\u0198\u019a\u019c\u019e\u01a0\u01a2")
buf.write("\u01a4\u01a6\u01a8\u01aa\u01ac\u01ae\u01b0\u01b2\u01b4")
buf.write("\u01b6\u01b8\u01ba\u01bc\u01be\u01c0\u01c2\u01c4\u01c6")
buf.write("\u01c8\u01ca\u01cc\u01ce\u01d0\u01d2\u01d4\u01d6\u01d8")
buf.write("\u01da\u01dc\u01de\u01e0\u01e2\u01e4\u01e6\u01e8\u01ea")
buf.write("\u01ec\u01ee\u01f0\u01f2\u01f4\u01f6\u01f8\u01fa\u01fc")
buf.write("\u01fe\u0200\u0202\u0204\u0206\u0208\u020a\u020c\u020e")
buf.write("\u0210\u0212\u0214\u0216\u0218\u021a\u021c\u021e\u0220")
buf.write("\u0222\u0224\u0226\u0228\u022a\u022c\u022e\2\23\4\2,w")
buf.write("yy\3\2\u0092\u0093\4\2\u008b\u008b\u0090\u0090\3\2\u0092")
buf.write("\u0092\3\2\u0099\u009a\3\2\u008b\u0090\4\2zz\u0084\u0084")
buf.write("\5\288::==\3\2BD\4\2\u008e\u008e\u0090\u0090\3\2`b\3\2")
buf.write(",.\4\2\u0086\u0086\u0090\u0090\4\2\u0088\u0088\u008c\u008c")
buf.write("\3\2\r\17\3\2WY\4\2WZnn\2\u0a33\2\u0233\3\2\2\2\4\u0265")
buf.write("\3\2\2\2\6\u026a\3\2\2\2\b\u026e\3\2\2\2\n\u0270\3\2\2")
buf.write("\2\f\u0274\3\2\2\2\16\u027e\3\2\2\2\20\u0282\3\2\2\2\22")
buf.write("\u0290\3\2\2\2\24\u0292\3\2\2\2\26\u0294\3\2\2\2\30\u0296")
buf.write("\3\2\2\2\32\u0298\3\2\2\2\34\u029a\3\2\2\2\36\u02a2\3")
buf.write("\2\2\2 \u02c1\3\2\2\2\"\u02c4\3\2\2\2$\u02ca\3\2\2\2&")
buf.write("\u02d0\3\2\2\2(\u02d2\3\2\2\2*\u02d6\3\2\2\2,\u02e2\3")
buf.write("\2\2\2.\u02e4\3\2\2\2\60\u02eb\3\2\2\2\62\u02ed\3\2\2")
buf.write("\2\64\u02f2\3\2\2\2\66\u02f7\3\2\2\28\u02fc\3\2\2\2:\u0301")
buf.write("\3\2\2\2<\u031f\3\2\2\2>\u0321\3\2\2\2@\u0343\3\2\2\2")
buf.write("B\u0360\3\2\2\2D\u037d\3\2\2\2F\u037f\3\2\2\2H\u03b5\3")
buf.write("\2\2\2J\u03bc\3\2\2\2L\u03c4\3\2\2\2N\u03cc\3\2\2\2P\u03d3")
buf.write("\3\2\2\2R\u03da\3\2\2\2T\u03e0\3\2\2\2V\u03e2\3\2\2\2")
buf.write("X\u03e6\3\2\2\2Z\u03e8\3\2\2\2\\\u03f3\3\2\2\2^\u03f8")
buf.write("\3\2\2\2`\u03fa\3\2\2\2b\u03ff\3\2\2\2d\u0407\3\2\2\2")
buf.write("f\u0429\3\2\2\2h\u0433\3\2\2\2j\u043e\3\2\2\2l\u0446\3")
buf.write("\2\2\2n\u044f\3\2\2\2p\u0451\3\2\2\2r\u0458\3\2\2\2t\u045d")
buf.write("\3\2\2\2v\u047e\3\2\2\2x\u0480\3\2\2\2z\u0483\3\2\2\2")
buf.write("|\u0487\3\2\2\2~\u048a\3\2\2\2\u0080\u048c\3\2\2\2\u0082")
buf.write("\u048f\3\2\2\2\u0084\u0491\3\2\2\2\u0086\u049a\3\2\2\2")
buf.write("\u0088\u049c\3\2\2\2\u008a\u049f\3\2\2\2\u008c\u04a2\3")
buf.write("\2\2\2\u008e\u04a4\3\2\2\2\u0090\u04b8\3\2\2\2\u0092\u04ba")
buf.write("\3\2\2\2\u0094\u04bc\3\2\2\2\u0096\u04be\3\2\2\2\u0098")
buf.write("\u04c0\3\2\2\2\u009a\u04c2\3\2\2\2\u009c\u04c4\3\2\2\2")
buf.write("\u009e\u04c6\3\2\2\2\u00a0\u04c8\3\2\2\2\u00a2\u04ca\3")
buf.write("\2\2\2\u00a4\u04cc\3\2\2\2\u00a6\u04ce\3\2\2\2\u00a8\u04d0")
buf.write("\3\2\2\2\u00aa\u04d2\3\2\2\2\u00ac\u04dd\3\2\2\2\u00ae")
buf.write("\u04df\3\2\2\2\u00b0\u04ea\3\2\2\2\u00b2\u04f1\3\2\2\2")
buf.write("\u00b4\u04f3\3\2\2\2\u00b6\u04f6\3\2\2\2\u00b8\u04fd\3")
buf.write("\2\2\2\u00ba\u0508\3\2\2\2\u00bc\u050f\3\2\2\2\u00be\u0511")
buf.write("\3\2\2\2\u00c0\u0514\3\2\2\2\u00c2\u0519\3\2\2\2\u00c4")
buf.write("\u0521\3\2\2\2\u00c6\u0523\3\2\2\2\u00c8\u052a\3\2\2\2")
buf.write("\u00ca\u052c\3\2\2\2\u00cc\u0533\3\2\2\2\u00ce\u0535\3")
buf.write("\2\2\2\u00d0\u053d\3\2\2\2\u00d2\u0541\3\2\2\2\u00d4\u0543")
buf.write("\3\2\2\2\u00d6\u0549\3\2\2\2\u00d8\u054c\3\2\2\2\u00da")
buf.write("\u054f\3\2\2\2\u00dc\u055d\3\2\2\2\u00de\u055f\3\2\2\2")
buf.write("\u00e0\u0561\3\2\2\2\u00e2\u0563\3\2\2\2\u00e4\u0565\3")
buf.write("\2\2\2\u00e6\u0578\3\2\2\2\u00e8\u057a\3\2\2\2\u00ea\u059c")
buf.write("\3\2\2\2\u00ec\u05b2\3\2\2\2\u00ee\u05bc\3\2\2\2\u00f0")
buf.write("\u05be\3\2\2\2\u00f2\u05c0\3\2\2\2\u00f4\u05ca\3\2\2\2")
buf.write("\u00f6\u05d9\3\2\2\2\u00f8\u05db\3\2\2\2\u00fa\u05df\3")
buf.write("\2\2\2\u00fc\u05e1\3\2\2\2\u00fe\u05e5\3\2\2\2\u0100\u05e9")
buf.write("\3\2\2\2\u0102\u05f3\3\2\2\2\u0104\u05fb\3\2\2\2\u0106")
buf.write("\u05fd\3\2\2\2\u0108\u05ff\3\2\2\2\u010a\u0608\3\2\2\2")
buf.write("\u010c\u0611\3\2\2\2\u010e\u061a\3\2\2\2\u0110\u0623\3")
buf.write("\2\2\2\u0112\u062c\3\2\2\2\u0114\u0635\3\2\2\2\u0116\u0646")
buf.write("\3\2\2\2\u0118\u0648\3\2\2\2\u011a\u064a\3\2\2\2\u011c")
buf.write("\u0655\3\2\2\2\u011e\u066d\3\2\2\2\u0120\u0670\3\2\2\2")
buf.write("\u0122\u0672\3\2\2\2\u0124\u067b\3\2\2\2\u0126\u0684\3")
buf.write("\2\2\2\u0128\u068c\3\2\2\2\u012a\u0697\3\2\2\2\u012c\u06a2")
buf.write("\3\2\2\2\u012e\u06ad\3\2\2\2\u0130\u06b6\3\2\2\2\u0132")
buf.write("\u06bf\3\2\2\2\u0134\u06cb\3\2\2\2\u0136\u06cd\3\2\2\2")
buf.write("\u0138\u06d9\3\2\2\2\u013a\u06df\3\2\2\2\u013c\u06e1\3")
buf.write("\2\2\2\u013e\u06e3\3\2\2\2\u0140\u06e5\3\2\2\2\u0142\u06ee")
buf.write("\3\2\2\2\u0144\u06f4\3\2\2\2\u0146\u06f6\3\2\2\2\u0148")
buf.write("\u06f8\3\2\2\2\u014a\u0701\3\2\2\2\u014c\u0706\3\2\2\2")
buf.write("\u014e\u0708\3\2\2\2\u0150\u070d\3\2\2\2\u0152\u0715\3")
buf.write("\2\2\2\u0154\u0718\3\2\2\2\u0156\u071b\3\2\2\2\u0158\u0722")
buf.write("\3\2\2\2\u015a\u0724\3\2\2\2\u015c\u0729\3\2\2\2\u015e")
buf.write("\u072e\3\2\2\2\u0160\u0730\3\2\2\2\u0162\u0733\3\2\2\2")
buf.write("\u0164\u0736\3\2\2\2\u0166\u0739\3\2\2\2\u0168\u073c\3")
buf.write("\2\2\2\u016a\u0741\3\2\2\2\u016c\u0743\3\2\2\2\u016e\u0751")
buf.write("\3\2\2\2\u0170\u076a\3\2\2\2\u0172\u0770\3\2\2\2\u0174")
buf.write("\u0773\3\2\2\2\u0176\u0777\3\2\2\2\u0178\u0779\3\2\2\2")
buf.write("\u017a\u0786\3\2\2\2\u017c\u078b\3\2\2\2\u017e\u0792\3")
buf.write("\2\2\2\u0180\u0796\3\2\2\2\u0182\u079c\3\2\2\2\u0184\u07a8")
buf.write("\3\2\2\2\u0186\u07aa\3\2\2\2\u0188\u07af\3\2\2\2\u018a")
buf.write("\u07c7\3\2\2\2\u018c\u07c9\3\2\2\2\u018e\u07d4\3\2\2\2")
buf.write("\u0190\u07d6\3\2\2\2\u0192\u07d8\3\2\2\2\u0194\u07e9\3")
buf.write("\2\2\2\u0196\u07eb\3\2\2\2\u0198\u07f4\3\2\2\2\u019a\u0809")
buf.write("\3\2\2\2\u019c\u080b\3\2\2\2\u019e\u0815\3\2\2\2\u01a0")
buf.write("\u0824\3\2\2\2\u01a2\u0826\3\2\2\2\u01a4\u0828\3\2\2\2")
buf.write("\u01a6\u0835\3\2\2\2\u01a8\u0837\3\2\2\2\u01aa\u0843\3")
buf.write("\2\2\2\u01ac\u0845\3\2\2\2\u01ae\u0847\3\2\2\2\u01b0\u084b")
buf.write("\3\2\2\2\u01b2\u0852\3\2\2\2\u01b4\u0854\3\2\2\2\u01b6")
buf.write("\u085b\3\2\2\2\u01b8\u085d\3\2\2\2\u01ba\u0860\3\2\2\2")
buf.write("\u01bc\u0865\3\2\2\2\u01be\u08a4\3\2\2\2\u01c0\u08c0\3")
buf.write("\2\2\2\u01c2\u08c6\3\2\2\2\u01c4\u08cc\3\2\2\2\u01c6\u08d2")
buf.write("\3\2\2\2\u01c8\u08d8\3\2\2\2\u01ca\u08dc\3\2\2\2\u01cc")
buf.write("\u08de\3\2\2\2\u01ce\u08e0\3\2\2\2\u01d0\u08e4\3\2\2\2")
buf.write("\u01d2\u08e8\3\2\2\2\u01d4\u08ea\3\2\2\2\u01d6\u08ee\3")
buf.write("\2\2\2\u01d8\u08f0\3\2\2\2\u01da\u08f4\3\2\2\2\u01dc\u08fa")
buf.write("\3\2\2\2\u01de\u0900\3\2\2\2\u01e0\u0904\3\2\2\2\u01e2")
buf.write("\u0908\3\2\2\2\u01e4\u090c\3\2\2\2\u01e6\u0914\3\2\2\2")
buf.write("\u01e8\u0916\3\2\2\2\u01ea\u091a\3\2\2\2\u01ec\u091e\3")
buf.write("\2\2\2\u01ee\u0920\3\2\2\2\u01f0\u0924\3\2\2\2\u01f2\u0926")
buf.write("\3\2\2\2\u01f4\u092e\3\2\2\2\u01f6\u0937\3\2\2\2\u01f8")
buf.write("\u0939\3\2\2\2\u01fa\u093b\3\2\2\2\u01fc\u093f\3\2\2\2")
buf.write("\u01fe\u0947\3\2\2\2\u0200\u094e\3\2\2\2\u0202\u0950\3")
buf.write("\2\2\2\u0204\u0954\3\2\2\2\u0206\u0958\3\2\2\2\u0208\u095b")
buf.write("\3\2\2\2\u020a\u095e\3\2\2\2\u020c\u0961\3\2\2\2\u020e")
buf.write("\u0978\3\2\2\2\u0210\u097b\3\2\2\2\u0212\u0991\3\2\2\2")
buf.write("\u0214\u0996\3\2\2\2\u0216\u0998\3\2\2\2\u0218\u09a3\3")
buf.write("\2\2\2\u021a\u09a7\3\2\2\2\u021c\u09ac\3\2\2\2\u021e\u09ae")
buf.write("\3\2\2\2\u0220\u09b0\3\2\2\2\u0222\u09b8\3\2\2\2\u0224")
buf.write("\u09bf\3\2\2\2\u0226\u09c1\3\2\2\2\u0228\u09c4\3\2\2\2")
buf.write("\u022a\u09c6\3\2\2\2\u022c\u09ca\3\2\2\2\u022e\u09cf\3")
buf.write("\2\2\2\u0230\u0232\7x\2\2\u0231\u0230\3\2\2\2\u0232\u0235")
buf.write("\3\2\2\2\u0233\u0231\3\2\2\2\u0233\u0234\3\2\2\2\u0234")
buf.write("\u0239\3\2\2\2\u0235\u0233\3\2\2\2\u0236\u0238\5,\27\2")
buf.write("\u0237\u0236\3\2\2\2\u0238\u023b\3\2\2\2\u0239\u0237\3")
buf.write("\2\2\2\u0239\u023a\3\2\2\2\u023a\u023f\3\2\2\2\u023b\u0239")
buf.write("\3\2\2\2\u023c\u023e\7x\2\2\u023d\u023c\3\2\2\2\u023e")
buf.write("\u0241\3\2\2\2\u023f\u023d\3\2\2\2\u023f\u0240\3\2\2\2")
buf.write("\u0240\u024a\3\2\2\2\u0241\u023f\3\2\2\2\u0242\u0244\5")
buf.write("\4\3\2\u0243\u0242\3\2\2\2\u0243\u0244\3\2\2\2\u0244\u0246")
buf.write("\3\2\2\2\u0245\u0247\5\u016c\u00b7\2\u0246\u0245\3\2\2")
buf.write("\2\u0247\u0248\3\2\2\2\u0248\u0246\3\2\2\2\u0248\u0249")
buf.write("\3\2\2\2\u0249\u024b\3\2\2\2\u024a\u0243\3\2\2\2\u024a")
buf.write("\u024b\3\2\2\2\u024b\u024f\3\2\2\2\u024c\u024e\7x\2\2")
buf.write("\u024d\u024c\3\2\2\2\u024e\u0251\3\2\2\2\u024f\u024d\3")
buf.write("\2\2\2\u024f\u0250\3\2\2\2\u0250\u025a\3\2\2\2\u0251\u024f")
buf.write("\3\2\2\2\u0252\u0254\5\6\4\2\u0253\u0252\3\2\2\2\u0253")
buf.write("\u0254\3\2\2\2\u0254\u0256\3\2\2\2\u0255\u0257\5d\63\2")
buf.write("\u0256\u0255\3\2\2\2\u0257\u0258\3\2\2\2\u0258\u0256\3")
buf.write("\2\2\2\u0258\u0259\3\2\2\2\u0259\u025b\3\2\2\2\u025a\u0253")
buf.write("\3\2\2\2\u025a\u025b\3\2\2\2\u025b\u025f\3\2\2\2\u025c")
buf.write("\u025e\7x\2\2\u025d\u025c\3\2\2\2\u025e\u0261\3\2\2\2")
buf.write("\u025f\u025d\3\2\2\2\u025f\u0260\3\2\2\2\u0260\u0262\3")
buf.write("\2\2\2\u0261\u025f\3\2\2\2\u0262\u0263\7\2\2\3\u0263\3")
buf.write("\3\2\2\2\u0264\u0266\5\b\5\2\u0265\u0264\3\2\2\2\u0266")
buf.write("\u0267\3\2\2\2\u0267\u0265\3\2\2\2\u0267\u0268\3\2\2\2")
buf.write("\u0268\5\3\2\2\2\u0269\u026b\5\n\6\2\u026a\u0269\3\2\2")
buf.write("\2\u026b\u026c\3\2\2\2\u026c\u026a\3\2\2\2\u026c\u026d")
buf.write("\3\2\2\2\u026d\7\3\2\2\2\u026e\u026f\5\f\7\2\u026f\t\3")
buf.write("\2\2\2\u0270\u0271\5\f\7\2\u0271\13\3\2\2\2\u0272\u0273")
buf.write("\7\\\2\2\u0273\u0275\5\16\b\2\u0274\u0272\3\2\2\2\u0274")
buf.write("\u0275\3\2\2\2\u0275\u0276\3\2\2\2\u0276\u0277\7t\2\2")
buf.write("\u0277\u0279\5\20\t\2\u0278\u027a\7x\2\2\u0279\u0278\3")
buf.write("\2\2\2\u027a\u027b\3\2\2\2\u027b\u0279\3\2\2\2\u027b\u027c")
buf.write("\3\2\2\2\u027c\r\3\2\2\2\u027d\u027f\7\u0088\2\2\u027e")
buf.write("\u027d\3\2\2\2\u027e\u027f\3\2\2\2\u027f\u0280\3\2\2\2")
buf.write("\u0280\u0281\5\34\17\2\u0281\17\3\2\2\2\u0282\u0287\5")
buf.write("\22\n\2\u0283\u0284\7\u0087\2\2\u0284\u0286\5\22\n\2\u0285")
buf.write("\u0283\3\2\2\2\u0286\u0289\3\2\2\2\u0287\u0285\3\2\2\2")
buf.write("\u0287\u0288\3\2\2\2\u0288\21\3\2\2\2\u0289\u0287\3\2")
buf.write("\2\2\u028a\u028d\5\24\13\2\u028b\u028c\7u\2\2\u028c\u028e")
buf.write("\5\26\f\2\u028d\u028b\3\2\2\2\u028d\u028e\3\2\2\2\u028e")
buf.write("\u0291\3\2\2\2\u028f\u0291\5\30\r\2\u0290\u028a\3\2\2")
buf.write("\2\u0290\u028f\3\2\2\2\u0291\23\3\2\2\2\u0292\u0293\5")
buf.write("\34\17\2\u0293\25\3\2\2\2\u0294\u0295\5\32\16\2\u0295")
buf.write("\27\3\2\2\2\u0296\u0297\7\u008f\2\2\u0297\31\3\2\2\2\u0298")
buf.write("\u0299\t\2\2\2\u0299\33\3\2\2\2\u029a\u029f\5\32\16\2")
buf.write("\u029b\u029c\7\u0088\2\2\u029c\u029e\5\32\16\2\u029d\u029b")
buf.write("\3\2\2\2\u029e\u02a1\3\2\2\2\u029f\u029d\3\2\2\2\u029f")
buf.write("\u02a0\3\2\2\2\u02a0\35\3\2\2\2\u02a1\u029f\3\2\2\2\u02a2")
buf.write("\u02a6\7\u0089\2\2\u02a3\u02a4\5\32\16\2\u02a4\u02a5\7")
buf.write("\u0088\2\2\u02a5\u02a7\3\2\2\2\u02a6\u02a3\3\2\2\2\u02a6")
buf.write("\u02a7\3\2\2\2\u02a7\u02a8\3\2\2\2\u02a8\u02a9\5\32\16")
buf.write("\2\u02a9\37\3\2\2\2\u02aa\u02ac\7\u0088\2\2\u02ab\u02aa")
buf.write("\3\2\2\2\u02ab\u02ac\3\2\2\2\u02ac\u02ad\3\2\2\2\u02ad")
buf.write("\u02b3\7\u008f\2\2\u02ae\u02af\7\u0087\2\2\u02af\u02b0")
buf.write("\7\177\2\2\u02b0\u02b2\5\"\22\2\u02b1\u02ae\3\2\2\2\u02b2")
buf.write("\u02b5\3\2\2\2\u02b3\u02b1\3\2\2\2\u02b3\u02b4\3\2\2\2")
buf.write("\u02b4\u02c2\3\2\2\2\u02b5\u02b3\3\2\2\2\u02b6\u02be\5")
buf.write("\32\16\2\u02b7\u02b9\7\u0087\2\2\u02b8\u02ba\7\177\2\2")
buf.write("\u02b9\u02b8\3\2\2\2\u02b9\u02ba\3\2\2\2\u02ba\u02bb\3")
buf.write("\2\2\2\u02bb\u02bd\5\"\22\2\u02bc\u02b7\3\2\2\2\u02bd")
buf.write("\u02c0\3\2\2\2\u02be\u02bc\3\2\2\2\u02be\u02bf\3\2\2\2")
buf.write("\u02bf\u02c2\3\2\2\2\u02c0\u02be\3\2\2\2\u02c1\u02ab\3")
buf.write("\2\2\2\u02c1\u02b6\3\2\2\2\u02c2!\3\2\2\2\u02c3\u02c5")
buf.write("\7\u008f\2\2\u02c4\u02c3\3\2\2\2\u02c4\u02c5\3\2\2\2\u02c5")
buf.write("\u02c6\3\2\2\2\u02c6\u02c8\5\32\16\2\u02c7\u02c9\7\u008f")
buf.write("\2\2\u02c8\u02c7\3\2\2\2\u02c8\u02c9\3\2\2\2\u02c9#\3")
buf.write("\2\2\2\u02ca\u02cb\7\u0082\2\2\u02cb\u02cc\7v\2\2\u02cc")
buf.write("\u02cd\7\u0083\2\2\u02cd%\3\2\2\2\u02ce\u02d1\5*\26\2")
buf.write("\u02cf\u02d1\5(\25\2\u02d0\u02ce\3\2\2\2\u02d0\u02cf\3")
buf.write("\2\2\2\u02d1\'\3\2\2\2\u02d2\u02d3\7\u0099\2\2\u02d3\u02d4")
buf.write("\7\u009d\2\2\u02d4\u02d5\7x\2\2\u02d5)\3\2\2\2\u02d6\u02d7")
buf.write("\7\u009b\2\2\u02d7+\3\2\2\2\u02d8\u02e3\5.\30\2\u02d9")
buf.write("\u02e3\5\62\32\2\u02da\u02e3\5\64\33\2\u02db\u02e3\5\66")
buf.write("\34\2\u02dc\u02e3\58\35\2\u02dd\u02e3\5:\36\2\u02de\u02e3")
buf.write("\5V,\2\u02df\u02e3\5Z.\2\u02e0\u02e3\5`\61\2\u02e1\u02e3")
buf.write("\7x\2\2\u02e2\u02d8\3\2\2\2\u02e2\u02d9\3\2\2\2\u02e2")
buf.write("\u02da\3\2\2\2\u02e2\u02db\3\2\2\2\u02e2\u02dc\3\2\2\2")
buf.write("\u02e2\u02dd\3\2\2\2\u02e2\u02de\3\2\2\2\u02e2\u02df\3")
buf.write("\2\2\2\u02e2\u02e0\3\2\2\2\u02e2\u02e1\3\2\2\2\u02e3-")
buf.write("\3\2\2\2\u02e4\u02e9\7\4\2\2\u02e5\u02e6\7\u0080\2\2\u02e6")
buf.write("\u02e7\5\60\31\2\u02e7\u02e8\7\u0081\2\2\u02e8\u02ea\3")
buf.write("\2\2\2\u02e9\u02e5\3\2\2\2\u02e9\u02ea\3\2\2\2\u02ea/")
buf.write("\3\2\2\2\u02eb\u02ec\t\3\2\2\u02ec\61\3\2\2\2\u02ed\u02f0")
buf.write("\7\5\2\2\u02ee\u02ef\7\u0080\2\2\u02ef\u02f1\7\u0081\2")
buf.write("\2\u02f0\u02ee\3\2\2\2\u02f0\u02f1\3\2\2\2\u02f1\63\3")
buf.write("\2\2\2\u02f2\u02f5\7\7\2\2\u02f3\u02f4\7\u0080\2\2\u02f4")
buf.write("\u02f6\7\u0081\2\2\u02f5\u02f3\3\2\2\2\u02f5\u02f6\3\2")
buf.write("\2\2\u02f6\65\3\2\2\2\u02f7\u02fa\7\b\2\2\u02f8\u02f9")
buf.write("\7\u0080\2\2\u02f9\u02fb\7\u0081\2\2\u02fa\u02f8\3\2\2")
buf.write("\2\u02fa\u02fb\3\2\2\2\u02fb\67\3\2\2\2\u02fc\u02ff\7")
buf.write("\13\2\2\u02fd\u02fe\7\u0080\2\2\u02fe\u0300\7\u0081\2")
buf.write("\2\u02ff\u02fd\3\2\2\2\u02ff\u0300\3\2\2\2\u03009\3\2")
buf.write("\2\2\u0301\u0302\7\f\2\2\u0302\u0306\7\u0080\2\2\u0303")
buf.write("\u0305\7x\2\2\u0304\u0303\3\2\2\2\u0305\u0308\3\2\2\2")
buf.write("\u0306\u0304\3\2\2\2\u0306\u0307\3\2\2\2\u0307\u030a\3")
buf.write("\2\2\2\u0308\u0306\3\2\2\2\u0309\u030b\5<\37\2\u030a\u0309")
buf.write("\3\2\2\2\u030a\u030b\3\2\2\2\u030b\u030f\3\2\2\2\u030c")
buf.write("\u030e\7x\2\2\u030d\u030c\3\2\2\2\u030e\u0311\3\2\2\2")
buf.write("\u030f\u030d\3\2\2\2\u030f\u0310\3\2\2\2\u0310\u0313\3")
buf.write("\2\2\2\u0311\u030f\3\2\2\2\u0312\u0314\5F$\2\u0313\u0312")
buf.write("\3\2\2\2\u0314\u0315\3\2\2\2\u0315\u0313\3\2\2\2\u0315")
buf.write("\u0316\3\2\2\2\u0316\u031a\3\2\2\2\u0317\u0319\7x\2\2")
buf.write("\u0318\u0317\3\2\2\2\u0319\u031c\3\2\2\2\u031a\u0318\3")
buf.write("\2\2\2\u031a\u031b\3\2\2\2\u031b\u031d\3\2\2\2\u031c\u031a")
buf.write("\3\2\2\2\u031d\u031e\7\u0081\2\2\u031e;\3\2\2\2\u031f")
buf.write("\u0320\5> \2\u0320=\3\2\2\2\u0321\u0322\7J\2\2\u0322\u0326")
buf.write("\7\u0080\2\2\u0323\u0325\7x\2\2\u0324\u0323\3\2\2\2\u0325")
buf.write("\u0328\3\2\2\2\u0326\u0324\3\2\2\2\u0326\u0327\3\2\2\2")
buf.write("\u0327\u032a\3\2\2\2\u0328\u0326\3\2\2\2\u0329\u032b\5")
buf.write("@!\2\u032a\u0329\3\2\2\2\u032a\u032b\3\2\2\2\u032b\u032f")
buf.write("\3\2\2\2\u032c\u032e\7x\2\2\u032d\u032c\3\2\2\2\u032e")
buf.write("\u0331\3\2\2\2\u032f\u032d\3\2\2\2\u032f\u0330\3\2\2\2")
buf.write("\u0330\u0338\3\2\2\2\u0331\u032f\3\2\2\2\u0332\u0334\5")
buf.write("P)\2\u0333\u0335\7\u0087\2\2\u0334\u0333\3\2\2\2\u0334")
buf.write("\u0335\3\2\2\2\u0335\u0337\3\2\2\2\u0336\u0332\3\2\2\2")
buf.write("\u0337\u033a\3\2\2\2\u0338\u0336\3\2\2\2\u0338\u0339\3")
buf.write("\2\2\2\u0339\u033e\3\2\2\2\u033a\u0338\3\2\2\2\u033b\u033d")
buf.write("\7x\2\2\u033c\u033b\3\2\2\2\u033d\u0340\3\2\2\2\u033e")
buf.write("\u033c\3\2\2\2\u033e\u033f\3\2\2\2\u033f\u0341\3\2\2\2")
buf.write("\u0340\u033e\3\2\2\2\u0341\u0342\7\u0081\2\2\u0342?\3")
buf.write("\2\2\2\u0343\u0344\7I\2\2\u0344\u0348\7\u0080\2\2\u0345")
buf.write("\u0347\7x\2\2\u0346\u0345\3\2\2\2\u0347\u034a\3\2\2\2")
buf.write("\u0348\u0346\3\2\2\2\u0348\u0349\3\2\2\2\u0349\u0353\3")
buf.write("\2\2\2\u034a\u0348\3\2\2\2\u034b\u0350\5B\"\2\u034c\u034d")
buf.write("\7\u0087\2\2\u034d\u034f\5B\"\2\u034e\u034c\3\2\2\2\u034f")
buf.write("\u0352\3\2\2\2\u0350\u034e\3\2\2\2\u0350\u0351\3\2\2\2")
buf.write("\u0351\u0354\3\2\2\2\u0352\u0350\3\2\2\2\u0353\u034b\3")
buf.write("\2\2\2\u0353\u0354\3\2\2\2\u0354\u0358\3\2\2\2\u0355\u0357")
buf.write("\7x\2\2\u0356\u0355\3\2\2\2\u0357\u035a\3\2\2\2\u0358")
buf.write("\u0356\3\2\2\2\u0358\u0359\3\2\2\2\u0359\u035b\3\2\2\2")
buf.write("\u035a\u0358\3\2\2\2\u035b\u035c\7\u0081\2\2\u035cA\3")
buf.write("\2\2\2\u035d\u035f\7x\2\2\u035e\u035d\3\2\2\2\u035f\u0362")
buf.write("\3\2\2\2\u0360\u035e\3\2\2\2\u0360\u0361\3\2\2\2\u0361")
buf.write("\u0363\3\2\2\2\u0362\u0360\3\2\2\2\u0363\u037b\5D#\2\u0364")
buf.write("\u0368\7\u0080\2\2\u0365\u0367\7x\2\2\u0366\u0365\3\2")
buf.write("\2\2\u0367\u036a\3\2\2\2\u0368\u0366\3\2\2\2\u0368\u0369")
buf.write("\3\2\2\2\u0369\u0371\3\2\2\2\u036a\u0368\3\2\2\2\u036b")
buf.write("\u036d\5P)\2\u036c\u036e\7\u0087\2\2\u036d\u036c\3\2\2")
buf.write("\2\u036d\u036e\3\2\2\2\u036e\u0370\3\2\2\2\u036f\u036b")
buf.write("\3\2\2\2\u0370\u0373\3\2\2\2\u0371\u036f\3\2\2\2\u0371")
buf.write("\u0372\3\2\2\2\u0372\u0377\3\2\2\2\u0373\u0371\3\2\2\2")
buf.write("\u0374\u0376\7x\2\2\u0375\u0374\3\2\2\2\u0376\u0379\3")
buf.write("\2\2\2\u0377\u0375\3\2\2\2\u0377\u0378\3\2\2\2\u0378\u037a")
buf.write("\3\2\2\2\u0379\u0377\3\2\2\2\u037a\u037c\7\u0081\2\2\u037b")
buf.write("\u0364\3\2\2\2\u037b\u037c\3\2\2\2\u037cC\3\2\2\2\u037d")
buf.write("\u037e\5\32\16\2\u037eE\3\2\2\2\u037f\u0383\5J&\2\u0380")
buf.write("\u0382\7x\2\2\u0381\u0380\3\2\2\2\u0382\u0385\3\2\2\2")
buf.write("\u0383\u0381\3\2\2\2\u0383\u0384\3\2\2\2\u0384\u0386\3")
buf.write("\2\2\2\u0385\u0383\3\2\2\2\u0386\u038a\5H%\2\u0387\u0389")
buf.write("\7x\2\2\u0388\u0387\3\2\2\2\u0389\u038c\3\2\2\2\u038a")
buf.write("\u0388\3\2\2\2\u038a\u038b\3\2\2\2\u038b\u038d\3\2\2\2")
buf.write("\u038c\u038a\3\2\2\2\u038d\u038e\5L\'\2\u038e\u0392\7")
buf.write("\u0080\2\2\u038f\u0391\7x\2\2\u0390\u038f\3\2\2\2\u0391")
buf.write("\u0394\3\2\2\2\u0392\u0390\3\2\2\2\u0392\u0393\3\2\2\2")
buf.write("\u0393\u0395\3\2\2\2\u0394\u0392\3\2\2\2\u0395\u03a6\5")
buf.write("N(\2\u0396\u039a\7~\2\2\u0397\u0399\7x\2\2\u0398\u0397")
buf.write("\3\2\2\2\u0399\u039c\3\2\2\2\u039a\u0398\3\2\2\2\u039a")
buf.write("\u039b\3\2\2\2\u039b\u03a3\3\2\2\2\u039c\u039a\3\2\2\2")
buf.write("\u039d\u039f\5P)\2\u039e\u03a0\7\u0087\2\2\u039f\u039e")
buf.write("\3\2\2\2\u039f\u03a0\3\2\2\2\u03a0\u03a2\3\2\2\2\u03a1")
buf.write("\u039d\3\2\2\2\u03a2\u03a5\3\2\2\2\u03a3\u03a1\3\2\2\2")
buf.write("\u03a3\u03a4\3\2\2\2\u03a4\u03a7\3\2\2\2\u03a5\u03a3\3")
buf.write("\2\2\2\u03a6\u0396\3\2\2\2\u03a6\u03a7\3\2\2\2\u03a7\u03ab")
buf.write("\3\2\2\2\u03a8\u03aa\7x\2\2\u03a9\u03a8\3\2\2\2\u03aa")
buf.write("\u03ad\3\2\2\2\u03ab\u03a9\3\2\2\2\u03ab\u03ac\3\2\2\2")
buf.write("\u03ac\u03ae\3\2\2\2\u03ad\u03ab\3\2\2\2\u03ae\u03b2\7")
buf.write("\u0081\2\2\u03af\u03b1\7x\2\2\u03b0\u03af\3\2\2\2\u03b1")
buf.write("\u03b4\3\2\2\2\u03b2\u03b0\3\2\2\2\u03b2\u03b3\3\2\2\2")
buf.write("\u03b3G\3\2\2\2\u03b4\u03b2\3\2\2\2\u03b5\u03b6\t\4\2")
buf.write("\2\u03b6\u03b7\7}\2\2\u03b7I\3\2\2\2\u03b8\u03bd\5\32")
buf.write("\16\2\u03b9\u03bd\7\u0086\2\2\u03ba\u03bd\7\u008f\2\2")
buf.write("\u03bb\u03bd\7\u008a\2\2\u03bc\u03b8\3\2\2\2\u03bc\u03b9")
buf.write("\3\2\2\2\u03bc\u03ba\3\2\2\2\u03bc\u03bb\3\2\2\2\u03bd")
buf.write("\u03be\3\2\2\2\u03be\u03bc\3\2\2\2\u03be\u03bf\3\2\2\2")
buf.write("\u03bfK\3\2\2\2\u03c0\u03c5\5\32\16\2\u03c1\u03c5\7\u0086")
buf.write("\2\2\u03c2\u03c5\7\u008a\2\2\u03c3\u03c5\7\u008f\2\2\u03c4")
buf.write("\u03c0\3\2\2\2\u03c4\u03c1\3\2\2\2\u03c4\u03c2\3\2\2\2")
buf.write("\u03c4\u03c3\3\2\2\2\u03c5\u03c6\3\2\2\2\u03c6\u03c4\3")
buf.write("\2\2\2\u03c6\u03c7\3\2\2\2\u03c7M\3\2\2\2\u03c8\u03cd")
buf.write("\5\32\16\2\u03c9\u03cd\7\u0086\2\2\u03ca\u03cd\7\u008f")
buf.write("\2\2\u03cb\u03cd\7\u0088\2\2\u03cc\u03c8\3\2\2\2\u03cc")
buf.write("\u03c9\3\2\2\2\u03cc\u03ca\3\2\2\2\u03cc\u03cb\3\2\2\2")
buf.write("\u03cd\u03ce\3\2\2\2\u03ce\u03cc\3\2\2\2\u03ce\u03cf\3")
buf.write("\2\2\2\u03cfO\3\2\2\2\u03d0\u03d2\7x\2\2\u03d1\u03d0\3")
buf.write("\2\2\2\u03d2\u03d5\3\2\2\2\u03d3\u03d1\3\2\2\2\u03d3\u03d4")
buf.write("\3\2\2\2\u03d4\u03d6\3\2\2\2\u03d5\u03d3\3\2\2\2\u03d6")
buf.write("\u03d7\5R*\2\u03d7\u03d8\7\u008b\2\2\u03d8\u03d9\5T+\2")
buf.write("\u03d9Q\3\2\2\2\u03da\u03db\5\32\16\2\u03dbS\3\2\2\2\u03dc")
buf.write("\u03e1\7\u0092\2\2\u03dd\u03e1\7\u0093\2\2\u03de\u03e1")
buf.write("\7z\2\2\u03df\u03e1\5\32\16\2\u03e0\u03dc\3\2\2\2\u03e0")
buf.write("\u03dd\3\2\2\2\u03e0\u03de\3\2\2\2\u03e0\u03df\3\2\2\2")
buf.write("\u03e1U\3\2\2\2\u03e2\u03e3\7\22\2\2\u03e3\u03e4\5X-\2")
buf.write("\u03e4\u03e5\5&\24\2\u03e5W\3\2\2\2\u03e6\u03e7\t\5\2")
buf.write("\2\u03e7Y\3\2\2\2\u03e8\u03e9\7\20\2\2\u03e9\u03ea\7\u0080")
buf.write("\2\2\u03ea\u03ef\5^\60\2\u03eb\u03ec\7\u0087\2\2\u03ec")
buf.write("\u03ed\7G\2\2\u03ed\u03ee\7\u008b\2\2\u03ee\u03f0\5\\")
buf.write("/\2\u03ef\u03eb\3\2\2\2\u03ef\u03f0\3\2\2\2\u03f0\u03f1")
buf.write("\3\2\2\2\u03f1\u03f2\7\u0081\2\2\u03f2[\3\2\2\2\u03f3")
buf.write("\u03f4\7w\2\2\u03f4]\3\2\2\2\u03f5\u03f9\5\32\16\2\u03f6")
buf.write("\u03f9\7\u0092\2\2\u03f7\u03f9\7\u0093\2\2\u03f8\u03f5")
buf.write("\3\2\2\2\u03f8\u03f6\3\2\2\2\u03f8\u03f7\3\2\2\2\u03f9")
buf.write("_\3\2\2\2\u03fa\u03fb\7+\2\2\u03fb\u03fc\7\u0080\2\2\u03fc")
buf.write("\u03fd\5b\62\2\u03fd\u03fe\7\u0081\2\2\u03fea\3\2\2\2")
buf.write("\u03ff\u0404\7y\2\2\u0400\u0401\7\u0087\2\2\u0401\u0403")
buf.write("\7y\2\2\u0402\u0400\3\2\2\2\u0403\u0406\3\2\2\2\u0404")
buf.write("\u0402\3\2\2\2\u0404\u0405\3\2\2\2\u0405c\3\2\2\2\u0406")
buf.write("\u0404\3\2\2\2\u0407\u0409\5h\65\2\u0408\u040a\5f\64\2")
buf.write("\u0409\u0408\3\2\2\2\u0409\u040a\3\2\2\2\u040a\u040e\3")
buf.write("\2\2\2\u040b\u040d\7x\2\2\u040c\u040b\3\2\2\2\u040d\u0410")
buf.write("\3\2\2\2\u040e\u040c\3\2\2\2\u040e\u040f\3\2\2\2\u040f")
buf.write("\u0414\3\2\2\2\u0410\u040e\3\2\2\2\u0411\u0413\5t;\2\u0412")
buf.write("\u0411\3\2\2\2\u0413\u0416\3\2\2\2\u0414\u0412\3\2\2\2")
buf.write("\u0414\u0415\3\2\2\2\u0415\u041a\3\2\2\2\u0416\u0414\3")
buf.write("\2\2\2\u0417\u0419\7x\2\2\u0418\u0417\3\2\2\2\u0419\u041c")
buf.write("\3\2\2\2\u041a\u0418\3\2\2\2\u041a\u041b\3\2\2\2\u041b")
buf.write("\u0420\3\2\2\2\u041c\u041a\3\2\2\2\u041d\u041f\5\u00e6")
buf.write("t\2\u041e\u041d\3\2\2\2\u041f\u0422\3\2\2\2\u0420\u041e")
buf.write("\3\2\2\2\u0420\u0421\3\2\2\2\u0421\u0426\3\2\2\2\u0422")
buf.write("\u0420\3\2\2\2\u0423\u0425\7x\2\2\u0424\u0423\3\2\2\2")
buf.write("\u0425\u0428\3\2\2\2\u0426\u0424\3\2\2\2\u0426\u0427\3")
buf.write("\2\2\2\u0427e\3\2\2\2\u0428\u0426\3\2\2\2\u0429\u042a")
buf.write("\7\u008b\2\2\u042a\u0431\t\3\2\2\u042b\u042d\7x\2\2\u042c")
buf.write("\u042b\3\2\2\2\u042d\u042e\3\2\2\2\u042e\u042c\3\2\2\2")
buf.write("\u042e\u042f\3\2\2\2\u042f\u0432\3\2\2\2\u0430\u0432\7")
buf.write("\2\2\3\u0431\u042c\3\2\2\2\u0431\u0430\3\2\2\2\u0432g")
buf.write("\3\2\2\2\u0433\u0435\7\u0089\2\2\u0434\u0436\5p9\2\u0435")
buf.write("\u0434\3\2\2\2\u0435\u0436\3\2\2\2\u0436\u0437\3\2\2\2")
buf.write("\u0437\u0439\5r:\2\u0438\u043a\5l\67\2\u0439\u0438\3\2")
buf.write("\2\2\u0439\u043a\3\2\2\2\u043a\u043b\3\2\2\2\u043b\u043c")
buf.write("\5j\66\2\u043c\u043d\7x\2\2\u043di\3\2\2\2\u043e\u043f")
buf.write("\7x\2\2\u043f\u0440\7\u0086\2\2\u0440\u0442\7\u0086\2")
buf.write("\2\u0441\u0443\7\u0086\2\2\u0442\u0441\3\2\2\2\u0443\u0444")
buf.write("\3\2\2\2\u0444\u0442\3\2\2\2\u0444\u0445\3\2\2\2\u0445")
buf.write("k\3\2\2\2\u0446\u0447\7~\2\2\u0447\u044a\5n8\2\u0448\u0449")
buf.write("\7\u008a\2\2\u0449\u044b\5n8\2\u044a\u0448\3\2\2\2\u044a")
buf.write("\u044b\3\2\2\2\u044bm\3\2\2\2\u044c\u0450\5\32\16\2\u044d")
buf.write("\u0450\7\u0092\2\2\u044e\u0450\7\u0093\2\2\u044f\u044c")
buf.write("\3\2\2\2\u044f\u044d\3\2\2\2\u044f\u044e\3\2\2\2\u0450")
buf.write("o\3\2\2\2\u0451\u0456\5\32\16\2\u0452\u0453\7\u0086\2")
buf.write("\2\u0453\u0457\7}\2\2\u0454\u0455\7\u0090\2\2\u0455\u0457")
buf.write("\7}\2\2\u0456\u0452\3\2\2\2\u0456\u0454\3\2\2\2\u0457")
buf.write("q\3\2\2\2\u0458\u0459\5\32\16\2\u0459s\3\2\2\2\u045a\u045c")
buf.write("\5\u008eH\2\u045b\u045a\3\2\2\2\u045c\u045f\3\2\2\2\u045d")
buf.write("\u045b\3\2\2\2\u045d\u045e\3\2\2\2\u045e\u0460\3\2\2\2")
buf.write("\u045f\u045d\3\2\2\2\u0460\u0462\5\u008cG\2\u0461\u0463")
buf.write("\5v<\2\u0462\u0461\3\2\2\2\u0462\u0463\3\2\2\2\u0463\u0465")
buf.write("\3\2\2\2\u0464\u0466\5\u008aF\2\u0465\u0464\3\2\2\2\u0465")
buf.write("\u0466\3\2\2\2\u0466\u0468\3\2\2\2\u0467\u0469\5\u0088")
buf.write("E\2\u0468\u0467\3\2\2\2\u0468\u0469\3\2\2\2\u0469\u0470")
buf.write("\3\2\2\2\u046a\u046c\7x\2\2\u046b\u046a\3\2\2\2\u046c")
buf.write("\u046d\3\2\2\2\u046d\u046b\3\2\2\2\u046d\u046e\3\2\2\2")
buf.write("\u046e\u0471\3\2\2\2\u046f\u0471\7\2\2\3\u0470\u046b\3")
buf.write("\2\2\2\u0470\u046f\3\2\2\2\u0471u\3\2\2\2\u0472\u0474")
buf.write("\7~\2\2\u0473\u0475\5x=\2\u0474\u0473\3\2\2\2\u0474\u0475")
buf.write("\3\2\2\2\u0475\u047f\3\2\2\2\u0476\u0477\7~\2\2\u0477")
buf.write("\u0479\5\u0090I\2\u0478\u047a\5z>\2\u0479\u0478\3\2\2")
buf.write("\2\u0479\u047a\3\2\2\2\u047a\u047f\3\2\2\2\u047b\u047c")
buf.write("\7~\2\2\u047c\u047f\5~@\2\u047d\u047f\5\u0080A\2\u047e")
buf.write("\u0472\3\2\2\2\u047e\u0476\3\2\2\2\u047e\u047b\3\2\2\2")
buf.write("\u047e\u047d\3\2\2\2\u047fw\3\2\2\2\u0480\u0481\5*\26")
buf.write("\2\u0481y\3\2\2\2\u0482\u0484\5|?\2\u0483\u0482\3\2\2")
buf.write("\2\u0483\u0484\3\2\2\2\u0484\u0485\3\2\2\2\u0485\u0486")
buf.write("\5*\26\2\u0486{\3\2\2\2\u0487\u0488\7\u0088\2\2\u0488")
buf.write("\u0489\7\u0088\2\2\u0489}\3\2\2\2\u048a\u048b\5\32\16")
buf.write("\2\u048b\177\3\2\2\2\u048c\u048d\5\u0082B\2\u048d\u048e")
buf.write("\5\u0084C\2\u048e\u0081\3\2\2\2\u048f\u0490\t\6\2\2\u0490")
buf.write("\u0083\3\2\2\2\u0491\u0492\7\u009d\2\2\u0492\u0085\3\2")
buf.write("\2\2\u0493\u0495\5\32\16\2\u0494\u0493\3\2\2\2\u0495\u0496")
buf.write("\3\2\2\2\u0496\u0494\3\2\2\2\u0496\u0497\3\2\2\2\u0497")
buf.write("\u049b\3\2\2\2\u0498\u049b\7\u0092\2\2\u0499\u049b\7\u0093")
buf.write("\2\2\u049a\u0494\3\2\2\2\u049a\u0498\3\2\2\2\u049a\u0499")
buf.write("\3\2\2\2\u049b\u0087\3\2\2\2\u049c\u049d\7\u0084\2\2\u049d")
buf.write("\u049e\5\u0086D\2\u049e\u0089\3\2\2\2\u049f\u04a0\7\u008a")
buf.write("\2\2\u04a0\u04a1\5\u0086D\2\u04a1\u008b\3\2\2\2\u04a2")
buf.write("\u04a3\5\32\16\2\u04a3\u008d\3\2\2\2\u04a4\u04a5\t\7\2")
buf.write("\2\u04a5\u008f\3\2\2\2\u04a6\u04b9\5\u0092J\2\u04a7\u04b9")
buf.write("\5\u0096L\2\u04a8\u04b9\5\u0094K\2\u04a9\u04b9\5\u0098")
buf.write("M\2\u04aa\u04b9\5\u009aN\2\u04ab\u04b9\5\u009cO\2\u04ac")
buf.write("\u04b9\5\u009eP\2\u04ad\u04b9\5\u00a0Q\2\u04ae\u04b9\5")
buf.write("\u00a2R\2\u04af\u04b9\5\u00aaV\2\u04b0\u04b9\5\u00b6\\")
buf.write("\2\u04b1\u04b9\5\u00c0a\2\u04b2\u04b9\5\u00c6d\2\u04b3")
buf.write("\u04b9\5\u00dan\2\u04b4\u04b9\5\u00caf\2\u04b5\u04b9\5")
buf.write("\u00a4S\2\u04b6\u04b9\5\u00a6T\2\u04b7\u04b9\5\u00a8U")
buf.write("\2\u04b8\u04a6\3\2\2\2\u04b8\u04a7\3\2\2\2\u04b8\u04a8")
buf.write("\3\2\2\2\u04b8\u04a9\3\2\2\2\u04b8\u04aa\3\2\2\2\u04b8")
buf.write("\u04ab\3\2\2\2\u04b8\u04ac\3\2\2\2\u04b8\u04ad\3\2\2\2")
buf.write("\u04b8\u04ae\3\2\2\2\u04b8\u04af\3\2\2\2\u04b8\u04b0\3")
buf.write("\2\2\2\u04b8\u04b1\3\2\2\2\u04b8\u04b2\3\2\2\2\u04b8\u04b3")
buf.write("\3\2\2\2\u04b8\u04b4\3\2\2\2\u04b8\u04b5\3\2\2\2\u04b8")
buf.write("\u04b6\3\2\2\2\u04b8\u04b7\3\2\2\2\u04b9\u0091\3\2\2\2")
buf.write("\u04ba\u04bb\7/\2\2\u04bb\u0093\3\2\2\2\u04bc\u04bd\7")
buf.write("\60\2\2\u04bd\u0095\3\2\2\2\u04be\u04bf\7\61\2\2\u04bf")
buf.write("\u0097\3\2\2\2\u04c0\u04c1\7\62\2\2\u04c1\u0099\3\2\2")
buf.write("\2\u04c2\u04c3\7\63\2\2\u04c3\u009b\3\2\2\2\u04c4\u04c5")
buf.write("\7\64\2\2\u04c5\u009d\3\2\2\2\u04c6\u04c7\7\65\2\2\u04c7")
buf.write("\u009f\3\2\2\2\u04c8\u04c9\7\66\2\2\u04c9\u00a1\3\2\2")
buf.write("\2\u04ca\u04cb\7\67\2\2\u04cb\u00a3\3\2\2\2\u04cc\u04cd")
buf.write("\79\2\2\u04cd\u00a5\3\2\2\2\u04ce\u04cf\7;\2\2\u04cf\u00a7")
buf.write("\3\2\2\2\u04d0\u04d1\7<\2\2\u04d1\u00a9\3\2\2\2\u04d2")
buf.write("\u04db\7>\2\2\u04d3\u04d4\7\u0080\2\2\u04d4\u04d7\5\u00ac")
buf.write("W\2\u04d5\u04d6\7\u0087\2\2\u04d6\u04d8\5\u00aeX\2\u04d7")
buf.write("\u04d5\3\2\2\2\u04d7\u04d8\3\2\2\2\u04d8\u04d9\3\2\2\2")
buf.write("\u04d9\u04da\7\u0081\2\2\u04da\u04dc\3\2\2\2\u04db\u04d3")
buf.write("\3\2\2\2\u04db\u04dc\3\2\2\2\u04dc\u00ab\3\2\2\2\u04dd")
buf.write("\u04de\t\b\2\2\u04de\u00ad\3\2\2\2\u04df\u04e0\7E\2\2")
buf.write("\u04e0\u04e1\7\u008b\2\2\u04e1\u04e6\5\u00b0Y\2\u04e2")
buf.write("\u04e3\7\u0087\2\2\u04e3\u04e5\5\u00b0Y\2\u04e4\u04e2")
buf.write("\3\2\2\2\u04e5\u04e8\3\2\2\2\u04e6\u04e4\3\2\2\2\u04e6")
buf.write("\u04e7\3\2\2\2\u04e7\u00af\3\2\2\2\u04e8\u04e6\3\2\2\2")
buf.write("\u04e9\u04eb\5\u00b4[\2\u04ea\u04e9\3\2\2\2\u04ea\u04eb")
buf.write("\3\2\2\2\u04eb\u04ec\3\2\2\2\u04ec\u04ed\5\u00b2Z\2\u04ed")
buf.write("\u00b1\3\2\2\2\u04ee\u04f2\5\32\16\2\u04ef\u04f2\7\u0092")
buf.write("\2\2\u04f0\u04f2\7\u0093\2\2\u04f1\u04ee\3\2\2\2\u04f1")
buf.write("\u04ef\3\2\2\2\u04f1\u04f0\3\2\2\2\u04f2\u00b3\3\2\2\2")
buf.write("\u04f3\u04f4\5\32\16\2\u04f4\u04f5\7~\2\2\u04f5\u00b5")
buf.write("\3\2\2\2\u04f6\u04fb\7?\2\2\u04f7\u04f8\7\u0080\2\2\u04f8")
buf.write("\u04f9\5\u00b8]\2\u04f9\u04fa\7\u0081\2\2\u04fa\u04fc")
buf.write("\3\2\2\2\u04fb\u04f7\3\2\2\2\u04fb\u04fc\3\2\2\2\u04fc")
buf.write("\u00b7\3\2\2\2\u04fd\u04fe\7E\2\2\u04fe\u04ff\7\u008b")
buf.write("\2\2\u04ff\u0504\5\u00ba^\2\u0500\u0501\7\u0087\2\2\u0501")
buf.write("\u0503\5\u00ba^\2\u0502\u0500\3\2\2\2\u0503\u0506\3\2")
buf.write("\2\2\u0504\u0502\3\2\2\2\u0504\u0505\3\2\2\2\u0505\u00b9")
buf.write("\3\2\2\2\u0506\u0504\3\2\2\2\u0507\u0509\5\u00be`\2\u0508")
buf.write("\u0507\3\2\2\2\u0508\u0509\3\2\2\2\u0509\u050a\3\2\2\2")
buf.write("\u050a\u050b\5\u00bc_\2\u050b\u00bb\3\2\2\2\u050c\u0510")
buf.write("\5\32\16\2\u050d\u0510\7\u0092\2\2\u050e\u0510\7\u0093")
buf.write("\2\2\u050f\u050c\3\2\2\2\u050f\u050d\3\2\2\2\u050f\u050e")
buf.write("\3\2\2\2\u0510\u00bd\3\2\2\2\u0511\u0512\7z\2\2\u0512")
buf.write("\u0513\7~\2\2\u0513\u00bf\3\2\2\2\u0514\u0515\7@\2\2\u0515")
buf.write("\u0516\7\u0080\2\2\u0516\u0517\5\u00c2b\2\u0517\u0518")
buf.write("\7\u0081\2\2\u0518\u00c1\3\2\2\2\u0519\u051e\5\u00c4c")
buf.write("\2\u051a\u051b\7\u0087\2\2\u051b\u051d\5\u00c4c\2\u051c")
buf.write("\u051a\3\2\2\2\u051d\u0520\3\2\2\2\u051e\u051c\3\2\2\2")
buf.write("\u051e\u051f\3\2\2\2\u051f\u00c3\3\2\2\2\u0520\u051e\3")
buf.write("\2\2\2\u0521\u0522\5\32\16\2\u0522\u00c5\3\2\2\2\u0523")
buf.write("\u0528\7A\2\2\u0524\u0525\7\u0080\2\2\u0525\u0526\5\u00c8")
buf.write("e\2\u0526\u0527\7\u0081\2\2\u0527\u0529\3\2\2\2\u0528")
buf.write("\u0524\3\2\2\2\u0528\u0529\3\2\2\2\u0529\u00c7\3\2\2\2")
buf.write("\u052a\u052b\7w\2\2\u052b\u00c9\3\2\2\2\u052c\u0531\5")
buf.write("\u00ccg\2\u052d\u052e\7\u0080\2\2\u052e\u052f\5\u00ce")
buf.write("h\2\u052f\u0530\7\u0081\2\2\u0530\u0532\3\2\2\2\u0531")
buf.write("\u052d\3\2\2\2\u0531\u0532\3\2\2\2\u0532\u00cb\3\2\2\2")
buf.write("\u0533\u0534\t\t\2\2\u0534\u00cd\3\2\2\2\u0535\u053a\5")
buf.write("\u00d0i\2\u0536\u0537\7\u0087\2\2\u0537\u0539\5\u00d0")
buf.write("i\2\u0538\u0536\3\2\2\2\u0539\u053c\3\2\2\2\u053a\u0538")
buf.write("\3\2\2\2\u053a\u053b\3\2\2\2\u053b\u00cf\3\2\2\2\u053c")
buf.write("\u053a\3\2\2\2\u053d\u053e\5\u00d4k\2\u053e\u053f\5\u00d2")
buf.write("j\2\u053f\u0540\5\u00d6l\2\u0540\u00d1\3\2\2\2\u0541\u0542")
buf.write("\7{\2\2\u0542\u00d3\3\2\2\2\u0543\u0544\5\32\16\2\u0544")
buf.write("\u0545\7\u008b\2\2\u0545\u00d5\3\2\2\2\u0546\u0548\5\u00d8")
buf.write("m\2\u0547\u0546\3\2\2\2\u0548\u054b\3\2\2\2\u0549\u0547")
buf.write("\3\2\2\2\u0549\u054a\3\2\2\2\u054a\u00d7\3\2\2\2\u054b")
buf.write("\u0549\3\2\2\2\u054c\u054d\7\u0091\2\2\u054d\u054e\5\32")
buf.write("\16\2\u054e\u00d9\3\2\2\2\u054f\u0550\5\u00dco\2\u0550")
buf.write("\u0552\7\u0080\2\2\u0551\u0553\5\u00dep\2\u0552\u0551")
buf.write("\3\2\2\2\u0552\u0553\3\2\2\2\u0553\u0556\3\2\2\2\u0554")
buf.write("\u0557\5\u00e0q\2\u0555\u0557\5\u00e2r\2\u0556\u0554\3")
buf.write("\2\2\2\u0556\u0555\3\2\2\2\u0557\u0559\3\2\2\2\u0558\u055a")
buf.write("\5\u00e4s\2\u0559\u0558\3\2\2\2\u0559\u055a\3\2\2\2\u055a")
buf.write("\u055b\3\2\2\2\u055b\u055c\7\u0081\2\2\u055c\u00db\3\2")
buf.write("\2\2\u055d\u055e\t\n\2\2\u055e\u00dd\3\2\2\2\u055f\u0560")
buf.write("\t\13\2\2\u0560\u00df\3\2\2\2\u0561\u0562\5\36\20\2\u0562")
buf.write("\u00e1\3\2\2\2\u0563\u0564\5\34\17\2\u0564\u00e3\3\2\2")
buf.write("\2\u0565\u0566\7\u0086\2\2\u0566\u0567\7}\2\2\u0567\u0568")
buf.write("\5\32\16\2\u0568\u00e5\3\2\2\2\u0569\u0579\5\u00e8u\2")
buf.write("\u056a\u0579\5\u0114\u008b\2\u056b\u0579\5\u011a\u008e")
buf.write("\2\u056c\u0579\5\u014e\u00a8\2\u056d\u0579\5\u0152\u00aa")
buf.write("\2\u056e\u0579\5\u0154\u00ab\2\u056f\u0579\5\u0156\u00ac")
buf.write("\2\u0570\u0579\5\u015a\u00ae\2\u0571\u0579\5\u015c\u00af")
buf.write("\2\u0572\u0579\5\u0160\u00b1\2\u0573\u0579\5\u0162\u00b2")
buf.write("\2\u0574\u0579\5\u0164\u00b3\2\u0575\u0579\5\u0166\u00b4")
buf.write("\2\u0576\u0579\5\u0168\u00b5\2\u0577\u0579\7x\2\2\u0578")
buf.write("\u0569\3\2\2\2\u0578\u056a\3\2\2\2\u0578\u056b\3\2\2\2")
buf.write("\u0578\u056c\3\2\2\2\u0578\u056d\3\2\2\2\u0578\u056e\3")
buf.write("\2\2\2\u0578\u056f\3\2\2\2\u0578\u0570\3\2\2\2\u0578\u0571")
buf.write("\3\2\2\2\u0578\u0572\3\2\2\2\u0578\u0573\3\2\2\2\u0578")
buf.write("\u0574\3\2\2\2\u0578\u0575\3\2\2\2\u0578\u0576\3\2\2\2")
buf.write("\u0578\u0577\3\2\2\2\u0579\u00e7\3\2\2\2\u057a\u0594\7")
buf.write("\3\2\2\u057b\u058a\7\u0080\2\2\u057c\u0589\5\u0108\u0085")
buf.write("\2\u057d\u0589\5\u010a\u0086\2\u057e\u0589\5\u010c\u0087")
buf.write("\2\u057f\u0589\5\u010e\u0088\2\u0580\u0589\5\u0110\u0089")
buf.write("\2\u0581\u0589\5\u0112\u008a\2\u0582\u0589\5\u0100\u0081")
buf.write("\2\u0583\u0589\5\u00f2z\2\u0584\u0589\5\u00ecw\2\u0585")
buf.write("\u0589\5\u00eav\2\u0586\u0589\7x\2\2\u0587\u0589\7\u0087")
buf.write("\2\2\u0588\u057c\3\2\2\2\u0588\u057d\3\2\2\2\u0588\u057e")
buf.write("\3\2\2\2\u0588\u057f\3\2\2\2\u0588\u0580\3\2\2\2\u0588")
buf.write("\u0581\3\2\2\2\u0588\u0582\3\2\2\2\u0588\u0583\3\2\2\2")
buf.write("\u0588\u0584\3\2\2\2\u0588\u0585\3\2\2\2\u0588\u0586\3")
buf.write("\2\2\2\u0588\u0587\3\2\2\2\u0589\u058c\3\2\2\2\u058a\u0588")
buf.write("\3\2\2\2\u058a\u058b\3\2\2\2\u058b\u0590\3\2\2\2\u058c")
buf.write("\u058a\3\2\2\2\u058d\u058f\7x\2\2\u058e\u058d\3\2\2\2")
buf.write("\u058f\u0592\3\2\2\2\u0590\u058e\3\2\2\2\u0590\u0591\3")
buf.write("\2\2\2\u0591\u0593\3\2\2\2\u0592\u0590\3\2\2\2\u0593\u0595")
buf.write("\7\u0081\2\2\u0594\u057b\3\2\2\2\u0594\u0595\3\2\2\2\u0595")
buf.write("\u0599\3\2\2\2\u0596\u0598\7x\2\2\u0597\u0596\3\2\2\2")
buf.write("\u0598\u059b\3\2\2\2\u0599\u0597\3\2\2\2\u0599\u059a\3")
buf.write("\2\2\2\u059a\u00e9\3\2\2\2\u059b\u0599\3\2\2\2\u059c\u059d")
buf.write("\7_\2\2\u059d\u05a1\7~\2\2\u059e\u05a0\7x\2\2\u059f\u059e")
buf.write("\3\2\2\2\u05a0\u05a3\3\2\2\2\u05a1\u059f\3\2\2\2\u05a1")
buf.write("\u05a2\3\2\2\2\u05a2\u05a4\3\2\2\2\u05a3\u05a1\3\2\2\2")
buf.write("\u05a4\u05af\5\u00f0y\2\u05a5\u05a9\7\u0087\2\2\u05a6")
buf.write("\u05a8\7x\2\2\u05a7\u05a6\3\2\2\2\u05a8\u05ab\3\2\2\2")
buf.write("\u05a9\u05a7\3\2\2\2\u05a9\u05aa\3\2\2\2\u05aa\u05ac\3")
buf.write("\2\2\2\u05ab\u05a9\3\2\2\2\u05ac\u05ae\5\u00f0y\2\u05ad")
buf.write("\u05a5\3\2\2\2\u05ae\u05b1\3\2\2\2\u05af\u05ad\3\2\2\2")
buf.write("\u05af\u05b0\3\2\2\2\u05b0\u00eb\3\2\2\2\u05b1\u05af\3")
buf.write("\2\2\2\u05b2\u05b3\7^\2\2\u05b3\u05b4\7~\2\2\u05b4\u05b9")
buf.write("\5\u00eex\2\u05b5\u05b6\7\u0087\2\2\u05b6\u05b8\5\u00ee")
buf.write("x\2\u05b7\u05b5\3\2\2\2\u05b8\u05bb\3\2\2\2\u05b9\u05b7")
buf.write("\3\2\2\2\u05b9\u05ba\3\2\2\2\u05ba\u00ed\3\2\2\2\u05bb")
buf.write("\u05b9\3\2\2\2\u05bc\u05bd\t\3\2\2\u05bd\u00ef\3\2\2\2")
buf.write("\u05be\u05bf\t\3\2\2\u05bf\u00f1\3\2\2\2\u05c0\u05c1\7")
buf.write("c\2\2\u05c1\u05c2\7~\2\2\u05c2\u05c7\5\u00f4{\2\u05c3")
buf.write("\u05c4\7\u0087\2\2\u05c4\u05c6\5\u00f4{\2\u05c5\u05c3")
buf.write("\3\2\2\2\u05c6\u05c9\3\2\2\2\u05c7\u05c5\3\2\2\2\u05c7")
buf.write("\u05c8\3\2\2\2\u05c8\u00f3\3\2\2\2\u05c9\u05c7\3\2\2\2")
buf.write("\u05ca\u05d7\5\u00f6|\2\u05cb\u05d3\7\u0080\2\2\u05cc")
buf.write("\u05d2\5\u00f8}\2\u05cd\u05d2\5\u00fc\177\2\u05ce\u05d2")
buf.write("\5\u00fe\u0080\2\u05cf\u05d2\7x\2\2\u05d0\u05d2\7\u0087")
buf.write("\2\2\u05d1\u05cc\3\2\2\2\u05d1\u05cd\3\2\2\2\u05d1\u05ce")
buf.write("\3\2\2\2\u05d1\u05cf\3\2\2\2\u05d1\u05d0\3\2\2\2\u05d2")
buf.write("\u05d5\3\2\2\2\u05d3\u05d1\3\2\2\2\u05d3\u05d4\3\2\2\2")
buf.write("\u05d4\u05d6\3\2\2\2\u05d5\u05d3\3\2\2\2\u05d6\u05d8\7")
buf.write("\u0081\2\2\u05d7\u05cb\3\2\2\2\u05d7\u05d8\3\2\2\2\u05d8")
buf.write("\u00f5\3\2\2\2\u05d9\u05da\5\32\16\2\u05da\u00f7\3\2\2")
buf.write("\2\u05db\u05dc\7d\2\2\u05dc\u05dd\7~\2\2\u05dd\u05de\5")
buf.write("\u00fa~\2\u05de\u00f9\3\2\2\2\u05df\u05e0\t\f\2\2\u05e0")
buf.write("\u00fb\3\2\2\2\u05e1\u05e2\7l\2\2\u05e2\u05e3\7~\2\2\u05e3")
buf.write("\u05e4\7z\2\2\u05e4\u00fd\3\2\2\2\u05e5\u05e6\7s\2\2\u05e6")
buf.write("\u05e7\7~\2\2\u05e7\u05e8\5 \21\2\u05e8\u00ff\3\2\2\2")
buf.write("\u05e9\u05ea\7m\2\2\u05ea\u05eb\7~\2\2\u05eb\u05f0\5\u0102")
buf.write("\u0082\2\u05ec\u05ed\7\u0087\2\2\u05ed\u05ef\5\u0102\u0082")
buf.write("\2\u05ee\u05ec\3\2\2\2\u05ef\u05f2\3\2\2\2\u05f0\u05ee")
buf.write("\3\2\2\2\u05f0\u05f1\3\2\2\2\u05f1\u0101\3\2\2\2\u05f2")
buf.write("\u05f0\3\2\2\2\u05f3\u05f5\5\u0104\u0083\2\u05f4\u05f6")
buf.write("\5\u0106\u0084\2\u05f5\u05f4\3\2\2\2\u05f5\u05f6\3\2\2")
buf.write("\2\u05f6\u05f7\3\2\2\2\u05f7\u05f8\7\u0080\2\2\u05f8\u05f9")
buf.write("\5 \21\2\u05f9\u05fa\7\u0081\2\2\u05fa\u0103\3\2\2\2\u05fb")
buf.write("\u05fc\5\32\16\2\u05fc\u0105\3\2\2\2\u05fd\u05fe\t\3\2")
buf.write("\2\u05fe\u0107\3\2\2\2\u05ff\u0600\7n\2\2\u0600\u0601")
buf.write("\7~\2\2\u0601\u0605\5 \21\2\u0602\u0604\7x\2\2\u0603\u0602")
buf.write("\3\2\2\2\u0604\u0607\3\2\2\2\u0605\u0603\3\2\2\2\u0605")
buf.write("\u0606\3\2\2\2\u0606\u0109\3\2\2\2\u0607\u0605\3\2\2\2")
buf.write("\u0608\u0609\7o\2\2\u0609\u060a\7~\2\2\u060a\u060e\5 ")
buf.write("\21\2\u060b\u060d\7x\2\2\u060c\u060b\3\2\2\2\u060d\u0610")
buf.write("\3\2\2\2\u060e\u060c\3\2\2\2\u060e\u060f\3\2\2\2\u060f")
buf.write("\u010b\3\2\2\2\u0610\u060e\3\2\2\2\u0611\u0612\7p\2\2")
buf.write("\u0612\u0613\7~\2\2\u0613\u0617\5 \21\2\u0614\u0616\7")
buf.write("x\2\2\u0615\u0614\3\2\2\2\u0616\u0619\3\2\2\2\u0617\u0615")
buf.write("\3\2\2\2\u0617\u0618\3\2\2\2\u0618\u010d\3\2\2\2\u0619")
buf.write("\u0617\3\2\2\2\u061a\u061b\7q\2\2\u061b\u061c\7~\2\2\u061c")
buf.write("\u0620\5 \21\2\u061d\u061f\7x\2\2\u061e\u061d\3\2\2\2")
buf.write("\u061f\u0622\3\2\2\2\u0620\u061e\3\2\2\2\u0620\u0621\3")
buf.write("\2\2\2\u0621\u010f\3\2\2\2\u0622\u0620\3\2\2\2\u0623\u0624")
buf.write("\7r\2\2\u0624\u0625\7~\2\2\u0625\u0629\5 \21\2\u0626\u0628")
buf.write("\7x\2\2\u0627\u0626\3\2\2\2\u0628\u062b\3\2\2\2\u0629")
buf.write("\u0627\3\2\2\2\u0629\u062a\3\2\2\2\u062a\u0111\3\2\2\2")
buf.write("\u062b\u0629\3\2\2\2\u062c\u062d\7s\2\2\u062d\u062e\7")
buf.write("~\2\2\u062e\u0632\5 \21\2\u062f\u0631\7x\2\2\u0630\u062f")
buf.write("\3\2\2\2\u0631\u0634\3\2\2\2\u0632\u0630\3\2\2\2\u0632")
buf.write("\u0633\3\2\2\2\u0633\u0113\3\2\2\2\u0634\u0632\3\2\2\2")
buf.write("\u0635\u0644\7\t\2\2\u0636\u0640\7\u0080\2\2\u0637\u0641")
buf.write("\5\u0116\u008c\2\u0638\u063d\5\u0118\u008d\2\u0639\u063a")
buf.write("\7\u0087\2\2\u063a\u063c\5\u0118\u008d\2\u063b\u0639\3")
buf.write("\2\2\2\u063c\u063f\3\2\2\2\u063d\u063b\3\2\2\2\u063d\u063e")
buf.write("\3\2\2\2\u063e\u0641\3\2\2\2\u063f\u063d\3\2\2\2\u0640")
buf.write("\u0637\3\2\2\2\u0640\u0638\3\2\2\2\u0641\u0642\3\2\2\2")
buf.write("\u0642\u0643\7\u0081\2\2\u0643\u0645\3\2\2\2\u0644\u0636")
buf.write("\3\2\2\2\u0644\u0645\3\2\2\2\u0645\u0115\3\2\2\2\u0646")
buf.write("\u0647\7\u008f\2\2\u0647\u0117\3\2\2\2\u0648\u0649\5\32")
buf.write("\16\2\u0649\u0119\3\2\2\2\u064a\u064d\7\n\2\2\u064b\u064c")
buf.write("\7\u0088\2\2\u064c\u064e\5\u0120\u0091\2\u064d\u064b\3")
buf.write("\2\2\2\u064d\u064e\3\2\2\2\u064e\u0653\3\2\2\2\u064f\u0650")
buf.write("\7\u0080\2\2\u0650\u0651\5\u011c\u008f\2\u0651\u0652\7")
buf.write("\u0081\2\2\u0652\u0654\3\2\2\2\u0653\u064f\3\2\2\2\u0653")
buf.write("\u0654\3\2\2\2\u0654\u011b\3\2\2\2\u0655\u065b\5\u011e")
buf.write("\u0090\2\u0656\u065a\5\u0148\u00a5\2\u0657\u065a\7x\2")
buf.write("\2\u0658\u065a\7\u0087\2\2\u0659\u0656\3\2\2\2\u0659\u0657")
buf.write("\3\2\2\2\u0659\u0658\3\2\2\2\u065a\u065d\3\2\2\2\u065b")
buf.write("\u0659\3\2\2\2\u065b\u065c\3\2\2\2\u065c\u011d\3\2\2\2")
buf.write("\u065d\u065b\3\2\2\2\u065e\u066c\5\u0132\u009a\2\u065f")
buf.write("\u066c\5\u0122\u0092\2\u0660\u066c\5\u0124\u0093\2\u0661")
buf.write("\u066c\5\u0136\u009c\2\u0662\u066c\5\u0126\u0094\2\u0663")
buf.write("\u066c\5\u0128\u0095\2\u0664\u066c\5\u012a\u0096\2\u0665")
buf.write("\u066c\5\u012c\u0097\2\u0666\u066c\5\u012e\u0098\2\u0667")
buf.write("\u066c\5\u0130\u0099\2\u0668\u066c\5\u0140\u00a1\2\u0669")
buf.write("\u066c\7x\2\2\u066a\u066c\7\u0087\2\2\u066b\u065e\3\2")
buf.write("\2\2\u066b\u065f\3\2\2\2\u066b\u0660\3\2\2\2\u066b\u0661")
buf.write("\3\2\2\2\u066b\u0662\3\2\2\2\u066b\u0663\3\2\2\2\u066b")
buf.write("\u0664\3\2\2\2\u066b\u0665\3\2\2\2\u066b\u0666\3\2\2\2")
buf.write("\u066b\u0667\3\2\2\2\u066b\u0668\3\2\2\2\u066b\u0669\3")
buf.write("\2\2\2\u066b\u066a\3\2\2\2\u066c\u066f\3\2\2\2\u066d\u066b")
buf.write("\3\2\2\2\u066d\u066e\3\2\2\2\u066e\u011f\3\2\2\2\u066f")
buf.write("\u066d\3\2\2\2\u0670\u0671\5\32\16\2\u0671\u0121\3\2\2")
buf.write("\2\u0672\u0673\7k\2\2\u0673\u0674\7~\2\2\u0674\u0678\7")
buf.write("w\2\2\u0675\u0677\7x\2\2\u0676\u0675\3\2\2\2\u0677\u067a")
buf.write("\3\2\2\2\u0678\u0676\3\2\2\2\u0678\u0679\3\2\2\2\u0679")
buf.write("\u0123\3\2\2\2\u067a\u0678\3\2\2\2\u067b\u067c\7>\2\2")
buf.write("\u067c\u067d\7~\2\2\u067d\u0681\7w\2\2\u067e\u0680\7x")
buf.write("\2\2\u067f\u067e\3\2\2\2\u0680\u0683\3\2\2\2\u0681\u067f")
buf.write("\3\2\2\2\u0681\u0682\3\2\2\2\u0682\u0125\3\2\2\2\u0683")
buf.write("\u0681\3\2\2\2\u0684\u0685\7h\2\2\u0685\u0689\5&\24\2")
buf.write("\u0686\u0688\7x\2\2\u0687\u0686\3\2\2\2\u0688\u068b\3")
buf.write("\2\2\2\u0689\u0687\3\2\2\2\u0689\u068a\3\2\2\2\u068a\u0127")
buf.write("\3\2\2\2\u068b\u0689\3\2\2\2\u068c\u068e\7g\2\2\u068d")
buf.write("\u068f\7~\2\2\u068e\u068d\3\2\2\2\u068e\u068f\3\2\2\2")
buf.write("\u068f\u0690\3\2\2\2\u0690\u0694\5&\24\2\u0691\u0693\7")
buf.write("x\2\2\u0692\u0691\3\2\2\2\u0693\u0696\3\2\2\2\u0694\u0692")
buf.write("\3\2\2\2\u0694\u0695\3\2\2\2\u0695\u0129\3\2\2\2\u0696")
buf.write("\u0694\3\2\2\2\u0697\u0699\7M\2\2\u0698\u069a\7~\2\2\u0699")
buf.write("\u0698\3\2\2\2\u0699\u069a\3\2\2\2\u069a\u069b\3\2\2\2")
buf.write("\u069b\u069f\5&\24\2\u069c\u069e\7x\2\2\u069d\u069c\3")
buf.write("\2\2\2\u069e\u06a1\3\2\2\2\u069f\u069d\3\2\2\2\u069f\u06a0")
buf.write("\3\2\2\2\u06a0\u012b\3\2\2\2\u06a1\u069f\3\2\2\2\u06a2")
buf.write("\u06a4\7L\2\2\u06a3\u06a5\7~\2\2\u06a4\u06a3\3\2\2\2\u06a4")
buf.write("\u06a5\3\2\2\2\u06a5\u06a6\3\2\2\2\u06a6\u06aa\5&\24\2")
buf.write("\u06a7\u06a9\7x\2\2\u06a8\u06a7\3\2\2\2\u06a9\u06ac\3")
buf.write("\2\2\2\u06aa\u06a8\3\2\2\2\u06aa\u06ab\3\2\2\2\u06ab\u012d")
buf.write("\3\2\2\2\u06ac\u06aa\3\2\2\2\u06ad\u06ae\7o\2\2\u06ae")
buf.write("\u06af\7~\2\2\u06af\u06b3\5 \21\2\u06b0\u06b2\7x\2\2\u06b1")
buf.write("\u06b0\3\2\2\2\u06b2\u06b5\3\2\2\2\u06b3\u06b1\3\2\2\2")
buf.write("\u06b3\u06b4\3\2\2\2\u06b4\u012f\3\2\2\2\u06b5\u06b3\3")
buf.write("\2\2\2\u06b6\u06b7\7e\2\2\u06b7\u06b8\7~\2\2\u06b8\u06bc")
buf.write("\5\32\16\2\u06b9\u06bb\7x\2\2\u06ba\u06b9\3\2\2\2\u06bb")
buf.write("\u06be\3\2\2\2\u06bc\u06ba\3\2\2\2\u06bc\u06bd\3\2\2\2")
buf.write("\u06bd\u0131\3\2\2\2\u06be\u06bc\3\2\2\2\u06bf\u06c0\7")
buf.write("s\2\2\u06c0\u06c1\7~\2\2\u06c1\u06c3\5 \21\2\u06c2\u06c4")
buf.write("\5\u0134\u009b\2\u06c3\u06c2\3\2\2\2\u06c3\u06c4\3\2\2")
buf.write("\2\u06c4\u06c8\3\2\2\2\u06c5\u06c7\7x\2\2\u06c6\u06c5")
buf.write("\3\2\2\2\u06c7\u06ca\3\2\2\2\u06c8\u06c6\3\2\2\2\u06c8")
buf.write("\u06c9\3\2\2\2\u06c9\u0133\3\2\2\2\u06ca\u06c8\3\2\2\2")
buf.write("\u06cb\u06cc\5$\23\2\u06cc\u0135\3\2\2\2\u06cd\u06ce\7")
buf.write("i\2\2\u06ce\u06cf\7\u0080\2\2\u06cf\u06d4\5\u0138\u009d")
buf.write("\2\u06d0\u06d1\7\u0087\2\2\u06d1\u06d3\5\u0138\u009d\2")
buf.write("\u06d2\u06d0\3\2\2\2\u06d3\u06d6\3\2\2\2\u06d4\u06d2\3")
buf.write("\2\2\2\u06d4\u06d5\3\2\2\2\u06d5\u06d7\3\2\2\2\u06d6\u06d4")
buf.write("\3\2\2\2\u06d7\u06d8\7\u0081\2\2\u06d8\u0137\3\2\2\2\u06d9")
buf.write("\u06dd\5\u013a\u009e\2\u06da\u06db\7~\2\2\u06db\u06de")
buf.write("\5\u013c\u009f\2\u06dc\u06de\5\u013e\u00a0\2\u06dd\u06da")
buf.write("\3\2\2\2\u06dd\u06dc\3\2\2\2\u06dd\u06de\3\2\2\2\u06de")
buf.write("\u0139\3\2\2\2\u06df\u06e0\t\r\2\2\u06e0\u013b\3\2\2\2")
buf.write("\u06e1\u06e2\5\36\20\2\u06e2\u013d\3\2\2\2\u06e3\u06e4")
buf.write("\5\34\17\2\u06e4\u013f\3\2\2\2\u06e5\u06e6\7f\2\2\u06e6")
buf.write("\u06e7\7~\2\2\u06e7\u06eb\5\u0142\u00a2\2\u06e8\u06ea")
buf.write("\7x\2\2\u06e9\u06e8\3\2\2\2\u06ea\u06ed\3\2\2\2\u06eb")
buf.write("\u06e9\3\2\2\2\u06eb\u06ec\3\2\2\2\u06ec\u0141\3\2\2\2")
buf.write("\u06ed\u06eb\3\2\2\2\u06ee\u06ef\7j\2\2\u06ef\u06f2\5")
buf.write("\u0144\u00a3\2\u06f0\u06f1\7u\2\2\u06f1\u06f3\5\u0146")
buf.write("\u00a4\2\u06f2\u06f0\3\2\2\2\u06f2\u06f3\3\2\2\2\u06f3")
buf.write("\u0143\3\2\2\2\u06f4\u06f5\5\32\16\2\u06f5\u0145\3\2\2")
buf.write("\2\u06f6\u06f7\5\32\16\2\u06f7\u0147\3\2\2\2\u06f8\u06f9")
buf.write("\7c\2\2\u06f9\u06fd\7~\2\2\u06fa\u06fe\5\u014a\u00a6\2")
buf.write("\u06fb\u06fe\7\u0087\2\2\u06fc\u06fe\7x\2\2\u06fd\u06fa")
buf.write("\3\2\2\2\u06fd\u06fb\3\2\2\2\u06fd\u06fc\3\2\2\2\u06fe")
buf.write("\u06ff\3\2\2\2\u06ff\u06fd\3\2\2\2\u06ff\u0700\3\2\2\2")
buf.write("\u0700\u0149\3\2\2\2\u0701\u0702\5\u014c\u00a7\2\u0702")
buf.write("\u0703\7\u0080\2\2\u0703\u0704\5\u011c\u008f\2\u0704\u0705")
buf.write("\7\u0081\2\2\u0705\u014b\3\2\2\2\u0706\u0707\5\32\16\2")
buf.write("\u0707\u014d\3\2\2\2\u0708\u0709\7)\2\2\u0709\u070a\7")
buf.write("\u0080\2\2\u070a\u070b\5\u0150\u00a9\2\u070b\u070c\7\u0081")
buf.write("\2\2\u070c\u014f\3\2\2\2\u070d\u0712\5\32\16\2\u070e\u070f")
buf.write("\7\u0087\2\2\u070f\u0711\5\32\16\2\u0710\u070e\3\2\2\2")
buf.write("\u0711\u0714\3\2\2\2\u0712\u0710\3\2\2\2\u0712\u0713\3")
buf.write("\2\2\2\u0713\u0151\3\2\2\2\u0714\u0712\3\2\2\2\u0715\u0716")
buf.write("\7(\2\2\u0716\u0717\5&\24\2\u0717\u0153\3\2\2\2\u0718")
buf.write("\u0719\7%\2\2\u0719\u071a\5&\24\2\u071a\u0155\3\2\2\2")
buf.write("\u071b\u0720\7 \2\2\u071c\u071d\7\u0080\2\2\u071d\u071e")
buf.write("\5\u0158\u00ad\2\u071e\u071f\7\u0081\2\2\u071f\u0721\3")
buf.write("\2\2\2\u0720\u071c\3\2\2\2\u0720\u0721\3\2\2\2\u0721\u0157")
buf.write("\3\2\2\2\u0722\u0723\7]\2\2\u0723\u0159\3\2\2\2\u0724")
buf.write("\u0725\7\"\2\2\u0725\u0726\7\u0080\2\2\u0726\u0727\5\34")
buf.write("\17\2\u0727\u0728\7\u0081\2\2\u0728\u015b\3\2\2\2\u0729")
buf.write("\u072a\7!\2\2\u072a\u072b\7\u0080\2\2\u072b\u072c\5\u015e")
buf.write("\u00b0\2\u072c\u072d\7\u0081\2\2\u072d\u015d\3\2\2\2\u072e")
buf.write("\u072f\5\32\16\2\u072f\u015f\3\2\2\2\u0730\u0731\7#\2")
buf.write("\2\u0731\u0732\5&\24\2\u0732\u0161\3\2\2\2\u0733\u0734")
buf.write("\7&\2\2\u0734\u0735\5&\24\2\u0735\u0163\3\2\2\2\u0736")
buf.write("\u0737\7\'\2\2\u0737\u0738\5&\24\2\u0738\u0165\3\2\2\2")
buf.write("\u0739\u073a\7$\2\2\u073a\u073b\5&\24\2\u073b\u0167\3")
buf.write("\2\2\2\u073c\u073d\7*\2\2\u073d\u073e\7\u0080\2\2\u073e")
buf.write("\u073f\5\u016a\u00b6\2\u073f\u0740\7\u0081\2\2\u0740\u0169")
buf.write("\3\2\2\2\u0741\u0742\5\32\16\2\u0742\u016b\3\2\2\2\u0743")
buf.write("\u0747\5\u016e\u00b8\2\u0744\u0746\7x\2\2\u0745\u0744")
buf.write("\3\2\2\2\u0746\u0749\3\2\2\2\u0747\u0745\3\2\2\2\u0747")
buf.write("\u0748\3\2\2\2\u0748\u074a\3\2\2\2\u0749\u0747\3\2\2\2")
buf.write("\u074a\u074e\5\u0188\u00c5\2\u074b\u074d\7x\2\2\u074c")
buf.write("\u074b\3\2\2\2\u074d\u0750\3\2\2\2\u074e\u074c\3\2\2\2")
buf.write("\u074e\u074f\3\2\2\2\u074f\u016d\3\2\2\2\u0750\u074e\3")
buf.write("\2\2\2\u0751\u0753\7\u0082\2\2\u0752\u0754\5\u0170\u00b9")
buf.write("\2\u0753\u0752\3\2\2\2\u0753\u0754\3\2\2\2\u0754\u0755")
buf.write("\3\2\2\2\u0755\u0757\5\u0186\u00c4\2\u0756\u0758\5\u0172")
buf.write("\u00ba\2\u0757\u0756\3\2\2\2\u0757\u0758\3\2\2\2\u0758")
buf.write("\u0761\3\2\2\2\u0759\u075b\7~\2\2\u075a\u075c\5\u017c")
buf.write("\u00bf\2\u075b\u075a\3\2\2\2\u075b\u075c\3\2\2\2\u075c")
buf.write("\u075f\3\2\2\2\u075d\u075e\7~\2\2\u075e\u0760\5\u0176")
buf.write("\u00bc\2\u075f\u075d\3\2\2\2\u075f\u0760\3\2\2\2\u0760")
buf.write("\u0762\3\2\2\2\u0761\u0759\3\2\2\2\u0761\u0762\3\2\2\2")
buf.write("\u0762\u0763\3\2\2\2\u0763\u0765\7\u0083\2\2\u0764\u0766")
buf.write("\7x\2\2\u0765\u0764\3\2\2\2\u0765\u0766\3\2\2\2\u0766")
buf.write("\u016f\3\2\2\2\u0767\u0768\5\32\16\2\u0768\u0769\7\u0088")
buf.write("\2\2\u0769\u076b\3\2\2\2\u076a\u0767\3\2\2\2\u076a\u076b")
buf.write("\3\2\2\2\u076b\u076c\3\2\2\2\u076c\u076d\5\32\16\2\u076d")
buf.write("\u076e\t\16\2\2\u076e\u076f\7}\2\2\u076f\u0171\3\2\2\2")
buf.write("\u0770\u0771\7u\2\2\u0771\u0772\5\u0174\u00bb\2\u0772")
buf.write("\u0173\3\2\2\2\u0773\u0774\5\32\16\2\u0774\u0175\3\2\2")
buf.write("\2\u0775\u0778\5\u0178\u00bd\2\u0776\u0778\5&\24\2\u0777")
buf.write("\u0775\3\2\2\2\u0777\u0776\3\2\2\2\u0778\u0177\3\2\2\2")
buf.write("\u0779\u077e\5\u017a\u00be\2\u077a\u077b\7\u008a\2\2\u077b")
buf.write("\u077d\5\u017a\u00be\2\u077c\u077a\3\2\2\2\u077d\u0780")
buf.write("\3\2\2\2\u077e\u077c\3\2\2\2\u077e\u077f\3\2\2\2\u077f")
buf.write("\u0179\3\2\2\2\u0780\u077e\3\2\2\2\u0781\u0787\5\32\16")
buf.write("\2\u0782\u0787\7z\2\2\u0783\u0787\7\u0086\2\2\u0784\u0787")
buf.write("\7\u0085\2\2\u0785\u0787\7\u0088\2\2\u0786\u0781\3\2\2")
buf.write("\2\u0786\u0782\3\2\2\2\u0786\u0783\3\2\2\2\u0786\u0784")
buf.write("\3\2\2\2\u0786\u0785\3\2\2\2\u0787\u0788\3\2\2\2\u0788")
buf.write("\u0786\3\2\2\2\u0788\u0789\3\2\2\2\u0789\u017b\3\2\2\2")
buf.write("\u078a\u078c\t\17\2\2\u078b\u078a\3\2\2\2\u078b\u078c")
buf.write("\3\2\2\2\u078c\u078d\3\2\2\2\u078d\u078e\5\u0184\u00c3")
buf.write("\2\u078e\u017d\3\2\2\2\u078f\u0793\5\32\16\2\u0790\u0793")
buf.write("\7\u0086\2\2\u0791\u0793\7z\2\2\u0792\u078f\3\2\2\2\u0792")
buf.write("\u0790\3\2\2\2\u0792\u0791\3\2\2\2\u0793\u0794\3\2\2\2")
buf.write("\u0794\u0792\3\2\2\2\u0794\u0795\3\2\2\2\u0795\u017f\3")
buf.write("\2\2\2\u0796\u0797\7|\2\2\u0797\u0798\5\32\16\2\u0798")
buf.write("\u0799\7}\2\2\u0799\u0181\3\2\2\2\u079a\u079d\5\u017e")
buf.write("\u00c0\2\u079b\u079d\5\u0180\u00c1\2\u079c\u079a\3\2\2")
buf.write("\2\u079c\u079b\3\2\2\2\u079d\u0183\3\2\2\2\u079e\u07a9")
buf.write("\7\u008a\2\2\u079f\u07a0\7\u008a\2\2\u07a0\u07a2\5\u0182")
buf.write("\u00c2\2\u07a1\u079f\3\2\2\2\u07a2\u07a3\3\2\2\2\u07a3")
buf.write("\u07a1\3\2\2\2\u07a3\u07a4\3\2\2\2\u07a4\u07a6\3\2\2\2")
buf.write("\u07a5\u07a7\7\u008a\2\2\u07a6\u07a5\3\2\2\2\u07a6\u07a7")
buf.write("\3\2\2\2\u07a7\u07a9\3\2\2\2\u07a8\u079e\3\2\2\2\u07a8")
buf.write("\u07a1\3\2\2\2\u07a9\u0185\3\2\2\2\u07aa\u07ab\5\32\16")
buf.write("\2\u07ab\u0187\3\2\2\2\u07ac\u07ae\5\u018c\u00c7\2\u07ad")
buf.write("\u07ac\3\2\2\2\u07ae\u07b1\3\2\2\2\u07af\u07ad\3\2\2\2")
buf.write("\u07af\u07b0\3\2\2\2\u07b0\u07b5\3\2\2\2\u07b1\u07af\3")
buf.write("\2\2\2\u07b2\u07b4\5\u0192\u00ca\2\u07b3\u07b2\3\2\2\2")
buf.write("\u07b4\u07b7\3\2\2\2\u07b5\u07b3\3\2\2\2\u07b5\u07b6\3")
buf.write("\2\2\2\u07b6\u07b9\3\2\2\2\u07b7\u07b5\3\2\2\2\u07b8\u07ba")
buf.write("\5\u018a\u00c6\2\u07b9\u07b8\3\2\2\2\u07b9\u07ba\3\2\2")
buf.write("\2\u07ba\u07be\3\2\2\2\u07bb\u07bd\7x\2\2\u07bc\u07bb")
buf.write("\3\2\2\2\u07bd\u07c0\3\2\2\2\u07be\u07bc\3\2\2\2\u07be")
buf.write("\u07bf\3\2\2\2\u07bf\u07c4\3\2\2\2\u07c0\u07be\3\2\2\2")
buf.write("\u07c1\u07c3\5\u019a\u00ce\2\u07c2\u07c1\3\2\2\2\u07c3")
buf.write("\u07c6\3\2\2\2\u07c4\u07c2\3\2\2\2\u07c4\u07c5\3\2\2\2")
buf.write("\u07c5\u0189\3\2\2\2\u07c6\u07c4\3\2\2\2\u07c7\u07c8\5")
buf.write("&\24\2\u07c8\u018b\3\2\2\2\u07c9\u07ca\5\u018e\u00c8\2")
buf.write("\u07ca\u07cb\7\u0099\2\2\u07cb\u07d2\5\u0190\u00c9\2\u07cc")
buf.write("\u07ce\7x\2\2\u07cd\u07cc\3\2\2\2\u07ce\u07cf\3\2\2\2")
buf.write("\u07cf\u07cd\3\2\2\2\u07cf\u07d0\3\2\2\2\u07d0\u07d3\3")
buf.write("\2\2\2\u07d1\u07d3\7\2\2\3\u07d2\u07cd\3\2\2\2\u07d2\u07d1")
buf.write("\3\2\2\2\u07d3\u018d\3\2\2\2\u07d4\u07d5\5\32\16\2\u07d5")
buf.write("\u018f\3\2\2\2\u07d6\u07d7\7\u009d\2\2\u07d7\u0191\3\2")
buf.write("\2\2\u07d8\u07d9\5\u0194\u00cb\2\u07d9\u07db\7\u0080\2")
buf.write("\2\u07da\u07dc\5\u0196\u00cc\2\u07db\u07da\3\2\2\2\u07db")
buf.write("\u07dc\3\2\2\2\u07dc\u07dd\3\2\2\2\u07dd\u07df\7\u0081")
buf.write("\2\2\u07de\u07e0\5*\26\2\u07df\u07de\3\2\2\2\u07df\u07e0")
buf.write("\3\2\2\2\u07e0\u07e7\3\2\2\2\u07e1\u07e3\7x\2\2\u07e2")
buf.write("\u07e1\3\2\2\2\u07e3\u07e4\3\2\2\2\u07e4\u07e2\3\2\2\2")
buf.write("\u07e4\u07e5\3\2\2\2\u07e5\u07e8\3\2\2\2\u07e6\u07e8\7")
buf.write("\2\2\3\u07e7\u07e2\3\2\2\2\u07e7\u07e6\3\2\2\2\u07e8\u0193")
buf.write("\3\2\2\2\u07e9\u07ea\5\32\16\2\u07ea\u0195\3\2\2\2\u07eb")
buf.write("\u07f0\5\u0198\u00cd\2\u07ec\u07ed\7\u0087\2\2\u07ed\u07ef")
buf.write("\5\u0198\u00cd\2\u07ee\u07ec\3\2\2\2\u07ef\u07f2\3\2\2")
buf.write("\2\u07f0\u07ee\3\2\2\2\u07f0\u07f1\3\2\2\2\u07f1\u0197")
buf.write("\3\2\2\2\u07f2\u07f0\3\2\2\2\u07f3\u07f5\7\u0088\2\2\u07f4")
buf.write("\u07f3\3\2\2\2\u07f4\u07f5\3\2\2\2\u07f5\u07f6\3\2\2\2")
buf.write("\u07f6\u07f7\5\32\16\2\u07f7\u0199\3\2\2\2\u07f8\u080a")
buf.write("\5\u019c\u00cf\2\u07f9\u080a\5\u01a8\u00d5\2\u07fa\u080a")
buf.write("\5\u01b0\u00d9\2\u07fb\u080a\5\u01b4\u00db\2\u07fc\u080a")
buf.write("\5\u01b8\u00dd\2\u07fd\u080a\5\u0202\u0102\2\u07fe\u080a")
buf.write("\5\u0204\u0103\2\u07ff\u080a\5\u0206\u0104\2\u0800\u080a")
buf.write("\5\u0208\u0105\2\u0801\u080a\5\u01ba\u00de\2\u0802\u080a")
buf.write("\5\u020a\u0106\2\u0803\u080a\5\u020c\u0107\2\u0804\u080a")
buf.write("\5\u0226\u0114\2\u0805\u080a\5\u0228\u0115\2\u0806\u080a")
buf.write("\5\u022a\u0116\2\u0807\u080a\5\u022c\u0117\2\u0808\u080a")
buf.write("\7x\2\2\u0809\u07f8\3\2\2\2\u0809\u07f9\3\2\2\2\u0809")
buf.write("\u07fa\3\2\2\2\u0809\u07fb\3\2\2\2\u0809\u07fc\3\2\2\2")
buf.write("\u0809\u07fd\3\2\2\2\u0809\u07fe\3\2\2\2\u0809\u07ff\3")
buf.write("\2\2\2\u0809\u0800\3\2\2\2\u0809\u0801\3\2\2\2\u0809\u0802")
buf.write("\3\2\2\2\u0809\u0803\3\2\2\2\u0809\u0804\3\2\2\2\u0809")
buf.write("\u0805\3\2\2\2\u0809\u0806\3\2\2\2\u0809\u0807\3\2\2\2")
buf.write("\u0809\u0808\3\2\2\2\u080a\u019b\3\2\2\2\u080b\u080c\7")
buf.write("\6\2\2\u080c\u080f\7\u0080\2\2\u080d\u0810\5\u019e\u00d0")
buf.write("\2\u080e\u0810\7x\2\2\u080f\u080d\3\2\2\2\u080f\u080e")
buf.write("\3\2\2\2\u0810\u0811\3\2\2\2\u0811\u080f\3\2\2\2\u0811")
buf.write("\u0812\3\2\2\2\u0812\u0813\3\2\2\2\u0813\u0814\7\u0081")
buf.write("\2\2\u0814\u019d\3\2\2\2\u0815\u0817\5\u01a0\u00d1\2\u0816")
buf.write("\u0818\5\u01a2\u00d2\2\u0817\u0816\3\2\2\2\u0817\u0818")
buf.write("\3\2\2\2\u0818\u081a\3\2\2\2\u0819\u081b\5\u01a4\u00d3")
buf.write("\2\u081a\u0819\3\2\2\2\u081a\u081b\3\2\2\2\u081b\u081d")
buf.write("\3\2\2\2\u081c\u081e\7\u0087\2\2\u081d\u081c\3\2\2\2\u081d")
buf.write("\u081e\3\2\2\2\u081e\u0820\3\2\2\2\u081f\u0821\7x\2\2")
buf.write("\u0820\u081f\3\2\2\2\u0820\u0821\3\2\2\2\u0821\u019f\3")
buf.write("\2\2\2\u0822\u0825\5\36\20\2\u0823\u0825\5\34\17\2\u0824")
buf.write("\u0822\3\2\2\2\u0824\u0823\3\2\2\2\u0825\u01a1\3\2\2\2")
buf.write("\u0826\u0827\5*\26\2\u0827\u01a3\3\2\2\2\u0828\u0829\7")
buf.write("\u008b\2\2\u0829\u0833\7}\2\2\u082a\u0834\7\u008f\2\2")
buf.write("\u082b\u0830\5\u01a6\u00d4\2\u082c\u082d\7\u0087\2\2\u082d")
buf.write("\u082f\5\u01a6\u00d4\2\u082e\u082c\3\2\2\2\u082f\u0832")
buf.write("\3\2\2\2\u0830\u082e\3\2\2\2\u0830\u0831\3\2\2\2\u0831")
buf.write("\u0834\3\2\2\2\u0832\u0830\3\2\2\2\u0833\u082a\3\2\2\2")
buf.write("\u0833\u082b\3\2\2\2\u0834\u01a5\3\2\2\2\u0835\u0836\5")
buf.write("\32\16\2\u0836\u01a7\3\2\2\2\u0837\u083a\5\u01aa\u00d6")
buf.write("\2\u0838\u0839\7\u0088\2\2\u0839\u083b\5\u01ac\u00d7\2")
buf.write("\u083a\u0838\3\2\2\2\u083a\u083b\3\2\2\2\u083b\u0841\3")
buf.write("\2\2\2\u083c\u083e\7\u0080\2\2\u083d\u083f\5\u01ae\u00d8")
buf.write("\2\u083e\u083d\3\2\2\2\u083e\u083f\3\2\2\2\u083f\u0840")
buf.write("\3\2\2\2\u0840\u0842\7\u0081\2\2\u0841\u083c\3\2\2\2\u0841")
buf.write("\u0842\3\2\2\2\u0842\u01a9\3\2\2\2\u0843\u0844\t\20\2")
buf.write("\2\u0844\u01ab\3\2\2\2\u0845\u0846\5\32\16\2\u0846\u01ad")
buf.write("\3\2\2\2\u0847\u0848\7K\2\2\u0848\u0849\7~\2\2\u0849\u084a")
buf.write("\7w\2\2\u084a\u01af\3\2\2\2\u084b\u084e\7\37\2\2\u084c")
buf.write("\u084d\7\u0088\2\2\u084d\u084f\5\u01b2\u00da\2\u084e\u084c")
buf.write("\3\2\2\2\u084e\u084f\3\2\2\2\u084f\u0850\3\2\2\2\u0850")
buf.write("\u0851\5*\26\2\u0851\u01b1\3\2\2\2\u0852\u0853\5\32\16")
buf.write("\2\u0853\u01b3\3\2\2\2\u0854\u0857\7\36\2\2\u0855\u0856")
buf.write("\7\u0088\2\2\u0856\u0858\5\u01b6\u00dc\2\u0857\u0855\3")
buf.write("\2\2\2\u0857\u0858\3\2\2\2\u0858\u0859\3\2\2\2\u0859\u085a")
buf.write("\5*\26\2\u085a\u01b5\3\2\2\2\u085b\u085c\5\32\16\2\u085c")
buf.write("\u01b7\3\2\2\2\u085d\u085e\7\30\2\2\u085e\u085f\5\u01bc")
buf.write("\u00df\2\u085f\u01b9\3\2\2\2\u0860\u0861\7\25\2\2\u0861")
buf.write("\u0862\5\u01bc\u00df\2\u0862\u01bb\3\2\2\2\u0863\u0864")
buf.write("\7\u0088\2\2\u0864\u0866\5\u01c0\u00e1\2\u0865\u0863\3")
buf.write("\2\2\2\u0865\u0866\3\2\2\2\u0866\u0867\3\2\2\2\u0867\u086b")
buf.write("\7\u0080\2\2\u0868\u086a\7x\2\2\u0869\u0868\3\2\2\2\u086a")
buf.write("\u086d\3\2\2\2\u086b\u0869\3\2\2\2\u086b\u086c\3\2\2\2")
buf.write("\u086c\u086e\3\2\2\2\u086d\u086b\3\2\2\2\u086e\u0870\5")
buf.write("\u01ca\u00e6\2\u086f\u0871\5\u01cc\u00e7\2\u0870\u086f")
buf.write("\3\2\2\2\u0870\u0871\3\2\2\2\u0871\u0883\3\2\2\2\u0872")
buf.write("\u0882\5\u01ce\u00e8\2\u0873\u0882\5\u01e2\u00f2\2\u0874")
buf.write("\u0882\5\u01e8\u00f5\2\u0875\u0882\5\u01fa\u00fe\2\u0876")
buf.write("\u0882\5\u01e0\u00f1\2\u0877\u0882\5\u01d8\u00ed\2\u0878")
buf.write("\u0882\5\u01de\u00f0\2\u0879\u0882\5\u01da\u00ee\2\u087a")
buf.write("\u0882\5\u01dc\u00ef\2\u087b\u0882\5\u01d0\u00e9\2\u087c")
buf.write("\u0882\5\u01d4\u00eb\2\u087d\u0882\5\u01ea\u00f6\2\u087e")
buf.write("\u0882\5\u01ee\u00f8\2\u087f\u0882\7x\2\2\u0880\u0882")
buf.write("\7\u0087\2\2\u0881\u0872\3\2\2\2\u0881\u0873\3\2\2\2\u0881")
buf.write("\u0874\3\2\2\2\u0881\u0875\3\2\2\2\u0881\u0876\3\2\2\2")
buf.write("\u0881\u0877\3\2\2\2\u0881\u0878\3\2\2\2\u0881\u0879\3")
buf.write("\2\2\2\u0881\u087a\3\2\2\2\u0881\u087b\3\2\2\2\u0881\u087c")
buf.write("\3\2\2\2\u0881\u087d\3\2\2\2\u0881\u087e\3\2\2\2\u0881")
buf.write("\u087f\3\2\2\2\u0881\u0880\3\2\2\2\u0882\u0885\3\2\2\2")
buf.write("\u0883\u0881\3\2\2\2\u0883\u0884\3\2\2\2\u0884\u0889\3")
buf.write("\2\2\2\u0885\u0883\3\2\2\2\u0886\u0888\7x\2\2\u0887\u0886")
buf.write("\3\2\2\2\u0888\u088b\3\2\2\2\u0889\u0887\3\2\2\2\u0889")
buf.write("\u088a\3\2\2\2\u088a\u088e\3\2\2\2\u088b\u0889\3\2\2\2")
buf.write("\u088c\u088f\5\u01c2\u00e2\2\u088d\u088f\5\u01c6\u00e4")
buf.write("\2\u088e\u088c\3\2\2\2\u088e\u088d\3\2\2\2\u088e\u088f")
buf.write("\3\2\2\2\u088f\u0893\3\2\2\2\u0890\u0892\7x\2\2\u0891")
buf.write("\u0890\3\2\2\2\u0892\u0895\3\2\2\2\u0893\u0891\3\2\2\2")
buf.write("\u0893\u0894\3\2\2\2\u0894\u0899\3\2\2\2\u0895\u0893\3")
buf.write("\2\2\2\u0896\u0898\5\u01be\u00e0\2\u0897\u0896\3\2\2\2")
buf.write("\u0898\u089b\3\2\2\2\u0899\u0897\3\2\2\2\u0899\u089a\3")
buf.write("\2\2\2\u089a\u089f\3\2\2\2\u089b\u0899\3\2\2\2\u089c\u089e")
buf.write("\7x\2\2\u089d\u089c\3\2\2\2\u089e\u08a1\3\2\2\2\u089f")
buf.write("\u089d\3\2\2\2\u089f\u08a0\3\2\2\2\u08a0\u08a2\3\2\2\2")
buf.write("\u08a1\u089f\3\2\2\2\u08a2\u08a3\7\u0081\2\2\u08a3\u01bd")
buf.write("\3\2\2\2\u08a4\u08a8\5\u01e6\u00f4\2\u08a5\u08a7\7x\2")
buf.write("\2\u08a6\u08a5\3\2\2\2\u08a7\u08aa\3\2\2\2\u08a8\u08a6")
buf.write("\3\2\2\2\u08a8\u08a9\3\2\2\2\u08a9\u08ab\3\2\2\2\u08aa")
buf.write("\u08a8\3\2\2\2\u08ab\u08af\7\u0080\2\2\u08ac\u08ae\7x")
buf.write("\2\2\u08ad\u08ac\3\2\2\2\u08ae\u08b1\3\2\2\2\u08af\u08ad")
buf.write("\3\2\2\2\u08af\u08b0\3\2\2\2\u08b0\u08b2\3\2\2\2\u08b1")
buf.write("\u08af\3\2\2\2\u08b2\u08b6\5\u0188\u00c5\2\u08b3\u08b5")
buf.write("\7x\2\2\u08b4\u08b3\3\2\2\2\u08b5\u08b8\3\2\2\2\u08b6")
buf.write("\u08b4\3\2\2\2\u08b6\u08b7\3\2\2\2\u08b7\u08b9\3\2\2\2")
buf.write("\u08b8\u08b6\3\2\2\2\u08b9\u08bd\7\u0081\2\2\u08ba\u08bc")
buf.write("\7x\2\2\u08bb\u08ba\3\2\2\2\u08bc\u08bf\3\2\2\2\u08bd")
buf.write("\u08bb\3\2\2\2\u08bd\u08be\3\2\2\2\u08be\u01bf\3\2\2\2")
buf.write("\u08bf\u08bd\3\2\2\2\u08c0\u08c1\5\32\16\2\u08c1\u01c1")
buf.write("\3\2\2\2\u08c2\u08c3\7\u0080\2\2\u08c3\u08c4\5\u01c4\u00e3")
buf.write("\2\u08c4\u08c5\7\u0081\2\2\u08c5\u08c7\3\2\2\2\u08c6\u08c2")
buf.write("\3\2\2\2\u08c6\u08c7\3\2\2\2\u08c7\u08c8\3\2\2\2\u08c8")
buf.write("\u08c9\7\u008b\2\2\u08c9\u08ca\7}\2\2\u08ca\u08cb\5*\26")
buf.write("\2\u08cb\u01c3\3\2\2\2\u08cc\u08cd\t\21\2\2\u08cd\u01c5")
buf.write("\3\2\2\2\u08ce\u08cf\7\u0080\2\2\u08cf\u08d0\5\u01c4\u00e3")
buf.write("\2\u08d0\u08d1\7\u0081\2\2\u08d1\u08d3\3\2\2\2\u08d2\u08ce")
buf.write("\3\2\2\2\u08d2\u08d3\3\2\2\2\u08d3\u08d4\3\2\2\2\u08d4")
buf.write("\u08d5\7\u008b\2\2\u08d5\u08d6\7}\2\2\u08d6\u08d7\5\u01c8")
buf.write("\u00e5\2\u08d7\u01c7\3\2\2\2\u08d8\u08d9\t\3\2\2\u08d9")
buf.write("\u01c9\3\2\2\2\u08da\u08dd\5\36\20\2\u08db\u08dd\5\34")
buf.write("\17\2\u08dc\u08da\3\2\2\2\u08dc\u08db\3\2\2\2\u08dd\u01cb")
buf.write("\3\2\2\2\u08de\u08df\5*\26\2\u08df\u01cd\3\2\2\2\u08e0")
buf.write("\u08e1\7F\2\2\u08e1\u08e2\7~\2\2\u08e2\u08e3\5\32\16\2")
buf.write("\u08e3\u01cf\3\2\2\2\u08e4\u08e5\7P\2\2\u08e5\u08e6\7")
buf.write("~\2\2\u08e6\u08e7\5\u01d2\u00ea\2\u08e7\u01d1\3\2\2\2")
buf.write("\u08e8\u08e9\t\3\2\2\u08e9\u01d3\3\2\2\2\u08ea\u08eb\7")
buf.write("O\2\2\u08eb\u08ec\7~\2\2\u08ec\u08ed\5\u01d6\u00ec\2\u08ed")
buf.write("\u01d5\3\2\2\2\u08ee\u08ef\t\3\2\2\u08ef\u01d7\3\2\2\2")
buf.write("\u08f0\u08f1\7T\2\2\u08f1\u08f2\7~\2\2\u08f2\u08f3\5\32")
buf.write("\16\2\u08f3\u01d9\3\2\2\2\u08f4\u08f8\7R\2\2\u08f5\u08f9")
buf.write("\5(\25\2\u08f6\u08f7\7~\2\2\u08f7\u08f9\5*\26\2\u08f8")
buf.write("\u08f5\3\2\2\2\u08f8\u08f6\3\2\2\2\u08f9\u01db\3\2\2\2")
buf.write("\u08fa\u08fe\7Q\2\2\u08fb\u08ff\5(\25\2\u08fc\u08fd\7")
buf.write("~\2\2\u08fd\u08ff\5*\26\2\u08fe\u08fb\3\2\2\2\u08fe\u08fc")
buf.write("\3\2\2\2\u08ff\u01dd\3\2\2\2\u0900\u0901\7S\2\2\u0901")
buf.write("\u0902\7~\2\2\u0902\u0903\5\32\16\2\u0903\u01df\3\2\2")
buf.write("\2\u0904\u0905\7U\2\2\u0905\u0906\7~\2\2\u0906\u0907\5")
buf.write("\32\16\2\u0907\u01e1\3\2\2\2\u0908\u0909\7[\2\2\u0909")
buf.write("\u090a\7~\2\2\u090a\u090b\5\u01e4\u00f3\2\u090b\u01e3")
buf.write("\3\2\2\2\u090c\u0911\5\u01e6\u00f4\2\u090d\u090e\7\u0087")
buf.write("\2\2\u090e\u0910\5\u01e6\u00f4\2\u090f\u090d\3\2\2\2\u0910")
buf.write("\u0913\3\2\2\2\u0911\u090f\3\2\2\2\u0911\u0912\3\2\2\2")
buf.write("\u0912\u01e5\3\2\2\2\u0913\u0911\3\2\2\2\u0914\u0915\t")
buf.write("\22\2\2\u0915\u01e7\3\2\2\2\u0916\u0917\7s\2\2\u0917\u0918")
buf.write("\7~\2\2\u0918\u0919\5\u01f2\u00fa\2\u0919\u01e9\3\2\2")
buf.write("\2\u091a\u091b\7n\2\2\u091b\u091c\7~\2\2\u091c\u091d\5")
buf.write("\u01ec\u00f7\2\u091d\u01eb\3\2\2\2\u091e\u091f\t\f\2\2")
buf.write("\u091f\u01ed\3\2\2\2\u0920\u0921\7H\2\2\u0921\u0922\7")
buf.write("~\2\2\u0922\u0923\5\u01f0\u00f9\2\u0923\u01ef\3\2\2\2")
buf.write("\u0924\u0925\7w\2\2\u0925\u01f1\3\2\2\2\u0926\u092b\5")
buf.write("\u01f4\u00fb\2\u0927\u0928\7\u0087\2\2\u0928\u092a\5\u01f4")
buf.write("\u00fb\2\u0929\u0927\3\2\2\2\u092a\u092d\3\2\2\2\u092b")
buf.write("\u0929\3\2\2\2\u092b\u092c\3\2\2\2\u092c\u01f3\3\2\2\2")
buf.write("\u092d\u092b\3\2\2\2\u092e\u0930\5\u01f6\u00fc\2\u092f")
buf.write("\u0931\5\u01f8\u00fd\2\u0930\u092f\3\2\2\2\u0930\u0931")
buf.write("\3\2\2\2\u0931\u01f5\3\2\2\2\u0932\u0938\7\u008f\2\2\u0933")
buf.write("\u0935\7\177\2\2\u0934\u0933\3\2\2\2\u0934\u0935\3\2\2")
buf.write("\2\u0935\u0936\3\2\2\2\u0936\u0938\5\32\16\2\u0937\u0932")
buf.write("\3\2\2\2\u0937\u0934\3\2\2\2\u0938\u01f7\3\2\2\2\u0939")
buf.write("\u093a\5*\26\2\u093a\u01f9\3\2\2\2\u093b\u093c\7V\2\2")
buf.write("\u093c\u093d\7~\2\2\u093d\u093e\5\u01fc\u00ff\2\u093e")
buf.write("\u01fb\3\2\2\2\u093f\u0944\5\u01fe\u0100\2\u0940\u0941")
buf.write("\7\u0087\2\2\u0941\u0943\5\u01fe\u0100\2\u0942\u0940\3")
buf.write("\2\2\2\u0943\u0946\3\2\2\2\u0944\u0942\3\2\2\2\u0944\u0945")
buf.write("\3\2\2\2\u0945\u01fd\3\2\2\2\u0946\u0944\3\2\2\2\u0947")
buf.write("\u0948\5\u0200\u0101\2\u0948\u01ff\3\2\2\2\u0949\u094f")
buf.write("\7\u008f\2\2\u094a\u094c\7\177\2\2\u094b\u094a\3\2\2\2")
buf.write("\u094b\u094c\3\2\2\2\u094c\u094d\3\2\2\2\u094d\u094f\5")
buf.write("\32\16\2\u094e\u0949\3\2\2\2\u094e\u094b\3\2\2\2\u094f")
buf.write("\u0201\3\2\2\2\u0950\u0952\7\33\2\2\u0951\u0953\5*\26")
buf.write("\2\u0952\u0951\3\2\2\2\u0952\u0953\3\2\2\2\u0953\u0203")
buf.write("\3\2\2\2\u0954\u0956\7\35\2\2\u0955\u0957\5*\26\2\u0956")
buf.write("\u0955\3\2\2\2\u0956\u0957\3\2\2\2\u0957\u0205\3\2\2\2")
buf.write("\u0958\u0959\7\32\2\2\u0959\u095a\5\u01bc\u00df\2\u095a")
buf.write("\u0207\3\2\2\2\u095b\u095c\7\31\2\2\u095c\u095d\5\u01bc")
buf.write("\u00df\2\u095d\u0209\3\2\2\2\u095e\u095f\7\27\2\2\u095f")
buf.write("\u0960\5\u01bc\u00df\2\u0960\u020b\3\2\2\2\u0961\u0962")
buf.write("\7\24\2\2\u0962\u0963\7\u0088\2\2\u0963\u0964\5\u020e")
buf.write("\u0108\2\u0964\u0968\7\u0080\2\2\u0965\u0967\7x\2\2\u0966")
buf.write("\u0965\3\2\2\2\u0967\u096a\3\2\2\2\u0968\u0966\3\2\2\2")
buf.write("\u0968\u0969\3\2\2\2\u0969\u096c\3\2\2\2\u096a\u0968\3")
buf.write("\2\2\2\u096b\u096d\5\u0210\u0109\2\u096c\u096b\3\2\2\2")
buf.write("\u096d\u096e\3\2\2\2\u096e\u096c\3\2\2\2\u096e\u096f\3")
buf.write("\2\2\2\u096f\u0973\3\2\2\2\u0970\u0972\7x\2\2\u0971\u0970")
buf.write("\3\2\2\2\u0972\u0975\3\2\2\2\u0973\u0971\3\2\2\2\u0973")
buf.write("\u0974\3\2\2\2\u0974\u0976\3\2\2\2\u0975\u0973\3\2\2\2")
buf.write("\u0976\u0977\7\u0081\2\2\u0977\u020d\3\2\2\2\u0978\u0979")
buf.write("\5\32\16\2\u0979\u020f\3\2\2\2\u097a\u097c\7\u0087\2\2")
buf.write("\u097b\u097a\3\2\2\2\u097b\u097c\3\2\2\2\u097c\u0980\3")
buf.write("\2\2\2\u097d\u097f\7x\2\2\u097e\u097d\3\2\2\2\u097f\u0982")
buf.write("\3\2\2\2\u0980\u097e\3\2\2\2\u0980\u0981\3\2\2\2\u0981")
buf.write("\u0984\3\2\2\2\u0982\u0980\3\2\2\2\u0983\u0985\5\u0216")
buf.write("\u010c\2\u0984\u0983\3\2\2\2\u0984\u0985\3\2\2\2\u0985")
buf.write("\u0986\3\2\2\2\u0986\u0989\5\u0224\u0113\2\u0987\u098a")
buf.write("\5\u0214\u010b\2\u0988\u098a\5\u0212\u010a\2\u0989\u0987")
buf.write("\3\2\2\2\u0989\u0988\3\2\2\2\u098a\u098e\3\2\2\2\u098b")
buf.write("\u098d\7x\2\2\u098c\u098b\3\2\2\2\u098d\u0990\3\2\2\2")
buf.write("\u098e\u098c\3\2\2\2\u098e\u098f\3\2\2\2\u098f\u0211\3")
buf.write("\2\2\2\u0990\u098e\3\2\2\2\u0991\u0994\7~\2\2\u0992\u0995")
buf.write("\5\u0220\u0111\2\u0993\u0995\5\u021e\u0110\2\u0994\u0992")
buf.write("\3\2\2\2\u0994\u0993\3\2\2\2\u0995\u0213\3\2\2\2\u0996")
buf.write("\u0997\5(\25\2\u0997\u0215\3\2\2\2\u0998\u0999\7\u0082")
buf.write("\2\2\u0999\u099e\5\u0218\u010d\2\u099a\u099b\7\u0087\2")
buf.write("\2\u099b\u099d\5\u0218\u010d\2\u099c\u099a\3\2\2\2\u099d")
buf.write("\u09a0\3\2\2\2\u099e\u099c\3\2\2\2\u099e\u099f\3\2\2\2")
buf.write("\u099f\u09a1\3\2\2\2\u09a0\u099e\3\2\2\2\u09a1\u09a2\7")
buf.write("\u0083\2\2\u09a2\u0217\3\2\2\2\u09a3\u09a4\5\u021a\u010e")
buf.write("\2\u09a4\u09a5\7\u008b\2\2\u09a5\u09a6\5\u021c\u010f\2")
buf.write("\u09a6\u0219\3\2\2\2\u09a7\u09a8\5\32\16\2\u09a8\u021b")
buf.write("\3\2\2\2\u09a9\u09ad\7\u0092\2\2\u09aa\u09ad\7\u0093\2")
buf.write("\2\u09ab\u09ad\5\32\16\2\u09ac\u09a9\3\2\2\2\u09ac\u09aa")
buf.write("\3\2\2\2\u09ac\u09ab\3\2\2\2\u09ad\u021d\3\2\2\2\u09ae")
buf.write("\u09af\t\3\2\2\u09af\u021f\3\2\2\2\u09b0\u09b1\7N\2\2")
buf.write("\u09b1\u09b2\7\u0080\2\2\u09b2\u09b3\5\u0222\u0112\2\u09b3")
buf.write("\u09b4\7\u0081\2\2\u09b4\u0221\3\2\2\2\u09b5\u09b6\5\32")
buf.write("\16\2\u09b6\u09b7\7\u0088\2\2\u09b7\u09b9\3\2\2\2\u09b8")
buf.write("\u09b5\3\2\2\2\u09b8\u09b9\3\2\2\2\u09b9\u09ba\3\2\2\2")
buf.write("\u09ba\u09bb\5\32\16\2\u09bb\u0223\3\2\2\2\u09bc\u09c0")
buf.write("\7\u0092\2\2\u09bd\u09c0\7\u0093\2\2\u09be\u09c0\5\32")
buf.write("\16\2\u09bf\u09bc\3\2\2\2\u09bf\u09bd\3\2\2\2\u09bf\u09be")
buf.write("\3\2\2\2\u09c0\u0225\3\2\2\2\u09c1\u09c2\7\26\2\2\u09c2")
buf.write("\u09c3\5\u01bc\u00df\2\u09c3\u0227\3\2\2\2\u09c4\u09c5")
buf.write("\7\21\2\2\u09c5\u0229\3\2\2\2\u09c6\u09c8\7\23\2\2\u09c7")
buf.write("\u09c9\5*\26\2\u09c8\u09c7\3\2\2\2\u09c8\u09c9\3\2\2\2")
buf.write("\u09c9\u022b\3\2\2\2\u09ca\u09cb\7\34\2\2\u09cb\u09cc")
buf.write("\7\u0080\2\2\u09cc\u09cd\5\u022e\u0118\2\u09cd\u09ce\7")
buf.write("\u0081\2\2\u09ce\u022d\3\2\2\2\u09cf\u09d0\7z\2\2\u09d0")
buf.write("\u022f\3\2\2\2\u0109\u0233\u0239\u023f\u0243\u0248\u024a")
buf.write("\u024f\u0253\u0258\u025a\u025f\u0267\u026c\u0274\u027b")
buf.write("\u027e\u0287\u028d\u0290\u029f\u02a6\u02ab\u02b3\u02b9")
buf.write("\u02be\u02c1\u02c4\u02c8\u02d0\u02e2\u02e9\u02f0\u02f5")
buf.write("\u02fa\u02ff\u0306\u030a\u030f\u0315\u031a\u0326\u032a")
buf.write("\u032f\u0334\u0338\u033e\u0348\u0350\u0353\u0358\u0360")
buf.write("\u0368\u036d\u0371\u0377\u037b\u0383\u038a\u0392\u039a")
buf.write("\u039f\u03a3\u03a6\u03ab\u03b2\u03bc\u03be\u03c4\u03c6")
buf.write("\u03cc\u03ce\u03d3\u03e0\u03ef\u03f8\u0404\u0409\u040e")
buf.write("\u0414\u041a\u0420\u0426\u042e\u0431\u0435\u0439\u0444")
buf.write("\u044a\u044f\u0456\u045d\u0462\u0465\u0468\u046d\u0470")
buf.write("\u0474\u0479\u047e\u0483\u0496\u049a\u04b8\u04d7\u04db")
buf.write("\u04e6\u04ea\u04f1\u04fb\u0504\u0508\u050f\u051e\u0528")
buf.write("\u0531\u053a\u0549\u0552\u0556\u0559\u0578\u0588\u058a")
buf.write("\u0590\u0594\u0599\u05a1\u05a9\u05af\u05b9\u05c7\u05d1")
buf.write("\u05d3\u05d7\u05f0\u05f5\u0605\u060e\u0617\u0620\u0629")
buf.write("\u0632\u063d\u0640\u0644\u064d\u0653\u0659\u065b\u066b")
buf.write("\u066d\u0678\u0681\u0689\u068e\u0694\u0699\u069f\u06a4")
buf.write("\u06aa\u06b3\u06bc\u06c3\u06c8\u06d4\u06dd\u06eb\u06f2")
buf.write("\u06fd\u06ff\u0712\u0720\u0747\u074e\u0753\u0757\u075b")
buf.write("\u075f\u0761\u0765\u076a\u0777\u077e\u0786\u0788\u078b")
buf.write("\u0792\u0794\u079c\u07a3\u07a6\u07a8\u07af\u07b5\u07b9")
buf.write("\u07be\u07c4\u07cf\u07d2\u07db\u07df\u07e4\u07e7\u07f0")
buf.write("\u07f4\u0809\u080f\u0811\u0817\u081a\u081d\u0820\u0824")
buf.write("\u0830\u0833\u083a\u083e\u0841\u084e\u0857\u0865\u086b")
buf.write("\u0870\u0881\u0883\u0889\u088e\u0893\u0899\u089f\u08a8")
buf.write("\u08af\u08b6\u08bd\u08c6\u08d2\u08dc\u08f8\u08fe\u0911")
buf.write("\u092b\u0930\u0934\u0937\u0944\u094b\u094e\u0952\u0956")
buf.write("\u0968\u096e\u0973\u097b\u0980\u0984\u0989\u098e\u0994")
buf.write("\u099e\u09ac\u09b8\u09bf\u09c8")
return buf.getvalue()
class ZmeiLangParser ( Parser ):
grammarFileName = "ZmeiLangParser.g4"
atn = ATNDeserializer().deserialize(serializedATN())
decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ]
sharedContextCache = PredictionContextCache()
literalNames = [ "<INVALID>", "'@admin'", "'@suit'", "'@celery'", "'@stream'",
"'@channels'", "'@docker'", "'@api'", "'@rest'", "'@filer'",
"'@gitlab'", "'@react'", "'@react_client'", "'@react_server'",
"'@theme'", "'@@'", "'@file'", "'@get'", "'@menu'",
"'@crud'", "'@crud_detail'", "'@crud_list'", "'@crud_delete'",
"'@crud_edit'", "'@crud_create'", "'@post'", "'@error'",
"'@auth'", "'@markdown'", "'@html'", "'@tree'", "'@date_tree'",
"'@mixin'", "'@m2m_changed'", "'@post_delete'", "'@pre_delete'",
"'@post_save'", "'@pre_save'", "'@clean'", "'@order'",
"'@sortable'", "'@langs'", "'basic'", "'session'",
"'token'", "'text'", "'html'", "'html_media'", "'float'",
"'decimal'", "'date'", "'datetime'", "'create_time'",
"'update_time'", "'image'", "'file'", "'filer_image'",
"'filer_file'", "'filer_folder'", "'filer_image_folder'",
"'str'", "'int'", "'slug'", "'bool'", "'one'", "'one2one'",
"'many'", "'choices'", "'theme'", "'install'", "'header'",
"'services'", "'selenium_pytest'", "'child'", "'filter_out'",
"'filter_in'", "'page'", "'link_suffix'", "'url_prefix'",
"'can_edit'", "'object_expr'", "'block'", "'item_name'",
"'pk_param'", "'list_fields'", "'delete'", "'edit'",
"'create'", "'detail'", "'skip'", "'from'", "'+polymorphic_list'",
"'css'", "'js'", "'tabular'", "'stacked'", "'polymorphic'",
"'inline'", "'type'", "'user_field'", "'annotate'",
"'on_create'", "'query'", "'auth'", "'count'", "'i18n'",
"'extension'", "'tabs'", "'list'", "'read_only'", "'list_editable'",
"'list_filter'", "'list_search'", "'fields'", "'import'",
"'as'", "<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
"<INVALID>", "<INVALID>", "'<'", "'>'", "':'", "'^'",
"'('", "')'", "'['", "']'", "'?'", "'_'", "'-'", "','",
"'.'", "'#'", "'/'", "'='", "'$'", "'&'", "'!'", "'*'",
"'~'", "'|'", "<INVALID>", "<INVALID>", "<INVALID>",
"<INVALID>", "<INVALID>", "' '", "<INVALID>", "<INVALID>",
"<INVALID>", "<INVALID>", "<INVALID>", "<INVALID>",
"<INVALID>", "';'", "<INVALID>", "'\n'" ]
symbolicNames = [ "<INVALID>", "AN_ADMIN", "AN_SUIT", "AN_CELERY", "AN_STREAM",
"AN_CHANNELS", "AN_DOCKER", "AN_API", "AN_REST", "AN_FILER",
"AN_GITLAB", "AN_REACT", "AN_REACT_CLIENT", "AN_REACT_SERVER",
"AN_THEME", "AN_PRIORITY", "AN_FILE", "AN_GET", "AN_MENU",
"AN_CRUD", "AN_CRUD_DETAIL", "AN_CRUD_LIST", "AN_CRUD_DELETE",
"AN_CRUD_EDIT", "AN_CRUD_CREATE", "AN_POST", "AN_ERROR",
"AN_AUTH", "AN_MARKDOWN", "AN_HTML", "AN_TREE", "AN_DATE_TREE",
"AN_MIXIN", "AN_M2M_CHANGED", "AN_POST_DELETE", "AN_PRE_DELETE",
"AN_POST_SAVE", "AN_PRE_SAVE", "AN_CLEAN", "AN_ORDER",
"AN_SORTABLE", "AN_LANGS", "KW_AUTH_TYPE_BASIC", "KW_AUTH_TYPE_SESSION",
"KW_AUTH_TYPE_TOKEN", "COL_FIELD_TYPE_LONGTEXT", "COL_FIELD_TYPE_HTML",
"COL_FIELD_TYPE_HTML_MEDIA", "COL_FIELD_TYPE_FLOAT",
"COL_FIELD_TYPE_DECIMAL", "COL_FIELD_TYPE_DATE", "COL_FIELD_TYPE_DATETIME",
"COL_FIELD_TYPE_CREATE_TIME", "COL_FIELD_TYPE_UPDATE_TIME",
"COL_FIELD_TYPE_IMAGE", "COL_FIELD_TYPE_FILE", "COL_FIELD_TYPE_FILER_IMAGE",
"COL_FIELD_TYPE_FILER_FILE", "COL_FIELD_TYPE_FILER_FOLDER",
"COL_FIELD_TYPE_FILER_IMAGE_FOLDER", "COL_FIELD_TYPE_TEXT",
"COL_FIELD_TYPE_INT", "COL_FIELD_TYPE_SLUG", "COL_FIELD_TYPE_BOOL",
"COL_FIELD_TYPE_ONE", "COL_FIELD_TYPE_ONE2ONE", "COL_FIELD_TYPE_MANY",
"COL_FIELD_CHOICES", "KW_THEME", "KW_INSTALL", "KW_HEADER",
"KW_SERVICES", "KW_SELENIUM_PYTEST", "KW_CHILD", "KW_FILTER_OUT",
"KW_FILTER_IN", "KW_PAGE", "KW_LINK_SUFFIX", "KW_URL_PREFIX",
"KW_CAN_EDIT", "KW_OBJECT_EXPR", "KW_BLOCK", "KW_ITEM_NAME",
"KW_PK_PARAM", "KW_LIST_FIELDS", "KW_DELETE", "KW_EDIT",
"KW_CREATE", "KW_DETAIL", "KW_SKIP", "KW_FROM", "KW_POLY_LIST",
"KW_CSS", "KW_JS", "KW_INLINE_TYPE_TABULAR", "KW_INLINE_TYPE_STACKED",
"KW_INLINE_TYPE_POLYMORPHIC", "KW_INLINE", "KW_TYPE",
"KW_USER_FIELD", "KW_ANNOTATE", "KW_ON_CREATE", "KW_QUERY",
"KW_AUTH", "KW_COUNT", "KW_I18N", "KW_EXTENSION",
"KW_TABS", "KW_LIST", "KW_READ_ONLY", "KW_LIST_EDITABLE",
"KW_LIST_FILTER", "KW_LIST_SEARCH", "KW_FIELDS", "KW_IMPORT",
"KW_AS", "WRITE_MODE", "BOOL", "NL", "ID", "DIGIT",
"SIZE2D", "LT", "GT", "COLON", "EXCLUDE", "BRACE_OPEN",
"BRACE_CLOSE", "SQ_BRACE_OPEN", "SQ_BRACE_CLOSE",
"QUESTION_MARK", "UNDERSCORE", "DASH", "COMA", "DOT",
"HASH", "SLASH", "EQUALS", "DOLLAR", "AMP", "EXCLAM",
"STAR", "APPROX", "PIPE", "STRING_DQ", "STRING_SQ",
"COMMENT_LINE", "COMMENT_BLOCK", "UNICODE", "WS",
"COL_FIELD_CALCULATED", "ASSIGN", "ASSIGN_STATIC",
"CODE_BLOCK", "ERRCHAR", "PYTHON_CODE", "PYTHON_LINE_ERRCHAR",
"PYTHON_LINE_END", "PYTHON_EXPR_ERRCHAR", "PYTHON_LINE_NL" ]
RULE_col_file = 0
RULE_page_imports = 1
RULE_model_imports = 2
RULE_page_import_statement = 3
RULE_model_import_statement = 4
RULE_import_statement = 5
RULE_import_source = 6
RULE_import_list = 7
RULE_import_item = 8
RULE_import_item_name = 9
RULE_import_item_alias = 10
RULE_import_item_all = 11
RULE_id_or_kw = 12
RULE_classname = 13
RULE_model_ref = 14
RULE_field_list_expr = 15
RULE_field_list_expr_field = 16
RULE_write_mode_expr = 17
RULE_python_code = 18
RULE_code_line = 19
RULE_code_block = 20
RULE_cs_annotation = 21
RULE_an_suit = 22
RULE_an_suit_app_name = 23
RULE_an_celery = 24
RULE_an_channels = 25
RULE_an_docker = 26
RULE_an_filer = 27
RULE_an_gitlab = 28
RULE_an_gitlab_test_declaration = 29
RULE_an_gitlab_test_declaration_selenium_pytest = 30
RULE_an_gitlab_test_services = 31
RULE_an_gitlab_test_service = 32
RULE_an_gitlab_test_service_name = 33
RULE_an_gitlab_branch_declaration = 34
RULE_an_gitlab_branch_deploy_type = 35
RULE_an_gitlab_branch_name = 36
RULE_an_gitlab_deployment_name = 37
RULE_an_gitlab_deployment_host = 38
RULE_an_gitlab_deployment_variable = 39
RULE_an_gitlab_deployment_variable_name = 40
RULE_an_gitlab_deployment_variable_value = 41
RULE_an_file = 42
RULE_an_file_name = 43
RULE_an_theme = 44
RULE_an_theme_install = 45
RULE_an_theme_name = 46
RULE_an_langs = 47
RULE_an_langs_list = 48
RULE_col = 49
RULE_col_str_expr = 50
RULE_col_header = 51
RULE_col_header_line_separator = 52
RULE_col_verbose_name = 53
RULE_verbose_name_part = 54
RULE_col_base_name = 55
RULE_col_name = 56
RULE_col_field = 57
RULE_col_field_expr_or_def = 58
RULE_col_field_custom = 59
RULE_col_field_extend = 60
RULE_col_field_extend_append = 61
RULE_wrong_field_type = 62
RULE_col_field_expr = 63
RULE_col_field_expr_marker = 64
RULE_col_feild_expr_code = 65
RULE_string_or_quoted = 66
RULE_col_field_help_text = 67
RULE_col_field_verbose_name = 68
RULE_col_field_name = 69
RULE_col_modifier = 70
RULE_col_field_def = 71
RULE_field_longtext = 72
RULE_field_html = 73
RULE_field_html_media = 74
RULE_field_float = 75
RULE_field_decimal = 76
RULE_field_date = 77
RULE_field_datetime = 78
RULE_field_create_time = 79
RULE_field_update_time = 80
RULE_field_file = 81
RULE_field_filer_file = 82
RULE_field_filer_folder = 83
RULE_field_text = 84
RULE_field_text_size = 85
RULE_field_text_choices = 86
RULE_field_text_choice = 87
RULE_field_text_choice_val = 88
RULE_field_text_choice_key = 89
RULE_field_int = 90
RULE_field_int_choices = 91
RULE_field_int_choice = 92
RULE_field_int_choice_val = 93
RULE_field_int_choice_key = 94
RULE_field_slug = 95
RULE_field_slug_ref_field = 96
RULE_field_slug_ref_field_id = 97
RULE_field_bool = 98
RULE_field_bool_default = 99
RULE_field_image = 100
RULE_filer_image_type = 101
RULE_field_image_sizes = 102
RULE_field_image_size = 103
RULE_field_image_size_dimensions = 104
RULE_field_image_size_name = 105
RULE_field_image_filters = 106
RULE_field_image_filter = 107
RULE_field_relation = 108
RULE_field_relation_type = 109
RULE_field_relation_cascade_marker = 110
RULE_field_relation_target_ref = 111
RULE_field_relation_target_class = 112
RULE_field_relation_related_name = 113
RULE_model_annotation = 114
RULE_an_admin = 115
RULE_an_admin_js = 116
RULE_an_admin_css = 117
RULE_an_admin_css_file_name = 118
RULE_an_admin_js_file_name = 119
RULE_an_admin_inlines = 120
RULE_an_admin_inline = 121
RULE_inline_name = 122
RULE_inline_type = 123
RULE_inline_type_name = 124
RULE_inline_extension = 125
RULE_inline_fields = 126
RULE_an_admin_tabs = 127
RULE_an_admin_tab = 128
RULE_tab_name = 129
RULE_tab_verbose_name = 130
RULE_an_admin_list = 131
RULE_an_admin_read_only = 132
RULE_an_admin_list_editable = 133
RULE_an_admin_list_filter = 134
RULE_an_admin_list_search = 135
RULE_an_admin_fields = 136
RULE_an_api = 137
RULE_an_api_all = 138
RULE_an_api_name = 139
RULE_an_rest = 140
RULE_an_rest_config = 141
RULE_an_rest_main_part = 142
RULE_an_rest_descriptor = 143
RULE_an_rest_i18n = 144
RULE_an_rest_str = 145
RULE_an_rest_query = 146
RULE_an_rest_on_create = 147
RULE_an_rest_filter_in = 148
RULE_an_rest_filter_out = 149
RULE_an_rest_read_only = 150
RULE_an_rest_user_field = 151
RULE_an_rest_fields = 152
RULE_an_rest_fields_write_mode = 153
RULE_an_rest_auth = 154
RULE_an_rest_auth_type = 155
RULE_an_rest_auth_type_name = 156
RULE_an_rest_auth_token_model = 157
RULE_an_rest_auth_token_class = 158
RULE_an_rest_annotate = 159
RULE_an_rest_annotate_count = 160
RULE_an_rest_annotate_count_field = 161
RULE_an_rest_annotate_count_alias = 162
RULE_an_rest_inline = 163
RULE_an_rest_inline_decl = 164
RULE_an_rest_inline_name = 165
RULE_an_order = 166
RULE_an_order_fields = 167
RULE_an_clean = 168
RULE_an_pre_delete = 169
RULE_an_tree = 170
RULE_an_tree_poly = 171
RULE_an_mixin = 172
RULE_an_date_tree = 173
RULE_an_date_tree_field = 174
RULE_an_m2m_changed = 175
RULE_an_post_save = 176
RULE_an_pre_save = 177
RULE_an_post_delete = 178
RULE_an_sortable = 179
RULE_an_sortable_field_name = 180
RULE_page = 181
RULE_page_header = 182
RULE_page_base = 183
RULE_page_alias = 184
RULE_page_alias_name = 185
RULE_page_template = 186
RULE_template_name = 187
RULE_file_name_part = 188
RULE_page_url = 189
RULE_url_part = 190
RULE_url_param = 191
RULE_url_segment = 192
RULE_url_segments = 193
RULE_page_name = 194
RULE_page_body = 195
RULE_page_code = 196
RULE_page_field = 197
RULE_page_field_name = 198
RULE_page_field_code = 199
RULE_page_function = 200
RULE_page_function_name = 201
RULE_page_function_args = 202
RULE_page_function_arg = 203
RULE_page_annotation = 204
RULE_an_stream = 205
RULE_an_stream_model = 206
RULE_an_stream_target_model = 207
RULE_an_stream_target_filter = 208
RULE_an_stream_field_list = 209
RULE_an_stream_field_name = 210
RULE_an_react = 211
RULE_an_react_type = 212
RULE_an_react_descriptor = 213
RULE_an_react_child = 214
RULE_an_html = 215
RULE_an_html_descriptor = 216
RULE_an_markdown = 217
RULE_an_markdown_descriptor = 218
RULE_an_crud_delete = 219
RULE_an_crud = 220
RULE_an_crud_params = 221
RULE_an_crud_page_override = 222
RULE_an_crud_descriptor = 223
RULE_an_crud_next_page = 224
RULE_an_crud_next_page_event_name = 225
RULE_an_crud_next_page_url = 226
RULE_an_crud_next_page_url_val = 227
RULE_an_crud_target_model = 228
RULE_an_crud_target_filter = 229
RULE_an_crud_theme = 230
RULE_an_crud_url_prefix = 231
RULE_an_crud_url_prefix_val = 232
RULE_an_crud_link_suffix = 233
RULE_an_crud_link_suffix_val = 234
RULE_an_crud_item_name = 235
RULE_an_crud_object_expr = 236
RULE_an_crud_can_edit = 237
RULE_an_crud_block = 238
RULE_an_crud_pk_param = 239
RULE_an_crud_skip = 240
RULE_an_crud_skip_values = 241
RULE_an_crud_view_name = 242
RULE_an_crud_fields = 243
RULE_an_crud_list_type = 244
RULE_an_crud_list_type_var = 245
RULE_an_crud_header = 246
RULE_an_crud_header_enabled = 247
RULE_an_crud_fields_expr = 248
RULE_an_crud_field = 249
RULE_an_crud_field_spec = 250
RULE_an_crud_field_filter = 251
RULE_an_crud_list_fields = 252
RULE_an_crud_list_fields_expr = 253
RULE_an_crud_list_field = 254
RULE_an_crud_list_field_spec = 255
RULE_an_post = 256
RULE_an_auth = 257
RULE_an_crud_create = 258
RULE_an_crud_edit = 259
RULE_an_crud_list = 260
RULE_an_menu = 261
RULE_an_menu_descriptor = 262
RULE_an_menu_item = 263
RULE_an_menu_target = 264
RULE_an_menu_item_code = 265
RULE_an_menu_item_args = 266
RULE_an_menu_item_arg = 267
RULE_an_menu_item_arg_key = 268
RULE_an_menu_item_arg_val = 269
RULE_an_menu_item_url = 270
RULE_an_menu_item_page = 271
RULE_an_menu_item_page_ref = 272
RULE_an_menu_label = 273
RULE_an_crud_detail = 274
RULE_an_priority_marker = 275
RULE_an_get = 276
RULE_an_error = 277
RULE_an_error_code = 278
ruleNames = [ "col_file", "page_imports", "model_imports", "page_import_statement",
"model_import_statement", "import_statement", "import_source",
"import_list", "import_item", "import_item_name", "import_item_alias",
"import_item_all", "id_or_kw", "classname", "model_ref",
"field_list_expr", "field_list_expr_field", "write_mode_expr",
"python_code", "code_line", "code_block", "cs_annotation",
"an_suit", "an_suit_app_name", "an_celery", "an_channels",
"an_docker", "an_filer", "an_gitlab", "an_gitlab_test_declaration",
"an_gitlab_test_declaration_selenium_pytest", "an_gitlab_test_services",
"an_gitlab_test_service", "an_gitlab_test_service_name",
"an_gitlab_branch_declaration", "an_gitlab_branch_deploy_type",
"an_gitlab_branch_name", "an_gitlab_deployment_name",
"an_gitlab_deployment_host", "an_gitlab_deployment_variable",
"an_gitlab_deployment_variable_name", "an_gitlab_deployment_variable_value",
"an_file", "an_file_name", "an_theme", "an_theme_install",
"an_theme_name", "an_langs", "an_langs_list", "col",
"col_str_expr", "col_header", "col_header_line_separator",
"col_verbose_name", "verbose_name_part", "col_base_name",
"col_name", "col_field", "col_field_expr_or_def", "col_field_custom",
"col_field_extend", "col_field_extend_append", "wrong_field_type",
"col_field_expr", "col_field_expr_marker", "col_feild_expr_code",
"string_or_quoted", "col_field_help_text", "col_field_verbose_name",
"col_field_name", "col_modifier", "col_field_def", "field_longtext",
"field_html", "field_html_media", "field_float", "field_decimal",
"field_date", "field_datetime", "field_create_time",
"field_update_time", "field_file", "field_filer_file",
"field_filer_folder", "field_text", "field_text_size",
"field_text_choices", "field_text_choice", "field_text_choice_val",
"field_text_choice_key", "field_int", "field_int_choices",
"field_int_choice", "field_int_choice_val", "field_int_choice_key",
"field_slug", "field_slug_ref_field", "field_slug_ref_field_id",
"field_bool", "field_bool_default", "field_image", "filer_image_type",
"field_image_sizes", "field_image_size", "field_image_size_dimensions",
"field_image_size_name", "field_image_filters", "field_image_filter",
"field_relation", "field_relation_type", "field_relation_cascade_marker",
"field_relation_target_ref", "field_relation_target_class",
"field_relation_related_name", "model_annotation", "an_admin",
"an_admin_js", "an_admin_css", "an_admin_css_file_name",
"an_admin_js_file_name", "an_admin_inlines", "an_admin_inline",
"inline_name", "inline_type", "inline_type_name", "inline_extension",
"inline_fields", "an_admin_tabs", "an_admin_tab", "tab_name",
"tab_verbose_name", "an_admin_list", "an_admin_read_only",
"an_admin_list_editable", "an_admin_list_filter", "an_admin_list_search",
"an_admin_fields", "an_api", "an_api_all", "an_api_name",
"an_rest", "an_rest_config", "an_rest_main_part", "an_rest_descriptor",
"an_rest_i18n", "an_rest_str", "an_rest_query", "an_rest_on_create",
"an_rest_filter_in", "an_rest_filter_out", "an_rest_read_only",
"an_rest_user_field", "an_rest_fields", "an_rest_fields_write_mode",
"an_rest_auth", "an_rest_auth_type", "an_rest_auth_type_name",
"an_rest_auth_token_model", "an_rest_auth_token_class",
"an_rest_annotate", "an_rest_annotate_count", "an_rest_annotate_count_field",
"an_rest_annotate_count_alias", "an_rest_inline", "an_rest_inline_decl",
"an_rest_inline_name", "an_order", "an_order_fields",
"an_clean", "an_pre_delete", "an_tree", "an_tree_poly",
"an_mixin", "an_date_tree", "an_date_tree_field", "an_m2m_changed",
"an_post_save", "an_pre_save", "an_post_delete", "an_sortable",
"an_sortable_field_name", "page", "page_header", "page_base",
"page_alias", "page_alias_name", "page_template", "template_name",
"file_name_part", "page_url", "url_part", "url_param",
"url_segment", "url_segments", "page_name", "page_body",
"page_code", "page_field", "page_field_name", "page_field_code",
"page_function", "page_function_name", "page_function_args",
"page_function_arg", "page_annotation", "an_stream",
"an_stream_model", "an_stream_target_model", "an_stream_target_filter",
"an_stream_field_list", "an_stream_field_name", "an_react",
"an_react_type", "an_react_descriptor", "an_react_child",
"an_html", "an_html_descriptor", "an_markdown", "an_markdown_descriptor",
"an_crud_delete", "an_crud", "an_crud_params", "an_crud_page_override",
"an_crud_descriptor", "an_crud_next_page", "an_crud_next_page_event_name",
"an_crud_next_page_url", "an_crud_next_page_url_val",
"an_crud_target_model", "an_crud_target_filter", "an_crud_theme",
"an_crud_url_prefix", "an_crud_url_prefix_val", "an_crud_link_suffix",
"an_crud_link_suffix_val", "an_crud_item_name", "an_crud_object_expr",
"an_crud_can_edit", "an_crud_block", "an_crud_pk_param",
"an_crud_skip", "an_crud_skip_values", "an_crud_view_name",
"an_crud_fields", "an_crud_list_type", "an_crud_list_type_var",
"an_crud_header", "an_crud_header_enabled", "an_crud_fields_expr",
"an_crud_field", "an_crud_field_spec", "an_crud_field_filter",
"an_crud_list_fields", "an_crud_list_fields_expr", "an_crud_list_field",
"an_crud_list_field_spec", "an_post", "an_auth", "an_crud_create",
"an_crud_edit", "an_crud_list", "an_menu", "an_menu_descriptor",
"an_menu_item", "an_menu_target", "an_menu_item_code",
"an_menu_item_args", "an_menu_item_arg", "an_menu_item_arg_key",
"an_menu_item_arg_val", "an_menu_item_url", "an_menu_item_page",
"an_menu_item_page_ref", "an_menu_label", "an_crud_detail",
"an_priority_marker", "an_get", "an_error", "an_error_code" ]
EOF = Token.EOF
AN_ADMIN=1
AN_SUIT=2
AN_CELERY=3
AN_STREAM=4
AN_CHANNELS=5
AN_DOCKER=6
AN_API=7
AN_REST=8
AN_FILER=9
AN_GITLAB=10
AN_REACT=11
AN_REACT_CLIENT=12
AN_REACT_SERVER=13
AN_THEME=14
AN_PRIORITY=15
AN_FILE=16
AN_GET=17
AN_MENU=18
AN_CRUD=19
AN_CRUD_DETAIL=20
AN_CRUD_LIST=21
AN_CRUD_DELETE=22
AN_CRUD_EDIT=23
AN_CRUD_CREATE=24
AN_POST=25
AN_ERROR=26
AN_AUTH=27
AN_MARKDOWN=28
AN_HTML=29
AN_TREE=30
AN_DATE_TREE=31
AN_MIXIN=32
AN_M2M_CHANGED=33
AN_POST_DELETE=34
AN_PRE_DELETE=35
AN_POST_SAVE=36
AN_PRE_SAVE=37
AN_CLEAN=38
AN_ORDER=39
AN_SORTABLE=40
AN_LANGS=41
KW_AUTH_TYPE_BASIC=42
KW_AUTH_TYPE_SESSION=43
KW_AUTH_TYPE_TOKEN=44
COL_FIELD_TYPE_LONGTEXT=45
COL_FIELD_TYPE_HTML=46
COL_FIELD_TYPE_HTML_MEDIA=47
COL_FIELD_TYPE_FLOAT=48
COL_FIELD_TYPE_DECIMAL=49
COL_FIELD_TYPE_DATE=50
COL_FIELD_TYPE_DATETIME=51
COL_FIELD_TYPE_CREATE_TIME=52
COL_FIELD_TYPE_UPDATE_TIME=53
COL_FIELD_TYPE_IMAGE=54
COL_FIELD_TYPE_FILE=55
COL_FIELD_TYPE_FILER_IMAGE=56
COL_FIELD_TYPE_FILER_FILE=57
COL_FIELD_TYPE_FILER_FOLDER=58
COL_FIELD_TYPE_FILER_IMAGE_FOLDER=59
COL_FIELD_TYPE_TEXT=60
COL_FIELD_TYPE_INT=61
COL_FIELD_TYPE_SLUG=62
COL_FIELD_TYPE_BOOL=63
COL_FIELD_TYPE_ONE=64
COL_FIELD_TYPE_ONE2ONE=65
COL_FIELD_TYPE_MANY=66
COL_FIELD_CHOICES=67
KW_THEME=68
KW_INSTALL=69
KW_HEADER=70
KW_SERVICES=71
KW_SELENIUM_PYTEST=72
KW_CHILD=73
KW_FILTER_OUT=74
KW_FILTER_IN=75
KW_PAGE=76
KW_LINK_SUFFIX=77
KW_URL_PREFIX=78
KW_CAN_EDIT=79
KW_OBJECT_EXPR=80
KW_BLOCK=81
KW_ITEM_NAME=82
KW_PK_PARAM=83
KW_LIST_FIELDS=84
KW_DELETE=85
KW_EDIT=86
KW_CREATE=87
KW_DETAIL=88
KW_SKIP=89
KW_FROM=90
KW_POLY_LIST=91
KW_CSS=92
KW_JS=93
KW_INLINE_TYPE_TABULAR=94
KW_INLINE_TYPE_STACKED=95
KW_INLINE_TYPE_POLYMORPHIC=96
KW_INLINE=97
KW_TYPE=98
KW_USER_FIELD=99
KW_ANNOTATE=100
KW_ON_CREATE=101
KW_QUERY=102
KW_AUTH=103
KW_COUNT=104
KW_I18N=105
KW_EXTENSION=106
KW_TABS=107
KW_LIST=108
KW_READ_ONLY=109
KW_LIST_EDITABLE=110
KW_LIST_FILTER=111
KW_LIST_SEARCH=112
KW_FIELDS=113
KW_IMPORT=114
KW_AS=115
WRITE_MODE=116
BOOL=117
NL=118
ID=119
DIGIT=120
SIZE2D=121
LT=122
GT=123
COLON=124
EXCLUDE=125
BRACE_OPEN=126
BRACE_CLOSE=127
SQ_BRACE_OPEN=128
SQ_BRACE_CLOSE=129
QUESTION_MARK=130
UNDERSCORE=131
DASH=132
COMA=133
DOT=134
HASH=135
SLASH=136
EQUALS=137
DOLLAR=138
AMP=139
EXCLAM=140
STAR=141
APPROX=142
PIPE=143
STRING_DQ=144
STRING_SQ=145
COMMENT_LINE=146
COMMENT_BLOCK=147
UNICODE=148
WS=149
COL_FIELD_CALCULATED=150
ASSIGN=151
ASSIGN_STATIC=152
CODE_BLOCK=153
ERRCHAR=154
PYTHON_CODE=155
PYTHON_LINE_ERRCHAR=156
PYTHON_LINE_END=157
PYTHON_EXPR_ERRCHAR=158
PYTHON_LINE_NL=159
def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
super().__init__(input, output)
self.checkVersion("4.7.2")
self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache)
self._predicates = None
class Col_fileContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def EOF(self):
return self.getToken(ZmeiLangParser.EOF, 0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def cs_annotation(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Cs_annotationContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Cs_annotationContext,i)
def page_imports(self):
return self.getTypedRuleContext(ZmeiLangParser.Page_importsContext,0)
def page(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.PageContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.PageContext,i)
def model_imports(self):
return self.getTypedRuleContext(ZmeiLangParser.Model_importsContext,0)
def col(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.ColContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.ColContext,i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_col_file
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCol_file" ):
listener.enterCol_file(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCol_file" ):
listener.exitCol_file(self)
def col_file(self):
localctx = ZmeiLangParser.Col_fileContext(self, self._ctx, self.state)
self.enterRule(localctx, 0, self.RULE_col_file)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 561
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,0,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 558
self.match(ZmeiLangParser.NL)
self.state = 563
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,0,self._ctx)
self.state = 567
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,1,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 564
self.cs_annotation()
self.state = 569
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,1,self._ctx)
self.state = 573
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,2,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 570
self.match(ZmeiLangParser.NL)
self.state = 575
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,2,self._ctx)
self.state = 584
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,5,self._ctx)
if la_ == 1:
self.state = 577
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.KW_FROM or _la==ZmeiLangParser.KW_IMPORT:
self.state = 576
self.page_imports()
self.state = 580
self._errHandler.sync(self)
_la = self._input.LA(1)
while True:
self.state = 579
self.page()
self.state = 582
self._errHandler.sync(self)
_la = self._input.LA(1)
if not (_la==ZmeiLangParser.SQ_BRACE_OPEN):
break
self.state = 589
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,6,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 586
self.match(ZmeiLangParser.NL)
self.state = 591
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,6,self._ctx)
self.state = 600
self._errHandler.sync(self)
_la = self._input.LA(1)
if ((((_la - 90)) & ~0x3f) == 0 and ((1 << (_la - 90)) & ((1 << (ZmeiLangParser.KW_FROM - 90)) | (1 << (ZmeiLangParser.KW_IMPORT - 90)) | (1 << (ZmeiLangParser.HASH - 90)))) != 0):
self.state = 593
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.KW_FROM or _la==ZmeiLangParser.KW_IMPORT:
self.state = 592
self.model_imports()
self.state = 596
self._errHandler.sync(self)
_la = self._input.LA(1)
while True:
self.state = 595
self.col()
self.state = 598
self._errHandler.sync(self)
_la = self._input.LA(1)
if not (_la==ZmeiLangParser.HASH):
break
self.state = 605
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.NL:
self.state = 602
self.match(ZmeiLangParser.NL)
self.state = 607
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 608
self.match(ZmeiLangParser.EOF)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Page_importsContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def page_import_statement(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Page_import_statementContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Page_import_statementContext,i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_page_imports
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterPage_imports" ):
listener.enterPage_imports(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitPage_imports" ):
listener.exitPage_imports(self)
def page_imports(self):
localctx = ZmeiLangParser.Page_importsContext(self, self._ctx, self.state)
self.enterRule(localctx, 2, self.RULE_page_imports)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 611
self._errHandler.sync(self)
_la = self._input.LA(1)
while True:
self.state = 610
self.page_import_statement()
self.state = 613
self._errHandler.sync(self)
_la = self._input.LA(1)
if not (_la==ZmeiLangParser.KW_FROM or _la==ZmeiLangParser.KW_IMPORT):
break
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Model_importsContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def model_import_statement(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Model_import_statementContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Model_import_statementContext,i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_model_imports
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterModel_imports" ):
listener.enterModel_imports(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitModel_imports" ):
listener.exitModel_imports(self)
def model_imports(self):
localctx = ZmeiLangParser.Model_importsContext(self, self._ctx, self.state)
self.enterRule(localctx, 4, self.RULE_model_imports)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 616
self._errHandler.sync(self)
_la = self._input.LA(1)
while True:
self.state = 615
self.model_import_statement()
self.state = 618
self._errHandler.sync(self)
_la = self._input.LA(1)
if not (_la==ZmeiLangParser.KW_FROM or _la==ZmeiLangParser.KW_IMPORT):
break
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Page_import_statementContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def import_statement(self):
return self.getTypedRuleContext(ZmeiLangParser.Import_statementContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_page_import_statement
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterPage_import_statement" ):
listener.enterPage_import_statement(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitPage_import_statement" ):
listener.exitPage_import_statement(self)
def page_import_statement(self):
localctx = ZmeiLangParser.Page_import_statementContext(self, self._ctx, self.state)
self.enterRule(localctx, 6, self.RULE_page_import_statement)
try:
self.enterOuterAlt(localctx, 1)
self.state = 620
self.import_statement()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Model_import_statementContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def import_statement(self):
return self.getTypedRuleContext(ZmeiLangParser.Import_statementContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_model_import_statement
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterModel_import_statement" ):
listener.enterModel_import_statement(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitModel_import_statement" ):
listener.exitModel_import_statement(self)
def model_import_statement(self):
localctx = ZmeiLangParser.Model_import_statementContext(self, self._ctx, self.state)
self.enterRule(localctx, 8, self.RULE_model_import_statement)
try:
self.enterOuterAlt(localctx, 1)
self.state = 622
self.import_statement()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Import_statementContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_IMPORT(self):
return self.getToken(ZmeiLangParser.KW_IMPORT, 0)
def import_list(self):
return self.getTypedRuleContext(ZmeiLangParser.Import_listContext,0)
def KW_FROM(self):
return self.getToken(ZmeiLangParser.KW_FROM, 0)
def import_source(self):
return self.getTypedRuleContext(ZmeiLangParser.Import_sourceContext,0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_import_statement
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterImport_statement" ):
listener.enterImport_statement(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitImport_statement" ):
listener.exitImport_statement(self)
def import_statement(self):
localctx = ZmeiLangParser.Import_statementContext(self, self._ctx, self.state)
self.enterRule(localctx, 10, self.RULE_import_statement)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 626
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.KW_FROM:
self.state = 624
self.match(ZmeiLangParser.KW_FROM)
self.state = 625
self.import_source()
self.state = 628
self.match(ZmeiLangParser.KW_IMPORT)
self.state = 629
self.import_list()
self.state = 631
self._errHandler.sync(self)
_la = self._input.LA(1)
while True:
self.state = 630
self.match(ZmeiLangParser.NL)
self.state = 633
self._errHandler.sync(self)
_la = self._input.LA(1)
if not (_la==ZmeiLangParser.NL):
break
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Import_sourceContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def classname(self):
return self.getTypedRuleContext(ZmeiLangParser.ClassnameContext,0)
def DOT(self):
return self.getToken(ZmeiLangParser.DOT, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_import_source
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterImport_source" ):
listener.enterImport_source(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitImport_source" ):
listener.exitImport_source(self)
def import_source(self):
localctx = ZmeiLangParser.Import_sourceContext(self, self._ctx, self.state)
self.enterRule(localctx, 12, self.RULE_import_source)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 636
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.DOT:
self.state = 635
self.match(ZmeiLangParser.DOT)
self.state = 638
self.classname()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Import_listContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def import_item(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Import_itemContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Import_itemContext,i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_import_list
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterImport_list" ):
listener.enterImport_list(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitImport_list" ):
listener.exitImport_list(self)
def import_list(self):
localctx = ZmeiLangParser.Import_listContext(self, self._ctx, self.state)
self.enterRule(localctx, 14, self.RULE_import_list)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 640
self.import_item()
self.state = 645
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.COMA:
self.state = 641
self.match(ZmeiLangParser.COMA)
self.state = 642
self.import_item()
self.state = 647
self._errHandler.sync(self)
_la = self._input.LA(1)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Import_itemContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def import_item_name(self):
return self.getTypedRuleContext(ZmeiLangParser.Import_item_nameContext,0)
def KW_AS(self):
return self.getToken(ZmeiLangParser.KW_AS, 0)
def import_item_alias(self):
return self.getTypedRuleContext(ZmeiLangParser.Import_item_aliasContext,0)
def import_item_all(self):
return self.getTypedRuleContext(ZmeiLangParser.Import_item_allContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_import_item
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterImport_item" ):
listener.enterImport_item(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitImport_item" ):
listener.exitImport_item(self)
def import_item(self):
localctx = ZmeiLangParser.Import_itemContext(self, self._ctx, self.state)
self.enterRule(localctx, 16, self.RULE_import_item)
self._la = 0 # Token type
try:
self.state = 654
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID]:
self.enterOuterAlt(localctx, 1)
self.state = 648
self.import_item_name()
self.state = 651
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.KW_AS:
self.state = 649
self.match(ZmeiLangParser.KW_AS)
self.state = 650
self.import_item_alias()
pass
elif token in [ZmeiLangParser.STAR]:
self.enterOuterAlt(localctx, 2)
self.state = 653
self.import_item_all()
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Import_item_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def classname(self):
return self.getTypedRuleContext(ZmeiLangParser.ClassnameContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_import_item_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterImport_item_name" ):
listener.enterImport_item_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitImport_item_name" ):
listener.exitImport_item_name(self)
def import_item_name(self):
localctx = ZmeiLangParser.Import_item_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 18, self.RULE_import_item_name)
try:
self.enterOuterAlt(localctx, 1)
self.state = 656
self.classname()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Import_item_aliasContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_import_item_alias
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterImport_item_alias" ):
listener.enterImport_item_alias(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitImport_item_alias" ):
listener.exitImport_item_alias(self)
def import_item_alias(self):
localctx = ZmeiLangParser.Import_item_aliasContext(self, self._ctx, self.state)
self.enterRule(localctx, 20, self.RULE_import_item_alias)
try:
self.enterOuterAlt(localctx, 1)
self.state = 658
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Import_item_allContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def STAR(self):
return self.getToken(ZmeiLangParser.STAR, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_import_item_all
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterImport_item_all" ):
listener.enterImport_item_all(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitImport_item_all" ):
listener.exitImport_item_all(self)
def import_item_all(self):
localctx = ZmeiLangParser.Import_item_allContext(self, self._ctx, self.state)
self.enterRule(localctx, 22, self.RULE_import_item_all)
try:
self.enterOuterAlt(localctx, 1)
self.state = 660
self.match(ZmeiLangParser.STAR)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Id_or_kwContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def ID(self):
return self.getToken(ZmeiLangParser.ID, 0)
def BOOL(self):
return self.getToken(ZmeiLangParser.BOOL, 0)
def WRITE_MODE(self):
return self.getToken(ZmeiLangParser.WRITE_MODE, 0)
def KW_AUTH_TYPE_BASIC(self):
return self.getToken(ZmeiLangParser.KW_AUTH_TYPE_BASIC, 0)
def KW_AUTH_TYPE_SESSION(self):
return self.getToken(ZmeiLangParser.KW_AUTH_TYPE_SESSION, 0)
def KW_AUTH_TYPE_TOKEN(self):
return self.getToken(ZmeiLangParser.KW_AUTH_TYPE_TOKEN, 0)
def COL_FIELD_TYPE_LONGTEXT(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, 0)
def COL_FIELD_TYPE_HTML(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_HTML, 0)
def COL_FIELD_TYPE_HTML_MEDIA(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, 0)
def COL_FIELD_TYPE_FLOAT(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_FLOAT, 0)
def COL_FIELD_TYPE_DECIMAL(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, 0)
def COL_FIELD_TYPE_DATE(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_DATE, 0)
def COL_FIELD_TYPE_DATETIME(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_DATETIME, 0)
def COL_FIELD_TYPE_CREATE_TIME(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, 0)
def COL_FIELD_TYPE_UPDATE_TIME(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, 0)
def COL_FIELD_TYPE_IMAGE(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_IMAGE, 0)
def COL_FIELD_TYPE_FILE(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_FILE, 0)
def COL_FIELD_TYPE_FILER_IMAGE(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, 0)
def COL_FIELD_TYPE_FILER_FILE(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, 0)
def COL_FIELD_TYPE_FILER_FOLDER(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, 0)
def COL_FIELD_TYPE_FILER_IMAGE_FOLDER(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, 0)
def COL_FIELD_TYPE_TEXT(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_TEXT, 0)
def COL_FIELD_TYPE_INT(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_INT, 0)
def COL_FIELD_TYPE_SLUG(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_SLUG, 0)
def COL_FIELD_TYPE_BOOL(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_BOOL, 0)
def COL_FIELD_TYPE_ONE(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_ONE, 0)
def COL_FIELD_TYPE_ONE2ONE(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, 0)
def COL_FIELD_TYPE_MANY(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_MANY, 0)
def COL_FIELD_CHOICES(self):
return self.getToken(ZmeiLangParser.COL_FIELD_CHOICES, 0)
def KW_THEME(self):
return self.getToken(ZmeiLangParser.KW_THEME, 0)
def KW_INSTALL(self):
return self.getToken(ZmeiLangParser.KW_INSTALL, 0)
def KW_HEADER(self):
return self.getToken(ZmeiLangParser.KW_HEADER, 0)
def KW_SERVICES(self):
return self.getToken(ZmeiLangParser.KW_SERVICES, 0)
def KW_SELENIUM_PYTEST(self):
return self.getToken(ZmeiLangParser.KW_SELENIUM_PYTEST, 0)
def KW_CHILD(self):
return self.getToken(ZmeiLangParser.KW_CHILD, 0)
def KW_FILTER_OUT(self):
return self.getToken(ZmeiLangParser.KW_FILTER_OUT, 0)
def KW_FILTER_IN(self):
return self.getToken(ZmeiLangParser.KW_FILTER_IN, 0)
def KW_PAGE(self):
return self.getToken(ZmeiLangParser.KW_PAGE, 0)
def KW_LINK_SUFFIX(self):
return self.getToken(ZmeiLangParser.KW_LINK_SUFFIX, 0)
def KW_URL_PREFIX(self):
return self.getToken(ZmeiLangParser.KW_URL_PREFIX, 0)
def KW_CAN_EDIT(self):
return self.getToken(ZmeiLangParser.KW_CAN_EDIT, 0)
def KW_OBJECT_EXPR(self):
return self.getToken(ZmeiLangParser.KW_OBJECT_EXPR, 0)
def KW_BLOCK(self):
return self.getToken(ZmeiLangParser.KW_BLOCK, 0)
def KW_ITEM_NAME(self):
return self.getToken(ZmeiLangParser.KW_ITEM_NAME, 0)
def KW_PK_PARAM(self):
return self.getToken(ZmeiLangParser.KW_PK_PARAM, 0)
def KW_LIST_FIELDS(self):
return self.getToken(ZmeiLangParser.KW_LIST_FIELDS, 0)
def KW_DELETE(self):
return self.getToken(ZmeiLangParser.KW_DELETE, 0)
def KW_EDIT(self):
return self.getToken(ZmeiLangParser.KW_EDIT, 0)
def KW_CREATE(self):
return self.getToken(ZmeiLangParser.KW_CREATE, 0)
def KW_DETAIL(self):
return self.getToken(ZmeiLangParser.KW_DETAIL, 0)
def KW_SKIP(self):
return self.getToken(ZmeiLangParser.KW_SKIP, 0)
def KW_FROM(self):
return self.getToken(ZmeiLangParser.KW_FROM, 0)
def KW_POLY_LIST(self):
return self.getToken(ZmeiLangParser.KW_POLY_LIST, 0)
def KW_CSS(self):
return self.getToken(ZmeiLangParser.KW_CSS, 0)
def KW_JS(self):
return self.getToken(ZmeiLangParser.KW_JS, 0)
def KW_INLINE_TYPE_TABULAR(self):
return self.getToken(ZmeiLangParser.KW_INLINE_TYPE_TABULAR, 0)
def KW_INLINE_TYPE_STACKED(self):
return self.getToken(ZmeiLangParser.KW_INLINE_TYPE_STACKED, 0)
def KW_INLINE_TYPE_POLYMORPHIC(self):
return self.getToken(ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, 0)
def KW_INLINE(self):
return self.getToken(ZmeiLangParser.KW_INLINE, 0)
def KW_TYPE(self):
return self.getToken(ZmeiLangParser.KW_TYPE, 0)
def KW_USER_FIELD(self):
return self.getToken(ZmeiLangParser.KW_USER_FIELD, 0)
def KW_ANNOTATE(self):
return self.getToken(ZmeiLangParser.KW_ANNOTATE, 0)
def KW_ON_CREATE(self):
return self.getToken(ZmeiLangParser.KW_ON_CREATE, 0)
def KW_QUERY(self):
return self.getToken(ZmeiLangParser.KW_QUERY, 0)
def KW_AUTH(self):
return self.getToken(ZmeiLangParser.KW_AUTH, 0)
def KW_COUNT(self):
return self.getToken(ZmeiLangParser.KW_COUNT, 0)
def KW_I18N(self):
return self.getToken(ZmeiLangParser.KW_I18N, 0)
def KW_EXTENSION(self):
return self.getToken(ZmeiLangParser.KW_EXTENSION, 0)
def KW_TABS(self):
return self.getToken(ZmeiLangParser.KW_TABS, 0)
def KW_LIST(self):
return self.getToken(ZmeiLangParser.KW_LIST, 0)
def KW_READ_ONLY(self):
return self.getToken(ZmeiLangParser.KW_READ_ONLY, 0)
def KW_LIST_EDITABLE(self):
return self.getToken(ZmeiLangParser.KW_LIST_EDITABLE, 0)
def KW_LIST_FILTER(self):
return self.getToken(ZmeiLangParser.KW_LIST_FILTER, 0)
def KW_LIST_SEARCH(self):
return self.getToken(ZmeiLangParser.KW_LIST_SEARCH, 0)
def KW_FIELDS(self):
return self.getToken(ZmeiLangParser.KW_FIELDS, 0)
def KW_IMPORT(self):
return self.getToken(ZmeiLangParser.KW_IMPORT, 0)
def KW_AS(self):
return self.getToken(ZmeiLangParser.KW_AS, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_id_or_kw
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterId_or_kw" ):
listener.enterId_or_kw(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitId_or_kw" ):
listener.exitId_or_kw(self)
def id_or_kw(self):
localctx = ZmeiLangParser.Id_or_kwContext(self, self._ctx, self.state)
self.enterRule(localctx, 24, self.RULE_id_or_kw)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 662
_la = self._input.LA(1)
if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << ZmeiLangParser.KW_AUTH_TYPE_BASIC) | (1 << ZmeiLangParser.KW_AUTH_TYPE_SESSION) | (1 << ZmeiLangParser.KW_AUTH_TYPE_TOKEN) | (1 << ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT) | (1 << ZmeiLangParser.COL_FIELD_TYPE_HTML) | (1 << ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA) | (1 << ZmeiLangParser.COL_FIELD_TYPE_FLOAT) | (1 << ZmeiLangParser.COL_FIELD_TYPE_DECIMAL) | (1 << ZmeiLangParser.COL_FIELD_TYPE_DATE) | (1 << ZmeiLangParser.COL_FIELD_TYPE_DATETIME) | (1 << ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME) | (1 << ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME) | (1 << ZmeiLangParser.COL_FIELD_TYPE_IMAGE) | (1 << ZmeiLangParser.COL_FIELD_TYPE_FILE) | (1 << ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE) | (1 << ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE) | (1 << ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER) | (1 << ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER) | (1 << ZmeiLangParser.COL_FIELD_TYPE_TEXT) | (1 << ZmeiLangParser.COL_FIELD_TYPE_INT) | (1 << ZmeiLangParser.COL_FIELD_TYPE_SLUG) | (1 << ZmeiLangParser.COL_FIELD_TYPE_BOOL))) != 0) or ((((_la - 64)) & ~0x3f) == 0 and ((1 << (_la - 64)) & ((1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE - 64)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE - 64)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_MANY - 64)) | (1 << (ZmeiLangParser.COL_FIELD_CHOICES - 64)) | (1 << (ZmeiLangParser.KW_THEME - 64)) | (1 << (ZmeiLangParser.KW_INSTALL - 64)) | (1 << (ZmeiLangParser.KW_HEADER - 64)) | (1 << (ZmeiLangParser.KW_SERVICES - 64)) | (1 << (ZmeiLangParser.KW_SELENIUM_PYTEST - 64)) | (1 << (ZmeiLangParser.KW_CHILD - 64)) | (1 << (ZmeiLangParser.KW_FILTER_OUT - 64)) | (1 << (ZmeiLangParser.KW_FILTER_IN - 64)) | (1 << (ZmeiLangParser.KW_PAGE - 64)) | (1 << (ZmeiLangParser.KW_LINK_SUFFIX - 64)) | (1 << (ZmeiLangParser.KW_URL_PREFIX - 64)) | (1 << (ZmeiLangParser.KW_CAN_EDIT - 64)) | (1 << (ZmeiLangParser.KW_OBJECT_EXPR - 64)) | (1 << (ZmeiLangParser.KW_BLOCK - 64)) | (1 << (ZmeiLangParser.KW_ITEM_NAME - 64)) | (1 << (ZmeiLangParser.KW_PK_PARAM - 64)) | (1 << (ZmeiLangParser.KW_LIST_FIELDS - 64)) | (1 << (ZmeiLangParser.KW_DELETE - 64)) | (1 << (ZmeiLangParser.KW_EDIT - 64)) | (1 << (ZmeiLangParser.KW_CREATE - 64)) | (1 << (ZmeiLangParser.KW_DETAIL - 64)) | (1 << (ZmeiLangParser.KW_SKIP - 64)) | (1 << (ZmeiLangParser.KW_FROM - 64)) | (1 << (ZmeiLangParser.KW_POLY_LIST - 64)) | (1 << (ZmeiLangParser.KW_CSS - 64)) | (1 << (ZmeiLangParser.KW_JS - 64)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_TABULAR - 64)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_STACKED - 64)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC - 64)) | (1 << (ZmeiLangParser.KW_INLINE - 64)) | (1 << (ZmeiLangParser.KW_TYPE - 64)) | (1 << (ZmeiLangParser.KW_USER_FIELD - 64)) | (1 << (ZmeiLangParser.KW_ANNOTATE - 64)) | (1 << (ZmeiLangParser.KW_ON_CREATE - 64)) | (1 << (ZmeiLangParser.KW_QUERY - 64)) | (1 << (ZmeiLangParser.KW_AUTH - 64)) | (1 << (ZmeiLangParser.KW_COUNT - 64)) | (1 << (ZmeiLangParser.KW_I18N - 64)) | (1 << (ZmeiLangParser.KW_EXTENSION - 64)) | (1 << (ZmeiLangParser.KW_TABS - 64)) | (1 << (ZmeiLangParser.KW_LIST - 64)) | (1 << (ZmeiLangParser.KW_READ_ONLY - 64)) | (1 << (ZmeiLangParser.KW_LIST_EDITABLE - 64)) | (1 << (ZmeiLangParser.KW_LIST_FILTER - 64)) | (1 << (ZmeiLangParser.KW_LIST_SEARCH - 64)) | (1 << (ZmeiLangParser.KW_FIELDS - 64)) | (1 << (ZmeiLangParser.KW_IMPORT - 64)) | (1 << (ZmeiLangParser.KW_AS - 64)) | (1 << (ZmeiLangParser.WRITE_MODE - 64)) | (1 << (ZmeiLangParser.BOOL - 64)) | (1 << (ZmeiLangParser.ID - 64)))) != 0)):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class ClassnameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Id_or_kwContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,i)
def DOT(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.DOT)
else:
return self.getToken(ZmeiLangParser.DOT, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_classname
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterClassname" ):
listener.enterClassname(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitClassname" ):
listener.exitClassname(self)
def classname(self):
localctx = ZmeiLangParser.ClassnameContext(self, self._ctx, self.state)
self.enterRule(localctx, 26, self.RULE_classname)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 664
self.id_or_kw()
self.state = 669
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.DOT:
self.state = 665
self.match(ZmeiLangParser.DOT)
self.state = 666
self.id_or_kw()
self.state = 671
self._errHandler.sync(self)
_la = self._input.LA(1)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Model_refContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def HASH(self):
return self.getToken(ZmeiLangParser.HASH, 0)
def id_or_kw(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Id_or_kwContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,i)
def DOT(self):
return self.getToken(ZmeiLangParser.DOT, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_model_ref
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterModel_ref" ):
listener.enterModel_ref(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitModel_ref" ):
listener.exitModel_ref(self)
def model_ref(self):
localctx = ZmeiLangParser.Model_refContext(self, self._ctx, self.state)
self.enterRule(localctx, 28, self.RULE_model_ref)
try:
self.enterOuterAlt(localctx, 1)
self.state = 672
self.match(ZmeiLangParser.HASH)
self.state = 676
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,20,self._ctx)
if la_ == 1:
self.state = 673
self.id_or_kw()
self.state = 674
self.match(ZmeiLangParser.DOT)
self.state = 678
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_list_exprContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def STAR(self):
return self.getToken(ZmeiLangParser.STAR, 0)
def DOT(self):
return self.getToken(ZmeiLangParser.DOT, 0)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def EXCLUDE(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.EXCLUDE)
else:
return self.getToken(ZmeiLangParser.EXCLUDE, i)
def field_list_expr_field(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Field_list_expr_fieldContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Field_list_expr_fieldContext,i)
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_list_expr
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_list_expr" ):
listener.enterField_list_expr(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_list_expr" ):
listener.exitField_list_expr(self)
def field_list_expr(self):
localctx = ZmeiLangParser.Field_list_exprContext(self, self._ctx, self.state)
self.enterRule(localctx, 30, self.RULE_field_list_expr)
self._la = 0 # Token type
try:
self.state = 703
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.DOT, ZmeiLangParser.STAR]:
self.enterOuterAlt(localctx, 1)
self.state = 681
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.DOT:
self.state = 680
self.match(ZmeiLangParser.DOT)
self.state = 683
self.match(ZmeiLangParser.STAR)
self.state = 689
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,22,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 684
self.match(ZmeiLangParser.COMA)
self.state = 685
self.match(ZmeiLangParser.EXCLUDE)
self.state = 686
self.field_list_expr_field()
self.state = 691
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,22,self._ctx)
pass
elif token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID]:
self.enterOuterAlt(localctx, 2)
self.state = 692
self.id_or_kw()
self.state = 700
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,24,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 693
self.match(ZmeiLangParser.COMA)
self.state = 695
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.EXCLUDE:
self.state = 694
self.match(ZmeiLangParser.EXCLUDE)
self.state = 697
self.field_list_expr_field()
self.state = 702
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,24,self._ctx)
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_list_expr_fieldContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def STAR(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.STAR)
else:
return self.getToken(ZmeiLangParser.STAR, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_list_expr_field
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_list_expr_field" ):
listener.enterField_list_expr_field(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_list_expr_field" ):
listener.exitField_list_expr_field(self)
def field_list_expr_field(self):
localctx = ZmeiLangParser.Field_list_expr_fieldContext(self, self._ctx, self.state)
self.enterRule(localctx, 32, self.RULE_field_list_expr_field)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 706
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.STAR:
self.state = 705
self.match(ZmeiLangParser.STAR)
self.state = 708
self.id_or_kw()
self.state = 710
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.STAR:
self.state = 709
self.match(ZmeiLangParser.STAR)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Write_mode_exprContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def SQ_BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.SQ_BRACE_OPEN, 0)
def WRITE_MODE(self):
return self.getToken(ZmeiLangParser.WRITE_MODE, 0)
def SQ_BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.SQ_BRACE_CLOSE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_write_mode_expr
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterWrite_mode_expr" ):
listener.enterWrite_mode_expr(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitWrite_mode_expr" ):
listener.exitWrite_mode_expr(self)
def write_mode_expr(self):
localctx = ZmeiLangParser.Write_mode_exprContext(self, self._ctx, self.state)
self.enterRule(localctx, 34, self.RULE_write_mode_expr)
try:
self.enterOuterAlt(localctx, 1)
self.state = 712
self.match(ZmeiLangParser.SQ_BRACE_OPEN)
self.state = 713
self.match(ZmeiLangParser.WRITE_MODE)
self.state = 714
self.match(ZmeiLangParser.SQ_BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Python_codeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def code_block(self):
return self.getTypedRuleContext(ZmeiLangParser.Code_blockContext,0)
def code_line(self):
return self.getTypedRuleContext(ZmeiLangParser.Code_lineContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_python_code
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterPython_code" ):
listener.enterPython_code(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitPython_code" ):
listener.exitPython_code(self)
def python_code(self):
localctx = ZmeiLangParser.Python_codeContext(self, self._ctx, self.state)
self.enterRule(localctx, 36, self.RULE_python_code)
try:
self.state = 718
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.CODE_BLOCK]:
self.enterOuterAlt(localctx, 1)
self.state = 716
self.code_block()
pass
elif token in [ZmeiLangParser.ASSIGN]:
self.enterOuterAlt(localctx, 2)
self.state = 717
self.code_line()
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Code_lineContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def ASSIGN(self):
return self.getToken(ZmeiLangParser.ASSIGN, 0)
def PYTHON_CODE(self):
return self.getToken(ZmeiLangParser.PYTHON_CODE, 0)
def NL(self):
return self.getToken(ZmeiLangParser.NL, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_code_line
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCode_line" ):
listener.enterCode_line(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCode_line" ):
listener.exitCode_line(self)
def code_line(self):
localctx = ZmeiLangParser.Code_lineContext(self, self._ctx, self.state)
self.enterRule(localctx, 38, self.RULE_code_line)
try:
self.enterOuterAlt(localctx, 1)
self.state = 720
self.match(ZmeiLangParser.ASSIGN)
self.state = 721
self.match(ZmeiLangParser.PYTHON_CODE)
self.state = 722
self.match(ZmeiLangParser.NL)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Code_blockContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def CODE_BLOCK(self):
return self.getToken(ZmeiLangParser.CODE_BLOCK, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_code_block
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCode_block" ):
listener.enterCode_block(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCode_block" ):
listener.exitCode_block(self)
def code_block(self):
localctx = ZmeiLangParser.Code_blockContext(self, self._ctx, self.state)
self.enterRule(localctx, 40, self.RULE_code_block)
try:
self.enterOuterAlt(localctx, 1)
self.state = 724
self.match(ZmeiLangParser.CODE_BLOCK)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Cs_annotationContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def an_suit(self):
return self.getTypedRuleContext(ZmeiLangParser.An_suitContext,0)
def an_celery(self):
return self.getTypedRuleContext(ZmeiLangParser.An_celeryContext,0)
def an_channels(self):
return self.getTypedRuleContext(ZmeiLangParser.An_channelsContext,0)
def an_docker(self):
return self.getTypedRuleContext(ZmeiLangParser.An_dockerContext,0)
def an_filer(self):
return self.getTypedRuleContext(ZmeiLangParser.An_filerContext,0)
def an_gitlab(self):
return self.getTypedRuleContext(ZmeiLangParser.An_gitlabContext,0)
def an_file(self):
return self.getTypedRuleContext(ZmeiLangParser.An_fileContext,0)
def an_theme(self):
return self.getTypedRuleContext(ZmeiLangParser.An_themeContext,0)
def an_langs(self):
return self.getTypedRuleContext(ZmeiLangParser.An_langsContext,0)
def NL(self):
return self.getToken(ZmeiLangParser.NL, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_cs_annotation
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCs_annotation" ):
listener.enterCs_annotation(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCs_annotation" ):
listener.exitCs_annotation(self)
def cs_annotation(self):
localctx = ZmeiLangParser.Cs_annotationContext(self, self._ctx, self.state)
self.enterRule(localctx, 42, self.RULE_cs_annotation)
try:
self.state = 736
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.AN_SUIT]:
self.enterOuterAlt(localctx, 1)
self.state = 726
self.an_suit()
pass
elif token in [ZmeiLangParser.AN_CELERY]:
self.enterOuterAlt(localctx, 2)
self.state = 727
self.an_celery()
pass
elif token in [ZmeiLangParser.AN_CHANNELS]:
self.enterOuterAlt(localctx, 3)
self.state = 728
self.an_channels()
pass
elif token in [ZmeiLangParser.AN_DOCKER]:
self.enterOuterAlt(localctx, 4)
self.state = 729
self.an_docker()
pass
elif token in [ZmeiLangParser.AN_FILER]:
self.enterOuterAlt(localctx, 5)
self.state = 730
self.an_filer()
pass
elif token in [ZmeiLangParser.AN_GITLAB]:
self.enterOuterAlt(localctx, 6)
self.state = 731
self.an_gitlab()
pass
elif token in [ZmeiLangParser.AN_FILE]:
self.enterOuterAlt(localctx, 7)
self.state = 732
self.an_file()
pass
elif token in [ZmeiLangParser.AN_THEME]:
self.enterOuterAlt(localctx, 8)
self.state = 733
self.an_theme()
pass
elif token in [ZmeiLangParser.AN_LANGS]:
self.enterOuterAlt(localctx, 9)
self.state = 734
self.an_langs()
pass
elif token in [ZmeiLangParser.NL]:
self.enterOuterAlt(localctx, 10)
self.state = 735
self.match(ZmeiLangParser.NL)
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_suitContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_SUIT(self):
return self.getToken(ZmeiLangParser.AN_SUIT, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def an_suit_app_name(self):
return self.getTypedRuleContext(ZmeiLangParser.An_suit_app_nameContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_suit
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_suit" ):
listener.enterAn_suit(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_suit" ):
listener.exitAn_suit(self)
def an_suit(self):
localctx = ZmeiLangParser.An_suitContext(self, self._ctx, self.state)
self.enterRule(localctx, 44, self.RULE_an_suit)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 738
self.match(ZmeiLangParser.AN_SUIT)
self.state = 743
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.BRACE_OPEN:
self.state = 739
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 740
self.an_suit_app_name()
self.state = 741
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_suit_app_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def STRING_DQ(self):
return self.getToken(ZmeiLangParser.STRING_DQ, 0)
def STRING_SQ(self):
return self.getToken(ZmeiLangParser.STRING_SQ, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_suit_app_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_suit_app_name" ):
listener.enterAn_suit_app_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_suit_app_name" ):
listener.exitAn_suit_app_name(self)
def an_suit_app_name(self):
localctx = ZmeiLangParser.An_suit_app_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 46, self.RULE_an_suit_app_name)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 745
_la = self._input.LA(1)
if not(_la==ZmeiLangParser.STRING_DQ or _la==ZmeiLangParser.STRING_SQ):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_celeryContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_CELERY(self):
return self.getToken(ZmeiLangParser.AN_CELERY, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_celery
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_celery" ):
listener.enterAn_celery(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_celery" ):
listener.exitAn_celery(self)
def an_celery(self):
localctx = ZmeiLangParser.An_celeryContext(self, self._ctx, self.state)
self.enterRule(localctx, 48, self.RULE_an_celery)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 747
self.match(ZmeiLangParser.AN_CELERY)
self.state = 750
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.BRACE_OPEN:
self.state = 748
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 749
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_channelsContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_CHANNELS(self):
return self.getToken(ZmeiLangParser.AN_CHANNELS, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_channels
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_channels" ):
listener.enterAn_channels(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_channels" ):
listener.exitAn_channels(self)
def an_channels(self):
localctx = ZmeiLangParser.An_channelsContext(self, self._ctx, self.state)
self.enterRule(localctx, 50, self.RULE_an_channels)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 752
self.match(ZmeiLangParser.AN_CHANNELS)
self.state = 755
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.BRACE_OPEN:
self.state = 753
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 754
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_dockerContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_DOCKER(self):
return self.getToken(ZmeiLangParser.AN_DOCKER, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_docker
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_docker" ):
listener.enterAn_docker(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_docker" ):
listener.exitAn_docker(self)
def an_docker(self):
localctx = ZmeiLangParser.An_dockerContext(self, self._ctx, self.state)
self.enterRule(localctx, 52, self.RULE_an_docker)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 757
self.match(ZmeiLangParser.AN_DOCKER)
self.state = 760
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.BRACE_OPEN:
self.state = 758
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 759
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_filerContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_FILER(self):
return self.getToken(ZmeiLangParser.AN_FILER, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_filer
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_filer" ):
listener.enterAn_filer(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_filer" ):
listener.exitAn_filer(self)
def an_filer(self):
localctx = ZmeiLangParser.An_filerContext(self, self._ctx, self.state)
self.enterRule(localctx, 54, self.RULE_an_filer)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 762
self.match(ZmeiLangParser.AN_FILER)
self.state = 765
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.BRACE_OPEN:
self.state = 763
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 764
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_gitlabContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_GITLAB(self):
return self.getToken(ZmeiLangParser.AN_GITLAB, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def an_gitlab_test_declaration(self):
return self.getTypedRuleContext(ZmeiLangParser.An_gitlab_test_declarationContext,0)
def an_gitlab_branch_declaration(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_gitlab_branch_declarationContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_gitlab_branch_declarationContext,i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_gitlab
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_gitlab" ):
listener.enterAn_gitlab(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_gitlab" ):
listener.exitAn_gitlab(self)
def an_gitlab(self):
localctx = ZmeiLangParser.An_gitlabContext(self, self._ctx, self.state)
self.enterRule(localctx, 56, self.RULE_an_gitlab)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 767
self.match(ZmeiLangParser.AN_GITLAB)
self.state = 768
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 772
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,35,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 769
self.match(ZmeiLangParser.NL)
self.state = 774
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,35,self._ctx)
self.state = 776
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,36,self._ctx)
if la_ == 1:
self.state = 775
self.an_gitlab_test_declaration()
self.state = 781
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.NL:
self.state = 778
self.match(ZmeiLangParser.NL)
self.state = 783
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 785
self._errHandler.sync(self)
_la = self._input.LA(1)
while True:
self.state = 784
self.an_gitlab_branch_declaration()
self.state = 787
self._errHandler.sync(self)
_la = self._input.LA(1)
if not (((((_la - 42)) & ~0x3f) == 0 and ((1 << (_la - 42)) & ((1 << (ZmeiLangParser.KW_AUTH_TYPE_BASIC - 42)) | (1 << (ZmeiLangParser.KW_AUTH_TYPE_SESSION - 42)) | (1 << (ZmeiLangParser.KW_AUTH_TYPE_TOKEN - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_HTML - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FLOAT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DECIMAL - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DATE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DATETIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_IMAGE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_TEXT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_INT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_SLUG - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_BOOL - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_MANY - 42)) | (1 << (ZmeiLangParser.COL_FIELD_CHOICES - 42)) | (1 << (ZmeiLangParser.KW_THEME - 42)) | (1 << (ZmeiLangParser.KW_INSTALL - 42)) | (1 << (ZmeiLangParser.KW_HEADER - 42)) | (1 << (ZmeiLangParser.KW_SERVICES - 42)) | (1 << (ZmeiLangParser.KW_SELENIUM_PYTEST - 42)) | (1 << (ZmeiLangParser.KW_CHILD - 42)) | (1 << (ZmeiLangParser.KW_FILTER_OUT - 42)) | (1 << (ZmeiLangParser.KW_FILTER_IN - 42)) | (1 << (ZmeiLangParser.KW_PAGE - 42)) | (1 << (ZmeiLangParser.KW_LINK_SUFFIX - 42)) | (1 << (ZmeiLangParser.KW_URL_PREFIX - 42)) | (1 << (ZmeiLangParser.KW_CAN_EDIT - 42)) | (1 << (ZmeiLangParser.KW_OBJECT_EXPR - 42)) | (1 << (ZmeiLangParser.KW_BLOCK - 42)) | (1 << (ZmeiLangParser.KW_ITEM_NAME - 42)) | (1 << (ZmeiLangParser.KW_PK_PARAM - 42)) | (1 << (ZmeiLangParser.KW_LIST_FIELDS - 42)) | (1 << (ZmeiLangParser.KW_DELETE - 42)) | (1 << (ZmeiLangParser.KW_EDIT - 42)) | (1 << (ZmeiLangParser.KW_CREATE - 42)) | (1 << (ZmeiLangParser.KW_DETAIL - 42)) | (1 << (ZmeiLangParser.KW_SKIP - 42)) | (1 << (ZmeiLangParser.KW_FROM - 42)) | (1 << (ZmeiLangParser.KW_POLY_LIST - 42)) | (1 << (ZmeiLangParser.KW_CSS - 42)) | (1 << (ZmeiLangParser.KW_JS - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_TABULAR - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_STACKED - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC - 42)) | (1 << (ZmeiLangParser.KW_INLINE - 42)) | (1 << (ZmeiLangParser.KW_TYPE - 42)) | (1 << (ZmeiLangParser.KW_USER_FIELD - 42)) | (1 << (ZmeiLangParser.KW_ANNOTATE - 42)) | (1 << (ZmeiLangParser.KW_ON_CREATE - 42)) | (1 << (ZmeiLangParser.KW_QUERY - 42)) | (1 << (ZmeiLangParser.KW_AUTH - 42)) | (1 << (ZmeiLangParser.KW_COUNT - 42)) | (1 << (ZmeiLangParser.KW_I18N - 42)))) != 0) or ((((_la - 106)) & ~0x3f) == 0 and ((1 << (_la - 106)) & ((1 << (ZmeiLangParser.KW_EXTENSION - 106)) | (1 << (ZmeiLangParser.KW_TABS - 106)) | (1 << (ZmeiLangParser.KW_LIST - 106)) | (1 << (ZmeiLangParser.KW_READ_ONLY - 106)) | (1 << (ZmeiLangParser.KW_LIST_EDITABLE - 106)) | (1 << (ZmeiLangParser.KW_LIST_FILTER - 106)) | (1 << (ZmeiLangParser.KW_LIST_SEARCH - 106)) | (1 << (ZmeiLangParser.KW_FIELDS - 106)) | (1 << (ZmeiLangParser.KW_IMPORT - 106)) | (1 << (ZmeiLangParser.KW_AS - 106)) | (1 << (ZmeiLangParser.WRITE_MODE - 106)) | (1 << (ZmeiLangParser.BOOL - 106)) | (1 << (ZmeiLangParser.ID - 106)) | (1 << (ZmeiLangParser.DASH - 106)) | (1 << (ZmeiLangParser.SLASH - 106)) | (1 << (ZmeiLangParser.STAR - 106)))) != 0)):
break
self.state = 792
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.NL:
self.state = 789
self.match(ZmeiLangParser.NL)
self.state = 794
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 795
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_gitlab_test_declarationContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def an_gitlab_test_declaration_selenium_pytest(self):
return self.getTypedRuleContext(ZmeiLangParser.An_gitlab_test_declaration_selenium_pytestContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_gitlab_test_declaration
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_gitlab_test_declaration" ):
listener.enterAn_gitlab_test_declaration(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_gitlab_test_declaration" ):
listener.exitAn_gitlab_test_declaration(self)
def an_gitlab_test_declaration(self):
localctx = ZmeiLangParser.An_gitlab_test_declarationContext(self, self._ctx, self.state)
self.enterRule(localctx, 58, self.RULE_an_gitlab_test_declaration)
try:
self.enterOuterAlt(localctx, 1)
self.state = 797
self.an_gitlab_test_declaration_selenium_pytest()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_gitlab_test_declaration_selenium_pytestContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_SELENIUM_PYTEST(self):
return self.getToken(ZmeiLangParser.KW_SELENIUM_PYTEST, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def an_gitlab_test_services(self):
return self.getTypedRuleContext(ZmeiLangParser.An_gitlab_test_servicesContext,0)
def an_gitlab_deployment_variable(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_gitlab_deployment_variableContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_gitlab_deployment_variableContext,i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_gitlab_test_declaration_selenium_pytest
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_gitlab_test_declaration_selenium_pytest" ):
listener.enterAn_gitlab_test_declaration_selenium_pytest(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_gitlab_test_declaration_selenium_pytest" ):
listener.exitAn_gitlab_test_declaration_selenium_pytest(self)
def an_gitlab_test_declaration_selenium_pytest(self):
localctx = ZmeiLangParser.An_gitlab_test_declaration_selenium_pytestContext(self, self._ctx, self.state)
self.enterRule(localctx, 60, self.RULE_an_gitlab_test_declaration_selenium_pytest)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 799
self.match(ZmeiLangParser.KW_SELENIUM_PYTEST)
self.state = 800
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 804
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,40,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 801
self.match(ZmeiLangParser.NL)
self.state = 806
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,40,self._ctx)
self.state = 808
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,41,self._ctx)
if la_ == 1:
self.state = 807
self.an_gitlab_test_services()
self.state = 813
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,42,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 810
self.match(ZmeiLangParser.NL)
self.state = 815
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,42,self._ctx)
self.state = 822
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,44,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 816
self.an_gitlab_deployment_variable()
self.state = 818
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.COMA:
self.state = 817
self.match(ZmeiLangParser.COMA)
self.state = 824
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,44,self._ctx)
self.state = 828
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.NL:
self.state = 825
self.match(ZmeiLangParser.NL)
self.state = 830
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 831
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_gitlab_test_servicesContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_SERVICES(self):
return self.getToken(ZmeiLangParser.KW_SERVICES, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def an_gitlab_test_service(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_gitlab_test_serviceContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_gitlab_test_serviceContext,i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_gitlab_test_services
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_gitlab_test_services" ):
listener.enterAn_gitlab_test_services(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_gitlab_test_services" ):
listener.exitAn_gitlab_test_services(self)
def an_gitlab_test_services(self):
localctx = ZmeiLangParser.An_gitlab_test_servicesContext(self, self._ctx, self.state)
self.enterRule(localctx, 62, self.RULE_an_gitlab_test_services)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 833
self.match(ZmeiLangParser.KW_SERVICES)
self.state = 834
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 838
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,46,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 835
self.match(ZmeiLangParser.NL)
self.state = 840
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,46,self._ctx)
self.state = 849
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,48,self._ctx)
if la_ == 1:
self.state = 841
self.an_gitlab_test_service()
self.state = 846
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.COMA:
self.state = 842
self.match(ZmeiLangParser.COMA)
self.state = 843
self.an_gitlab_test_service()
self.state = 848
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 854
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.NL:
self.state = 851
self.match(ZmeiLangParser.NL)
self.state = 856
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 857
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_gitlab_test_serviceContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def an_gitlab_test_service_name(self):
return self.getTypedRuleContext(ZmeiLangParser.An_gitlab_test_service_nameContext,0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def an_gitlab_deployment_variable(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_gitlab_deployment_variableContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_gitlab_deployment_variableContext,i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_gitlab_test_service
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_gitlab_test_service" ):
listener.enterAn_gitlab_test_service(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_gitlab_test_service" ):
listener.exitAn_gitlab_test_service(self)
def an_gitlab_test_service(self):
localctx = ZmeiLangParser.An_gitlab_test_serviceContext(self, self._ctx, self.state)
self.enterRule(localctx, 64, self.RULE_an_gitlab_test_service)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 862
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.NL:
self.state = 859
self.match(ZmeiLangParser.NL)
self.state = 864
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 865
self.an_gitlab_test_service_name()
self.state = 889
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.BRACE_OPEN:
self.state = 866
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 870
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,51,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 867
self.match(ZmeiLangParser.NL)
self.state = 872
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,51,self._ctx)
self.state = 879
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,53,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 873
self.an_gitlab_deployment_variable()
self.state = 875
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.COMA:
self.state = 874
self.match(ZmeiLangParser.COMA)
self.state = 881
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,53,self._ctx)
self.state = 885
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.NL:
self.state = 882
self.match(ZmeiLangParser.NL)
self.state = 887
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 888
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_gitlab_test_service_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_gitlab_test_service_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_gitlab_test_service_name" ):
listener.enterAn_gitlab_test_service_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_gitlab_test_service_name" ):
listener.exitAn_gitlab_test_service_name(self)
def an_gitlab_test_service_name(self):
localctx = ZmeiLangParser.An_gitlab_test_service_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 66, self.RULE_an_gitlab_test_service_name)
try:
self.enterOuterAlt(localctx, 1)
self.state = 891
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_gitlab_branch_declarationContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def an_gitlab_branch_name(self):
return self.getTypedRuleContext(ZmeiLangParser.An_gitlab_branch_nameContext,0)
def an_gitlab_branch_deploy_type(self):
return self.getTypedRuleContext(ZmeiLangParser.An_gitlab_branch_deploy_typeContext,0)
def an_gitlab_deployment_name(self):
return self.getTypedRuleContext(ZmeiLangParser.An_gitlab_deployment_nameContext,0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def an_gitlab_deployment_host(self):
return self.getTypedRuleContext(ZmeiLangParser.An_gitlab_deployment_hostContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def an_gitlab_deployment_variable(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_gitlab_deployment_variableContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_gitlab_deployment_variableContext,i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_gitlab_branch_declaration
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_gitlab_branch_declaration" ):
listener.enterAn_gitlab_branch_declaration(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_gitlab_branch_declaration" ):
listener.exitAn_gitlab_branch_declaration(self)
def an_gitlab_branch_declaration(self):
localctx = ZmeiLangParser.An_gitlab_branch_declarationContext(self, self._ctx, self.state)
self.enterRule(localctx, 68, self.RULE_an_gitlab_branch_declaration)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 893
self.an_gitlab_branch_name()
self.state = 897
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.NL:
self.state = 894
self.match(ZmeiLangParser.NL)
self.state = 899
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 900
self.an_gitlab_branch_deploy_type()
self.state = 904
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.NL:
self.state = 901
self.match(ZmeiLangParser.NL)
self.state = 906
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 907
self.an_gitlab_deployment_name()
self.state = 908
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 912
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.NL:
self.state = 909
self.match(ZmeiLangParser.NL)
self.state = 914
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 915
self.an_gitlab_deployment_host()
self.state = 932
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.COLON:
self.state = 916
self.match(ZmeiLangParser.COLON)
self.state = 920
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,59,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 917
self.match(ZmeiLangParser.NL)
self.state = 922
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,59,self._ctx)
self.state = 929
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,61,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 923
self.an_gitlab_deployment_variable()
self.state = 925
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.COMA:
self.state = 924
self.match(ZmeiLangParser.COMA)
self.state = 931
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,61,self._ctx)
self.state = 937
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.NL:
self.state = 934
self.match(ZmeiLangParser.NL)
self.state = 939
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 940
self.match(ZmeiLangParser.BRACE_CLOSE)
self.state = 944
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,64,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 941
self.match(ZmeiLangParser.NL)
self.state = 946
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,64,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_gitlab_branch_deploy_typeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def GT(self):
return self.getToken(ZmeiLangParser.GT, 0)
def EQUALS(self):
return self.getToken(ZmeiLangParser.EQUALS, 0)
def APPROX(self):
return self.getToken(ZmeiLangParser.APPROX, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_gitlab_branch_deploy_type
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_gitlab_branch_deploy_type" ):
listener.enterAn_gitlab_branch_deploy_type(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_gitlab_branch_deploy_type" ):
listener.exitAn_gitlab_branch_deploy_type(self)
def an_gitlab_branch_deploy_type(self):
localctx = ZmeiLangParser.An_gitlab_branch_deploy_typeContext(self, self._ctx, self.state)
self.enterRule(localctx, 70, self.RULE_an_gitlab_branch_deploy_type)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 947
_la = self._input.LA(1)
if not(_la==ZmeiLangParser.EQUALS or _la==ZmeiLangParser.APPROX):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
self.state = 948
self.match(ZmeiLangParser.GT)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_gitlab_branch_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Id_or_kwContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,i)
def DASH(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.DASH)
else:
return self.getToken(ZmeiLangParser.DASH, i)
def STAR(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.STAR)
else:
return self.getToken(ZmeiLangParser.STAR, i)
def SLASH(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.SLASH)
else:
return self.getToken(ZmeiLangParser.SLASH, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_gitlab_branch_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_gitlab_branch_name" ):
listener.enterAn_gitlab_branch_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_gitlab_branch_name" ):
listener.exitAn_gitlab_branch_name(self)
def an_gitlab_branch_name(self):
localctx = ZmeiLangParser.An_gitlab_branch_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 72, self.RULE_an_gitlab_branch_name)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 954
self._errHandler.sync(self)
_la = self._input.LA(1)
while True:
self.state = 954
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID]:
self.state = 950
self.id_or_kw()
pass
elif token in [ZmeiLangParser.DASH]:
self.state = 951
self.match(ZmeiLangParser.DASH)
pass
elif token in [ZmeiLangParser.STAR]:
self.state = 952
self.match(ZmeiLangParser.STAR)
pass
elif token in [ZmeiLangParser.SLASH]:
self.state = 953
self.match(ZmeiLangParser.SLASH)
pass
else:
raise NoViableAltException(self)
self.state = 956
self._errHandler.sync(self)
_la = self._input.LA(1)
if not (((((_la - 42)) & ~0x3f) == 0 and ((1 << (_la - 42)) & ((1 << (ZmeiLangParser.KW_AUTH_TYPE_BASIC - 42)) | (1 << (ZmeiLangParser.KW_AUTH_TYPE_SESSION - 42)) | (1 << (ZmeiLangParser.KW_AUTH_TYPE_TOKEN - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_HTML - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FLOAT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DECIMAL - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DATE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DATETIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_IMAGE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_TEXT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_INT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_SLUG - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_BOOL - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_MANY - 42)) | (1 << (ZmeiLangParser.COL_FIELD_CHOICES - 42)) | (1 << (ZmeiLangParser.KW_THEME - 42)) | (1 << (ZmeiLangParser.KW_INSTALL - 42)) | (1 << (ZmeiLangParser.KW_HEADER - 42)) | (1 << (ZmeiLangParser.KW_SERVICES - 42)) | (1 << (ZmeiLangParser.KW_SELENIUM_PYTEST - 42)) | (1 << (ZmeiLangParser.KW_CHILD - 42)) | (1 << (ZmeiLangParser.KW_FILTER_OUT - 42)) | (1 << (ZmeiLangParser.KW_FILTER_IN - 42)) | (1 << (ZmeiLangParser.KW_PAGE - 42)) | (1 << (ZmeiLangParser.KW_LINK_SUFFIX - 42)) | (1 << (ZmeiLangParser.KW_URL_PREFIX - 42)) | (1 << (ZmeiLangParser.KW_CAN_EDIT - 42)) | (1 << (ZmeiLangParser.KW_OBJECT_EXPR - 42)) | (1 << (ZmeiLangParser.KW_BLOCK - 42)) | (1 << (ZmeiLangParser.KW_ITEM_NAME - 42)) | (1 << (ZmeiLangParser.KW_PK_PARAM - 42)) | (1 << (ZmeiLangParser.KW_LIST_FIELDS - 42)) | (1 << (ZmeiLangParser.KW_DELETE - 42)) | (1 << (ZmeiLangParser.KW_EDIT - 42)) | (1 << (ZmeiLangParser.KW_CREATE - 42)) | (1 << (ZmeiLangParser.KW_DETAIL - 42)) | (1 << (ZmeiLangParser.KW_SKIP - 42)) | (1 << (ZmeiLangParser.KW_FROM - 42)) | (1 << (ZmeiLangParser.KW_POLY_LIST - 42)) | (1 << (ZmeiLangParser.KW_CSS - 42)) | (1 << (ZmeiLangParser.KW_JS - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_TABULAR - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_STACKED - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC - 42)) | (1 << (ZmeiLangParser.KW_INLINE - 42)) | (1 << (ZmeiLangParser.KW_TYPE - 42)) | (1 << (ZmeiLangParser.KW_USER_FIELD - 42)) | (1 << (ZmeiLangParser.KW_ANNOTATE - 42)) | (1 << (ZmeiLangParser.KW_ON_CREATE - 42)) | (1 << (ZmeiLangParser.KW_QUERY - 42)) | (1 << (ZmeiLangParser.KW_AUTH - 42)) | (1 << (ZmeiLangParser.KW_COUNT - 42)) | (1 << (ZmeiLangParser.KW_I18N - 42)))) != 0) or ((((_la - 106)) & ~0x3f) == 0 and ((1 << (_la - 106)) & ((1 << (ZmeiLangParser.KW_EXTENSION - 106)) | (1 << (ZmeiLangParser.KW_TABS - 106)) | (1 << (ZmeiLangParser.KW_LIST - 106)) | (1 << (ZmeiLangParser.KW_READ_ONLY - 106)) | (1 << (ZmeiLangParser.KW_LIST_EDITABLE - 106)) | (1 << (ZmeiLangParser.KW_LIST_FILTER - 106)) | (1 << (ZmeiLangParser.KW_LIST_SEARCH - 106)) | (1 << (ZmeiLangParser.KW_FIELDS - 106)) | (1 << (ZmeiLangParser.KW_IMPORT - 106)) | (1 << (ZmeiLangParser.KW_AS - 106)) | (1 << (ZmeiLangParser.WRITE_MODE - 106)) | (1 << (ZmeiLangParser.BOOL - 106)) | (1 << (ZmeiLangParser.ID - 106)) | (1 << (ZmeiLangParser.DASH - 106)) | (1 << (ZmeiLangParser.SLASH - 106)) | (1 << (ZmeiLangParser.STAR - 106)))) != 0)):
break
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_gitlab_deployment_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Id_or_kwContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,i)
def DASH(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.DASH)
else:
return self.getToken(ZmeiLangParser.DASH, i)
def SLASH(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.SLASH)
else:
return self.getToken(ZmeiLangParser.SLASH, i)
def STAR(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.STAR)
else:
return self.getToken(ZmeiLangParser.STAR, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_gitlab_deployment_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_gitlab_deployment_name" ):
listener.enterAn_gitlab_deployment_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_gitlab_deployment_name" ):
listener.exitAn_gitlab_deployment_name(self)
def an_gitlab_deployment_name(self):
localctx = ZmeiLangParser.An_gitlab_deployment_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 74, self.RULE_an_gitlab_deployment_name)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 962
self._errHandler.sync(self)
_la = self._input.LA(1)
while True:
self.state = 962
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID]:
self.state = 958
self.id_or_kw()
pass
elif token in [ZmeiLangParser.DASH]:
self.state = 959
self.match(ZmeiLangParser.DASH)
pass
elif token in [ZmeiLangParser.SLASH]:
self.state = 960
self.match(ZmeiLangParser.SLASH)
pass
elif token in [ZmeiLangParser.STAR]:
self.state = 961
self.match(ZmeiLangParser.STAR)
pass
else:
raise NoViableAltException(self)
self.state = 964
self._errHandler.sync(self)
_la = self._input.LA(1)
if not (((((_la - 42)) & ~0x3f) == 0 and ((1 << (_la - 42)) & ((1 << (ZmeiLangParser.KW_AUTH_TYPE_BASIC - 42)) | (1 << (ZmeiLangParser.KW_AUTH_TYPE_SESSION - 42)) | (1 << (ZmeiLangParser.KW_AUTH_TYPE_TOKEN - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_HTML - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FLOAT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DECIMAL - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DATE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DATETIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_IMAGE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_TEXT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_INT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_SLUG - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_BOOL - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_MANY - 42)) | (1 << (ZmeiLangParser.COL_FIELD_CHOICES - 42)) | (1 << (ZmeiLangParser.KW_THEME - 42)) | (1 << (ZmeiLangParser.KW_INSTALL - 42)) | (1 << (ZmeiLangParser.KW_HEADER - 42)) | (1 << (ZmeiLangParser.KW_SERVICES - 42)) | (1 << (ZmeiLangParser.KW_SELENIUM_PYTEST - 42)) | (1 << (ZmeiLangParser.KW_CHILD - 42)) | (1 << (ZmeiLangParser.KW_FILTER_OUT - 42)) | (1 << (ZmeiLangParser.KW_FILTER_IN - 42)) | (1 << (ZmeiLangParser.KW_PAGE - 42)) | (1 << (ZmeiLangParser.KW_LINK_SUFFIX - 42)) | (1 << (ZmeiLangParser.KW_URL_PREFIX - 42)) | (1 << (ZmeiLangParser.KW_CAN_EDIT - 42)) | (1 << (ZmeiLangParser.KW_OBJECT_EXPR - 42)) | (1 << (ZmeiLangParser.KW_BLOCK - 42)) | (1 << (ZmeiLangParser.KW_ITEM_NAME - 42)) | (1 << (ZmeiLangParser.KW_PK_PARAM - 42)) | (1 << (ZmeiLangParser.KW_LIST_FIELDS - 42)) | (1 << (ZmeiLangParser.KW_DELETE - 42)) | (1 << (ZmeiLangParser.KW_EDIT - 42)) | (1 << (ZmeiLangParser.KW_CREATE - 42)) | (1 << (ZmeiLangParser.KW_DETAIL - 42)) | (1 << (ZmeiLangParser.KW_SKIP - 42)) | (1 << (ZmeiLangParser.KW_FROM - 42)) | (1 << (ZmeiLangParser.KW_POLY_LIST - 42)) | (1 << (ZmeiLangParser.KW_CSS - 42)) | (1 << (ZmeiLangParser.KW_JS - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_TABULAR - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_STACKED - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC - 42)) | (1 << (ZmeiLangParser.KW_INLINE - 42)) | (1 << (ZmeiLangParser.KW_TYPE - 42)) | (1 << (ZmeiLangParser.KW_USER_FIELD - 42)) | (1 << (ZmeiLangParser.KW_ANNOTATE - 42)) | (1 << (ZmeiLangParser.KW_ON_CREATE - 42)) | (1 << (ZmeiLangParser.KW_QUERY - 42)) | (1 << (ZmeiLangParser.KW_AUTH - 42)) | (1 << (ZmeiLangParser.KW_COUNT - 42)) | (1 << (ZmeiLangParser.KW_I18N - 42)))) != 0) or ((((_la - 106)) & ~0x3f) == 0 and ((1 << (_la - 106)) & ((1 << (ZmeiLangParser.KW_EXTENSION - 106)) | (1 << (ZmeiLangParser.KW_TABS - 106)) | (1 << (ZmeiLangParser.KW_LIST - 106)) | (1 << (ZmeiLangParser.KW_READ_ONLY - 106)) | (1 << (ZmeiLangParser.KW_LIST_EDITABLE - 106)) | (1 << (ZmeiLangParser.KW_LIST_FILTER - 106)) | (1 << (ZmeiLangParser.KW_LIST_SEARCH - 106)) | (1 << (ZmeiLangParser.KW_FIELDS - 106)) | (1 << (ZmeiLangParser.KW_IMPORT - 106)) | (1 << (ZmeiLangParser.KW_AS - 106)) | (1 << (ZmeiLangParser.WRITE_MODE - 106)) | (1 << (ZmeiLangParser.BOOL - 106)) | (1 << (ZmeiLangParser.ID - 106)) | (1 << (ZmeiLangParser.DASH - 106)) | (1 << (ZmeiLangParser.SLASH - 106)) | (1 << (ZmeiLangParser.STAR - 106)))) != 0)):
break
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_gitlab_deployment_hostContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Id_or_kwContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,i)
def DASH(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.DASH)
else:
return self.getToken(ZmeiLangParser.DASH, i)
def STAR(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.STAR)
else:
return self.getToken(ZmeiLangParser.STAR, i)
def DOT(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.DOT)
else:
return self.getToken(ZmeiLangParser.DOT, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_gitlab_deployment_host
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_gitlab_deployment_host" ):
listener.enterAn_gitlab_deployment_host(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_gitlab_deployment_host" ):
listener.exitAn_gitlab_deployment_host(self)
def an_gitlab_deployment_host(self):
localctx = ZmeiLangParser.An_gitlab_deployment_hostContext(self, self._ctx, self.state)
self.enterRule(localctx, 76, self.RULE_an_gitlab_deployment_host)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 970
self._errHandler.sync(self)
_la = self._input.LA(1)
while True:
self.state = 970
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID]:
self.state = 966
self.id_or_kw()
pass
elif token in [ZmeiLangParser.DASH]:
self.state = 967
self.match(ZmeiLangParser.DASH)
pass
elif token in [ZmeiLangParser.STAR]:
self.state = 968
self.match(ZmeiLangParser.STAR)
pass
elif token in [ZmeiLangParser.DOT]:
self.state = 969
self.match(ZmeiLangParser.DOT)
pass
else:
raise NoViableAltException(self)
self.state = 972
self._errHandler.sync(self)
_la = self._input.LA(1)
if not (((((_la - 42)) & ~0x3f) == 0 and ((1 << (_la - 42)) & ((1 << (ZmeiLangParser.KW_AUTH_TYPE_BASIC - 42)) | (1 << (ZmeiLangParser.KW_AUTH_TYPE_SESSION - 42)) | (1 << (ZmeiLangParser.KW_AUTH_TYPE_TOKEN - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_HTML - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FLOAT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DECIMAL - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DATE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DATETIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_IMAGE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_TEXT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_INT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_SLUG - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_BOOL - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_MANY - 42)) | (1 << (ZmeiLangParser.COL_FIELD_CHOICES - 42)) | (1 << (ZmeiLangParser.KW_THEME - 42)) | (1 << (ZmeiLangParser.KW_INSTALL - 42)) | (1 << (ZmeiLangParser.KW_HEADER - 42)) | (1 << (ZmeiLangParser.KW_SERVICES - 42)) | (1 << (ZmeiLangParser.KW_SELENIUM_PYTEST - 42)) | (1 << (ZmeiLangParser.KW_CHILD - 42)) | (1 << (ZmeiLangParser.KW_FILTER_OUT - 42)) | (1 << (ZmeiLangParser.KW_FILTER_IN - 42)) | (1 << (ZmeiLangParser.KW_PAGE - 42)) | (1 << (ZmeiLangParser.KW_LINK_SUFFIX - 42)) | (1 << (ZmeiLangParser.KW_URL_PREFIX - 42)) | (1 << (ZmeiLangParser.KW_CAN_EDIT - 42)) | (1 << (ZmeiLangParser.KW_OBJECT_EXPR - 42)) | (1 << (ZmeiLangParser.KW_BLOCK - 42)) | (1 << (ZmeiLangParser.KW_ITEM_NAME - 42)) | (1 << (ZmeiLangParser.KW_PK_PARAM - 42)) | (1 << (ZmeiLangParser.KW_LIST_FIELDS - 42)) | (1 << (ZmeiLangParser.KW_DELETE - 42)) | (1 << (ZmeiLangParser.KW_EDIT - 42)) | (1 << (ZmeiLangParser.KW_CREATE - 42)) | (1 << (ZmeiLangParser.KW_DETAIL - 42)) | (1 << (ZmeiLangParser.KW_SKIP - 42)) | (1 << (ZmeiLangParser.KW_FROM - 42)) | (1 << (ZmeiLangParser.KW_POLY_LIST - 42)) | (1 << (ZmeiLangParser.KW_CSS - 42)) | (1 << (ZmeiLangParser.KW_JS - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_TABULAR - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_STACKED - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC - 42)) | (1 << (ZmeiLangParser.KW_INLINE - 42)) | (1 << (ZmeiLangParser.KW_TYPE - 42)) | (1 << (ZmeiLangParser.KW_USER_FIELD - 42)) | (1 << (ZmeiLangParser.KW_ANNOTATE - 42)) | (1 << (ZmeiLangParser.KW_ON_CREATE - 42)) | (1 << (ZmeiLangParser.KW_QUERY - 42)) | (1 << (ZmeiLangParser.KW_AUTH - 42)) | (1 << (ZmeiLangParser.KW_COUNT - 42)) | (1 << (ZmeiLangParser.KW_I18N - 42)))) != 0) or ((((_la - 106)) & ~0x3f) == 0 and ((1 << (_la - 106)) & ((1 << (ZmeiLangParser.KW_EXTENSION - 106)) | (1 << (ZmeiLangParser.KW_TABS - 106)) | (1 << (ZmeiLangParser.KW_LIST - 106)) | (1 << (ZmeiLangParser.KW_READ_ONLY - 106)) | (1 << (ZmeiLangParser.KW_LIST_EDITABLE - 106)) | (1 << (ZmeiLangParser.KW_LIST_FILTER - 106)) | (1 << (ZmeiLangParser.KW_LIST_SEARCH - 106)) | (1 << (ZmeiLangParser.KW_FIELDS - 106)) | (1 << (ZmeiLangParser.KW_IMPORT - 106)) | (1 << (ZmeiLangParser.KW_AS - 106)) | (1 << (ZmeiLangParser.WRITE_MODE - 106)) | (1 << (ZmeiLangParser.BOOL - 106)) | (1 << (ZmeiLangParser.ID - 106)) | (1 << (ZmeiLangParser.DASH - 106)) | (1 << (ZmeiLangParser.DOT - 106)) | (1 << (ZmeiLangParser.STAR - 106)))) != 0)):
break
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_gitlab_deployment_variableContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def an_gitlab_deployment_variable_name(self):
return self.getTypedRuleContext(ZmeiLangParser.An_gitlab_deployment_variable_nameContext,0)
def EQUALS(self):
return self.getToken(ZmeiLangParser.EQUALS, 0)
def an_gitlab_deployment_variable_value(self):
return self.getTypedRuleContext(ZmeiLangParser.An_gitlab_deployment_variable_valueContext,0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_gitlab_deployment_variable
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_gitlab_deployment_variable" ):
listener.enterAn_gitlab_deployment_variable(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_gitlab_deployment_variable" ):
listener.exitAn_gitlab_deployment_variable(self)
def an_gitlab_deployment_variable(self):
localctx = ZmeiLangParser.An_gitlab_deployment_variableContext(self, self._ctx, self.state)
self.enterRule(localctx, 78, self.RULE_an_gitlab_deployment_variable)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 977
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.NL:
self.state = 974
self.match(ZmeiLangParser.NL)
self.state = 979
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 980
self.an_gitlab_deployment_variable_name()
self.state = 981
self.match(ZmeiLangParser.EQUALS)
self.state = 982
self.an_gitlab_deployment_variable_value()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_gitlab_deployment_variable_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_gitlab_deployment_variable_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_gitlab_deployment_variable_name" ):
listener.enterAn_gitlab_deployment_variable_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_gitlab_deployment_variable_name" ):
listener.exitAn_gitlab_deployment_variable_name(self)
def an_gitlab_deployment_variable_name(self):
localctx = ZmeiLangParser.An_gitlab_deployment_variable_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 80, self.RULE_an_gitlab_deployment_variable_name)
try:
self.enterOuterAlt(localctx, 1)
self.state = 984
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_gitlab_deployment_variable_valueContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def STRING_DQ(self):
return self.getToken(ZmeiLangParser.STRING_DQ, 0)
def STRING_SQ(self):
return self.getToken(ZmeiLangParser.STRING_SQ, 0)
def DIGIT(self):
return self.getToken(ZmeiLangParser.DIGIT, 0)
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_gitlab_deployment_variable_value
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_gitlab_deployment_variable_value" ):
listener.enterAn_gitlab_deployment_variable_value(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_gitlab_deployment_variable_value" ):
listener.exitAn_gitlab_deployment_variable_value(self)
def an_gitlab_deployment_variable_value(self):
localctx = ZmeiLangParser.An_gitlab_deployment_variable_valueContext(self, self._ctx, self.state)
self.enterRule(localctx, 82, self.RULE_an_gitlab_deployment_variable_value)
try:
self.state = 990
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.STRING_DQ]:
self.enterOuterAlt(localctx, 1)
self.state = 986
self.match(ZmeiLangParser.STRING_DQ)
pass
elif token in [ZmeiLangParser.STRING_SQ]:
self.enterOuterAlt(localctx, 2)
self.state = 987
self.match(ZmeiLangParser.STRING_SQ)
pass
elif token in [ZmeiLangParser.DIGIT]:
self.enterOuterAlt(localctx, 3)
self.state = 988
self.match(ZmeiLangParser.DIGIT)
pass
elif token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID]:
self.enterOuterAlt(localctx, 4)
self.state = 989
self.id_or_kw()
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_fileContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_FILE(self):
return self.getToken(ZmeiLangParser.AN_FILE, 0)
def an_file_name(self):
return self.getTypedRuleContext(ZmeiLangParser.An_file_nameContext,0)
def python_code(self):
return self.getTypedRuleContext(ZmeiLangParser.Python_codeContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_file
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_file" ):
listener.enterAn_file(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_file" ):
listener.exitAn_file(self)
def an_file(self):
localctx = ZmeiLangParser.An_fileContext(self, self._ctx, self.state)
self.enterRule(localctx, 84, self.RULE_an_file)
try:
self.enterOuterAlt(localctx, 1)
self.state = 992
self.match(ZmeiLangParser.AN_FILE)
self.state = 993
self.an_file_name()
self.state = 994
self.python_code()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_file_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def STRING_DQ(self):
return self.getToken(ZmeiLangParser.STRING_DQ, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_file_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_file_name" ):
listener.enterAn_file_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_file_name" ):
listener.exitAn_file_name(self)
def an_file_name(self):
localctx = ZmeiLangParser.An_file_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 86, self.RULE_an_file_name)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 996
_la = self._input.LA(1)
if not(_la==ZmeiLangParser.STRING_DQ):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_themeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_THEME(self):
return self.getToken(ZmeiLangParser.AN_THEME, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def an_theme_name(self):
return self.getTypedRuleContext(ZmeiLangParser.An_theme_nameContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def COMA(self):
return self.getToken(ZmeiLangParser.COMA, 0)
def KW_INSTALL(self):
return self.getToken(ZmeiLangParser.KW_INSTALL, 0)
def EQUALS(self):
return self.getToken(ZmeiLangParser.EQUALS, 0)
def an_theme_install(self):
return self.getTypedRuleContext(ZmeiLangParser.An_theme_installContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_theme
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_theme" ):
listener.enterAn_theme(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_theme" ):
listener.exitAn_theme(self)
def an_theme(self):
localctx = ZmeiLangParser.An_themeContext(self, self._ctx, self.state)
self.enterRule(localctx, 88, self.RULE_an_theme)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 998
self.match(ZmeiLangParser.AN_THEME)
self.state = 999
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 1000
self.an_theme_name()
self.state = 1005
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.COMA:
self.state = 1001
self.match(ZmeiLangParser.COMA)
self.state = 1002
self.match(ZmeiLangParser.KW_INSTALL)
self.state = 1003
self.match(ZmeiLangParser.EQUALS)
self.state = 1004
self.an_theme_install()
self.state = 1007
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_theme_installContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def BOOL(self):
return self.getToken(ZmeiLangParser.BOOL, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_theme_install
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_theme_install" ):
listener.enterAn_theme_install(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_theme_install" ):
listener.exitAn_theme_install(self)
def an_theme_install(self):
localctx = ZmeiLangParser.An_theme_installContext(self, self._ctx, self.state)
self.enterRule(localctx, 90, self.RULE_an_theme_install)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1009
self.match(ZmeiLangParser.BOOL)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_theme_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def STRING_DQ(self):
return self.getToken(ZmeiLangParser.STRING_DQ, 0)
def STRING_SQ(self):
return self.getToken(ZmeiLangParser.STRING_SQ, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_theme_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_theme_name" ):
listener.enterAn_theme_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_theme_name" ):
listener.exitAn_theme_name(self)
def an_theme_name(self):
localctx = ZmeiLangParser.An_theme_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 92, self.RULE_an_theme_name)
try:
self.state = 1014
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID]:
self.enterOuterAlt(localctx, 1)
self.state = 1011
self.id_or_kw()
pass
elif token in [ZmeiLangParser.STRING_DQ]:
self.enterOuterAlt(localctx, 2)
self.state = 1012
self.match(ZmeiLangParser.STRING_DQ)
pass
elif token in [ZmeiLangParser.STRING_SQ]:
self.enterOuterAlt(localctx, 3)
self.state = 1013
self.match(ZmeiLangParser.STRING_SQ)
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_langsContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_LANGS(self):
return self.getToken(ZmeiLangParser.AN_LANGS, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def an_langs_list(self):
return self.getTypedRuleContext(ZmeiLangParser.An_langs_listContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_langs
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_langs" ):
listener.enterAn_langs(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_langs" ):
listener.exitAn_langs(self)
def an_langs(self):
localctx = ZmeiLangParser.An_langsContext(self, self._ctx, self.state)
self.enterRule(localctx, 94, self.RULE_an_langs)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1016
self.match(ZmeiLangParser.AN_LANGS)
self.state = 1017
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 1018
self.an_langs_list()
self.state = 1019
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_langs_listContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def ID(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.ID)
else:
return self.getToken(ZmeiLangParser.ID, i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_langs_list
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_langs_list" ):
listener.enterAn_langs_list(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_langs_list" ):
listener.exitAn_langs_list(self)
def an_langs_list(self):
localctx = ZmeiLangParser.An_langs_listContext(self, self._ctx, self.state)
self.enterRule(localctx, 96, self.RULE_an_langs_list)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1021
self.match(ZmeiLangParser.ID)
self.state = 1026
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.COMA:
self.state = 1022
self.match(ZmeiLangParser.COMA)
self.state = 1023
self.match(ZmeiLangParser.ID)
self.state = 1028
self._errHandler.sync(self)
_la = self._input.LA(1)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class ColContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def col_header(self):
return self.getTypedRuleContext(ZmeiLangParser.Col_headerContext,0)
def col_str_expr(self):
return self.getTypedRuleContext(ZmeiLangParser.Col_str_exprContext,0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def col_field(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Col_fieldContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Col_fieldContext,i)
def model_annotation(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Model_annotationContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Model_annotationContext,i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_col
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCol" ):
listener.enterCol(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCol" ):
listener.exitCol(self)
def col(self):
localctx = ZmeiLangParser.ColContext(self, self._ctx, self.state)
self.enterRule(localctx, 98, self.RULE_col)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1029
self.col_header()
self.state = 1031
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,76,self._ctx)
if la_ == 1:
self.state = 1030
self.col_str_expr()
self.state = 1036
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,77,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1033
self.match(ZmeiLangParser.NL)
self.state = 1038
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,77,self._ctx)
self.state = 1042
self._errHandler.sync(self)
_la = self._input.LA(1)
while ((((_la - 42)) & ~0x3f) == 0 and ((1 << (_la - 42)) & ((1 << (ZmeiLangParser.KW_AUTH_TYPE_BASIC - 42)) | (1 << (ZmeiLangParser.KW_AUTH_TYPE_SESSION - 42)) | (1 << (ZmeiLangParser.KW_AUTH_TYPE_TOKEN - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_HTML - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FLOAT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DECIMAL - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DATE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DATETIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_IMAGE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_TEXT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_INT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_SLUG - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_BOOL - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_MANY - 42)) | (1 << (ZmeiLangParser.COL_FIELD_CHOICES - 42)) | (1 << (ZmeiLangParser.KW_THEME - 42)) | (1 << (ZmeiLangParser.KW_INSTALL - 42)) | (1 << (ZmeiLangParser.KW_HEADER - 42)) | (1 << (ZmeiLangParser.KW_SERVICES - 42)) | (1 << (ZmeiLangParser.KW_SELENIUM_PYTEST - 42)) | (1 << (ZmeiLangParser.KW_CHILD - 42)) | (1 << (ZmeiLangParser.KW_FILTER_OUT - 42)) | (1 << (ZmeiLangParser.KW_FILTER_IN - 42)) | (1 << (ZmeiLangParser.KW_PAGE - 42)) | (1 << (ZmeiLangParser.KW_LINK_SUFFIX - 42)) | (1 << (ZmeiLangParser.KW_URL_PREFIX - 42)) | (1 << (ZmeiLangParser.KW_CAN_EDIT - 42)) | (1 << (ZmeiLangParser.KW_OBJECT_EXPR - 42)) | (1 << (ZmeiLangParser.KW_BLOCK - 42)) | (1 << (ZmeiLangParser.KW_ITEM_NAME - 42)) | (1 << (ZmeiLangParser.KW_PK_PARAM - 42)) | (1 << (ZmeiLangParser.KW_LIST_FIELDS - 42)) | (1 << (ZmeiLangParser.KW_DELETE - 42)) | (1 << (ZmeiLangParser.KW_EDIT - 42)) | (1 << (ZmeiLangParser.KW_CREATE - 42)) | (1 << (ZmeiLangParser.KW_DETAIL - 42)) | (1 << (ZmeiLangParser.KW_SKIP - 42)) | (1 << (ZmeiLangParser.KW_FROM - 42)) | (1 << (ZmeiLangParser.KW_POLY_LIST - 42)) | (1 << (ZmeiLangParser.KW_CSS - 42)) | (1 << (ZmeiLangParser.KW_JS - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_TABULAR - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_STACKED - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC - 42)) | (1 << (ZmeiLangParser.KW_INLINE - 42)) | (1 << (ZmeiLangParser.KW_TYPE - 42)) | (1 << (ZmeiLangParser.KW_USER_FIELD - 42)) | (1 << (ZmeiLangParser.KW_ANNOTATE - 42)) | (1 << (ZmeiLangParser.KW_ON_CREATE - 42)) | (1 << (ZmeiLangParser.KW_QUERY - 42)) | (1 << (ZmeiLangParser.KW_AUTH - 42)) | (1 << (ZmeiLangParser.KW_COUNT - 42)) | (1 << (ZmeiLangParser.KW_I18N - 42)))) != 0) or ((((_la - 106)) & ~0x3f) == 0 and ((1 << (_la - 106)) & ((1 << (ZmeiLangParser.KW_EXTENSION - 106)) | (1 << (ZmeiLangParser.KW_TABS - 106)) | (1 << (ZmeiLangParser.KW_LIST - 106)) | (1 << (ZmeiLangParser.KW_READ_ONLY - 106)) | (1 << (ZmeiLangParser.KW_LIST_EDITABLE - 106)) | (1 << (ZmeiLangParser.KW_LIST_FILTER - 106)) | (1 << (ZmeiLangParser.KW_LIST_SEARCH - 106)) | (1 << (ZmeiLangParser.KW_FIELDS - 106)) | (1 << (ZmeiLangParser.KW_IMPORT - 106)) | (1 << (ZmeiLangParser.KW_AS - 106)) | (1 << (ZmeiLangParser.WRITE_MODE - 106)) | (1 << (ZmeiLangParser.BOOL - 106)) | (1 << (ZmeiLangParser.ID - 106)) | (1 << (ZmeiLangParser.EQUALS - 106)) | (1 << (ZmeiLangParser.DOLLAR - 106)) | (1 << (ZmeiLangParser.AMP - 106)) | (1 << (ZmeiLangParser.EXCLAM - 106)) | (1 << (ZmeiLangParser.STAR - 106)) | (1 << (ZmeiLangParser.APPROX - 106)))) != 0):
self.state = 1039
self.col_field()
self.state = 1044
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 1048
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,79,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1045
self.match(ZmeiLangParser.NL)
self.state = 1050
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,79,self._ctx)
self.state = 1054
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,80,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1051
self.model_annotation()
self.state = 1056
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,80,self._ctx)
self.state = 1060
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,81,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1057
self.match(ZmeiLangParser.NL)
self.state = 1062
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,81,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Col_str_exprContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def EQUALS(self):
return self.getToken(ZmeiLangParser.EQUALS, 0)
def STRING_DQ(self):
return self.getToken(ZmeiLangParser.STRING_DQ, 0)
def STRING_SQ(self):
return self.getToken(ZmeiLangParser.STRING_SQ, 0)
def EOF(self):
return self.getToken(ZmeiLangParser.EOF, 0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_col_str_expr
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCol_str_expr" ):
listener.enterCol_str_expr(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCol_str_expr" ):
listener.exitCol_str_expr(self)
def col_str_expr(self):
localctx = ZmeiLangParser.Col_str_exprContext(self, self._ctx, self.state)
self.enterRule(localctx, 100, self.RULE_col_str_expr)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1063
self.match(ZmeiLangParser.EQUALS)
self.state = 1064
_la = self._input.LA(1)
if not(_la==ZmeiLangParser.STRING_DQ or _la==ZmeiLangParser.STRING_SQ):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
self.state = 1071
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.NL]:
self.state = 1066
self._errHandler.sync(self)
_alt = 1
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt == 1:
self.state = 1065
self.match(ZmeiLangParser.NL)
else:
raise NoViableAltException(self)
self.state = 1068
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,82,self._ctx)
pass
elif token in [ZmeiLangParser.EOF]:
self.state = 1070
self.match(ZmeiLangParser.EOF)
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Col_headerContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def HASH(self):
return self.getToken(ZmeiLangParser.HASH, 0)
def col_name(self):
return self.getTypedRuleContext(ZmeiLangParser.Col_nameContext,0)
def col_header_line_separator(self):
return self.getTypedRuleContext(ZmeiLangParser.Col_header_line_separatorContext,0)
def NL(self):
return self.getToken(ZmeiLangParser.NL, 0)
def col_base_name(self):
return self.getTypedRuleContext(ZmeiLangParser.Col_base_nameContext,0)
def col_verbose_name(self):
return self.getTypedRuleContext(ZmeiLangParser.Col_verbose_nameContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_col_header
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCol_header" ):
listener.enterCol_header(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCol_header" ):
listener.exitCol_header(self)
def col_header(self):
localctx = ZmeiLangParser.Col_headerContext(self, self._ctx, self.state)
self.enterRule(localctx, 102, self.RULE_col_header)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1073
self.match(ZmeiLangParser.HASH)
self.state = 1075
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,84,self._ctx)
if la_ == 1:
self.state = 1074
self.col_base_name()
self.state = 1077
self.col_name()
self.state = 1079
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.COLON:
self.state = 1078
self.col_verbose_name()
self.state = 1081
self.col_header_line_separator()
self.state = 1082
self.match(ZmeiLangParser.NL)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Col_header_line_separatorContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def NL(self):
return self.getToken(ZmeiLangParser.NL, 0)
def DASH(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.DASH)
else:
return self.getToken(ZmeiLangParser.DASH, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_col_header_line_separator
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCol_header_line_separator" ):
listener.enterCol_header_line_separator(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCol_header_line_separator" ):
listener.exitCol_header_line_separator(self)
def col_header_line_separator(self):
localctx = ZmeiLangParser.Col_header_line_separatorContext(self, self._ctx, self.state)
self.enterRule(localctx, 104, self.RULE_col_header_line_separator)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1084
self.match(ZmeiLangParser.NL)
self.state = 1085
self.match(ZmeiLangParser.DASH)
self.state = 1086
self.match(ZmeiLangParser.DASH)
self.state = 1088
self._errHandler.sync(self)
_la = self._input.LA(1)
while True:
self.state = 1087
self.match(ZmeiLangParser.DASH)
self.state = 1090
self._errHandler.sync(self)
_la = self._input.LA(1)
if not (_la==ZmeiLangParser.DASH):
break
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Col_verbose_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def verbose_name_part(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Verbose_name_partContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Verbose_name_partContext,i)
def SLASH(self):
return self.getToken(ZmeiLangParser.SLASH, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_col_verbose_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCol_verbose_name" ):
listener.enterCol_verbose_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCol_verbose_name" ):
listener.exitCol_verbose_name(self)
def col_verbose_name(self):
localctx = ZmeiLangParser.Col_verbose_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 106, self.RULE_col_verbose_name)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1092
self.match(ZmeiLangParser.COLON)
self.state = 1093
self.verbose_name_part()
self.state = 1096
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.SLASH:
self.state = 1094
self.match(ZmeiLangParser.SLASH)
self.state = 1095
self.verbose_name_part()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Verbose_name_partContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def STRING_DQ(self):
return self.getToken(ZmeiLangParser.STRING_DQ, 0)
def STRING_SQ(self):
return self.getToken(ZmeiLangParser.STRING_SQ, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_verbose_name_part
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterVerbose_name_part" ):
listener.enterVerbose_name_part(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitVerbose_name_part" ):
listener.exitVerbose_name_part(self)
def verbose_name_part(self):
localctx = ZmeiLangParser.Verbose_name_partContext(self, self._ctx, self.state)
self.enterRule(localctx, 108, self.RULE_verbose_name_part)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1101
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID]:
self.state = 1098
self.id_or_kw()
pass
elif token in [ZmeiLangParser.STRING_DQ]:
self.state = 1099
self.match(ZmeiLangParser.STRING_DQ)
pass
elif token in [ZmeiLangParser.STRING_SQ]:
self.state = 1100
self.match(ZmeiLangParser.STRING_SQ)
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Col_base_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def DASH(self):
return self.getToken(ZmeiLangParser.DASH, 0)
def GT(self):
return self.getToken(ZmeiLangParser.GT, 0)
def APPROX(self):
return self.getToken(ZmeiLangParser.APPROX, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_col_base_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCol_base_name" ):
listener.enterCol_base_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCol_base_name" ):
listener.exitCol_base_name(self)
def col_base_name(self):
localctx = ZmeiLangParser.Col_base_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 110, self.RULE_col_base_name)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1103
self.id_or_kw()
self.state = 1108
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.DASH]:
self.state = 1104
self.match(ZmeiLangParser.DASH)
self.state = 1105
self.match(ZmeiLangParser.GT)
pass
elif token in [ZmeiLangParser.APPROX]:
self.state = 1106
self.match(ZmeiLangParser.APPROX)
self.state = 1107
self.match(ZmeiLangParser.GT)
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Col_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_col_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCol_name" ):
listener.enterCol_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCol_name" ):
listener.exitCol_name(self)
def col_name(self):
localctx = ZmeiLangParser.Col_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 112, self.RULE_col_name)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1110
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Col_fieldContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def col_field_name(self):
return self.getTypedRuleContext(ZmeiLangParser.Col_field_nameContext,0)
def EOF(self):
return self.getToken(ZmeiLangParser.EOF, 0)
def col_modifier(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Col_modifierContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Col_modifierContext,i)
def col_field_expr_or_def(self):
return self.getTypedRuleContext(ZmeiLangParser.Col_field_expr_or_defContext,0)
def col_field_verbose_name(self):
return self.getTypedRuleContext(ZmeiLangParser.Col_field_verbose_nameContext,0)
def col_field_help_text(self):
return self.getTypedRuleContext(ZmeiLangParser.Col_field_help_textContext,0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_col_field
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCol_field" ):
listener.enterCol_field(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCol_field" ):
listener.exitCol_field(self)
def col_field(self):
localctx = ZmeiLangParser.Col_fieldContext(self, self._ctx, self.state)
self.enterRule(localctx, 114, self.RULE_col_field)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1115
self._errHandler.sync(self)
_la = self._input.LA(1)
while ((((_la - 137)) & ~0x3f) == 0 and ((1 << (_la - 137)) & ((1 << (ZmeiLangParser.EQUALS - 137)) | (1 << (ZmeiLangParser.DOLLAR - 137)) | (1 << (ZmeiLangParser.AMP - 137)) | (1 << (ZmeiLangParser.EXCLAM - 137)) | (1 << (ZmeiLangParser.STAR - 137)) | (1 << (ZmeiLangParser.APPROX - 137)))) != 0):
self.state = 1112
self.col_modifier()
self.state = 1117
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 1118
self.col_field_name()
self.state = 1120
self._errHandler.sync(self)
_la = self._input.LA(1)
if ((((_la - 124)) & ~0x3f) == 0 and ((1 << (_la - 124)) & ((1 << (ZmeiLangParser.COLON - 124)) | (1 << (ZmeiLangParser.ASSIGN - 124)) | (1 << (ZmeiLangParser.ASSIGN_STATIC - 124)))) != 0):
self.state = 1119
self.col_field_expr_or_def()
self.state = 1123
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.SLASH:
self.state = 1122
self.col_field_verbose_name()
self.state = 1126
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.QUESTION_MARK:
self.state = 1125
self.col_field_help_text()
self.state = 1134
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.NL]:
self.state = 1129
self._errHandler.sync(self)
_alt = 1
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt == 1:
self.state = 1128
self.match(ZmeiLangParser.NL)
else:
raise NoViableAltException(self)
self.state = 1131
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,94,self._ctx)
pass
elif token in [ZmeiLangParser.EOF]:
self.state = 1133
self.match(ZmeiLangParser.EOF)
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Col_field_expr_or_defContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def col_field_expr(self):
return self.getTypedRuleContext(ZmeiLangParser.Col_field_exprContext,0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def col_field_def(self):
return self.getTypedRuleContext(ZmeiLangParser.Col_field_defContext,0)
def wrong_field_type(self):
return self.getTypedRuleContext(ZmeiLangParser.Wrong_field_typeContext,0)
def col_field_custom(self):
return self.getTypedRuleContext(ZmeiLangParser.Col_field_customContext,0)
def col_field_extend(self):
return self.getTypedRuleContext(ZmeiLangParser.Col_field_extendContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_col_field_expr_or_def
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCol_field_expr_or_def" ):
listener.enterCol_field_expr_or_def(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCol_field_expr_or_def" ):
listener.exitCol_field_expr_or_def(self)
def col_field_expr_or_def(self):
localctx = ZmeiLangParser.Col_field_expr_or_defContext(self, self._ctx, self.state)
self.enterRule(localctx, 116, self.RULE_col_field_expr_or_def)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1148
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,98,self._ctx)
if la_ == 1:
self.state = 1136
self.match(ZmeiLangParser.COLON)
self.state = 1138
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.CODE_BLOCK:
self.state = 1137
self.col_field_custom()
pass
elif la_ == 2:
self.state = 1140
self.match(ZmeiLangParser.COLON)
self.state = 1141
self.col_field_def()
self.state = 1143
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.DOT or _la==ZmeiLangParser.CODE_BLOCK:
self.state = 1142
self.col_field_extend()
pass
elif la_ == 3:
self.state = 1145
self.match(ZmeiLangParser.COLON)
self.state = 1146
self.wrong_field_type()
pass
elif la_ == 4:
self.state = 1147
self.col_field_expr()
pass
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Col_field_customContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def code_block(self):
return self.getTypedRuleContext(ZmeiLangParser.Code_blockContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_col_field_custom
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCol_field_custom" ):
listener.enterCol_field_custom(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCol_field_custom" ):
listener.exitCol_field_custom(self)
def col_field_custom(self):
localctx = ZmeiLangParser.Col_field_customContext(self, self._ctx, self.state)
self.enterRule(localctx, 118, self.RULE_col_field_custom)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1150
self.code_block()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Col_field_extendContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def code_block(self):
return self.getTypedRuleContext(ZmeiLangParser.Code_blockContext,0)
def col_field_extend_append(self):
return self.getTypedRuleContext(ZmeiLangParser.Col_field_extend_appendContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_col_field_extend
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCol_field_extend" ):
listener.enterCol_field_extend(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCol_field_extend" ):
listener.exitCol_field_extend(self)
def col_field_extend(self):
localctx = ZmeiLangParser.Col_field_extendContext(self, self._ctx, self.state)
self.enterRule(localctx, 120, self.RULE_col_field_extend)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1153
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.DOT:
self.state = 1152
self.col_field_extend_append()
self.state = 1155
self.code_block()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Col_field_extend_appendContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def DOT(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.DOT)
else:
return self.getToken(ZmeiLangParser.DOT, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_col_field_extend_append
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCol_field_extend_append" ):
listener.enterCol_field_extend_append(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCol_field_extend_append" ):
listener.exitCol_field_extend_append(self)
def col_field_extend_append(self):
localctx = ZmeiLangParser.Col_field_extend_appendContext(self, self._ctx, self.state)
self.enterRule(localctx, 122, self.RULE_col_field_extend_append)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1157
self.match(ZmeiLangParser.DOT)
self.state = 1158
self.match(ZmeiLangParser.DOT)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Wrong_field_typeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_wrong_field_type
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterWrong_field_type" ):
listener.enterWrong_field_type(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitWrong_field_type" ):
listener.exitWrong_field_type(self)
def wrong_field_type(self):
localctx = ZmeiLangParser.Wrong_field_typeContext(self, self._ctx, self.state)
self.enterRule(localctx, 124, self.RULE_wrong_field_type)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1160
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Col_field_exprContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def col_field_expr_marker(self):
return self.getTypedRuleContext(ZmeiLangParser.Col_field_expr_markerContext,0)
def col_feild_expr_code(self):
return self.getTypedRuleContext(ZmeiLangParser.Col_feild_expr_codeContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_col_field_expr
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCol_field_expr" ):
listener.enterCol_field_expr(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCol_field_expr" ):
listener.exitCol_field_expr(self)
def col_field_expr(self):
localctx = ZmeiLangParser.Col_field_exprContext(self, self._ctx, self.state)
self.enterRule(localctx, 126, self.RULE_col_field_expr)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1162
self.col_field_expr_marker()
self.state = 1163
self.col_feild_expr_code()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Col_field_expr_markerContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def ASSIGN(self):
return self.getToken(ZmeiLangParser.ASSIGN, 0)
def ASSIGN_STATIC(self):
return self.getToken(ZmeiLangParser.ASSIGN_STATIC, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_col_field_expr_marker
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCol_field_expr_marker" ):
listener.enterCol_field_expr_marker(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCol_field_expr_marker" ):
listener.exitCol_field_expr_marker(self)
def col_field_expr_marker(self):
localctx = ZmeiLangParser.Col_field_expr_markerContext(self, self._ctx, self.state)
self.enterRule(localctx, 128, self.RULE_col_field_expr_marker)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1165
_la = self._input.LA(1)
if not(_la==ZmeiLangParser.ASSIGN or _la==ZmeiLangParser.ASSIGN_STATIC):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Col_feild_expr_codeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def PYTHON_CODE(self):
return self.getToken(ZmeiLangParser.PYTHON_CODE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_col_feild_expr_code
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCol_feild_expr_code" ):
listener.enterCol_feild_expr_code(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCol_feild_expr_code" ):
listener.exitCol_feild_expr_code(self)
def col_feild_expr_code(self):
localctx = ZmeiLangParser.Col_feild_expr_codeContext(self, self._ctx, self.state)
self.enterRule(localctx, 130, self.RULE_col_feild_expr_code)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1167
self.match(ZmeiLangParser.PYTHON_CODE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class String_or_quotedContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def STRING_DQ(self):
return self.getToken(ZmeiLangParser.STRING_DQ, 0)
def STRING_SQ(self):
return self.getToken(ZmeiLangParser.STRING_SQ, 0)
def id_or_kw(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Id_or_kwContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_string_or_quoted
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterString_or_quoted" ):
listener.enterString_or_quoted(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitString_or_quoted" ):
listener.exitString_or_quoted(self)
def string_or_quoted(self):
localctx = ZmeiLangParser.String_or_quotedContext(self, self._ctx, self.state)
self.enterRule(localctx, 132, self.RULE_string_or_quoted)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1176
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID]:
self.state = 1170
self._errHandler.sync(self)
_la = self._input.LA(1)
while True:
self.state = 1169
self.id_or_kw()
self.state = 1172
self._errHandler.sync(self)
_la = self._input.LA(1)
if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << ZmeiLangParser.KW_AUTH_TYPE_BASIC) | (1 << ZmeiLangParser.KW_AUTH_TYPE_SESSION) | (1 << ZmeiLangParser.KW_AUTH_TYPE_TOKEN) | (1 << ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT) | (1 << ZmeiLangParser.COL_FIELD_TYPE_HTML) | (1 << ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA) | (1 << ZmeiLangParser.COL_FIELD_TYPE_FLOAT) | (1 << ZmeiLangParser.COL_FIELD_TYPE_DECIMAL) | (1 << ZmeiLangParser.COL_FIELD_TYPE_DATE) | (1 << ZmeiLangParser.COL_FIELD_TYPE_DATETIME) | (1 << ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME) | (1 << ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME) | (1 << ZmeiLangParser.COL_FIELD_TYPE_IMAGE) | (1 << ZmeiLangParser.COL_FIELD_TYPE_FILE) | (1 << ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE) | (1 << ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE) | (1 << ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER) | (1 << ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER) | (1 << ZmeiLangParser.COL_FIELD_TYPE_TEXT) | (1 << ZmeiLangParser.COL_FIELD_TYPE_INT) | (1 << ZmeiLangParser.COL_FIELD_TYPE_SLUG) | (1 << ZmeiLangParser.COL_FIELD_TYPE_BOOL))) != 0) or ((((_la - 64)) & ~0x3f) == 0 and ((1 << (_la - 64)) & ((1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE - 64)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE - 64)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_MANY - 64)) | (1 << (ZmeiLangParser.COL_FIELD_CHOICES - 64)) | (1 << (ZmeiLangParser.KW_THEME - 64)) | (1 << (ZmeiLangParser.KW_INSTALL - 64)) | (1 << (ZmeiLangParser.KW_HEADER - 64)) | (1 << (ZmeiLangParser.KW_SERVICES - 64)) | (1 << (ZmeiLangParser.KW_SELENIUM_PYTEST - 64)) | (1 << (ZmeiLangParser.KW_CHILD - 64)) | (1 << (ZmeiLangParser.KW_FILTER_OUT - 64)) | (1 << (ZmeiLangParser.KW_FILTER_IN - 64)) | (1 << (ZmeiLangParser.KW_PAGE - 64)) | (1 << (ZmeiLangParser.KW_LINK_SUFFIX - 64)) | (1 << (ZmeiLangParser.KW_URL_PREFIX - 64)) | (1 << (ZmeiLangParser.KW_CAN_EDIT - 64)) | (1 << (ZmeiLangParser.KW_OBJECT_EXPR - 64)) | (1 << (ZmeiLangParser.KW_BLOCK - 64)) | (1 << (ZmeiLangParser.KW_ITEM_NAME - 64)) | (1 << (ZmeiLangParser.KW_PK_PARAM - 64)) | (1 << (ZmeiLangParser.KW_LIST_FIELDS - 64)) | (1 << (ZmeiLangParser.KW_DELETE - 64)) | (1 << (ZmeiLangParser.KW_EDIT - 64)) | (1 << (ZmeiLangParser.KW_CREATE - 64)) | (1 << (ZmeiLangParser.KW_DETAIL - 64)) | (1 << (ZmeiLangParser.KW_SKIP - 64)) | (1 << (ZmeiLangParser.KW_FROM - 64)) | (1 << (ZmeiLangParser.KW_POLY_LIST - 64)) | (1 << (ZmeiLangParser.KW_CSS - 64)) | (1 << (ZmeiLangParser.KW_JS - 64)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_TABULAR - 64)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_STACKED - 64)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC - 64)) | (1 << (ZmeiLangParser.KW_INLINE - 64)) | (1 << (ZmeiLangParser.KW_TYPE - 64)) | (1 << (ZmeiLangParser.KW_USER_FIELD - 64)) | (1 << (ZmeiLangParser.KW_ANNOTATE - 64)) | (1 << (ZmeiLangParser.KW_ON_CREATE - 64)) | (1 << (ZmeiLangParser.KW_QUERY - 64)) | (1 << (ZmeiLangParser.KW_AUTH - 64)) | (1 << (ZmeiLangParser.KW_COUNT - 64)) | (1 << (ZmeiLangParser.KW_I18N - 64)) | (1 << (ZmeiLangParser.KW_EXTENSION - 64)) | (1 << (ZmeiLangParser.KW_TABS - 64)) | (1 << (ZmeiLangParser.KW_LIST - 64)) | (1 << (ZmeiLangParser.KW_READ_ONLY - 64)) | (1 << (ZmeiLangParser.KW_LIST_EDITABLE - 64)) | (1 << (ZmeiLangParser.KW_LIST_FILTER - 64)) | (1 << (ZmeiLangParser.KW_LIST_SEARCH - 64)) | (1 << (ZmeiLangParser.KW_FIELDS - 64)) | (1 << (ZmeiLangParser.KW_IMPORT - 64)) | (1 << (ZmeiLangParser.KW_AS - 64)) | (1 << (ZmeiLangParser.WRITE_MODE - 64)) | (1 << (ZmeiLangParser.BOOL - 64)) | (1 << (ZmeiLangParser.ID - 64)))) != 0)):
break
pass
elif token in [ZmeiLangParser.STRING_DQ]:
self.state = 1174
self.match(ZmeiLangParser.STRING_DQ)
pass
elif token in [ZmeiLangParser.STRING_SQ]:
self.state = 1175
self.match(ZmeiLangParser.STRING_SQ)
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Col_field_help_textContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def QUESTION_MARK(self):
return self.getToken(ZmeiLangParser.QUESTION_MARK, 0)
def string_or_quoted(self):
return self.getTypedRuleContext(ZmeiLangParser.String_or_quotedContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_col_field_help_text
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCol_field_help_text" ):
listener.enterCol_field_help_text(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCol_field_help_text" ):
listener.exitCol_field_help_text(self)
def col_field_help_text(self):
localctx = ZmeiLangParser.Col_field_help_textContext(self, self._ctx, self.state)
self.enterRule(localctx, 134, self.RULE_col_field_help_text)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1178
self.match(ZmeiLangParser.QUESTION_MARK)
self.state = 1179
self.string_or_quoted()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Col_field_verbose_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def SLASH(self):
return self.getToken(ZmeiLangParser.SLASH, 0)
def string_or_quoted(self):
return self.getTypedRuleContext(ZmeiLangParser.String_or_quotedContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_col_field_verbose_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCol_field_verbose_name" ):
listener.enterCol_field_verbose_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCol_field_verbose_name" ):
listener.exitCol_field_verbose_name(self)
def col_field_verbose_name(self):
localctx = ZmeiLangParser.Col_field_verbose_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 136, self.RULE_col_field_verbose_name)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1181
self.match(ZmeiLangParser.SLASH)
self.state = 1182
self.string_or_quoted()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Col_field_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_col_field_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCol_field_name" ):
listener.enterCol_field_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCol_field_name" ):
listener.exitCol_field_name(self)
def col_field_name(self):
localctx = ZmeiLangParser.Col_field_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 138, self.RULE_col_field_name)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1184
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Col_modifierContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def EQUALS(self):
return self.getToken(ZmeiLangParser.EQUALS, 0)
def DOLLAR(self):
return self.getToken(ZmeiLangParser.DOLLAR, 0)
def AMP(self):
return self.getToken(ZmeiLangParser.AMP, 0)
def EXCLAM(self):
return self.getToken(ZmeiLangParser.EXCLAM, 0)
def STAR(self):
return self.getToken(ZmeiLangParser.STAR, 0)
def APPROX(self):
return self.getToken(ZmeiLangParser.APPROX, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_col_modifier
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCol_modifier" ):
listener.enterCol_modifier(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCol_modifier" ):
listener.exitCol_modifier(self)
def col_modifier(self):
localctx = ZmeiLangParser.Col_modifierContext(self, self._ctx, self.state)
self.enterRule(localctx, 140, self.RULE_col_modifier)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1186
_la = self._input.LA(1)
if not(((((_la - 137)) & ~0x3f) == 0 and ((1 << (_la - 137)) & ((1 << (ZmeiLangParser.EQUALS - 137)) | (1 << (ZmeiLangParser.DOLLAR - 137)) | (1 << (ZmeiLangParser.AMP - 137)) | (1 << (ZmeiLangParser.EXCLAM - 137)) | (1 << (ZmeiLangParser.STAR - 137)) | (1 << (ZmeiLangParser.APPROX - 137)))) != 0)):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Col_field_defContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def field_longtext(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_longtextContext,0)
def field_html_media(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_html_mediaContext,0)
def field_html(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_htmlContext,0)
def field_float(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_floatContext,0)
def field_decimal(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_decimalContext,0)
def field_date(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_dateContext,0)
def field_datetime(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_datetimeContext,0)
def field_create_time(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_create_timeContext,0)
def field_update_time(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_update_timeContext,0)
def field_text(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_textContext,0)
def field_int(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_intContext,0)
def field_slug(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_slugContext,0)
def field_bool(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_boolContext,0)
def field_relation(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_relationContext,0)
def field_image(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_imageContext,0)
def field_file(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_fileContext,0)
def field_filer_file(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_filer_fileContext,0)
def field_filer_folder(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_filer_folderContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_col_field_def
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterCol_field_def" ):
listener.enterCol_field_def(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitCol_field_def" ):
listener.exitCol_field_def(self)
def col_field_def(self):
localctx = ZmeiLangParser.Col_field_defContext(self, self._ctx, self.state)
self.enterRule(localctx, 142, self.RULE_col_field_def)
try:
self.state = 1206
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT]:
self.enterOuterAlt(localctx, 1)
self.state = 1188
self.field_longtext()
pass
elif token in [ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA]:
self.enterOuterAlt(localctx, 2)
self.state = 1189
self.field_html_media()
pass
elif token in [ZmeiLangParser.COL_FIELD_TYPE_HTML]:
self.enterOuterAlt(localctx, 3)
self.state = 1190
self.field_html()
pass
elif token in [ZmeiLangParser.COL_FIELD_TYPE_FLOAT]:
self.enterOuterAlt(localctx, 4)
self.state = 1191
self.field_float()
pass
elif token in [ZmeiLangParser.COL_FIELD_TYPE_DECIMAL]:
self.enterOuterAlt(localctx, 5)
self.state = 1192
self.field_decimal()
pass
elif token in [ZmeiLangParser.COL_FIELD_TYPE_DATE]:
self.enterOuterAlt(localctx, 6)
self.state = 1193
self.field_date()
pass
elif token in [ZmeiLangParser.COL_FIELD_TYPE_DATETIME]:
self.enterOuterAlt(localctx, 7)
self.state = 1194
self.field_datetime()
pass
elif token in [ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME]:
self.enterOuterAlt(localctx, 8)
self.state = 1195
self.field_create_time()
pass
elif token in [ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME]:
self.enterOuterAlt(localctx, 9)
self.state = 1196
self.field_update_time()
pass
elif token in [ZmeiLangParser.COL_FIELD_TYPE_TEXT]:
self.enterOuterAlt(localctx, 10)
self.state = 1197
self.field_text()
pass
elif token in [ZmeiLangParser.COL_FIELD_TYPE_INT]:
self.enterOuterAlt(localctx, 11)
self.state = 1198
self.field_int()
pass
elif token in [ZmeiLangParser.COL_FIELD_TYPE_SLUG]:
self.enterOuterAlt(localctx, 12)
self.state = 1199
self.field_slug()
pass
elif token in [ZmeiLangParser.COL_FIELD_TYPE_BOOL]:
self.enterOuterAlt(localctx, 13)
self.state = 1200
self.field_bool()
pass
elif token in [ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY]:
self.enterOuterAlt(localctx, 14)
self.state = 1201
self.field_relation()
pass
elif token in [ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER]:
self.enterOuterAlt(localctx, 15)
self.state = 1202
self.field_image()
pass
elif token in [ZmeiLangParser.COL_FIELD_TYPE_FILE]:
self.enterOuterAlt(localctx, 16)
self.state = 1203
self.field_file()
pass
elif token in [ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE]:
self.enterOuterAlt(localctx, 17)
self.state = 1204
self.field_filer_file()
pass
elif token in [ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER]:
self.enterOuterAlt(localctx, 18)
self.state = 1205
self.field_filer_folder()
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_longtextContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COL_FIELD_TYPE_LONGTEXT(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_longtext
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_longtext" ):
listener.enterField_longtext(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_longtext" ):
listener.exitField_longtext(self)
def field_longtext(self):
localctx = ZmeiLangParser.Field_longtextContext(self, self._ctx, self.state)
self.enterRule(localctx, 144, self.RULE_field_longtext)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1208
self.match(ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_htmlContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COL_FIELD_TYPE_HTML(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_HTML, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_html
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_html" ):
listener.enterField_html(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_html" ):
listener.exitField_html(self)
def field_html(self):
localctx = ZmeiLangParser.Field_htmlContext(self, self._ctx, self.state)
self.enterRule(localctx, 146, self.RULE_field_html)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1210
self.match(ZmeiLangParser.COL_FIELD_TYPE_HTML)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_html_mediaContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COL_FIELD_TYPE_HTML_MEDIA(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_html_media
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_html_media" ):
listener.enterField_html_media(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_html_media" ):
listener.exitField_html_media(self)
def field_html_media(self):
localctx = ZmeiLangParser.Field_html_mediaContext(self, self._ctx, self.state)
self.enterRule(localctx, 148, self.RULE_field_html_media)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1212
self.match(ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_floatContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COL_FIELD_TYPE_FLOAT(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_FLOAT, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_float
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_float" ):
listener.enterField_float(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_float" ):
listener.exitField_float(self)
def field_float(self):
localctx = ZmeiLangParser.Field_floatContext(self, self._ctx, self.state)
self.enterRule(localctx, 150, self.RULE_field_float)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1214
self.match(ZmeiLangParser.COL_FIELD_TYPE_FLOAT)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_decimalContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COL_FIELD_TYPE_DECIMAL(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_decimal
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_decimal" ):
listener.enterField_decimal(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_decimal" ):
listener.exitField_decimal(self)
def field_decimal(self):
localctx = ZmeiLangParser.Field_decimalContext(self, self._ctx, self.state)
self.enterRule(localctx, 152, self.RULE_field_decimal)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1216
self.match(ZmeiLangParser.COL_FIELD_TYPE_DECIMAL)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_dateContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COL_FIELD_TYPE_DATE(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_DATE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_date
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_date" ):
listener.enterField_date(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_date" ):
listener.exitField_date(self)
def field_date(self):
localctx = ZmeiLangParser.Field_dateContext(self, self._ctx, self.state)
self.enterRule(localctx, 154, self.RULE_field_date)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1218
self.match(ZmeiLangParser.COL_FIELD_TYPE_DATE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_datetimeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COL_FIELD_TYPE_DATETIME(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_DATETIME, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_datetime
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_datetime" ):
listener.enterField_datetime(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_datetime" ):
listener.exitField_datetime(self)
def field_datetime(self):
localctx = ZmeiLangParser.Field_datetimeContext(self, self._ctx, self.state)
self.enterRule(localctx, 156, self.RULE_field_datetime)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1220
self.match(ZmeiLangParser.COL_FIELD_TYPE_DATETIME)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_create_timeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COL_FIELD_TYPE_CREATE_TIME(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_create_time
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_create_time" ):
listener.enterField_create_time(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_create_time" ):
listener.exitField_create_time(self)
def field_create_time(self):
localctx = ZmeiLangParser.Field_create_timeContext(self, self._ctx, self.state)
self.enterRule(localctx, 158, self.RULE_field_create_time)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1222
self.match(ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_update_timeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COL_FIELD_TYPE_UPDATE_TIME(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_update_time
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_update_time" ):
listener.enterField_update_time(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_update_time" ):
listener.exitField_update_time(self)
def field_update_time(self):
localctx = ZmeiLangParser.Field_update_timeContext(self, self._ctx, self.state)
self.enterRule(localctx, 160, self.RULE_field_update_time)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1224
self.match(ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_fileContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COL_FIELD_TYPE_FILE(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_FILE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_file
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_file" ):
listener.enterField_file(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_file" ):
listener.exitField_file(self)
def field_file(self):
localctx = ZmeiLangParser.Field_fileContext(self, self._ctx, self.state)
self.enterRule(localctx, 162, self.RULE_field_file)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1226
self.match(ZmeiLangParser.COL_FIELD_TYPE_FILE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_filer_fileContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COL_FIELD_TYPE_FILER_FILE(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_filer_file
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_filer_file" ):
listener.enterField_filer_file(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_filer_file" ):
listener.exitField_filer_file(self)
def field_filer_file(self):
localctx = ZmeiLangParser.Field_filer_fileContext(self, self._ctx, self.state)
self.enterRule(localctx, 164, self.RULE_field_filer_file)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1228
self.match(ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_filer_folderContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COL_FIELD_TYPE_FILER_FOLDER(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_filer_folder
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_filer_folder" ):
listener.enterField_filer_folder(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_filer_folder" ):
listener.exitField_filer_folder(self)
def field_filer_folder(self):
localctx = ZmeiLangParser.Field_filer_folderContext(self, self._ctx, self.state)
self.enterRule(localctx, 166, self.RULE_field_filer_folder)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1230
self.match(ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_textContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COL_FIELD_TYPE_TEXT(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_TEXT, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def field_text_size(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_text_sizeContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def COMA(self):
return self.getToken(ZmeiLangParser.COMA, 0)
def field_text_choices(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_text_choicesContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_text
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_text" ):
listener.enterField_text(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_text" ):
listener.exitField_text(self)
def field_text(self):
localctx = ZmeiLangParser.Field_textContext(self, self._ctx, self.state)
self.enterRule(localctx, 168, self.RULE_field_text)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1232
self.match(ZmeiLangParser.COL_FIELD_TYPE_TEXT)
self.state = 1241
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.BRACE_OPEN:
self.state = 1233
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 1234
self.field_text_size()
self.state = 1237
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.COMA:
self.state = 1235
self.match(ZmeiLangParser.COMA)
self.state = 1236
self.field_text_choices()
self.state = 1239
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_text_sizeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def DIGIT(self):
return self.getToken(ZmeiLangParser.DIGIT, 0)
def QUESTION_MARK(self):
return self.getToken(ZmeiLangParser.QUESTION_MARK, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_text_size
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_text_size" ):
listener.enterField_text_size(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_text_size" ):
listener.exitField_text_size(self)
def field_text_size(self):
localctx = ZmeiLangParser.Field_text_sizeContext(self, self._ctx, self.state)
self.enterRule(localctx, 170, self.RULE_field_text_size)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1243
_la = self._input.LA(1)
if not(_la==ZmeiLangParser.DIGIT or _la==ZmeiLangParser.QUESTION_MARK):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_text_choicesContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COL_FIELD_CHOICES(self):
return self.getToken(ZmeiLangParser.COL_FIELD_CHOICES, 0)
def EQUALS(self):
return self.getToken(ZmeiLangParser.EQUALS, 0)
def field_text_choice(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Field_text_choiceContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Field_text_choiceContext,i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_text_choices
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_text_choices" ):
listener.enterField_text_choices(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_text_choices" ):
listener.exitField_text_choices(self)
def field_text_choices(self):
localctx = ZmeiLangParser.Field_text_choicesContext(self, self._ctx, self.state)
self.enterRule(localctx, 172, self.RULE_field_text_choices)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1245
self.match(ZmeiLangParser.COL_FIELD_CHOICES)
self.state = 1246
self.match(ZmeiLangParser.EQUALS)
self.state = 1247
self.field_text_choice()
self.state = 1252
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.COMA:
self.state = 1248
self.match(ZmeiLangParser.COMA)
self.state = 1249
self.field_text_choice()
self.state = 1254
self._errHandler.sync(self)
_la = self._input.LA(1)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_text_choiceContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def field_text_choice_val(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_text_choice_valContext,0)
def field_text_choice_key(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_text_choice_keyContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_text_choice
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_text_choice" ):
listener.enterField_text_choice(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_text_choice" ):
listener.exitField_text_choice(self)
def field_text_choice(self):
localctx = ZmeiLangParser.Field_text_choiceContext(self, self._ctx, self.state)
self.enterRule(localctx, 174, self.RULE_field_text_choice)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1256
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,106,self._ctx)
if la_ == 1:
self.state = 1255
self.field_text_choice_key()
self.state = 1258
self.field_text_choice_val()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_text_choice_valContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def STRING_DQ(self):
return self.getToken(ZmeiLangParser.STRING_DQ, 0)
def STRING_SQ(self):
return self.getToken(ZmeiLangParser.STRING_SQ, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_text_choice_val
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_text_choice_val" ):
listener.enterField_text_choice_val(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_text_choice_val" ):
listener.exitField_text_choice_val(self)
def field_text_choice_val(self):
localctx = ZmeiLangParser.Field_text_choice_valContext(self, self._ctx, self.state)
self.enterRule(localctx, 176, self.RULE_field_text_choice_val)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1263
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID]:
self.state = 1260
self.id_or_kw()
pass
elif token in [ZmeiLangParser.STRING_DQ]:
self.state = 1261
self.match(ZmeiLangParser.STRING_DQ)
pass
elif token in [ZmeiLangParser.STRING_SQ]:
self.state = 1262
self.match(ZmeiLangParser.STRING_SQ)
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_text_choice_keyContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_text_choice_key
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_text_choice_key" ):
listener.enterField_text_choice_key(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_text_choice_key" ):
listener.exitField_text_choice_key(self)
def field_text_choice_key(self):
localctx = ZmeiLangParser.Field_text_choice_keyContext(self, self._ctx, self.state)
self.enterRule(localctx, 178, self.RULE_field_text_choice_key)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1265
self.id_or_kw()
self.state = 1266
self.match(ZmeiLangParser.COLON)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_intContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COL_FIELD_TYPE_INT(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_INT, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def field_int_choices(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_int_choicesContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_int
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_int" ):
listener.enterField_int(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_int" ):
listener.exitField_int(self)
def field_int(self):
localctx = ZmeiLangParser.Field_intContext(self, self._ctx, self.state)
self.enterRule(localctx, 180, self.RULE_field_int)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1268
self.match(ZmeiLangParser.COL_FIELD_TYPE_INT)
self.state = 1273
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.BRACE_OPEN:
self.state = 1269
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 1270
self.field_int_choices()
self.state = 1271
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_int_choicesContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COL_FIELD_CHOICES(self):
return self.getToken(ZmeiLangParser.COL_FIELD_CHOICES, 0)
def EQUALS(self):
return self.getToken(ZmeiLangParser.EQUALS, 0)
def field_int_choice(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Field_int_choiceContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Field_int_choiceContext,i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_int_choices
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_int_choices" ):
listener.enterField_int_choices(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_int_choices" ):
listener.exitField_int_choices(self)
def field_int_choices(self):
localctx = ZmeiLangParser.Field_int_choicesContext(self, self._ctx, self.state)
self.enterRule(localctx, 182, self.RULE_field_int_choices)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1275
self.match(ZmeiLangParser.COL_FIELD_CHOICES)
self.state = 1276
self.match(ZmeiLangParser.EQUALS)
self.state = 1277
self.field_int_choice()
self.state = 1282
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.COMA:
self.state = 1278
self.match(ZmeiLangParser.COMA)
self.state = 1279
self.field_int_choice()
self.state = 1284
self._errHandler.sync(self)
_la = self._input.LA(1)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_int_choiceContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def field_int_choice_val(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_int_choice_valContext,0)
def field_int_choice_key(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_int_choice_keyContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_int_choice
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_int_choice" ):
listener.enterField_int_choice(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_int_choice" ):
listener.exitField_int_choice(self)
def field_int_choice(self):
localctx = ZmeiLangParser.Field_int_choiceContext(self, self._ctx, self.state)
self.enterRule(localctx, 184, self.RULE_field_int_choice)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1286
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.DIGIT:
self.state = 1285
self.field_int_choice_key()
self.state = 1288
self.field_int_choice_val()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_int_choice_valContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def STRING_DQ(self):
return self.getToken(ZmeiLangParser.STRING_DQ, 0)
def STRING_SQ(self):
return self.getToken(ZmeiLangParser.STRING_SQ, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_int_choice_val
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_int_choice_val" ):
listener.enterField_int_choice_val(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_int_choice_val" ):
listener.exitField_int_choice_val(self)
def field_int_choice_val(self):
localctx = ZmeiLangParser.Field_int_choice_valContext(self, self._ctx, self.state)
self.enterRule(localctx, 186, self.RULE_field_int_choice_val)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1293
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID]:
self.state = 1290
self.id_or_kw()
pass
elif token in [ZmeiLangParser.STRING_DQ]:
self.state = 1291
self.match(ZmeiLangParser.STRING_DQ)
pass
elif token in [ZmeiLangParser.STRING_SQ]:
self.state = 1292
self.match(ZmeiLangParser.STRING_SQ)
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_int_choice_keyContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def DIGIT(self):
return self.getToken(ZmeiLangParser.DIGIT, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_int_choice_key
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_int_choice_key" ):
listener.enterField_int_choice_key(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_int_choice_key" ):
listener.exitField_int_choice_key(self)
def field_int_choice_key(self):
localctx = ZmeiLangParser.Field_int_choice_keyContext(self, self._ctx, self.state)
self.enterRule(localctx, 188, self.RULE_field_int_choice_key)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1295
self.match(ZmeiLangParser.DIGIT)
self.state = 1296
self.match(ZmeiLangParser.COLON)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_slugContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COL_FIELD_TYPE_SLUG(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_SLUG, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def field_slug_ref_field(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_slug_ref_fieldContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_slug
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_slug" ):
listener.enterField_slug(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_slug" ):
listener.exitField_slug(self)
def field_slug(self):
localctx = ZmeiLangParser.Field_slugContext(self, self._ctx, self.state)
self.enterRule(localctx, 190, self.RULE_field_slug)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1298
self.match(ZmeiLangParser.COL_FIELD_TYPE_SLUG)
self.state = 1299
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 1300
self.field_slug_ref_field()
self.state = 1301
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_slug_ref_fieldContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def field_slug_ref_field_id(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Field_slug_ref_field_idContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Field_slug_ref_field_idContext,i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_slug_ref_field
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_slug_ref_field" ):
listener.enterField_slug_ref_field(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_slug_ref_field" ):
listener.exitField_slug_ref_field(self)
def field_slug_ref_field(self):
localctx = ZmeiLangParser.Field_slug_ref_fieldContext(self, self._ctx, self.state)
self.enterRule(localctx, 192, self.RULE_field_slug_ref_field)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1303
self.field_slug_ref_field_id()
self.state = 1308
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.COMA:
self.state = 1304
self.match(ZmeiLangParser.COMA)
self.state = 1305
self.field_slug_ref_field_id()
self.state = 1310
self._errHandler.sync(self)
_la = self._input.LA(1)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_slug_ref_field_idContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_slug_ref_field_id
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_slug_ref_field_id" ):
listener.enterField_slug_ref_field_id(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_slug_ref_field_id" ):
listener.exitField_slug_ref_field_id(self)
def field_slug_ref_field_id(self):
localctx = ZmeiLangParser.Field_slug_ref_field_idContext(self, self._ctx, self.state)
self.enterRule(localctx, 194, self.RULE_field_slug_ref_field_id)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1311
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_boolContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COL_FIELD_TYPE_BOOL(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_BOOL, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def field_bool_default(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_bool_defaultContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_bool
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_bool" ):
listener.enterField_bool(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_bool" ):
listener.exitField_bool(self)
def field_bool(self):
localctx = ZmeiLangParser.Field_boolContext(self, self._ctx, self.state)
self.enterRule(localctx, 196, self.RULE_field_bool)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1313
self.match(ZmeiLangParser.COL_FIELD_TYPE_BOOL)
self.state = 1318
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.BRACE_OPEN:
self.state = 1314
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 1315
self.field_bool_default()
self.state = 1316
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_bool_defaultContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def BOOL(self):
return self.getToken(ZmeiLangParser.BOOL, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_bool_default
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_bool_default" ):
listener.enterField_bool_default(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_bool_default" ):
listener.exitField_bool_default(self)
def field_bool_default(self):
localctx = ZmeiLangParser.Field_bool_defaultContext(self, self._ctx, self.state)
self.enterRule(localctx, 198, self.RULE_field_bool_default)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1320
self.match(ZmeiLangParser.BOOL)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_imageContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def filer_image_type(self):
return self.getTypedRuleContext(ZmeiLangParser.Filer_image_typeContext,0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def field_image_sizes(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_image_sizesContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_image
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_image" ):
listener.enterField_image(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_image" ):
listener.exitField_image(self)
def field_image(self):
localctx = ZmeiLangParser.Field_imageContext(self, self._ctx, self.state)
self.enterRule(localctx, 200, self.RULE_field_image)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1322
self.filer_image_type()
self.state = 1327
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.BRACE_OPEN:
self.state = 1323
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 1324
self.field_image_sizes()
self.state = 1325
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Filer_image_typeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COL_FIELD_TYPE_IMAGE(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_IMAGE, 0)
def COL_FIELD_TYPE_FILER_IMAGE(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, 0)
def COL_FIELD_TYPE_FILER_IMAGE_FOLDER(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_filer_image_type
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterFiler_image_type" ):
listener.enterFiler_image_type(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitFiler_image_type" ):
listener.exitFiler_image_type(self)
def filer_image_type(self):
localctx = ZmeiLangParser.Filer_image_typeContext(self, self._ctx, self.state)
self.enterRule(localctx, 202, self.RULE_filer_image_type)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1329
_la = self._input.LA(1)
if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << ZmeiLangParser.COL_FIELD_TYPE_IMAGE) | (1 << ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE) | (1 << ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER))) != 0)):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_image_sizesContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def field_image_size(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Field_image_sizeContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Field_image_sizeContext,i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_image_sizes
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_image_sizes" ):
listener.enterField_image_sizes(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_image_sizes" ):
listener.exitField_image_sizes(self)
def field_image_sizes(self):
localctx = ZmeiLangParser.Field_image_sizesContext(self, self._ctx, self.state)
self.enterRule(localctx, 204, self.RULE_field_image_sizes)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1331
self.field_image_size()
self.state = 1336
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.COMA:
self.state = 1332
self.match(ZmeiLangParser.COMA)
self.state = 1333
self.field_image_size()
self.state = 1338
self._errHandler.sync(self)
_la = self._input.LA(1)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_image_sizeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def field_image_size_name(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_image_size_nameContext,0)
def field_image_size_dimensions(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_image_size_dimensionsContext,0)
def field_image_filters(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_image_filtersContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_image_size
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_image_size" ):
listener.enterField_image_size(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_image_size" ):
listener.exitField_image_size(self)
def field_image_size(self):
localctx = ZmeiLangParser.Field_image_sizeContext(self, self._ctx, self.state)
self.enterRule(localctx, 206, self.RULE_field_image_size)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1339
self.field_image_size_name()
self.state = 1340
self.field_image_size_dimensions()
self.state = 1341
self.field_image_filters()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_image_size_dimensionsContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def SIZE2D(self):
return self.getToken(ZmeiLangParser.SIZE2D, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_image_size_dimensions
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_image_size_dimensions" ):
listener.enterField_image_size_dimensions(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_image_size_dimensions" ):
listener.exitField_image_size_dimensions(self)
def field_image_size_dimensions(self):
localctx = ZmeiLangParser.Field_image_size_dimensionsContext(self, self._ctx, self.state)
self.enterRule(localctx, 208, self.RULE_field_image_size_dimensions)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1343
self.match(ZmeiLangParser.SIZE2D)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_image_size_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def EQUALS(self):
return self.getToken(ZmeiLangParser.EQUALS, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_image_size_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_image_size_name" ):
listener.enterField_image_size_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_image_size_name" ):
listener.exitField_image_size_name(self)
def field_image_size_name(self):
localctx = ZmeiLangParser.Field_image_size_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 210, self.RULE_field_image_size_name)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1345
self.id_or_kw()
self.state = 1346
self.match(ZmeiLangParser.EQUALS)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_image_filtersContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def field_image_filter(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Field_image_filterContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Field_image_filterContext,i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_image_filters
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_image_filters" ):
listener.enterField_image_filters(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_image_filters" ):
listener.exitField_image_filters(self)
def field_image_filters(self):
localctx = ZmeiLangParser.Field_image_filtersContext(self, self._ctx, self.state)
self.enterRule(localctx, 212, self.RULE_field_image_filters)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1351
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.PIPE:
self.state = 1348
self.field_image_filter()
self.state = 1353
self._errHandler.sync(self)
_la = self._input.LA(1)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_image_filterContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def PIPE(self):
return self.getToken(ZmeiLangParser.PIPE, 0)
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_image_filter
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_image_filter" ):
listener.enterField_image_filter(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_image_filter" ):
listener.exitField_image_filter(self)
def field_image_filter(self):
localctx = ZmeiLangParser.Field_image_filterContext(self, self._ctx, self.state)
self.enterRule(localctx, 214, self.RULE_field_image_filter)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1354
self.match(ZmeiLangParser.PIPE)
self.state = 1355
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_relationContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def field_relation_type(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_relation_typeContext,0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def field_relation_target_ref(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_relation_target_refContext,0)
def field_relation_target_class(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_relation_target_classContext,0)
def field_relation_cascade_marker(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_relation_cascade_markerContext,0)
def field_relation_related_name(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_relation_related_nameContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_relation
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_relation" ):
listener.enterField_relation(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_relation" ):
listener.exitField_relation(self)
def field_relation(self):
localctx = ZmeiLangParser.Field_relationContext(self, self._ctx, self.state)
self.enterRule(localctx, 216, self.RULE_field_relation)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1357
self.field_relation_type()
self.state = 1358
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 1360
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.EXCLAM or _la==ZmeiLangParser.APPROX:
self.state = 1359
self.field_relation_cascade_marker()
self.state = 1364
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.HASH]:
self.state = 1362
self.field_relation_target_ref()
pass
elif token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID]:
self.state = 1363
self.field_relation_target_class()
pass
else:
raise NoViableAltException(self)
self.state = 1367
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.DASH:
self.state = 1366
self.field_relation_related_name()
self.state = 1369
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_relation_typeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COL_FIELD_TYPE_ONE(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_ONE, 0)
def COL_FIELD_TYPE_ONE2ONE(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, 0)
def COL_FIELD_TYPE_MANY(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_MANY, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_relation_type
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_relation_type" ):
listener.enterField_relation_type(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_relation_type" ):
listener.exitField_relation_type(self)
def field_relation_type(self):
localctx = ZmeiLangParser.Field_relation_typeContext(self, self._ctx, self.state)
self.enterRule(localctx, 218, self.RULE_field_relation_type)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1371
_la = self._input.LA(1)
if not(((((_la - 64)) & ~0x3f) == 0 and ((1 << (_la - 64)) & ((1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE - 64)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE - 64)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_MANY - 64)))) != 0)):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_relation_cascade_markerContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def APPROX(self):
return self.getToken(ZmeiLangParser.APPROX, 0)
def EXCLAM(self):
return self.getToken(ZmeiLangParser.EXCLAM, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_relation_cascade_marker
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_relation_cascade_marker" ):
listener.enterField_relation_cascade_marker(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_relation_cascade_marker" ):
listener.exitField_relation_cascade_marker(self)
def field_relation_cascade_marker(self):
localctx = ZmeiLangParser.Field_relation_cascade_markerContext(self, self._ctx, self.state)
self.enterRule(localctx, 220, self.RULE_field_relation_cascade_marker)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1373
_la = self._input.LA(1)
if not(_la==ZmeiLangParser.EXCLAM or _la==ZmeiLangParser.APPROX):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_relation_target_refContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def model_ref(self):
return self.getTypedRuleContext(ZmeiLangParser.Model_refContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_relation_target_ref
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_relation_target_ref" ):
listener.enterField_relation_target_ref(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_relation_target_ref" ):
listener.exitField_relation_target_ref(self)
def field_relation_target_ref(self):
localctx = ZmeiLangParser.Field_relation_target_refContext(self, self._ctx, self.state)
self.enterRule(localctx, 222, self.RULE_field_relation_target_ref)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1375
self.model_ref()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_relation_target_classContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def classname(self):
return self.getTypedRuleContext(ZmeiLangParser.ClassnameContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_relation_target_class
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_relation_target_class" ):
listener.enterField_relation_target_class(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_relation_target_class" ):
listener.exitField_relation_target_class(self)
def field_relation_target_class(self):
localctx = ZmeiLangParser.Field_relation_target_classContext(self, self._ctx, self.state)
self.enterRule(localctx, 224, self.RULE_field_relation_target_class)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1377
self.classname()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Field_relation_related_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def DASH(self):
return self.getToken(ZmeiLangParser.DASH, 0)
def GT(self):
return self.getToken(ZmeiLangParser.GT, 0)
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_field_relation_related_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterField_relation_related_name" ):
listener.enterField_relation_related_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitField_relation_related_name" ):
listener.exitField_relation_related_name(self)
def field_relation_related_name(self):
localctx = ZmeiLangParser.Field_relation_related_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 226, self.RULE_field_relation_related_name)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1379
self.match(ZmeiLangParser.DASH)
self.state = 1380
self.match(ZmeiLangParser.GT)
self.state = 1381
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Model_annotationContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def an_admin(self):
return self.getTypedRuleContext(ZmeiLangParser.An_adminContext,0)
def an_api(self):
return self.getTypedRuleContext(ZmeiLangParser.An_apiContext,0)
def an_rest(self):
return self.getTypedRuleContext(ZmeiLangParser.An_restContext,0)
def an_order(self):
return self.getTypedRuleContext(ZmeiLangParser.An_orderContext,0)
def an_clean(self):
return self.getTypedRuleContext(ZmeiLangParser.An_cleanContext,0)
def an_pre_delete(self):
return self.getTypedRuleContext(ZmeiLangParser.An_pre_deleteContext,0)
def an_tree(self):
return self.getTypedRuleContext(ZmeiLangParser.An_treeContext,0)
def an_mixin(self):
return self.getTypedRuleContext(ZmeiLangParser.An_mixinContext,0)
def an_date_tree(self):
return self.getTypedRuleContext(ZmeiLangParser.An_date_treeContext,0)
def an_m2m_changed(self):
return self.getTypedRuleContext(ZmeiLangParser.An_m2m_changedContext,0)
def an_post_save(self):
return self.getTypedRuleContext(ZmeiLangParser.An_post_saveContext,0)
def an_pre_save(self):
return self.getTypedRuleContext(ZmeiLangParser.An_pre_saveContext,0)
def an_post_delete(self):
return self.getTypedRuleContext(ZmeiLangParser.An_post_deleteContext,0)
def an_sortable(self):
return self.getTypedRuleContext(ZmeiLangParser.An_sortableContext,0)
def NL(self):
return self.getToken(ZmeiLangParser.NL, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_model_annotation
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterModel_annotation" ):
listener.enterModel_annotation(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitModel_annotation" ):
listener.exitModel_annotation(self)
def model_annotation(self):
localctx = ZmeiLangParser.Model_annotationContext(self, self._ctx, self.state)
self.enterRule(localctx, 228, self.RULE_model_annotation)
try:
self.state = 1398
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.AN_ADMIN]:
self.enterOuterAlt(localctx, 1)
self.state = 1383
self.an_admin()
pass
elif token in [ZmeiLangParser.AN_API]:
self.enterOuterAlt(localctx, 2)
self.state = 1384
self.an_api()
pass
elif token in [ZmeiLangParser.AN_REST]:
self.enterOuterAlt(localctx, 3)
self.state = 1385
self.an_rest()
pass
elif token in [ZmeiLangParser.AN_ORDER]:
self.enterOuterAlt(localctx, 4)
self.state = 1386
self.an_order()
pass
elif token in [ZmeiLangParser.AN_CLEAN]:
self.enterOuterAlt(localctx, 5)
self.state = 1387
self.an_clean()
pass
elif token in [ZmeiLangParser.AN_PRE_DELETE]:
self.enterOuterAlt(localctx, 6)
self.state = 1388
self.an_pre_delete()
pass
elif token in [ZmeiLangParser.AN_TREE]:
self.enterOuterAlt(localctx, 7)
self.state = 1389
self.an_tree()
pass
elif token in [ZmeiLangParser.AN_MIXIN]:
self.enterOuterAlt(localctx, 8)
self.state = 1390
self.an_mixin()
pass
elif token in [ZmeiLangParser.AN_DATE_TREE]:
self.enterOuterAlt(localctx, 9)
self.state = 1391
self.an_date_tree()
pass
elif token in [ZmeiLangParser.AN_M2M_CHANGED]:
self.enterOuterAlt(localctx, 10)
self.state = 1392
self.an_m2m_changed()
pass
elif token in [ZmeiLangParser.AN_POST_SAVE]:
self.enterOuterAlt(localctx, 11)
self.state = 1393
self.an_post_save()
pass
elif token in [ZmeiLangParser.AN_PRE_SAVE]:
self.enterOuterAlt(localctx, 12)
self.state = 1394
self.an_pre_save()
pass
elif token in [ZmeiLangParser.AN_POST_DELETE]:
self.enterOuterAlt(localctx, 13)
self.state = 1395
self.an_post_delete()
pass
elif token in [ZmeiLangParser.AN_SORTABLE]:
self.enterOuterAlt(localctx, 14)
self.state = 1396
self.an_sortable()
pass
elif token in [ZmeiLangParser.NL]:
self.enterOuterAlt(localctx, 15)
self.state = 1397
self.match(ZmeiLangParser.NL)
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_adminContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_ADMIN(self):
return self.getToken(ZmeiLangParser.AN_ADMIN, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def an_admin_list(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_admin_listContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_admin_listContext,i)
def an_admin_read_only(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_admin_read_onlyContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_admin_read_onlyContext,i)
def an_admin_list_editable(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_admin_list_editableContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_admin_list_editableContext,i)
def an_admin_list_filter(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_admin_list_filterContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_admin_list_filterContext,i)
def an_admin_list_search(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_admin_list_searchContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_admin_list_searchContext,i)
def an_admin_fields(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_admin_fieldsContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_admin_fieldsContext,i)
def an_admin_tabs(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_admin_tabsContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_admin_tabsContext,i)
def an_admin_inlines(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_admin_inlinesContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_admin_inlinesContext,i)
def an_admin_css(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_admin_cssContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_admin_cssContext,i)
def an_admin_js(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_admin_jsContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_admin_jsContext,i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_admin
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_admin" ):
listener.enterAn_admin(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_admin" ):
listener.exitAn_admin(self)
def an_admin(self):
localctx = ZmeiLangParser.An_adminContext(self, self._ctx, self.state)
self.enterRule(localctx, 230, self.RULE_an_admin)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1400
self.match(ZmeiLangParser.AN_ADMIN)
self.state = 1426
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.BRACE_OPEN:
self.state = 1401
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 1416
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,122,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1414
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.KW_LIST]:
self.state = 1402
self.an_admin_list()
pass
elif token in [ZmeiLangParser.KW_READ_ONLY]:
self.state = 1403
self.an_admin_read_only()
pass
elif token in [ZmeiLangParser.KW_LIST_EDITABLE]:
self.state = 1404
self.an_admin_list_editable()
pass
elif token in [ZmeiLangParser.KW_LIST_FILTER]:
self.state = 1405
self.an_admin_list_filter()
pass
elif token in [ZmeiLangParser.KW_LIST_SEARCH]:
self.state = 1406
self.an_admin_list_search()
pass
elif token in [ZmeiLangParser.KW_FIELDS]:
self.state = 1407
self.an_admin_fields()
pass
elif token in [ZmeiLangParser.KW_TABS]:
self.state = 1408
self.an_admin_tabs()
pass
elif token in [ZmeiLangParser.KW_INLINE]:
self.state = 1409
self.an_admin_inlines()
pass
elif token in [ZmeiLangParser.KW_CSS]:
self.state = 1410
self.an_admin_css()
pass
elif token in [ZmeiLangParser.KW_JS]:
self.state = 1411
self.an_admin_js()
pass
elif token in [ZmeiLangParser.NL]:
self.state = 1412
self.match(ZmeiLangParser.NL)
pass
elif token in [ZmeiLangParser.COMA]:
self.state = 1413
self.match(ZmeiLangParser.COMA)
pass
else:
raise NoViableAltException(self)
self.state = 1418
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,122,self._ctx)
self.state = 1422
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.NL:
self.state = 1419
self.match(ZmeiLangParser.NL)
self.state = 1424
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 1425
self.match(ZmeiLangParser.BRACE_CLOSE)
self.state = 1431
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,125,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1428
self.match(ZmeiLangParser.NL)
self.state = 1433
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,125,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_admin_jsContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_JS(self):
return self.getToken(ZmeiLangParser.KW_JS, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def an_admin_js_file_name(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_admin_js_file_nameContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_admin_js_file_nameContext,i)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_admin_js
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_admin_js" ):
listener.enterAn_admin_js(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_admin_js" ):
listener.exitAn_admin_js(self)
def an_admin_js(self):
localctx = ZmeiLangParser.An_admin_jsContext(self, self._ctx, self.state)
self.enterRule(localctx, 232, self.RULE_an_admin_js)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1434
self.match(ZmeiLangParser.KW_JS)
self.state = 1435
self.match(ZmeiLangParser.COLON)
self.state = 1439
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.NL:
self.state = 1436
self.match(ZmeiLangParser.NL)
self.state = 1441
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 1442
self.an_admin_js_file_name()
self.state = 1453
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,128,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1443
self.match(ZmeiLangParser.COMA)
self.state = 1447
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.NL:
self.state = 1444
self.match(ZmeiLangParser.NL)
self.state = 1449
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 1450
self.an_admin_js_file_name()
self.state = 1455
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,128,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_admin_cssContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_CSS(self):
return self.getToken(ZmeiLangParser.KW_CSS, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def an_admin_css_file_name(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_admin_css_file_nameContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_admin_css_file_nameContext,i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_admin_css
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_admin_css" ):
listener.enterAn_admin_css(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_admin_css" ):
listener.exitAn_admin_css(self)
def an_admin_css(self):
localctx = ZmeiLangParser.An_admin_cssContext(self, self._ctx, self.state)
self.enterRule(localctx, 234, self.RULE_an_admin_css)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1456
self.match(ZmeiLangParser.KW_CSS)
self.state = 1457
self.match(ZmeiLangParser.COLON)
self.state = 1458
self.an_admin_css_file_name()
self.state = 1463
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,129,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1459
self.match(ZmeiLangParser.COMA)
self.state = 1460
self.an_admin_css_file_name()
self.state = 1465
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,129,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_admin_css_file_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def STRING_DQ(self):
return self.getToken(ZmeiLangParser.STRING_DQ, 0)
def STRING_SQ(self):
return self.getToken(ZmeiLangParser.STRING_SQ, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_admin_css_file_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_admin_css_file_name" ):
listener.enterAn_admin_css_file_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_admin_css_file_name" ):
listener.exitAn_admin_css_file_name(self)
def an_admin_css_file_name(self):
localctx = ZmeiLangParser.An_admin_css_file_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 236, self.RULE_an_admin_css_file_name)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1466
_la = self._input.LA(1)
if not(_la==ZmeiLangParser.STRING_DQ or _la==ZmeiLangParser.STRING_SQ):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_admin_js_file_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def STRING_DQ(self):
return self.getToken(ZmeiLangParser.STRING_DQ, 0)
def STRING_SQ(self):
return self.getToken(ZmeiLangParser.STRING_SQ, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_admin_js_file_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_admin_js_file_name" ):
listener.enterAn_admin_js_file_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_admin_js_file_name" ):
listener.exitAn_admin_js_file_name(self)
def an_admin_js_file_name(self):
localctx = ZmeiLangParser.An_admin_js_file_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 238, self.RULE_an_admin_js_file_name)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1468
_la = self._input.LA(1)
if not(_la==ZmeiLangParser.STRING_DQ or _la==ZmeiLangParser.STRING_SQ):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_admin_inlinesContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_INLINE(self):
return self.getToken(ZmeiLangParser.KW_INLINE, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def an_admin_inline(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_admin_inlineContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_admin_inlineContext,i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_admin_inlines
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_admin_inlines" ):
listener.enterAn_admin_inlines(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_admin_inlines" ):
listener.exitAn_admin_inlines(self)
def an_admin_inlines(self):
localctx = ZmeiLangParser.An_admin_inlinesContext(self, self._ctx, self.state)
self.enterRule(localctx, 240, self.RULE_an_admin_inlines)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1470
self.match(ZmeiLangParser.KW_INLINE)
self.state = 1471
self.match(ZmeiLangParser.COLON)
self.state = 1472
self.an_admin_inline()
self.state = 1477
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,130,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1473
self.match(ZmeiLangParser.COMA)
self.state = 1474
self.an_admin_inline()
self.state = 1479
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,130,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_admin_inlineContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def inline_name(self):
return self.getTypedRuleContext(ZmeiLangParser.Inline_nameContext,0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def inline_type(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Inline_typeContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Inline_typeContext,i)
def inline_extension(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Inline_extensionContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Inline_extensionContext,i)
def inline_fields(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Inline_fieldsContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Inline_fieldsContext,i)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_admin_inline
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_admin_inline" ):
listener.enterAn_admin_inline(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_admin_inline" ):
listener.exitAn_admin_inline(self)
def an_admin_inline(self):
localctx = ZmeiLangParser.An_admin_inlineContext(self, self._ctx, self.state)
self.enterRule(localctx, 242, self.RULE_an_admin_inline)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1480
self.inline_name()
self.state = 1493
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.BRACE_OPEN:
self.state = 1481
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 1489
self._errHandler.sync(self)
_la = self._input.LA(1)
while ((((_la - 98)) & ~0x3f) == 0 and ((1 << (_la - 98)) & ((1 << (ZmeiLangParser.KW_TYPE - 98)) | (1 << (ZmeiLangParser.KW_EXTENSION - 98)) | (1 << (ZmeiLangParser.KW_FIELDS - 98)) | (1 << (ZmeiLangParser.NL - 98)) | (1 << (ZmeiLangParser.COMA - 98)))) != 0):
self.state = 1487
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.KW_TYPE]:
self.state = 1482
self.inline_type()
pass
elif token in [ZmeiLangParser.KW_EXTENSION]:
self.state = 1483
self.inline_extension()
pass
elif token in [ZmeiLangParser.KW_FIELDS]:
self.state = 1484
self.inline_fields()
pass
elif token in [ZmeiLangParser.NL]:
self.state = 1485
self.match(ZmeiLangParser.NL)
pass
elif token in [ZmeiLangParser.COMA]:
self.state = 1486
self.match(ZmeiLangParser.COMA)
pass
else:
raise NoViableAltException(self)
self.state = 1491
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 1492
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Inline_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_inline_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterInline_name" ):
listener.enterInline_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitInline_name" ):
listener.exitInline_name(self)
def inline_name(self):
localctx = ZmeiLangParser.Inline_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 244, self.RULE_inline_name)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1495
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Inline_typeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_TYPE(self):
return self.getToken(ZmeiLangParser.KW_TYPE, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def inline_type_name(self):
return self.getTypedRuleContext(ZmeiLangParser.Inline_type_nameContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_inline_type
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterInline_type" ):
listener.enterInline_type(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitInline_type" ):
listener.exitInline_type(self)
def inline_type(self):
localctx = ZmeiLangParser.Inline_typeContext(self, self._ctx, self.state)
self.enterRule(localctx, 246, self.RULE_inline_type)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1497
self.match(ZmeiLangParser.KW_TYPE)
self.state = 1498
self.match(ZmeiLangParser.COLON)
self.state = 1499
self.inline_type_name()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Inline_type_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_INLINE_TYPE_TABULAR(self):
return self.getToken(ZmeiLangParser.KW_INLINE_TYPE_TABULAR, 0)
def KW_INLINE_TYPE_STACKED(self):
return self.getToken(ZmeiLangParser.KW_INLINE_TYPE_STACKED, 0)
def KW_INLINE_TYPE_POLYMORPHIC(self):
return self.getToken(ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_inline_type_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterInline_type_name" ):
listener.enterInline_type_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitInline_type_name" ):
listener.exitInline_type_name(self)
def inline_type_name(self):
localctx = ZmeiLangParser.Inline_type_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 248, self.RULE_inline_type_name)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1501
_la = self._input.LA(1)
if not(((((_la - 94)) & ~0x3f) == 0 and ((1 << (_la - 94)) & ((1 << (ZmeiLangParser.KW_INLINE_TYPE_TABULAR - 94)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_STACKED - 94)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC - 94)))) != 0)):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Inline_extensionContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_EXTENSION(self):
return self.getToken(ZmeiLangParser.KW_EXTENSION, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def DIGIT(self):
return self.getToken(ZmeiLangParser.DIGIT, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_inline_extension
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterInline_extension" ):
listener.enterInline_extension(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitInline_extension" ):
listener.exitInline_extension(self)
def inline_extension(self):
localctx = ZmeiLangParser.Inline_extensionContext(self, self._ctx, self.state)
self.enterRule(localctx, 250, self.RULE_inline_extension)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1503
self.match(ZmeiLangParser.KW_EXTENSION)
self.state = 1504
self.match(ZmeiLangParser.COLON)
self.state = 1505
self.match(ZmeiLangParser.DIGIT)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Inline_fieldsContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_FIELDS(self):
return self.getToken(ZmeiLangParser.KW_FIELDS, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def field_list_expr(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_list_exprContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_inline_fields
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterInline_fields" ):
listener.enterInline_fields(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitInline_fields" ):
listener.exitInline_fields(self)
def inline_fields(self):
localctx = ZmeiLangParser.Inline_fieldsContext(self, self._ctx, self.state)
self.enterRule(localctx, 252, self.RULE_inline_fields)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1507
self.match(ZmeiLangParser.KW_FIELDS)
self.state = 1508
self.match(ZmeiLangParser.COLON)
self.state = 1509
self.field_list_expr()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_admin_tabsContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_TABS(self):
return self.getToken(ZmeiLangParser.KW_TABS, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def an_admin_tab(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_admin_tabContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_admin_tabContext,i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_admin_tabs
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_admin_tabs" ):
listener.enterAn_admin_tabs(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_admin_tabs" ):
listener.exitAn_admin_tabs(self)
def an_admin_tabs(self):
localctx = ZmeiLangParser.An_admin_tabsContext(self, self._ctx, self.state)
self.enterRule(localctx, 254, self.RULE_an_admin_tabs)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1511
self.match(ZmeiLangParser.KW_TABS)
self.state = 1512
self.match(ZmeiLangParser.COLON)
self.state = 1513
self.an_admin_tab()
self.state = 1518
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,134,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1514
self.match(ZmeiLangParser.COMA)
self.state = 1515
self.an_admin_tab()
self.state = 1520
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,134,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_admin_tabContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def tab_name(self):
return self.getTypedRuleContext(ZmeiLangParser.Tab_nameContext,0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def field_list_expr(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_list_exprContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def tab_verbose_name(self):
return self.getTypedRuleContext(ZmeiLangParser.Tab_verbose_nameContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_admin_tab
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_admin_tab" ):
listener.enterAn_admin_tab(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_admin_tab" ):
listener.exitAn_admin_tab(self)
def an_admin_tab(self):
localctx = ZmeiLangParser.An_admin_tabContext(self, self._ctx, self.state)
self.enterRule(localctx, 256, self.RULE_an_admin_tab)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1521
self.tab_name()
self.state = 1523
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.STRING_DQ or _la==ZmeiLangParser.STRING_SQ:
self.state = 1522
self.tab_verbose_name()
self.state = 1525
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 1526
self.field_list_expr()
self.state = 1527
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Tab_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_tab_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterTab_name" ):
listener.enterTab_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitTab_name" ):
listener.exitTab_name(self)
def tab_name(self):
localctx = ZmeiLangParser.Tab_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 258, self.RULE_tab_name)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1529
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Tab_verbose_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def STRING_DQ(self):
return self.getToken(ZmeiLangParser.STRING_DQ, 0)
def STRING_SQ(self):
return self.getToken(ZmeiLangParser.STRING_SQ, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_tab_verbose_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterTab_verbose_name" ):
listener.enterTab_verbose_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitTab_verbose_name" ):
listener.exitTab_verbose_name(self)
def tab_verbose_name(self):
localctx = ZmeiLangParser.Tab_verbose_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 260, self.RULE_tab_verbose_name)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1531
_la = self._input.LA(1)
if not(_la==ZmeiLangParser.STRING_DQ or _la==ZmeiLangParser.STRING_SQ):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_admin_listContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_LIST(self):
return self.getToken(ZmeiLangParser.KW_LIST, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def field_list_expr(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_list_exprContext,0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_admin_list
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_admin_list" ):
listener.enterAn_admin_list(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_admin_list" ):
listener.exitAn_admin_list(self)
def an_admin_list(self):
localctx = ZmeiLangParser.An_admin_listContext(self, self._ctx, self.state)
self.enterRule(localctx, 262, self.RULE_an_admin_list)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1533
self.match(ZmeiLangParser.KW_LIST)
self.state = 1534
self.match(ZmeiLangParser.COLON)
self.state = 1535
self.field_list_expr()
self.state = 1539
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,136,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1536
self.match(ZmeiLangParser.NL)
self.state = 1541
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,136,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_admin_read_onlyContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_READ_ONLY(self):
return self.getToken(ZmeiLangParser.KW_READ_ONLY, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def field_list_expr(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_list_exprContext,0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_admin_read_only
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_admin_read_only" ):
listener.enterAn_admin_read_only(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_admin_read_only" ):
listener.exitAn_admin_read_only(self)
def an_admin_read_only(self):
localctx = ZmeiLangParser.An_admin_read_onlyContext(self, self._ctx, self.state)
self.enterRule(localctx, 264, self.RULE_an_admin_read_only)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1542
self.match(ZmeiLangParser.KW_READ_ONLY)
self.state = 1543
self.match(ZmeiLangParser.COLON)
self.state = 1544
self.field_list_expr()
self.state = 1548
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,137,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1545
self.match(ZmeiLangParser.NL)
self.state = 1550
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,137,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_admin_list_editableContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_LIST_EDITABLE(self):
return self.getToken(ZmeiLangParser.KW_LIST_EDITABLE, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def field_list_expr(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_list_exprContext,0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_admin_list_editable
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_admin_list_editable" ):
listener.enterAn_admin_list_editable(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_admin_list_editable" ):
listener.exitAn_admin_list_editable(self)
def an_admin_list_editable(self):
localctx = ZmeiLangParser.An_admin_list_editableContext(self, self._ctx, self.state)
self.enterRule(localctx, 266, self.RULE_an_admin_list_editable)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1551
self.match(ZmeiLangParser.KW_LIST_EDITABLE)
self.state = 1552
self.match(ZmeiLangParser.COLON)
self.state = 1553
self.field_list_expr()
self.state = 1557
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,138,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1554
self.match(ZmeiLangParser.NL)
self.state = 1559
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,138,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_admin_list_filterContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_LIST_FILTER(self):
return self.getToken(ZmeiLangParser.KW_LIST_FILTER, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def field_list_expr(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_list_exprContext,0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_admin_list_filter
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_admin_list_filter" ):
listener.enterAn_admin_list_filter(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_admin_list_filter" ):
listener.exitAn_admin_list_filter(self)
def an_admin_list_filter(self):
localctx = ZmeiLangParser.An_admin_list_filterContext(self, self._ctx, self.state)
self.enterRule(localctx, 268, self.RULE_an_admin_list_filter)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1560
self.match(ZmeiLangParser.KW_LIST_FILTER)
self.state = 1561
self.match(ZmeiLangParser.COLON)
self.state = 1562
self.field_list_expr()
self.state = 1566
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,139,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1563
self.match(ZmeiLangParser.NL)
self.state = 1568
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,139,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_admin_list_searchContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_LIST_SEARCH(self):
return self.getToken(ZmeiLangParser.KW_LIST_SEARCH, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def field_list_expr(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_list_exprContext,0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_admin_list_search
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_admin_list_search" ):
listener.enterAn_admin_list_search(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_admin_list_search" ):
listener.exitAn_admin_list_search(self)
def an_admin_list_search(self):
localctx = ZmeiLangParser.An_admin_list_searchContext(self, self._ctx, self.state)
self.enterRule(localctx, 270, self.RULE_an_admin_list_search)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1569
self.match(ZmeiLangParser.KW_LIST_SEARCH)
self.state = 1570
self.match(ZmeiLangParser.COLON)
self.state = 1571
self.field_list_expr()
self.state = 1575
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,140,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1572
self.match(ZmeiLangParser.NL)
self.state = 1577
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,140,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_admin_fieldsContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_FIELDS(self):
return self.getToken(ZmeiLangParser.KW_FIELDS, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def field_list_expr(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_list_exprContext,0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_admin_fields
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_admin_fields" ):
listener.enterAn_admin_fields(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_admin_fields" ):
listener.exitAn_admin_fields(self)
def an_admin_fields(self):
localctx = ZmeiLangParser.An_admin_fieldsContext(self, self._ctx, self.state)
self.enterRule(localctx, 272, self.RULE_an_admin_fields)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1578
self.match(ZmeiLangParser.KW_FIELDS)
self.state = 1579
self.match(ZmeiLangParser.COLON)
self.state = 1580
self.field_list_expr()
self.state = 1584
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,141,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1581
self.match(ZmeiLangParser.NL)
self.state = 1586
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,141,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_apiContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_API(self):
return self.getToken(ZmeiLangParser.AN_API, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def an_api_all(self):
return self.getTypedRuleContext(ZmeiLangParser.An_api_allContext,0)
def an_api_name(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_api_nameContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_api_nameContext,i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_api
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_api" ):
listener.enterAn_api(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_api" ):
listener.exitAn_api(self)
def an_api(self):
localctx = ZmeiLangParser.An_apiContext(self, self._ctx, self.state)
self.enterRule(localctx, 274, self.RULE_an_api)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1587
self.match(ZmeiLangParser.AN_API)
self.state = 1602
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.BRACE_OPEN:
self.state = 1588
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 1598
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.STAR]:
self.state = 1589
self.an_api_all()
pass
elif token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID]:
self.state = 1590
self.an_api_name()
self.state = 1595
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.COMA:
self.state = 1591
self.match(ZmeiLangParser.COMA)
self.state = 1592
self.an_api_name()
self.state = 1597
self._errHandler.sync(self)
_la = self._input.LA(1)
pass
else:
raise NoViableAltException(self)
self.state = 1600
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_api_allContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def STAR(self):
return self.getToken(ZmeiLangParser.STAR, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_api_all
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_api_all" ):
listener.enterAn_api_all(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_api_all" ):
listener.exitAn_api_all(self)
def an_api_all(self):
localctx = ZmeiLangParser.An_api_allContext(self, self._ctx, self.state)
self.enterRule(localctx, 276, self.RULE_an_api_all)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1604
self.match(ZmeiLangParser.STAR)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_api_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_api_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_api_name" ):
listener.enterAn_api_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_api_name" ):
listener.exitAn_api_name(self)
def an_api_name(self):
localctx = ZmeiLangParser.An_api_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 278, self.RULE_an_api_name)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1606
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_restContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_REST(self):
return self.getToken(ZmeiLangParser.AN_REST, 0)
def DOT(self):
return self.getToken(ZmeiLangParser.DOT, 0)
def an_rest_descriptor(self):
return self.getTypedRuleContext(ZmeiLangParser.An_rest_descriptorContext,0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def an_rest_config(self):
return self.getTypedRuleContext(ZmeiLangParser.An_rest_configContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest" ):
listener.enterAn_rest(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest" ):
listener.exitAn_rest(self)
def an_rest(self):
localctx = ZmeiLangParser.An_restContext(self, self._ctx, self.state)
self.enterRule(localctx, 280, self.RULE_an_rest)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1608
self.match(ZmeiLangParser.AN_REST)
self.state = 1611
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.DOT:
self.state = 1609
self.match(ZmeiLangParser.DOT)
self.state = 1610
self.an_rest_descriptor()
self.state = 1617
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.BRACE_OPEN:
self.state = 1613
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 1614
self.an_rest_config()
self.state = 1615
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_configContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def an_rest_main_part(self):
return self.getTypedRuleContext(ZmeiLangParser.An_rest_main_partContext,0)
def an_rest_inline(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_rest_inlineContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_rest_inlineContext,i)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_config
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_config" ):
listener.enterAn_rest_config(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_config" ):
listener.exitAn_rest_config(self)
def an_rest_config(self):
localctx = ZmeiLangParser.An_rest_configContext(self, self._ctx, self.state)
self.enterRule(localctx, 282, self.RULE_an_rest_config)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1619
self.an_rest_main_part()
self.state = 1625
self._errHandler.sync(self)
_la = self._input.LA(1)
while ((((_la - 97)) & ~0x3f) == 0 and ((1 << (_la - 97)) & ((1 << (ZmeiLangParser.KW_INLINE - 97)) | (1 << (ZmeiLangParser.NL - 97)) | (1 << (ZmeiLangParser.COMA - 97)))) != 0):
self.state = 1623
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.KW_INLINE]:
self.state = 1620
self.an_rest_inline()
pass
elif token in [ZmeiLangParser.NL]:
self.state = 1621
self.match(ZmeiLangParser.NL)
pass
elif token in [ZmeiLangParser.COMA]:
self.state = 1622
self.match(ZmeiLangParser.COMA)
pass
else:
raise NoViableAltException(self)
self.state = 1627
self._errHandler.sync(self)
_la = self._input.LA(1)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_main_partContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def an_rest_fields(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_rest_fieldsContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_rest_fieldsContext,i)
def an_rest_i18n(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_rest_i18nContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_rest_i18nContext,i)
def an_rest_str(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_rest_strContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_rest_strContext,i)
def an_rest_auth(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_rest_authContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_rest_authContext,i)
def an_rest_query(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_rest_queryContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_rest_queryContext,i)
def an_rest_on_create(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_rest_on_createContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_rest_on_createContext,i)
def an_rest_filter_in(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_rest_filter_inContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_rest_filter_inContext,i)
def an_rest_filter_out(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_rest_filter_outContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_rest_filter_outContext,i)
def an_rest_read_only(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_rest_read_onlyContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_rest_read_onlyContext,i)
def an_rest_user_field(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_rest_user_fieldContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_rest_user_fieldContext,i)
def an_rest_annotate(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_rest_annotateContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_rest_annotateContext,i)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_main_part
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_main_part" ):
listener.enterAn_rest_main_part(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_main_part" ):
listener.exitAn_rest_main_part(self)
def an_rest_main_part(self):
localctx = ZmeiLangParser.An_rest_main_partContext(self, self._ctx, self.state)
self.enterRule(localctx, 284, self.RULE_an_rest_main_part)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1643
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,150,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1641
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.KW_FIELDS]:
self.state = 1628
self.an_rest_fields()
pass
elif token in [ZmeiLangParser.KW_I18N]:
self.state = 1629
self.an_rest_i18n()
pass
elif token in [ZmeiLangParser.COL_FIELD_TYPE_TEXT]:
self.state = 1630
self.an_rest_str()
pass
elif token in [ZmeiLangParser.KW_AUTH]:
self.state = 1631
self.an_rest_auth()
pass
elif token in [ZmeiLangParser.KW_QUERY]:
self.state = 1632
self.an_rest_query()
pass
elif token in [ZmeiLangParser.KW_ON_CREATE]:
self.state = 1633
self.an_rest_on_create()
pass
elif token in [ZmeiLangParser.KW_FILTER_IN]:
self.state = 1634
self.an_rest_filter_in()
pass
elif token in [ZmeiLangParser.KW_FILTER_OUT]:
self.state = 1635
self.an_rest_filter_out()
pass
elif token in [ZmeiLangParser.KW_READ_ONLY]:
self.state = 1636
self.an_rest_read_only()
pass
elif token in [ZmeiLangParser.KW_USER_FIELD]:
self.state = 1637
self.an_rest_user_field()
pass
elif token in [ZmeiLangParser.KW_ANNOTATE]:
self.state = 1638
self.an_rest_annotate()
pass
elif token in [ZmeiLangParser.NL]:
self.state = 1639
self.match(ZmeiLangParser.NL)
pass
elif token in [ZmeiLangParser.COMA]:
self.state = 1640
self.match(ZmeiLangParser.COMA)
pass
else:
raise NoViableAltException(self)
self.state = 1645
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,150,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_descriptorContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_descriptor
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_descriptor" ):
listener.enterAn_rest_descriptor(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_descriptor" ):
listener.exitAn_rest_descriptor(self)
def an_rest_descriptor(self):
localctx = ZmeiLangParser.An_rest_descriptorContext(self, self._ctx, self.state)
self.enterRule(localctx, 286, self.RULE_an_rest_descriptor)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1646
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_i18nContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_I18N(self):
return self.getToken(ZmeiLangParser.KW_I18N, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def BOOL(self):
return self.getToken(ZmeiLangParser.BOOL, 0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_i18n
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_i18n" ):
listener.enterAn_rest_i18n(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_i18n" ):
listener.exitAn_rest_i18n(self)
def an_rest_i18n(self):
localctx = ZmeiLangParser.An_rest_i18nContext(self, self._ctx, self.state)
self.enterRule(localctx, 288, self.RULE_an_rest_i18n)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1648
self.match(ZmeiLangParser.KW_I18N)
self.state = 1649
self.match(ZmeiLangParser.COLON)
self.state = 1650
self.match(ZmeiLangParser.BOOL)
self.state = 1654
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,151,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1651
self.match(ZmeiLangParser.NL)
self.state = 1656
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,151,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_strContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COL_FIELD_TYPE_TEXT(self):
return self.getToken(ZmeiLangParser.COL_FIELD_TYPE_TEXT, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def BOOL(self):
return self.getToken(ZmeiLangParser.BOOL, 0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_str
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_str" ):
listener.enterAn_rest_str(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_str" ):
listener.exitAn_rest_str(self)
def an_rest_str(self):
localctx = ZmeiLangParser.An_rest_strContext(self, self._ctx, self.state)
self.enterRule(localctx, 290, self.RULE_an_rest_str)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1657
self.match(ZmeiLangParser.COL_FIELD_TYPE_TEXT)
self.state = 1658
self.match(ZmeiLangParser.COLON)
self.state = 1659
self.match(ZmeiLangParser.BOOL)
self.state = 1663
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,152,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1660
self.match(ZmeiLangParser.NL)
self.state = 1665
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,152,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_queryContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_QUERY(self):
return self.getToken(ZmeiLangParser.KW_QUERY, 0)
def python_code(self):
return self.getTypedRuleContext(ZmeiLangParser.Python_codeContext,0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_query
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_query" ):
listener.enterAn_rest_query(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_query" ):
listener.exitAn_rest_query(self)
def an_rest_query(self):
localctx = ZmeiLangParser.An_rest_queryContext(self, self._ctx, self.state)
self.enterRule(localctx, 292, self.RULE_an_rest_query)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1666
self.match(ZmeiLangParser.KW_QUERY)
self.state = 1667
self.python_code()
self.state = 1671
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,153,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1668
self.match(ZmeiLangParser.NL)
self.state = 1673
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,153,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_on_createContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_ON_CREATE(self):
return self.getToken(ZmeiLangParser.KW_ON_CREATE, 0)
def python_code(self):
return self.getTypedRuleContext(ZmeiLangParser.Python_codeContext,0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_on_create
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_on_create" ):
listener.enterAn_rest_on_create(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_on_create" ):
listener.exitAn_rest_on_create(self)
def an_rest_on_create(self):
localctx = ZmeiLangParser.An_rest_on_createContext(self, self._ctx, self.state)
self.enterRule(localctx, 294, self.RULE_an_rest_on_create)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1674
self.match(ZmeiLangParser.KW_ON_CREATE)
self.state = 1676
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.COLON:
self.state = 1675
self.match(ZmeiLangParser.COLON)
self.state = 1678
self.python_code()
self.state = 1682
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,155,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1679
self.match(ZmeiLangParser.NL)
self.state = 1684
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,155,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_filter_inContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_FILTER_IN(self):
return self.getToken(ZmeiLangParser.KW_FILTER_IN, 0)
def python_code(self):
return self.getTypedRuleContext(ZmeiLangParser.Python_codeContext,0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_filter_in
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_filter_in" ):
listener.enterAn_rest_filter_in(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_filter_in" ):
listener.exitAn_rest_filter_in(self)
def an_rest_filter_in(self):
localctx = ZmeiLangParser.An_rest_filter_inContext(self, self._ctx, self.state)
self.enterRule(localctx, 296, self.RULE_an_rest_filter_in)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1685
self.match(ZmeiLangParser.KW_FILTER_IN)
self.state = 1687
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.COLON:
self.state = 1686
self.match(ZmeiLangParser.COLON)
self.state = 1689
self.python_code()
self.state = 1693
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,157,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1690
self.match(ZmeiLangParser.NL)
self.state = 1695
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,157,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_filter_outContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_FILTER_OUT(self):
return self.getToken(ZmeiLangParser.KW_FILTER_OUT, 0)
def python_code(self):
return self.getTypedRuleContext(ZmeiLangParser.Python_codeContext,0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_filter_out
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_filter_out" ):
listener.enterAn_rest_filter_out(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_filter_out" ):
listener.exitAn_rest_filter_out(self)
def an_rest_filter_out(self):
localctx = ZmeiLangParser.An_rest_filter_outContext(self, self._ctx, self.state)
self.enterRule(localctx, 298, self.RULE_an_rest_filter_out)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1696
self.match(ZmeiLangParser.KW_FILTER_OUT)
self.state = 1698
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.COLON:
self.state = 1697
self.match(ZmeiLangParser.COLON)
self.state = 1700
self.python_code()
self.state = 1704
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,159,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1701
self.match(ZmeiLangParser.NL)
self.state = 1706
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,159,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_read_onlyContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_READ_ONLY(self):
return self.getToken(ZmeiLangParser.KW_READ_ONLY, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def field_list_expr(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_list_exprContext,0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_read_only
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_read_only" ):
listener.enterAn_rest_read_only(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_read_only" ):
listener.exitAn_rest_read_only(self)
def an_rest_read_only(self):
localctx = ZmeiLangParser.An_rest_read_onlyContext(self, self._ctx, self.state)
self.enterRule(localctx, 300, self.RULE_an_rest_read_only)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1707
self.match(ZmeiLangParser.KW_READ_ONLY)
self.state = 1708
self.match(ZmeiLangParser.COLON)
self.state = 1709
self.field_list_expr()
self.state = 1713
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,160,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1710
self.match(ZmeiLangParser.NL)
self.state = 1715
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,160,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_user_fieldContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_USER_FIELD(self):
return self.getToken(ZmeiLangParser.KW_USER_FIELD, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_user_field
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_user_field" ):
listener.enterAn_rest_user_field(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_user_field" ):
listener.exitAn_rest_user_field(self)
def an_rest_user_field(self):
localctx = ZmeiLangParser.An_rest_user_fieldContext(self, self._ctx, self.state)
self.enterRule(localctx, 302, self.RULE_an_rest_user_field)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1716
self.match(ZmeiLangParser.KW_USER_FIELD)
self.state = 1717
self.match(ZmeiLangParser.COLON)
self.state = 1718
self.id_or_kw()
self.state = 1722
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,161,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1719
self.match(ZmeiLangParser.NL)
self.state = 1724
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,161,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_fieldsContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_FIELDS(self):
return self.getToken(ZmeiLangParser.KW_FIELDS, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def field_list_expr(self):
return self.getTypedRuleContext(ZmeiLangParser.Field_list_exprContext,0)
def an_rest_fields_write_mode(self):
return self.getTypedRuleContext(ZmeiLangParser.An_rest_fields_write_modeContext,0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_fields
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_fields" ):
listener.enterAn_rest_fields(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_fields" ):
listener.exitAn_rest_fields(self)
def an_rest_fields(self):
localctx = ZmeiLangParser.An_rest_fieldsContext(self, self._ctx, self.state)
self.enterRule(localctx, 304, self.RULE_an_rest_fields)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1725
self.match(ZmeiLangParser.KW_FIELDS)
self.state = 1726
self.match(ZmeiLangParser.COLON)
self.state = 1727
self.field_list_expr()
self.state = 1729
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.SQ_BRACE_OPEN:
self.state = 1728
self.an_rest_fields_write_mode()
self.state = 1734
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,163,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1731
self.match(ZmeiLangParser.NL)
self.state = 1736
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,163,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_fields_write_modeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def write_mode_expr(self):
return self.getTypedRuleContext(ZmeiLangParser.Write_mode_exprContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_fields_write_mode
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_fields_write_mode" ):
listener.enterAn_rest_fields_write_mode(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_fields_write_mode" ):
listener.exitAn_rest_fields_write_mode(self)
def an_rest_fields_write_mode(self):
localctx = ZmeiLangParser.An_rest_fields_write_modeContext(self, self._ctx, self.state)
self.enterRule(localctx, 306, self.RULE_an_rest_fields_write_mode)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1737
self.write_mode_expr()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_authContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_AUTH(self):
return self.getToken(ZmeiLangParser.KW_AUTH, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def an_rest_auth_type(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_rest_auth_typeContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_rest_auth_typeContext,i)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_auth
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_auth" ):
listener.enterAn_rest_auth(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_auth" ):
listener.exitAn_rest_auth(self)
def an_rest_auth(self):
localctx = ZmeiLangParser.An_rest_authContext(self, self._ctx, self.state)
self.enterRule(localctx, 308, self.RULE_an_rest_auth)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1739
self.match(ZmeiLangParser.KW_AUTH)
self.state = 1740
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 1741
self.an_rest_auth_type()
self.state = 1746
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.COMA:
self.state = 1742
self.match(ZmeiLangParser.COMA)
self.state = 1743
self.an_rest_auth_type()
self.state = 1748
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 1749
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_auth_typeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def an_rest_auth_type_name(self):
return self.getTypedRuleContext(ZmeiLangParser.An_rest_auth_type_nameContext,0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def an_rest_auth_token_model(self):
return self.getTypedRuleContext(ZmeiLangParser.An_rest_auth_token_modelContext,0)
def an_rest_auth_token_class(self):
return self.getTypedRuleContext(ZmeiLangParser.An_rest_auth_token_classContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_auth_type
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_auth_type" ):
listener.enterAn_rest_auth_type(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_auth_type" ):
listener.exitAn_rest_auth_type(self)
def an_rest_auth_type(self):
localctx = ZmeiLangParser.An_rest_auth_typeContext(self, self._ctx, self.state)
self.enterRule(localctx, 310, self.RULE_an_rest_auth_type)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1751
self.an_rest_auth_type_name()
self.state = 1755
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.COLON]:
self.state = 1752
self.match(ZmeiLangParser.COLON)
self.state = 1753
self.an_rest_auth_token_model()
pass
elif token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID]:
self.state = 1754
self.an_rest_auth_token_class()
pass
elif token in [ZmeiLangParser.BRACE_CLOSE, ZmeiLangParser.COMA]:
pass
else:
pass
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_auth_type_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_AUTH_TYPE_BASIC(self):
return self.getToken(ZmeiLangParser.KW_AUTH_TYPE_BASIC, 0)
def KW_AUTH_TYPE_SESSION(self):
return self.getToken(ZmeiLangParser.KW_AUTH_TYPE_SESSION, 0)
def KW_AUTH_TYPE_TOKEN(self):
return self.getToken(ZmeiLangParser.KW_AUTH_TYPE_TOKEN, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_auth_type_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_auth_type_name" ):
listener.enterAn_rest_auth_type_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_auth_type_name" ):
listener.exitAn_rest_auth_type_name(self)
def an_rest_auth_type_name(self):
localctx = ZmeiLangParser.An_rest_auth_type_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 312, self.RULE_an_rest_auth_type_name)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1757
_la = self._input.LA(1)
if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << ZmeiLangParser.KW_AUTH_TYPE_BASIC) | (1 << ZmeiLangParser.KW_AUTH_TYPE_SESSION) | (1 << ZmeiLangParser.KW_AUTH_TYPE_TOKEN))) != 0)):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_auth_token_modelContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def model_ref(self):
return self.getTypedRuleContext(ZmeiLangParser.Model_refContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_auth_token_model
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_auth_token_model" ):
listener.enterAn_rest_auth_token_model(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_auth_token_model" ):
listener.exitAn_rest_auth_token_model(self)
def an_rest_auth_token_model(self):
localctx = ZmeiLangParser.An_rest_auth_token_modelContext(self, self._ctx, self.state)
self.enterRule(localctx, 314, self.RULE_an_rest_auth_token_model)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1759
self.model_ref()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_auth_token_classContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def classname(self):
return self.getTypedRuleContext(ZmeiLangParser.ClassnameContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_auth_token_class
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_auth_token_class" ):
listener.enterAn_rest_auth_token_class(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_auth_token_class" ):
listener.exitAn_rest_auth_token_class(self)
def an_rest_auth_token_class(self):
localctx = ZmeiLangParser.An_rest_auth_token_classContext(self, self._ctx, self.state)
self.enterRule(localctx, 316, self.RULE_an_rest_auth_token_class)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1761
self.classname()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_annotateContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_ANNOTATE(self):
return self.getToken(ZmeiLangParser.KW_ANNOTATE, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def an_rest_annotate_count(self):
return self.getTypedRuleContext(ZmeiLangParser.An_rest_annotate_countContext,0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_annotate
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_annotate" ):
listener.enterAn_rest_annotate(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_annotate" ):
listener.exitAn_rest_annotate(self)
def an_rest_annotate(self):
localctx = ZmeiLangParser.An_rest_annotateContext(self, self._ctx, self.state)
self.enterRule(localctx, 318, self.RULE_an_rest_annotate)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1763
self.match(ZmeiLangParser.KW_ANNOTATE)
self.state = 1764
self.match(ZmeiLangParser.COLON)
self.state = 1765
self.an_rest_annotate_count()
self.state = 1769
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,166,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1766
self.match(ZmeiLangParser.NL)
self.state = 1771
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,166,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_annotate_countContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_COUNT(self):
return self.getToken(ZmeiLangParser.KW_COUNT, 0)
def an_rest_annotate_count_field(self):
return self.getTypedRuleContext(ZmeiLangParser.An_rest_annotate_count_fieldContext,0)
def KW_AS(self):
return self.getToken(ZmeiLangParser.KW_AS, 0)
def an_rest_annotate_count_alias(self):
return self.getTypedRuleContext(ZmeiLangParser.An_rest_annotate_count_aliasContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_annotate_count
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_annotate_count" ):
listener.enterAn_rest_annotate_count(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_annotate_count" ):
listener.exitAn_rest_annotate_count(self)
def an_rest_annotate_count(self):
localctx = ZmeiLangParser.An_rest_annotate_countContext(self, self._ctx, self.state)
self.enterRule(localctx, 320, self.RULE_an_rest_annotate_count)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1772
self.match(ZmeiLangParser.KW_COUNT)
self.state = 1773
self.an_rest_annotate_count_field()
self.state = 1776
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.KW_AS:
self.state = 1774
self.match(ZmeiLangParser.KW_AS)
self.state = 1775
self.an_rest_annotate_count_alias()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_annotate_count_fieldContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_annotate_count_field
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_annotate_count_field" ):
listener.enterAn_rest_annotate_count_field(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_annotate_count_field" ):
listener.exitAn_rest_annotate_count_field(self)
def an_rest_annotate_count_field(self):
localctx = ZmeiLangParser.An_rest_annotate_count_fieldContext(self, self._ctx, self.state)
self.enterRule(localctx, 322, self.RULE_an_rest_annotate_count_field)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1778
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_annotate_count_aliasContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_annotate_count_alias
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_annotate_count_alias" ):
listener.enterAn_rest_annotate_count_alias(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_annotate_count_alias" ):
listener.exitAn_rest_annotate_count_alias(self)
def an_rest_annotate_count_alias(self):
localctx = ZmeiLangParser.An_rest_annotate_count_aliasContext(self, self._ctx, self.state)
self.enterRule(localctx, 324, self.RULE_an_rest_annotate_count_alias)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1780
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_inlineContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_INLINE(self):
return self.getToken(ZmeiLangParser.KW_INLINE, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def an_rest_inline_decl(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_rest_inline_declContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_rest_inline_declContext,i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_inline
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_inline" ):
listener.enterAn_rest_inline(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_inline" ):
listener.exitAn_rest_inline(self)
def an_rest_inline(self):
localctx = ZmeiLangParser.An_rest_inlineContext(self, self._ctx, self.state)
self.enterRule(localctx, 326, self.RULE_an_rest_inline)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1782
self.match(ZmeiLangParser.KW_INLINE)
self.state = 1783
self.match(ZmeiLangParser.COLON)
self.state = 1787
self._errHandler.sync(self)
_alt = 1
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt == 1:
self.state = 1787
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID]:
self.state = 1784
self.an_rest_inline_decl()
pass
elif token in [ZmeiLangParser.COMA]:
self.state = 1785
self.match(ZmeiLangParser.COMA)
pass
elif token in [ZmeiLangParser.NL]:
self.state = 1786
self.match(ZmeiLangParser.NL)
pass
else:
raise NoViableAltException(self)
else:
raise NoViableAltException(self)
self.state = 1789
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,169,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_inline_declContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def an_rest_inline_name(self):
return self.getTypedRuleContext(ZmeiLangParser.An_rest_inline_nameContext,0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def an_rest_config(self):
return self.getTypedRuleContext(ZmeiLangParser.An_rest_configContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_inline_decl
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_inline_decl" ):
listener.enterAn_rest_inline_decl(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_inline_decl" ):
listener.exitAn_rest_inline_decl(self)
def an_rest_inline_decl(self):
localctx = ZmeiLangParser.An_rest_inline_declContext(self, self._ctx, self.state)
self.enterRule(localctx, 328, self.RULE_an_rest_inline_decl)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1791
self.an_rest_inline_name()
self.state = 1792
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 1793
self.an_rest_config()
self.state = 1794
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_rest_inline_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_rest_inline_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_rest_inline_name" ):
listener.enterAn_rest_inline_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_rest_inline_name" ):
listener.exitAn_rest_inline_name(self)
def an_rest_inline_name(self):
localctx = ZmeiLangParser.An_rest_inline_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 330, self.RULE_an_rest_inline_name)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1796
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_orderContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_ORDER(self):
return self.getToken(ZmeiLangParser.AN_ORDER, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def an_order_fields(self):
return self.getTypedRuleContext(ZmeiLangParser.An_order_fieldsContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_order
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_order" ):
listener.enterAn_order(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_order" ):
listener.exitAn_order(self)
def an_order(self):
localctx = ZmeiLangParser.An_orderContext(self, self._ctx, self.state)
self.enterRule(localctx, 332, self.RULE_an_order)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1798
self.match(ZmeiLangParser.AN_ORDER)
self.state = 1799
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 1800
self.an_order_fields()
self.state = 1801
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_order_fieldsContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Id_or_kwContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_order_fields
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_order_fields" ):
listener.enterAn_order_fields(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_order_fields" ):
listener.exitAn_order_fields(self)
def an_order_fields(self):
localctx = ZmeiLangParser.An_order_fieldsContext(self, self._ctx, self.state)
self.enterRule(localctx, 334, self.RULE_an_order_fields)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1803
self.id_or_kw()
self.state = 1808
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.COMA:
self.state = 1804
self.match(ZmeiLangParser.COMA)
self.state = 1805
self.id_or_kw()
self.state = 1810
self._errHandler.sync(self)
_la = self._input.LA(1)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_cleanContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_CLEAN(self):
return self.getToken(ZmeiLangParser.AN_CLEAN, 0)
def python_code(self):
return self.getTypedRuleContext(ZmeiLangParser.Python_codeContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_clean
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_clean" ):
listener.enterAn_clean(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_clean" ):
listener.exitAn_clean(self)
def an_clean(self):
localctx = ZmeiLangParser.An_cleanContext(self, self._ctx, self.state)
self.enterRule(localctx, 336, self.RULE_an_clean)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1811
self.match(ZmeiLangParser.AN_CLEAN)
self.state = 1812
self.python_code()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_pre_deleteContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_PRE_DELETE(self):
return self.getToken(ZmeiLangParser.AN_PRE_DELETE, 0)
def python_code(self):
return self.getTypedRuleContext(ZmeiLangParser.Python_codeContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_pre_delete
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_pre_delete" ):
listener.enterAn_pre_delete(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_pre_delete" ):
listener.exitAn_pre_delete(self)
def an_pre_delete(self):
localctx = ZmeiLangParser.An_pre_deleteContext(self, self._ctx, self.state)
self.enterRule(localctx, 338, self.RULE_an_pre_delete)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1814
self.match(ZmeiLangParser.AN_PRE_DELETE)
self.state = 1815
self.python_code()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_treeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_TREE(self):
return self.getToken(ZmeiLangParser.AN_TREE, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def an_tree_poly(self):
return self.getTypedRuleContext(ZmeiLangParser.An_tree_polyContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_tree
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_tree" ):
listener.enterAn_tree(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_tree" ):
listener.exitAn_tree(self)
def an_tree(self):
localctx = ZmeiLangParser.An_treeContext(self, self._ctx, self.state)
self.enterRule(localctx, 340, self.RULE_an_tree)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1817
self.match(ZmeiLangParser.AN_TREE)
self.state = 1822
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.BRACE_OPEN:
self.state = 1818
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 1819
self.an_tree_poly()
self.state = 1820
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_tree_polyContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_POLY_LIST(self):
return self.getToken(ZmeiLangParser.KW_POLY_LIST, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_tree_poly
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_tree_poly" ):
listener.enterAn_tree_poly(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_tree_poly" ):
listener.exitAn_tree_poly(self)
def an_tree_poly(self):
localctx = ZmeiLangParser.An_tree_polyContext(self, self._ctx, self.state)
self.enterRule(localctx, 342, self.RULE_an_tree_poly)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1824
self.match(ZmeiLangParser.KW_POLY_LIST)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_mixinContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_MIXIN(self):
return self.getToken(ZmeiLangParser.AN_MIXIN, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def classname(self):
return self.getTypedRuleContext(ZmeiLangParser.ClassnameContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_mixin
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_mixin" ):
listener.enterAn_mixin(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_mixin" ):
listener.exitAn_mixin(self)
def an_mixin(self):
localctx = ZmeiLangParser.An_mixinContext(self, self._ctx, self.state)
self.enterRule(localctx, 344, self.RULE_an_mixin)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1826
self.match(ZmeiLangParser.AN_MIXIN)
self.state = 1827
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 1828
self.classname()
self.state = 1829
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_date_treeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_DATE_TREE(self):
return self.getToken(ZmeiLangParser.AN_DATE_TREE, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def an_date_tree_field(self):
return self.getTypedRuleContext(ZmeiLangParser.An_date_tree_fieldContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_date_tree
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_date_tree" ):
listener.enterAn_date_tree(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_date_tree" ):
listener.exitAn_date_tree(self)
def an_date_tree(self):
localctx = ZmeiLangParser.An_date_treeContext(self, self._ctx, self.state)
self.enterRule(localctx, 346, self.RULE_an_date_tree)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1831
self.match(ZmeiLangParser.AN_DATE_TREE)
self.state = 1832
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 1833
self.an_date_tree_field()
self.state = 1834
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_date_tree_fieldContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_date_tree_field
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_date_tree_field" ):
listener.enterAn_date_tree_field(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_date_tree_field" ):
listener.exitAn_date_tree_field(self)
def an_date_tree_field(self):
localctx = ZmeiLangParser.An_date_tree_fieldContext(self, self._ctx, self.state)
self.enterRule(localctx, 348, self.RULE_an_date_tree_field)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1836
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_m2m_changedContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_M2M_CHANGED(self):
return self.getToken(ZmeiLangParser.AN_M2M_CHANGED, 0)
def python_code(self):
return self.getTypedRuleContext(ZmeiLangParser.Python_codeContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_m2m_changed
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_m2m_changed" ):
listener.enterAn_m2m_changed(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_m2m_changed" ):
listener.exitAn_m2m_changed(self)
def an_m2m_changed(self):
localctx = ZmeiLangParser.An_m2m_changedContext(self, self._ctx, self.state)
self.enterRule(localctx, 350, self.RULE_an_m2m_changed)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1838
self.match(ZmeiLangParser.AN_M2M_CHANGED)
self.state = 1839
self.python_code()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_post_saveContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_POST_SAVE(self):
return self.getToken(ZmeiLangParser.AN_POST_SAVE, 0)
def python_code(self):
return self.getTypedRuleContext(ZmeiLangParser.Python_codeContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_post_save
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_post_save" ):
listener.enterAn_post_save(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_post_save" ):
listener.exitAn_post_save(self)
def an_post_save(self):
localctx = ZmeiLangParser.An_post_saveContext(self, self._ctx, self.state)
self.enterRule(localctx, 352, self.RULE_an_post_save)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1841
self.match(ZmeiLangParser.AN_POST_SAVE)
self.state = 1842
self.python_code()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_pre_saveContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_PRE_SAVE(self):
return self.getToken(ZmeiLangParser.AN_PRE_SAVE, 0)
def python_code(self):
return self.getTypedRuleContext(ZmeiLangParser.Python_codeContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_pre_save
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_pre_save" ):
listener.enterAn_pre_save(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_pre_save" ):
listener.exitAn_pre_save(self)
def an_pre_save(self):
localctx = ZmeiLangParser.An_pre_saveContext(self, self._ctx, self.state)
self.enterRule(localctx, 354, self.RULE_an_pre_save)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1844
self.match(ZmeiLangParser.AN_PRE_SAVE)
self.state = 1845
self.python_code()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_post_deleteContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_POST_DELETE(self):
return self.getToken(ZmeiLangParser.AN_POST_DELETE, 0)
def python_code(self):
return self.getTypedRuleContext(ZmeiLangParser.Python_codeContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_post_delete
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_post_delete" ):
listener.enterAn_post_delete(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_post_delete" ):
listener.exitAn_post_delete(self)
def an_post_delete(self):
localctx = ZmeiLangParser.An_post_deleteContext(self, self._ctx, self.state)
self.enterRule(localctx, 356, self.RULE_an_post_delete)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1847
self.match(ZmeiLangParser.AN_POST_DELETE)
self.state = 1848
self.python_code()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_sortableContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_SORTABLE(self):
return self.getToken(ZmeiLangParser.AN_SORTABLE, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def an_sortable_field_name(self):
return self.getTypedRuleContext(ZmeiLangParser.An_sortable_field_nameContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_sortable
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_sortable" ):
listener.enterAn_sortable(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_sortable" ):
listener.exitAn_sortable(self)
def an_sortable(self):
localctx = ZmeiLangParser.An_sortableContext(self, self._ctx, self.state)
self.enterRule(localctx, 358, self.RULE_an_sortable)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1850
self.match(ZmeiLangParser.AN_SORTABLE)
self.state = 1851
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 1852
self.an_sortable_field_name()
self.state = 1853
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_sortable_field_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_sortable_field_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_sortable_field_name" ):
listener.enterAn_sortable_field_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_sortable_field_name" ):
listener.exitAn_sortable_field_name(self)
def an_sortable_field_name(self):
localctx = ZmeiLangParser.An_sortable_field_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 360, self.RULE_an_sortable_field_name)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1855
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class PageContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def page_header(self):
return self.getTypedRuleContext(ZmeiLangParser.Page_headerContext,0)
def page_body(self):
return self.getTypedRuleContext(ZmeiLangParser.Page_bodyContext,0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_page
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterPage" ):
listener.enterPage(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitPage" ):
listener.exitPage(self)
def page(self):
localctx = ZmeiLangParser.PageContext(self, self._ctx, self.state)
self.enterRule(localctx, 362, self.RULE_page)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1857
self.page_header()
self.state = 1861
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,172,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1858
self.match(ZmeiLangParser.NL)
self.state = 1863
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,172,self._ctx)
self.state = 1864
self.page_body()
self.state = 1868
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,173,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1865
self.match(ZmeiLangParser.NL)
self.state = 1870
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,173,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Page_headerContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def SQ_BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.SQ_BRACE_OPEN, 0)
def page_name(self):
return self.getTypedRuleContext(ZmeiLangParser.Page_nameContext,0)
def SQ_BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.SQ_BRACE_CLOSE, 0)
def page_base(self):
return self.getTypedRuleContext(ZmeiLangParser.Page_baseContext,0)
def page_alias(self):
return self.getTypedRuleContext(ZmeiLangParser.Page_aliasContext,0)
def COLON(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COLON)
else:
return self.getToken(ZmeiLangParser.COLON, i)
def NL(self):
return self.getToken(ZmeiLangParser.NL, 0)
def page_url(self):
return self.getTypedRuleContext(ZmeiLangParser.Page_urlContext,0)
def page_template(self):
return self.getTypedRuleContext(ZmeiLangParser.Page_templateContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_page_header
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterPage_header" ):
listener.enterPage_header(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitPage_header" ):
listener.exitPage_header(self)
def page_header(self):
localctx = ZmeiLangParser.Page_headerContext(self, self._ctx, self.state)
self.enterRule(localctx, 364, self.RULE_page_header)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1871
self.match(ZmeiLangParser.SQ_BRACE_OPEN)
self.state = 1873
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,174,self._ctx)
if la_ == 1:
self.state = 1872
self.page_base()
self.state = 1875
self.page_name()
self.state = 1877
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.KW_AS:
self.state = 1876
self.page_alias()
self.state = 1887
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.COLON:
self.state = 1879
self.match(ZmeiLangParser.COLON)
self.state = 1881
self._errHandler.sync(self)
_la = self._input.LA(1)
if ((((_la - 134)) & ~0x3f) == 0 and ((1 << (_la - 134)) & ((1 << (ZmeiLangParser.DOT - 134)) | (1 << (ZmeiLangParser.SLASH - 134)) | (1 << (ZmeiLangParser.DOLLAR - 134)))) != 0):
self.state = 1880
self.page_url()
self.state = 1885
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.COLON:
self.state = 1883
self.match(ZmeiLangParser.COLON)
self.state = 1884
self.page_template()
self.state = 1889
self.match(ZmeiLangParser.SQ_BRACE_CLOSE)
self.state = 1891
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,179,self._ctx)
if la_ == 1:
self.state = 1890
self.match(ZmeiLangParser.NL)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Page_baseContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Id_or_kwContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,i)
def GT(self):
return self.getToken(ZmeiLangParser.GT, 0)
def DASH(self):
return self.getToken(ZmeiLangParser.DASH, 0)
def APPROX(self):
return self.getToken(ZmeiLangParser.APPROX, 0)
def DOT(self):
return self.getToken(ZmeiLangParser.DOT, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_page_base
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterPage_base" ):
listener.enterPage_base(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitPage_base" ):
listener.exitPage_base(self)
def page_base(self):
localctx = ZmeiLangParser.Page_baseContext(self, self._ctx, self.state)
self.enterRule(localctx, 366, self.RULE_page_base)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1896
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,180,self._ctx)
if la_ == 1:
self.state = 1893
self.id_or_kw()
self.state = 1894
self.match(ZmeiLangParser.DOT)
self.state = 1898
self.id_or_kw()
self.state = 1899
_la = self._input.LA(1)
if not(_la==ZmeiLangParser.DASH or _la==ZmeiLangParser.APPROX):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
self.state = 1900
self.match(ZmeiLangParser.GT)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Page_aliasContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_AS(self):
return self.getToken(ZmeiLangParser.KW_AS, 0)
def page_alias_name(self):
return self.getTypedRuleContext(ZmeiLangParser.Page_alias_nameContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_page_alias
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterPage_alias" ):
listener.enterPage_alias(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitPage_alias" ):
listener.exitPage_alias(self)
def page_alias(self):
localctx = ZmeiLangParser.Page_aliasContext(self, self._ctx, self.state)
self.enterRule(localctx, 368, self.RULE_page_alias)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1902
self.match(ZmeiLangParser.KW_AS)
self.state = 1903
self.page_alias_name()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Page_alias_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_page_alias_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterPage_alias_name" ):
listener.enterPage_alias_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitPage_alias_name" ):
listener.exitPage_alias_name(self)
def page_alias_name(self):
localctx = ZmeiLangParser.Page_alias_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 370, self.RULE_page_alias_name)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1905
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Page_templateContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def template_name(self):
return self.getTypedRuleContext(ZmeiLangParser.Template_nameContext,0)
def python_code(self):
return self.getTypedRuleContext(ZmeiLangParser.Python_codeContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_page_template
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterPage_template" ):
listener.enterPage_template(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitPage_template" ):
listener.exitPage_template(self)
def page_template(self):
localctx = ZmeiLangParser.Page_templateContext(self, self._ctx, self.state)
self.enterRule(localctx, 372, self.RULE_page_template)
try:
self.state = 1909
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID, ZmeiLangParser.DIGIT, ZmeiLangParser.UNDERSCORE, ZmeiLangParser.DASH, ZmeiLangParser.DOT]:
self.enterOuterAlt(localctx, 1)
self.state = 1907
self.template_name()
pass
elif token in [ZmeiLangParser.ASSIGN, ZmeiLangParser.CODE_BLOCK]:
self.enterOuterAlt(localctx, 2)
self.state = 1908
self.python_code()
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Template_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def file_name_part(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.File_name_partContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.File_name_partContext,i)
def SLASH(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.SLASH)
else:
return self.getToken(ZmeiLangParser.SLASH, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_template_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterTemplate_name" ):
listener.enterTemplate_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitTemplate_name" ):
listener.exitTemplate_name(self)
def template_name(self):
localctx = ZmeiLangParser.Template_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 374, self.RULE_template_name)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1911
self.file_name_part()
self.state = 1916
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.SLASH:
self.state = 1912
self.match(ZmeiLangParser.SLASH)
self.state = 1913
self.file_name_part()
self.state = 1918
self._errHandler.sync(self)
_la = self._input.LA(1)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class File_name_partContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Id_or_kwContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,i)
def DIGIT(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.DIGIT)
else:
return self.getToken(ZmeiLangParser.DIGIT, i)
def DASH(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.DASH)
else:
return self.getToken(ZmeiLangParser.DASH, i)
def UNDERSCORE(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.UNDERSCORE)
else:
return self.getToken(ZmeiLangParser.UNDERSCORE, i)
def DOT(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.DOT)
else:
return self.getToken(ZmeiLangParser.DOT, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_file_name_part
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterFile_name_part" ):
listener.enterFile_name_part(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitFile_name_part" ):
listener.exitFile_name_part(self)
def file_name_part(self):
localctx = ZmeiLangParser.File_name_partContext(self, self._ctx, self.state)
self.enterRule(localctx, 376, self.RULE_file_name_part)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1924
self._errHandler.sync(self)
_la = self._input.LA(1)
while True:
self.state = 1924
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID]:
self.state = 1919
self.id_or_kw()
pass
elif token in [ZmeiLangParser.DIGIT]:
self.state = 1920
self.match(ZmeiLangParser.DIGIT)
pass
elif token in [ZmeiLangParser.DASH]:
self.state = 1921
self.match(ZmeiLangParser.DASH)
pass
elif token in [ZmeiLangParser.UNDERSCORE]:
self.state = 1922
self.match(ZmeiLangParser.UNDERSCORE)
pass
elif token in [ZmeiLangParser.DOT]:
self.state = 1923
self.match(ZmeiLangParser.DOT)
pass
else:
raise NoViableAltException(self)
self.state = 1926
self._errHandler.sync(self)
_la = self._input.LA(1)
if not (((((_la - 42)) & ~0x3f) == 0 and ((1 << (_la - 42)) & ((1 << (ZmeiLangParser.KW_AUTH_TYPE_BASIC - 42)) | (1 << (ZmeiLangParser.KW_AUTH_TYPE_SESSION - 42)) | (1 << (ZmeiLangParser.KW_AUTH_TYPE_TOKEN - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_HTML - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FLOAT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DECIMAL - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DATE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DATETIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_IMAGE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_TEXT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_INT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_SLUG - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_BOOL - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_MANY - 42)) | (1 << (ZmeiLangParser.COL_FIELD_CHOICES - 42)) | (1 << (ZmeiLangParser.KW_THEME - 42)) | (1 << (ZmeiLangParser.KW_INSTALL - 42)) | (1 << (ZmeiLangParser.KW_HEADER - 42)) | (1 << (ZmeiLangParser.KW_SERVICES - 42)) | (1 << (ZmeiLangParser.KW_SELENIUM_PYTEST - 42)) | (1 << (ZmeiLangParser.KW_CHILD - 42)) | (1 << (ZmeiLangParser.KW_FILTER_OUT - 42)) | (1 << (ZmeiLangParser.KW_FILTER_IN - 42)) | (1 << (ZmeiLangParser.KW_PAGE - 42)) | (1 << (ZmeiLangParser.KW_LINK_SUFFIX - 42)) | (1 << (ZmeiLangParser.KW_URL_PREFIX - 42)) | (1 << (ZmeiLangParser.KW_CAN_EDIT - 42)) | (1 << (ZmeiLangParser.KW_OBJECT_EXPR - 42)) | (1 << (ZmeiLangParser.KW_BLOCK - 42)) | (1 << (ZmeiLangParser.KW_ITEM_NAME - 42)) | (1 << (ZmeiLangParser.KW_PK_PARAM - 42)) | (1 << (ZmeiLangParser.KW_LIST_FIELDS - 42)) | (1 << (ZmeiLangParser.KW_DELETE - 42)) | (1 << (ZmeiLangParser.KW_EDIT - 42)) | (1 << (ZmeiLangParser.KW_CREATE - 42)) | (1 << (ZmeiLangParser.KW_DETAIL - 42)) | (1 << (ZmeiLangParser.KW_SKIP - 42)) | (1 << (ZmeiLangParser.KW_FROM - 42)) | (1 << (ZmeiLangParser.KW_POLY_LIST - 42)) | (1 << (ZmeiLangParser.KW_CSS - 42)) | (1 << (ZmeiLangParser.KW_JS - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_TABULAR - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_STACKED - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC - 42)) | (1 << (ZmeiLangParser.KW_INLINE - 42)) | (1 << (ZmeiLangParser.KW_TYPE - 42)) | (1 << (ZmeiLangParser.KW_USER_FIELD - 42)) | (1 << (ZmeiLangParser.KW_ANNOTATE - 42)) | (1 << (ZmeiLangParser.KW_ON_CREATE - 42)) | (1 << (ZmeiLangParser.KW_QUERY - 42)) | (1 << (ZmeiLangParser.KW_AUTH - 42)) | (1 << (ZmeiLangParser.KW_COUNT - 42)) | (1 << (ZmeiLangParser.KW_I18N - 42)))) != 0) or ((((_la - 106)) & ~0x3f) == 0 and ((1 << (_la - 106)) & ((1 << (ZmeiLangParser.KW_EXTENSION - 106)) | (1 << (ZmeiLangParser.KW_TABS - 106)) | (1 << (ZmeiLangParser.KW_LIST - 106)) | (1 << (ZmeiLangParser.KW_READ_ONLY - 106)) | (1 << (ZmeiLangParser.KW_LIST_EDITABLE - 106)) | (1 << (ZmeiLangParser.KW_LIST_FILTER - 106)) | (1 << (ZmeiLangParser.KW_LIST_SEARCH - 106)) | (1 << (ZmeiLangParser.KW_FIELDS - 106)) | (1 << (ZmeiLangParser.KW_IMPORT - 106)) | (1 << (ZmeiLangParser.KW_AS - 106)) | (1 << (ZmeiLangParser.WRITE_MODE - 106)) | (1 << (ZmeiLangParser.BOOL - 106)) | (1 << (ZmeiLangParser.ID - 106)) | (1 << (ZmeiLangParser.DIGIT - 106)) | (1 << (ZmeiLangParser.UNDERSCORE - 106)) | (1 << (ZmeiLangParser.DASH - 106)) | (1 << (ZmeiLangParser.DOT - 106)))) != 0)):
break
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Page_urlContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def url_segments(self):
return self.getTypedRuleContext(ZmeiLangParser.Url_segmentsContext,0)
def DOT(self):
return self.getToken(ZmeiLangParser.DOT, 0)
def DOLLAR(self):
return self.getToken(ZmeiLangParser.DOLLAR, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_page_url
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterPage_url" ):
listener.enterPage_url(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitPage_url" ):
listener.exitPage_url(self)
def page_url(self):
localctx = ZmeiLangParser.Page_urlContext(self, self._ctx, self.state)
self.enterRule(localctx, 378, self.RULE_page_url)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1929
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.DOT or _la==ZmeiLangParser.DOLLAR:
self.state = 1928
_la = self._input.LA(1)
if not(_la==ZmeiLangParser.DOT or _la==ZmeiLangParser.DOLLAR):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
self.state = 1931
self.url_segments()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Url_partContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Id_or_kwContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,i)
def DASH(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.DASH)
else:
return self.getToken(ZmeiLangParser.DASH, i)
def DIGIT(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.DIGIT)
else:
return self.getToken(ZmeiLangParser.DIGIT, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_url_part
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterUrl_part" ):
listener.enterUrl_part(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitUrl_part" ):
listener.exitUrl_part(self)
def url_part(self):
localctx = ZmeiLangParser.Url_partContext(self, self._ctx, self.state)
self.enterRule(localctx, 380, self.RULE_url_part)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1936
self._errHandler.sync(self)
_la = self._input.LA(1)
while True:
self.state = 1936
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID]:
self.state = 1933
self.id_or_kw()
pass
elif token in [ZmeiLangParser.DASH]:
self.state = 1934
self.match(ZmeiLangParser.DASH)
pass
elif token in [ZmeiLangParser.DIGIT]:
self.state = 1935
self.match(ZmeiLangParser.DIGIT)
pass
else:
raise NoViableAltException(self)
self.state = 1938
self._errHandler.sync(self)
_la = self._input.LA(1)
if not (((((_la - 42)) & ~0x3f) == 0 and ((1 << (_la - 42)) & ((1 << (ZmeiLangParser.KW_AUTH_TYPE_BASIC - 42)) | (1 << (ZmeiLangParser.KW_AUTH_TYPE_SESSION - 42)) | (1 << (ZmeiLangParser.KW_AUTH_TYPE_TOKEN - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_HTML - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FLOAT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DECIMAL - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DATE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DATETIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_IMAGE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_TEXT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_INT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_SLUG - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_BOOL - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_MANY - 42)) | (1 << (ZmeiLangParser.COL_FIELD_CHOICES - 42)) | (1 << (ZmeiLangParser.KW_THEME - 42)) | (1 << (ZmeiLangParser.KW_INSTALL - 42)) | (1 << (ZmeiLangParser.KW_HEADER - 42)) | (1 << (ZmeiLangParser.KW_SERVICES - 42)) | (1 << (ZmeiLangParser.KW_SELENIUM_PYTEST - 42)) | (1 << (ZmeiLangParser.KW_CHILD - 42)) | (1 << (ZmeiLangParser.KW_FILTER_OUT - 42)) | (1 << (ZmeiLangParser.KW_FILTER_IN - 42)) | (1 << (ZmeiLangParser.KW_PAGE - 42)) | (1 << (ZmeiLangParser.KW_LINK_SUFFIX - 42)) | (1 << (ZmeiLangParser.KW_URL_PREFIX - 42)) | (1 << (ZmeiLangParser.KW_CAN_EDIT - 42)) | (1 << (ZmeiLangParser.KW_OBJECT_EXPR - 42)) | (1 << (ZmeiLangParser.KW_BLOCK - 42)) | (1 << (ZmeiLangParser.KW_ITEM_NAME - 42)) | (1 << (ZmeiLangParser.KW_PK_PARAM - 42)) | (1 << (ZmeiLangParser.KW_LIST_FIELDS - 42)) | (1 << (ZmeiLangParser.KW_DELETE - 42)) | (1 << (ZmeiLangParser.KW_EDIT - 42)) | (1 << (ZmeiLangParser.KW_CREATE - 42)) | (1 << (ZmeiLangParser.KW_DETAIL - 42)) | (1 << (ZmeiLangParser.KW_SKIP - 42)) | (1 << (ZmeiLangParser.KW_FROM - 42)) | (1 << (ZmeiLangParser.KW_POLY_LIST - 42)) | (1 << (ZmeiLangParser.KW_CSS - 42)) | (1 << (ZmeiLangParser.KW_JS - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_TABULAR - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_STACKED - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC - 42)) | (1 << (ZmeiLangParser.KW_INLINE - 42)) | (1 << (ZmeiLangParser.KW_TYPE - 42)) | (1 << (ZmeiLangParser.KW_USER_FIELD - 42)) | (1 << (ZmeiLangParser.KW_ANNOTATE - 42)) | (1 << (ZmeiLangParser.KW_ON_CREATE - 42)) | (1 << (ZmeiLangParser.KW_QUERY - 42)) | (1 << (ZmeiLangParser.KW_AUTH - 42)) | (1 << (ZmeiLangParser.KW_COUNT - 42)) | (1 << (ZmeiLangParser.KW_I18N - 42)))) != 0) or ((((_la - 106)) & ~0x3f) == 0 and ((1 << (_la - 106)) & ((1 << (ZmeiLangParser.KW_EXTENSION - 106)) | (1 << (ZmeiLangParser.KW_TABS - 106)) | (1 << (ZmeiLangParser.KW_LIST - 106)) | (1 << (ZmeiLangParser.KW_READ_ONLY - 106)) | (1 << (ZmeiLangParser.KW_LIST_EDITABLE - 106)) | (1 << (ZmeiLangParser.KW_LIST_FILTER - 106)) | (1 << (ZmeiLangParser.KW_LIST_SEARCH - 106)) | (1 << (ZmeiLangParser.KW_FIELDS - 106)) | (1 << (ZmeiLangParser.KW_IMPORT - 106)) | (1 << (ZmeiLangParser.KW_AS - 106)) | (1 << (ZmeiLangParser.WRITE_MODE - 106)) | (1 << (ZmeiLangParser.BOOL - 106)) | (1 << (ZmeiLangParser.ID - 106)) | (1 << (ZmeiLangParser.DIGIT - 106)) | (1 << (ZmeiLangParser.DASH - 106)))) != 0)):
break
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Url_paramContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def LT(self):
return self.getToken(ZmeiLangParser.LT, 0)
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def GT(self):
return self.getToken(ZmeiLangParser.GT, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_url_param
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterUrl_param" ):
listener.enterUrl_param(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitUrl_param" ):
listener.exitUrl_param(self)
def url_param(self):
localctx = ZmeiLangParser.Url_paramContext(self, self._ctx, self.state)
self.enterRule(localctx, 382, self.RULE_url_param)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1940
self.match(ZmeiLangParser.LT)
self.state = 1941
self.id_or_kw()
self.state = 1942
self.match(ZmeiLangParser.GT)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Url_segmentContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def url_part(self):
return self.getTypedRuleContext(ZmeiLangParser.Url_partContext,0)
def url_param(self):
return self.getTypedRuleContext(ZmeiLangParser.Url_paramContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_url_segment
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterUrl_segment" ):
listener.enterUrl_segment(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitUrl_segment" ):
listener.exitUrl_segment(self)
def url_segment(self):
localctx = ZmeiLangParser.Url_segmentContext(self, self._ctx, self.state)
self.enterRule(localctx, 384, self.RULE_url_segment)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1946
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID, ZmeiLangParser.DIGIT, ZmeiLangParser.DASH]:
self.state = 1944
self.url_part()
pass
elif token in [ZmeiLangParser.LT]:
self.state = 1945
self.url_param()
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Url_segmentsContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def SLASH(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.SLASH)
else:
return self.getToken(ZmeiLangParser.SLASH, i)
def url_segment(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Url_segmentContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Url_segmentContext,i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_url_segments
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterUrl_segments" ):
listener.enterUrl_segments(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitUrl_segments" ):
listener.exitUrl_segments(self)
def url_segments(self):
localctx = ZmeiLangParser.Url_segmentsContext(self, self._ctx, self.state)
self.enterRule(localctx, 386, self.RULE_url_segments)
self._la = 0 # Token type
try:
self.state = 1958
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,191,self._ctx)
if la_ == 1:
self.enterOuterAlt(localctx, 1)
self.state = 1948
self.match(ZmeiLangParser.SLASH)
pass
elif la_ == 2:
self.enterOuterAlt(localctx, 2)
self.state = 1951
self._errHandler.sync(self)
_alt = 1
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt == 1:
self.state = 1949
self.match(ZmeiLangParser.SLASH)
self.state = 1950
self.url_segment()
else:
raise NoViableAltException(self)
self.state = 1953
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,189,self._ctx)
self.state = 1956
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.SLASH:
self.state = 1955
self.match(ZmeiLangParser.SLASH)
pass
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Page_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_page_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterPage_name" ):
listener.enterPage_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitPage_name" ):
listener.exitPage_name(self)
def page_name(self):
localctx = ZmeiLangParser.Page_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 388, self.RULE_page_name)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1960
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Page_bodyContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def page_field(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Page_fieldContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Page_fieldContext,i)
def page_function(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Page_functionContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Page_functionContext,i)
def page_code(self):
return self.getTypedRuleContext(ZmeiLangParser.Page_codeContext,0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def page_annotation(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Page_annotationContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Page_annotationContext,i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_page_body
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterPage_body" ):
listener.enterPage_body(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitPage_body" ):
listener.exitPage_body(self)
def page_body(self):
localctx = ZmeiLangParser.Page_bodyContext(self, self._ctx, self.state)
self.enterRule(localctx, 390, self.RULE_page_body)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 1965
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,192,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1962
self.page_field()
self.state = 1967
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,192,self._ctx)
self.state = 1971
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,193,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1968
self.page_function()
self.state = 1973
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,193,self._ctx)
self.state = 1975
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.ASSIGN or _la==ZmeiLangParser.CODE_BLOCK:
self.state = 1974
self.page_code()
self.state = 1980
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,195,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1977
self.match(ZmeiLangParser.NL)
self.state = 1982
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,195,self._ctx)
self.state = 1986
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,196,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 1983
self.page_annotation()
self.state = 1988
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,196,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Page_codeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def python_code(self):
return self.getTypedRuleContext(ZmeiLangParser.Python_codeContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_page_code
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterPage_code" ):
listener.enterPage_code(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitPage_code" ):
listener.exitPage_code(self)
def page_code(self):
localctx = ZmeiLangParser.Page_codeContext(self, self._ctx, self.state)
self.enterRule(localctx, 392, self.RULE_page_code)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1989
self.python_code()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Page_fieldContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def page_field_name(self):
return self.getTypedRuleContext(ZmeiLangParser.Page_field_nameContext,0)
def ASSIGN(self):
return self.getToken(ZmeiLangParser.ASSIGN, 0)
def page_field_code(self):
return self.getTypedRuleContext(ZmeiLangParser.Page_field_codeContext,0)
def EOF(self):
return self.getToken(ZmeiLangParser.EOF, 0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_page_field
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterPage_field" ):
listener.enterPage_field(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitPage_field" ):
listener.exitPage_field(self)
def page_field(self):
localctx = ZmeiLangParser.Page_fieldContext(self, self._ctx, self.state)
self.enterRule(localctx, 394, self.RULE_page_field)
try:
self.enterOuterAlt(localctx, 1)
self.state = 1991
self.page_field_name()
self.state = 1992
self.match(ZmeiLangParser.ASSIGN)
self.state = 1993
self.page_field_code()
self.state = 2000
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.NL]:
self.state = 1995
self._errHandler.sync(self)
_alt = 1
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt == 1:
self.state = 1994
self.match(ZmeiLangParser.NL)
else:
raise NoViableAltException(self)
self.state = 1997
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,197,self._ctx)
pass
elif token in [ZmeiLangParser.EOF]:
self.state = 1999
self.match(ZmeiLangParser.EOF)
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Page_field_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_page_field_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterPage_field_name" ):
listener.enterPage_field_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitPage_field_name" ):
listener.exitPage_field_name(self)
def page_field_name(self):
localctx = ZmeiLangParser.Page_field_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 396, self.RULE_page_field_name)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2002
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Page_field_codeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def PYTHON_CODE(self):
return self.getToken(ZmeiLangParser.PYTHON_CODE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_page_field_code
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterPage_field_code" ):
listener.enterPage_field_code(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitPage_field_code" ):
listener.exitPage_field_code(self)
def page_field_code(self):
localctx = ZmeiLangParser.Page_field_codeContext(self, self._ctx, self.state)
self.enterRule(localctx, 398, self.RULE_page_field_code)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2004
self.match(ZmeiLangParser.PYTHON_CODE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Page_functionContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def page_function_name(self):
return self.getTypedRuleContext(ZmeiLangParser.Page_function_nameContext,0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def EOF(self):
return self.getToken(ZmeiLangParser.EOF, 0)
def page_function_args(self):
return self.getTypedRuleContext(ZmeiLangParser.Page_function_argsContext,0)
def code_block(self):
return self.getTypedRuleContext(ZmeiLangParser.Code_blockContext,0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_page_function
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterPage_function" ):
listener.enterPage_function(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitPage_function" ):
listener.exitPage_function(self)
def page_function(self):
localctx = ZmeiLangParser.Page_functionContext(self, self._ctx, self.state)
self.enterRule(localctx, 400, self.RULE_page_function)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2006
self.page_function_name()
self.state = 2007
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 2009
self._errHandler.sync(self)
_la = self._input.LA(1)
if ((((_la - 42)) & ~0x3f) == 0 and ((1 << (_la - 42)) & ((1 << (ZmeiLangParser.KW_AUTH_TYPE_BASIC - 42)) | (1 << (ZmeiLangParser.KW_AUTH_TYPE_SESSION - 42)) | (1 << (ZmeiLangParser.KW_AUTH_TYPE_TOKEN - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_HTML - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FLOAT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DECIMAL - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DATE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DATETIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_IMAGE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_TEXT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_INT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_SLUG - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_BOOL - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_MANY - 42)) | (1 << (ZmeiLangParser.COL_FIELD_CHOICES - 42)) | (1 << (ZmeiLangParser.KW_THEME - 42)) | (1 << (ZmeiLangParser.KW_INSTALL - 42)) | (1 << (ZmeiLangParser.KW_HEADER - 42)) | (1 << (ZmeiLangParser.KW_SERVICES - 42)) | (1 << (ZmeiLangParser.KW_SELENIUM_PYTEST - 42)) | (1 << (ZmeiLangParser.KW_CHILD - 42)) | (1 << (ZmeiLangParser.KW_FILTER_OUT - 42)) | (1 << (ZmeiLangParser.KW_FILTER_IN - 42)) | (1 << (ZmeiLangParser.KW_PAGE - 42)) | (1 << (ZmeiLangParser.KW_LINK_SUFFIX - 42)) | (1 << (ZmeiLangParser.KW_URL_PREFIX - 42)) | (1 << (ZmeiLangParser.KW_CAN_EDIT - 42)) | (1 << (ZmeiLangParser.KW_OBJECT_EXPR - 42)) | (1 << (ZmeiLangParser.KW_BLOCK - 42)) | (1 << (ZmeiLangParser.KW_ITEM_NAME - 42)) | (1 << (ZmeiLangParser.KW_PK_PARAM - 42)) | (1 << (ZmeiLangParser.KW_LIST_FIELDS - 42)) | (1 << (ZmeiLangParser.KW_DELETE - 42)) | (1 << (ZmeiLangParser.KW_EDIT - 42)) | (1 << (ZmeiLangParser.KW_CREATE - 42)) | (1 << (ZmeiLangParser.KW_DETAIL - 42)) | (1 << (ZmeiLangParser.KW_SKIP - 42)) | (1 << (ZmeiLangParser.KW_FROM - 42)) | (1 << (ZmeiLangParser.KW_POLY_LIST - 42)) | (1 << (ZmeiLangParser.KW_CSS - 42)) | (1 << (ZmeiLangParser.KW_JS - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_TABULAR - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_STACKED - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC - 42)) | (1 << (ZmeiLangParser.KW_INLINE - 42)) | (1 << (ZmeiLangParser.KW_TYPE - 42)) | (1 << (ZmeiLangParser.KW_USER_FIELD - 42)) | (1 << (ZmeiLangParser.KW_ANNOTATE - 42)) | (1 << (ZmeiLangParser.KW_ON_CREATE - 42)) | (1 << (ZmeiLangParser.KW_QUERY - 42)) | (1 << (ZmeiLangParser.KW_AUTH - 42)) | (1 << (ZmeiLangParser.KW_COUNT - 42)) | (1 << (ZmeiLangParser.KW_I18N - 42)))) != 0) or ((((_la - 106)) & ~0x3f) == 0 and ((1 << (_la - 106)) & ((1 << (ZmeiLangParser.KW_EXTENSION - 106)) | (1 << (ZmeiLangParser.KW_TABS - 106)) | (1 << (ZmeiLangParser.KW_LIST - 106)) | (1 << (ZmeiLangParser.KW_READ_ONLY - 106)) | (1 << (ZmeiLangParser.KW_LIST_EDITABLE - 106)) | (1 << (ZmeiLangParser.KW_LIST_FILTER - 106)) | (1 << (ZmeiLangParser.KW_LIST_SEARCH - 106)) | (1 << (ZmeiLangParser.KW_FIELDS - 106)) | (1 << (ZmeiLangParser.KW_IMPORT - 106)) | (1 << (ZmeiLangParser.KW_AS - 106)) | (1 << (ZmeiLangParser.WRITE_MODE - 106)) | (1 << (ZmeiLangParser.BOOL - 106)) | (1 << (ZmeiLangParser.ID - 106)) | (1 << (ZmeiLangParser.DOT - 106)))) != 0):
self.state = 2008
self.page_function_args()
self.state = 2011
self.match(ZmeiLangParser.BRACE_CLOSE)
self.state = 2013
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.CODE_BLOCK:
self.state = 2012
self.code_block()
self.state = 2021
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.NL]:
self.state = 2016
self._errHandler.sync(self)
_alt = 1
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt == 1:
self.state = 2015
self.match(ZmeiLangParser.NL)
else:
raise NoViableAltException(self)
self.state = 2018
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,201,self._ctx)
pass
elif token in [ZmeiLangParser.EOF]:
self.state = 2020
self.match(ZmeiLangParser.EOF)
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Page_function_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_page_function_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterPage_function_name" ):
listener.enterPage_function_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitPage_function_name" ):
listener.exitPage_function_name(self)
def page_function_name(self):
localctx = ZmeiLangParser.Page_function_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 402, self.RULE_page_function_name)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2023
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Page_function_argsContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def page_function_arg(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Page_function_argContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Page_function_argContext,i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_page_function_args
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterPage_function_args" ):
listener.enterPage_function_args(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitPage_function_args" ):
listener.exitPage_function_args(self)
def page_function_args(self):
localctx = ZmeiLangParser.Page_function_argsContext(self, self._ctx, self.state)
self.enterRule(localctx, 404, self.RULE_page_function_args)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2025
self.page_function_arg()
self.state = 2030
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.COMA:
self.state = 2026
self.match(ZmeiLangParser.COMA)
self.state = 2027
self.page_function_arg()
self.state = 2032
self._errHandler.sync(self)
_la = self._input.LA(1)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Page_function_argContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def DOT(self):
return self.getToken(ZmeiLangParser.DOT, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_page_function_arg
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterPage_function_arg" ):
listener.enterPage_function_arg(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitPage_function_arg" ):
listener.exitPage_function_arg(self)
def page_function_arg(self):
localctx = ZmeiLangParser.Page_function_argContext(self, self._ctx, self.state)
self.enterRule(localctx, 406, self.RULE_page_function_arg)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2034
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.DOT:
self.state = 2033
self.match(ZmeiLangParser.DOT)
self.state = 2036
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class Page_annotationContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def an_stream(self):
return self.getTypedRuleContext(ZmeiLangParser.An_streamContext,0)
def an_react(self):
return self.getTypedRuleContext(ZmeiLangParser.An_reactContext,0)
def an_html(self):
return self.getTypedRuleContext(ZmeiLangParser.An_htmlContext,0)
def an_markdown(self):
return self.getTypedRuleContext(ZmeiLangParser.An_markdownContext,0)
def an_crud_delete(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_deleteContext,0)
def an_post(self):
return self.getTypedRuleContext(ZmeiLangParser.An_postContext,0)
def an_auth(self):
return self.getTypedRuleContext(ZmeiLangParser.An_authContext,0)
def an_crud_create(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_createContext,0)
def an_crud_edit(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_editContext,0)
def an_crud(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crudContext,0)
def an_crud_list(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_listContext,0)
def an_menu(self):
return self.getTypedRuleContext(ZmeiLangParser.An_menuContext,0)
def an_crud_detail(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_detailContext,0)
def an_priority_marker(self):
return self.getTypedRuleContext(ZmeiLangParser.An_priority_markerContext,0)
def an_get(self):
return self.getTypedRuleContext(ZmeiLangParser.An_getContext,0)
def an_error(self):
return self.getTypedRuleContext(ZmeiLangParser.An_errorContext,0)
def NL(self):
return self.getToken(ZmeiLangParser.NL, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_page_annotation
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterPage_annotation" ):
listener.enterPage_annotation(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitPage_annotation" ):
listener.exitPage_annotation(self)
def page_annotation(self):
localctx = ZmeiLangParser.Page_annotationContext(self, self._ctx, self.state)
self.enterRule(localctx, 408, self.RULE_page_annotation)
try:
self.state = 2055
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.AN_STREAM]:
self.enterOuterAlt(localctx, 1)
self.state = 2038
self.an_stream()
pass
elif token in [ZmeiLangParser.AN_REACT, ZmeiLangParser.AN_REACT_CLIENT, ZmeiLangParser.AN_REACT_SERVER]:
self.enterOuterAlt(localctx, 2)
self.state = 2039
self.an_react()
pass
elif token in [ZmeiLangParser.AN_HTML]:
self.enterOuterAlt(localctx, 3)
self.state = 2040
self.an_html()
pass
elif token in [ZmeiLangParser.AN_MARKDOWN]:
self.enterOuterAlt(localctx, 4)
self.state = 2041
self.an_markdown()
pass
elif token in [ZmeiLangParser.AN_CRUD_DELETE]:
self.enterOuterAlt(localctx, 5)
self.state = 2042
self.an_crud_delete()
pass
elif token in [ZmeiLangParser.AN_POST]:
self.enterOuterAlt(localctx, 6)
self.state = 2043
self.an_post()
pass
elif token in [ZmeiLangParser.AN_AUTH]:
self.enterOuterAlt(localctx, 7)
self.state = 2044
self.an_auth()
pass
elif token in [ZmeiLangParser.AN_CRUD_CREATE]:
self.enterOuterAlt(localctx, 8)
self.state = 2045
self.an_crud_create()
pass
elif token in [ZmeiLangParser.AN_CRUD_EDIT]:
self.enterOuterAlt(localctx, 9)
self.state = 2046
self.an_crud_edit()
pass
elif token in [ZmeiLangParser.AN_CRUD]:
self.enterOuterAlt(localctx, 10)
self.state = 2047
self.an_crud()
pass
elif token in [ZmeiLangParser.AN_CRUD_LIST]:
self.enterOuterAlt(localctx, 11)
self.state = 2048
self.an_crud_list()
pass
elif token in [ZmeiLangParser.AN_MENU]:
self.enterOuterAlt(localctx, 12)
self.state = 2049
self.an_menu()
pass
elif token in [ZmeiLangParser.AN_CRUD_DETAIL]:
self.enterOuterAlt(localctx, 13)
self.state = 2050
self.an_crud_detail()
pass
elif token in [ZmeiLangParser.AN_PRIORITY]:
self.enterOuterAlt(localctx, 14)
self.state = 2051
self.an_priority_marker()
pass
elif token in [ZmeiLangParser.AN_GET]:
self.enterOuterAlt(localctx, 15)
self.state = 2052
self.an_get()
pass
elif token in [ZmeiLangParser.AN_ERROR]:
self.enterOuterAlt(localctx, 16)
self.state = 2053
self.an_error()
pass
elif token in [ZmeiLangParser.NL]:
self.enterOuterAlt(localctx, 17)
self.state = 2054
self.match(ZmeiLangParser.NL)
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_streamContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_STREAM(self):
return self.getToken(ZmeiLangParser.AN_STREAM, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def an_stream_model(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_stream_modelContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_stream_modelContext,i)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_stream
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_stream" ):
listener.enterAn_stream(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_stream" ):
listener.exitAn_stream(self)
def an_stream(self):
localctx = ZmeiLangParser.An_streamContext(self, self._ctx, self.state)
self.enterRule(localctx, 410, self.RULE_an_stream)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2057
self.match(ZmeiLangParser.AN_STREAM)
self.state = 2058
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 2061
self._errHandler.sync(self)
_la = self._input.LA(1)
while True:
self.state = 2061
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID, ZmeiLangParser.HASH]:
self.state = 2059
self.an_stream_model()
pass
elif token in [ZmeiLangParser.NL]:
self.state = 2060
self.match(ZmeiLangParser.NL)
pass
else:
raise NoViableAltException(self)
self.state = 2063
self._errHandler.sync(self)
_la = self._input.LA(1)
if not (((((_la - 42)) & ~0x3f) == 0 and ((1 << (_la - 42)) & ((1 << (ZmeiLangParser.KW_AUTH_TYPE_BASIC - 42)) | (1 << (ZmeiLangParser.KW_AUTH_TYPE_SESSION - 42)) | (1 << (ZmeiLangParser.KW_AUTH_TYPE_TOKEN - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_HTML - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FLOAT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DECIMAL - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DATE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_DATETIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_IMAGE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_TEXT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_INT - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_SLUG - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_BOOL - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE - 42)) | (1 << (ZmeiLangParser.COL_FIELD_TYPE_MANY - 42)) | (1 << (ZmeiLangParser.COL_FIELD_CHOICES - 42)) | (1 << (ZmeiLangParser.KW_THEME - 42)) | (1 << (ZmeiLangParser.KW_INSTALL - 42)) | (1 << (ZmeiLangParser.KW_HEADER - 42)) | (1 << (ZmeiLangParser.KW_SERVICES - 42)) | (1 << (ZmeiLangParser.KW_SELENIUM_PYTEST - 42)) | (1 << (ZmeiLangParser.KW_CHILD - 42)) | (1 << (ZmeiLangParser.KW_FILTER_OUT - 42)) | (1 << (ZmeiLangParser.KW_FILTER_IN - 42)) | (1 << (ZmeiLangParser.KW_PAGE - 42)) | (1 << (ZmeiLangParser.KW_LINK_SUFFIX - 42)) | (1 << (ZmeiLangParser.KW_URL_PREFIX - 42)) | (1 << (ZmeiLangParser.KW_CAN_EDIT - 42)) | (1 << (ZmeiLangParser.KW_OBJECT_EXPR - 42)) | (1 << (ZmeiLangParser.KW_BLOCK - 42)) | (1 << (ZmeiLangParser.KW_ITEM_NAME - 42)) | (1 << (ZmeiLangParser.KW_PK_PARAM - 42)) | (1 << (ZmeiLangParser.KW_LIST_FIELDS - 42)) | (1 << (ZmeiLangParser.KW_DELETE - 42)) | (1 << (ZmeiLangParser.KW_EDIT - 42)) | (1 << (ZmeiLangParser.KW_CREATE - 42)) | (1 << (ZmeiLangParser.KW_DETAIL - 42)) | (1 << (ZmeiLangParser.KW_SKIP - 42)) | (1 << (ZmeiLangParser.KW_FROM - 42)) | (1 << (ZmeiLangParser.KW_POLY_LIST - 42)) | (1 << (ZmeiLangParser.KW_CSS - 42)) | (1 << (ZmeiLangParser.KW_JS - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_TABULAR - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_STACKED - 42)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC - 42)) | (1 << (ZmeiLangParser.KW_INLINE - 42)) | (1 << (ZmeiLangParser.KW_TYPE - 42)) | (1 << (ZmeiLangParser.KW_USER_FIELD - 42)) | (1 << (ZmeiLangParser.KW_ANNOTATE - 42)) | (1 << (ZmeiLangParser.KW_ON_CREATE - 42)) | (1 << (ZmeiLangParser.KW_QUERY - 42)) | (1 << (ZmeiLangParser.KW_AUTH - 42)) | (1 << (ZmeiLangParser.KW_COUNT - 42)) | (1 << (ZmeiLangParser.KW_I18N - 42)))) != 0) or ((((_la - 106)) & ~0x3f) == 0 and ((1 << (_la - 106)) & ((1 << (ZmeiLangParser.KW_EXTENSION - 106)) | (1 << (ZmeiLangParser.KW_TABS - 106)) | (1 << (ZmeiLangParser.KW_LIST - 106)) | (1 << (ZmeiLangParser.KW_READ_ONLY - 106)) | (1 << (ZmeiLangParser.KW_LIST_EDITABLE - 106)) | (1 << (ZmeiLangParser.KW_LIST_FILTER - 106)) | (1 << (ZmeiLangParser.KW_LIST_SEARCH - 106)) | (1 << (ZmeiLangParser.KW_FIELDS - 106)) | (1 << (ZmeiLangParser.KW_IMPORT - 106)) | (1 << (ZmeiLangParser.KW_AS - 106)) | (1 << (ZmeiLangParser.WRITE_MODE - 106)) | (1 << (ZmeiLangParser.BOOL - 106)) | (1 << (ZmeiLangParser.NL - 106)) | (1 << (ZmeiLangParser.ID - 106)) | (1 << (ZmeiLangParser.HASH - 106)))) != 0)):
break
self.state = 2065
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_stream_modelContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def an_stream_target_model(self):
return self.getTypedRuleContext(ZmeiLangParser.An_stream_target_modelContext,0)
def an_stream_target_filter(self):
return self.getTypedRuleContext(ZmeiLangParser.An_stream_target_filterContext,0)
def an_stream_field_list(self):
return self.getTypedRuleContext(ZmeiLangParser.An_stream_field_listContext,0)
def COMA(self):
return self.getToken(ZmeiLangParser.COMA, 0)
def NL(self):
return self.getToken(ZmeiLangParser.NL, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_stream_model
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_stream_model" ):
listener.enterAn_stream_model(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_stream_model" ):
listener.exitAn_stream_model(self)
def an_stream_model(self):
localctx = ZmeiLangParser.An_stream_modelContext(self, self._ctx, self.state)
self.enterRule(localctx, 412, self.RULE_an_stream_model)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2067
self.an_stream_target_model()
self.state = 2069
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.CODE_BLOCK:
self.state = 2068
self.an_stream_target_filter()
self.state = 2072
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.EQUALS:
self.state = 2071
self.an_stream_field_list()
self.state = 2075
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.COMA:
self.state = 2074
self.match(ZmeiLangParser.COMA)
self.state = 2078
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,211,self._ctx)
if la_ == 1:
self.state = 2077
self.match(ZmeiLangParser.NL)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_stream_target_modelContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def model_ref(self):
return self.getTypedRuleContext(ZmeiLangParser.Model_refContext,0)
def classname(self):
return self.getTypedRuleContext(ZmeiLangParser.ClassnameContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_stream_target_model
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_stream_target_model" ):
listener.enterAn_stream_target_model(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_stream_target_model" ):
listener.exitAn_stream_target_model(self)
def an_stream_target_model(self):
localctx = ZmeiLangParser.An_stream_target_modelContext(self, self._ctx, self.state)
self.enterRule(localctx, 414, self.RULE_an_stream_target_model)
try:
self.state = 2082
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.HASH]:
self.enterOuterAlt(localctx, 1)
self.state = 2080
self.model_ref()
pass
elif token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID]:
self.enterOuterAlt(localctx, 2)
self.state = 2081
self.classname()
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_stream_target_filterContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def code_block(self):
return self.getTypedRuleContext(ZmeiLangParser.Code_blockContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_stream_target_filter
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_stream_target_filter" ):
listener.enterAn_stream_target_filter(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_stream_target_filter" ):
listener.exitAn_stream_target_filter(self)
def an_stream_target_filter(self):
localctx = ZmeiLangParser.An_stream_target_filterContext(self, self._ctx, self.state)
self.enterRule(localctx, 416, self.RULE_an_stream_target_filter)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2084
self.code_block()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_stream_field_listContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def EQUALS(self):
return self.getToken(ZmeiLangParser.EQUALS, 0)
def GT(self):
return self.getToken(ZmeiLangParser.GT, 0)
def STAR(self):
return self.getToken(ZmeiLangParser.STAR, 0)
def an_stream_field_name(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_stream_field_nameContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_stream_field_nameContext,i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_stream_field_list
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_stream_field_list" ):
listener.enterAn_stream_field_list(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_stream_field_list" ):
listener.exitAn_stream_field_list(self)
def an_stream_field_list(self):
localctx = ZmeiLangParser.An_stream_field_listContext(self, self._ctx, self.state)
self.enterRule(localctx, 418, self.RULE_an_stream_field_list)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2086
self.match(ZmeiLangParser.EQUALS)
self.state = 2087
self.match(ZmeiLangParser.GT)
self.state = 2097
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.STAR]:
self.state = 2088
self.match(ZmeiLangParser.STAR)
pass
elif token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID]:
self.state = 2089
self.an_stream_field_name()
self.state = 2094
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,213,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 2090
self.match(ZmeiLangParser.COMA)
self.state = 2091
self.an_stream_field_name()
self.state = 2096
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,213,self._ctx)
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_stream_field_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_stream_field_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_stream_field_name" ):
listener.enterAn_stream_field_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_stream_field_name" ):
listener.exitAn_stream_field_name(self)
def an_stream_field_name(self):
localctx = ZmeiLangParser.An_stream_field_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 420, self.RULE_an_stream_field_name)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2099
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_reactContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def an_react_type(self):
return self.getTypedRuleContext(ZmeiLangParser.An_react_typeContext,0)
def DOT(self):
return self.getToken(ZmeiLangParser.DOT, 0)
def an_react_descriptor(self):
return self.getTypedRuleContext(ZmeiLangParser.An_react_descriptorContext,0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def an_react_child(self):
return self.getTypedRuleContext(ZmeiLangParser.An_react_childContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_react
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_react" ):
listener.enterAn_react(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_react" ):
listener.exitAn_react(self)
def an_react(self):
localctx = ZmeiLangParser.An_reactContext(self, self._ctx, self.state)
self.enterRule(localctx, 422, self.RULE_an_react)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2101
self.an_react_type()
self.state = 2104
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.DOT:
self.state = 2102
self.match(ZmeiLangParser.DOT)
self.state = 2103
self.an_react_descriptor()
self.state = 2111
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.BRACE_OPEN:
self.state = 2106
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 2108
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.KW_CHILD:
self.state = 2107
self.an_react_child()
self.state = 2110
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_react_typeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_REACT(self):
return self.getToken(ZmeiLangParser.AN_REACT, 0)
def AN_REACT_CLIENT(self):
return self.getToken(ZmeiLangParser.AN_REACT_CLIENT, 0)
def AN_REACT_SERVER(self):
return self.getToken(ZmeiLangParser.AN_REACT_SERVER, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_react_type
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_react_type" ):
listener.enterAn_react_type(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_react_type" ):
listener.exitAn_react_type(self)
def an_react_type(self):
localctx = ZmeiLangParser.An_react_typeContext(self, self._ctx, self.state)
self.enterRule(localctx, 424, self.RULE_an_react_type)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2113
_la = self._input.LA(1)
if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << ZmeiLangParser.AN_REACT) | (1 << ZmeiLangParser.AN_REACT_CLIENT) | (1 << ZmeiLangParser.AN_REACT_SERVER))) != 0)):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_react_descriptorContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_react_descriptor
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_react_descriptor" ):
listener.enterAn_react_descriptor(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_react_descriptor" ):
listener.exitAn_react_descriptor(self)
def an_react_descriptor(self):
localctx = ZmeiLangParser.An_react_descriptorContext(self, self._ctx, self.state)
self.enterRule(localctx, 426, self.RULE_an_react_descriptor)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2115
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_react_childContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_CHILD(self):
return self.getToken(ZmeiLangParser.KW_CHILD, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def BOOL(self):
return self.getToken(ZmeiLangParser.BOOL, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_react_child
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_react_child" ):
listener.enterAn_react_child(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_react_child" ):
listener.exitAn_react_child(self)
def an_react_child(self):
localctx = ZmeiLangParser.An_react_childContext(self, self._ctx, self.state)
self.enterRule(localctx, 428, self.RULE_an_react_child)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2117
self.match(ZmeiLangParser.KW_CHILD)
self.state = 2118
self.match(ZmeiLangParser.COLON)
self.state = 2119
self.match(ZmeiLangParser.BOOL)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_htmlContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_HTML(self):
return self.getToken(ZmeiLangParser.AN_HTML, 0)
def code_block(self):
return self.getTypedRuleContext(ZmeiLangParser.Code_blockContext,0)
def DOT(self):
return self.getToken(ZmeiLangParser.DOT, 0)
def an_html_descriptor(self):
return self.getTypedRuleContext(ZmeiLangParser.An_html_descriptorContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_html
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_html" ):
listener.enterAn_html(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_html" ):
listener.exitAn_html(self)
def an_html(self):
localctx = ZmeiLangParser.An_htmlContext(self, self._ctx, self.state)
self.enterRule(localctx, 430, self.RULE_an_html)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2121
self.match(ZmeiLangParser.AN_HTML)
self.state = 2124
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.DOT:
self.state = 2122
self.match(ZmeiLangParser.DOT)
self.state = 2123
self.an_html_descriptor()
self.state = 2126
self.code_block()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_html_descriptorContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_html_descriptor
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_html_descriptor" ):
listener.enterAn_html_descriptor(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_html_descriptor" ):
listener.exitAn_html_descriptor(self)
def an_html_descriptor(self):
localctx = ZmeiLangParser.An_html_descriptorContext(self, self._ctx, self.state)
self.enterRule(localctx, 432, self.RULE_an_html_descriptor)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2128
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_markdownContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_MARKDOWN(self):
return self.getToken(ZmeiLangParser.AN_MARKDOWN, 0)
def code_block(self):
return self.getTypedRuleContext(ZmeiLangParser.Code_blockContext,0)
def DOT(self):
return self.getToken(ZmeiLangParser.DOT, 0)
def an_markdown_descriptor(self):
return self.getTypedRuleContext(ZmeiLangParser.An_markdown_descriptorContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_markdown
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_markdown" ):
listener.enterAn_markdown(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_markdown" ):
listener.exitAn_markdown(self)
def an_markdown(self):
localctx = ZmeiLangParser.An_markdownContext(self, self._ctx, self.state)
self.enterRule(localctx, 434, self.RULE_an_markdown)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2130
self.match(ZmeiLangParser.AN_MARKDOWN)
self.state = 2133
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.DOT:
self.state = 2131
self.match(ZmeiLangParser.DOT)
self.state = 2132
self.an_markdown_descriptor()
self.state = 2135
self.code_block()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_markdown_descriptorContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_markdown_descriptor
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_markdown_descriptor" ):
listener.enterAn_markdown_descriptor(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_markdown_descriptor" ):
listener.exitAn_markdown_descriptor(self)
def an_markdown_descriptor(self):
localctx = ZmeiLangParser.An_markdown_descriptorContext(self, self._ctx, self.state)
self.enterRule(localctx, 436, self.RULE_an_markdown_descriptor)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2137
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_deleteContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_CRUD_DELETE(self):
return self.getToken(ZmeiLangParser.AN_CRUD_DELETE, 0)
def an_crud_params(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_paramsContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_delete
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_delete" ):
listener.enterAn_crud_delete(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_delete" ):
listener.exitAn_crud_delete(self)
def an_crud_delete(self):
localctx = ZmeiLangParser.An_crud_deleteContext(self, self._ctx, self.state)
self.enterRule(localctx, 438, self.RULE_an_crud_delete)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2139
self.match(ZmeiLangParser.AN_CRUD_DELETE)
self.state = 2140
self.an_crud_params()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crudContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_CRUD(self):
return self.getToken(ZmeiLangParser.AN_CRUD, 0)
def an_crud_params(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_paramsContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud" ):
listener.enterAn_crud(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud" ):
listener.exitAn_crud(self)
def an_crud(self):
localctx = ZmeiLangParser.An_crudContext(self, self._ctx, self.state)
self.enterRule(localctx, 440, self.RULE_an_crud)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2142
self.match(ZmeiLangParser.AN_CRUD)
self.state = 2143
self.an_crud_params()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_paramsContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def an_crud_target_model(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_target_modelContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def DOT(self):
return self.getToken(ZmeiLangParser.DOT, 0)
def an_crud_descriptor(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_descriptorContext,0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def an_crud_target_filter(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_target_filterContext,0)
def an_crud_theme(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_crud_themeContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_crud_themeContext,i)
def an_crud_skip(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_crud_skipContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_crud_skipContext,i)
def an_crud_fields(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_crud_fieldsContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_crud_fieldsContext,i)
def an_crud_list_fields(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_crud_list_fieldsContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_crud_list_fieldsContext,i)
def an_crud_pk_param(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_crud_pk_paramContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_crud_pk_paramContext,i)
def an_crud_item_name(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_crud_item_nameContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_crud_item_nameContext,i)
def an_crud_block(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_crud_blockContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_crud_blockContext,i)
def an_crud_object_expr(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_crud_object_exprContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_crud_object_exprContext,i)
def an_crud_can_edit(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_crud_can_editContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_crud_can_editContext,i)
def an_crud_url_prefix(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_crud_url_prefixContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_crud_url_prefixContext,i)
def an_crud_link_suffix(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_crud_link_suffixContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_crud_link_suffixContext,i)
def an_crud_list_type(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_crud_list_typeContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_crud_list_typeContext,i)
def an_crud_header(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_crud_headerContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_crud_headerContext,i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def an_crud_next_page(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_next_pageContext,0)
def an_crud_next_page_url(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_next_page_urlContext,0)
def an_crud_page_override(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_crud_page_overrideContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_crud_page_overrideContext,i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_params
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_params" ):
listener.enterAn_crud_params(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_params" ):
listener.exitAn_crud_params(self)
def an_crud_params(self):
localctx = ZmeiLangParser.An_crud_paramsContext(self, self._ctx, self.state)
self.enterRule(localctx, 442, self.RULE_an_crud_params)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2147
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.DOT:
self.state = 2145
self.match(ZmeiLangParser.DOT)
self.state = 2146
self.an_crud_descriptor()
self.state = 2149
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 2153
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.NL:
self.state = 2150
self.match(ZmeiLangParser.NL)
self.state = 2155
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 2156
self.an_crud_target_model()
self.state = 2158
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.CODE_BLOCK:
self.state = 2157
self.an_crud_target_filter()
self.state = 2177
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,224,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 2175
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.KW_THEME]:
self.state = 2160
self.an_crud_theme()
pass
elif token in [ZmeiLangParser.KW_SKIP]:
self.state = 2161
self.an_crud_skip()
pass
elif token in [ZmeiLangParser.KW_FIELDS]:
self.state = 2162
self.an_crud_fields()
pass
elif token in [ZmeiLangParser.KW_LIST_FIELDS]:
self.state = 2163
self.an_crud_list_fields()
pass
elif token in [ZmeiLangParser.KW_PK_PARAM]:
self.state = 2164
self.an_crud_pk_param()
pass
elif token in [ZmeiLangParser.KW_ITEM_NAME]:
self.state = 2165
self.an_crud_item_name()
pass
elif token in [ZmeiLangParser.KW_BLOCK]:
self.state = 2166
self.an_crud_block()
pass
elif token in [ZmeiLangParser.KW_OBJECT_EXPR]:
self.state = 2167
self.an_crud_object_expr()
pass
elif token in [ZmeiLangParser.KW_CAN_EDIT]:
self.state = 2168
self.an_crud_can_edit()
pass
elif token in [ZmeiLangParser.KW_URL_PREFIX]:
self.state = 2169
self.an_crud_url_prefix()
pass
elif token in [ZmeiLangParser.KW_LINK_SUFFIX]:
self.state = 2170
self.an_crud_link_suffix()
pass
elif token in [ZmeiLangParser.KW_LIST]:
self.state = 2171
self.an_crud_list_type()
pass
elif token in [ZmeiLangParser.KW_HEADER]:
self.state = 2172
self.an_crud_header()
pass
elif token in [ZmeiLangParser.NL]:
self.state = 2173
self.match(ZmeiLangParser.NL)
pass
elif token in [ZmeiLangParser.COMA]:
self.state = 2174
self.match(ZmeiLangParser.COMA)
pass
else:
raise NoViableAltException(self)
self.state = 2179
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,224,self._ctx)
self.state = 2183
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,225,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 2180
self.match(ZmeiLangParser.NL)
self.state = 2185
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,225,self._ctx)
self.state = 2188
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,226,self._ctx)
if la_ == 1:
self.state = 2186
self.an_crud_next_page()
elif la_ == 2:
self.state = 2187
self.an_crud_next_page_url()
self.state = 2193
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,227,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 2190
self.match(ZmeiLangParser.NL)
self.state = 2195
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,227,self._ctx)
self.state = 2199
self._errHandler.sync(self)
_la = self._input.LA(1)
while ((((_la - 85)) & ~0x3f) == 0 and ((1 << (_la - 85)) & ((1 << (ZmeiLangParser.KW_DELETE - 85)) | (1 << (ZmeiLangParser.KW_EDIT - 85)) | (1 << (ZmeiLangParser.KW_CREATE - 85)) | (1 << (ZmeiLangParser.KW_DETAIL - 85)) | (1 << (ZmeiLangParser.KW_LIST - 85)))) != 0):
self.state = 2196
self.an_crud_page_override()
self.state = 2201
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 2205
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.NL:
self.state = 2202
self.match(ZmeiLangParser.NL)
self.state = 2207
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 2208
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_page_overrideContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def an_crud_view_name(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_view_nameContext,0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def page_body(self):
return self.getTypedRuleContext(ZmeiLangParser.Page_bodyContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_page_override
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_page_override" ):
listener.enterAn_crud_page_override(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_page_override" ):
listener.exitAn_crud_page_override(self)
def an_crud_page_override(self):
localctx = ZmeiLangParser.An_crud_page_overrideContext(self, self._ctx, self.state)
self.enterRule(localctx, 444, self.RULE_an_crud_page_override)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2210
self.an_crud_view_name()
self.state = 2214
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.NL:
self.state = 2211
self.match(ZmeiLangParser.NL)
self.state = 2216
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 2217
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 2221
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,231,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 2218
self.match(ZmeiLangParser.NL)
self.state = 2223
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,231,self._ctx)
self.state = 2224
self.page_body()
self.state = 2228
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.NL:
self.state = 2225
self.match(ZmeiLangParser.NL)
self.state = 2230
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 2231
self.match(ZmeiLangParser.BRACE_CLOSE)
self.state = 2235
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,233,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 2232
self.match(ZmeiLangParser.NL)
self.state = 2237
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,233,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_descriptorContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_descriptor
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_descriptor" ):
listener.enterAn_crud_descriptor(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_descriptor" ):
listener.exitAn_crud_descriptor(self)
def an_crud_descriptor(self):
localctx = ZmeiLangParser.An_crud_descriptorContext(self, self._ctx, self.state)
self.enterRule(localctx, 446, self.RULE_an_crud_descriptor)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2238
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_next_pageContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def EQUALS(self):
return self.getToken(ZmeiLangParser.EQUALS, 0)
def GT(self):
return self.getToken(ZmeiLangParser.GT, 0)
def code_block(self):
return self.getTypedRuleContext(ZmeiLangParser.Code_blockContext,0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def an_crud_next_page_event_name(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_next_page_event_nameContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_next_page
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_next_page" ):
listener.enterAn_crud_next_page(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_next_page" ):
listener.exitAn_crud_next_page(self)
def an_crud_next_page(self):
localctx = ZmeiLangParser.An_crud_next_pageContext(self, self._ctx, self.state)
self.enterRule(localctx, 448, self.RULE_an_crud_next_page)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2244
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.BRACE_OPEN:
self.state = 2240
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 2241
self.an_crud_next_page_event_name()
self.state = 2242
self.match(ZmeiLangParser.BRACE_CLOSE)
self.state = 2246
self.match(ZmeiLangParser.EQUALS)
self.state = 2247
self.match(ZmeiLangParser.GT)
self.state = 2248
self.code_block()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_next_page_event_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_DELETE(self):
return self.getToken(ZmeiLangParser.KW_DELETE, 0)
def KW_CREATE(self):
return self.getToken(ZmeiLangParser.KW_CREATE, 0)
def KW_EDIT(self):
return self.getToken(ZmeiLangParser.KW_EDIT, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_next_page_event_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_next_page_event_name" ):
listener.enterAn_crud_next_page_event_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_next_page_event_name" ):
listener.exitAn_crud_next_page_event_name(self)
def an_crud_next_page_event_name(self):
localctx = ZmeiLangParser.An_crud_next_page_event_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 450, self.RULE_an_crud_next_page_event_name)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2250
_la = self._input.LA(1)
if not(((((_la - 85)) & ~0x3f) == 0 and ((1 << (_la - 85)) & ((1 << (ZmeiLangParser.KW_DELETE - 85)) | (1 << (ZmeiLangParser.KW_EDIT - 85)) | (1 << (ZmeiLangParser.KW_CREATE - 85)))) != 0)):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_next_page_urlContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def EQUALS(self):
return self.getToken(ZmeiLangParser.EQUALS, 0)
def GT(self):
return self.getToken(ZmeiLangParser.GT, 0)
def an_crud_next_page_url_val(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_next_page_url_valContext,0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def an_crud_next_page_event_name(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_next_page_event_nameContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_next_page_url
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_next_page_url" ):
listener.enterAn_crud_next_page_url(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_next_page_url" ):
listener.exitAn_crud_next_page_url(self)
def an_crud_next_page_url(self):
localctx = ZmeiLangParser.An_crud_next_page_urlContext(self, self._ctx, self.state)
self.enterRule(localctx, 452, self.RULE_an_crud_next_page_url)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2256
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.BRACE_OPEN:
self.state = 2252
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 2253
self.an_crud_next_page_event_name()
self.state = 2254
self.match(ZmeiLangParser.BRACE_CLOSE)
self.state = 2258
self.match(ZmeiLangParser.EQUALS)
self.state = 2259
self.match(ZmeiLangParser.GT)
self.state = 2260
self.an_crud_next_page_url_val()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_next_page_url_valContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def STRING_DQ(self):
return self.getToken(ZmeiLangParser.STRING_DQ, 0)
def STRING_SQ(self):
return self.getToken(ZmeiLangParser.STRING_SQ, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_next_page_url_val
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_next_page_url_val" ):
listener.enterAn_crud_next_page_url_val(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_next_page_url_val" ):
listener.exitAn_crud_next_page_url_val(self)
def an_crud_next_page_url_val(self):
localctx = ZmeiLangParser.An_crud_next_page_url_valContext(self, self._ctx, self.state)
self.enterRule(localctx, 454, self.RULE_an_crud_next_page_url_val)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2262
_la = self._input.LA(1)
if not(_la==ZmeiLangParser.STRING_DQ or _la==ZmeiLangParser.STRING_SQ):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_target_modelContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def model_ref(self):
return self.getTypedRuleContext(ZmeiLangParser.Model_refContext,0)
def classname(self):
return self.getTypedRuleContext(ZmeiLangParser.ClassnameContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_target_model
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_target_model" ):
listener.enterAn_crud_target_model(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_target_model" ):
listener.exitAn_crud_target_model(self)
def an_crud_target_model(self):
localctx = ZmeiLangParser.An_crud_target_modelContext(self, self._ctx, self.state)
self.enterRule(localctx, 456, self.RULE_an_crud_target_model)
try:
self.state = 2266
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.HASH]:
self.enterOuterAlt(localctx, 1)
self.state = 2264
self.model_ref()
pass
elif token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID]:
self.enterOuterAlt(localctx, 2)
self.state = 2265
self.classname()
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_target_filterContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def code_block(self):
return self.getTypedRuleContext(ZmeiLangParser.Code_blockContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_target_filter
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_target_filter" ):
listener.enterAn_crud_target_filter(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_target_filter" ):
listener.exitAn_crud_target_filter(self)
def an_crud_target_filter(self):
localctx = ZmeiLangParser.An_crud_target_filterContext(self, self._ctx, self.state)
self.enterRule(localctx, 458, self.RULE_an_crud_target_filter)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2268
self.code_block()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_themeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_THEME(self):
return self.getToken(ZmeiLangParser.KW_THEME, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_theme
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_theme" ):
listener.enterAn_crud_theme(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_theme" ):
listener.exitAn_crud_theme(self)
def an_crud_theme(self):
localctx = ZmeiLangParser.An_crud_themeContext(self, self._ctx, self.state)
self.enterRule(localctx, 460, self.RULE_an_crud_theme)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2270
self.match(ZmeiLangParser.KW_THEME)
self.state = 2271
self.match(ZmeiLangParser.COLON)
self.state = 2272
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_url_prefixContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_URL_PREFIX(self):
return self.getToken(ZmeiLangParser.KW_URL_PREFIX, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def an_crud_url_prefix_val(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_url_prefix_valContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_url_prefix
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_url_prefix" ):
listener.enterAn_crud_url_prefix(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_url_prefix" ):
listener.exitAn_crud_url_prefix(self)
def an_crud_url_prefix(self):
localctx = ZmeiLangParser.An_crud_url_prefixContext(self, self._ctx, self.state)
self.enterRule(localctx, 462, self.RULE_an_crud_url_prefix)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2274
self.match(ZmeiLangParser.KW_URL_PREFIX)
self.state = 2275
self.match(ZmeiLangParser.COLON)
self.state = 2276
self.an_crud_url_prefix_val()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_url_prefix_valContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def STRING_DQ(self):
return self.getToken(ZmeiLangParser.STRING_DQ, 0)
def STRING_SQ(self):
return self.getToken(ZmeiLangParser.STRING_SQ, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_url_prefix_val
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_url_prefix_val" ):
listener.enterAn_crud_url_prefix_val(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_url_prefix_val" ):
listener.exitAn_crud_url_prefix_val(self)
def an_crud_url_prefix_val(self):
localctx = ZmeiLangParser.An_crud_url_prefix_valContext(self, self._ctx, self.state)
self.enterRule(localctx, 464, self.RULE_an_crud_url_prefix_val)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2278
_la = self._input.LA(1)
if not(_la==ZmeiLangParser.STRING_DQ or _la==ZmeiLangParser.STRING_SQ):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_link_suffixContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_LINK_SUFFIX(self):
return self.getToken(ZmeiLangParser.KW_LINK_SUFFIX, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def an_crud_link_suffix_val(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_link_suffix_valContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_link_suffix
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_link_suffix" ):
listener.enterAn_crud_link_suffix(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_link_suffix" ):
listener.exitAn_crud_link_suffix(self)
def an_crud_link_suffix(self):
localctx = ZmeiLangParser.An_crud_link_suffixContext(self, self._ctx, self.state)
self.enterRule(localctx, 466, self.RULE_an_crud_link_suffix)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2280
self.match(ZmeiLangParser.KW_LINK_SUFFIX)
self.state = 2281
self.match(ZmeiLangParser.COLON)
self.state = 2282
self.an_crud_link_suffix_val()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_link_suffix_valContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def STRING_DQ(self):
return self.getToken(ZmeiLangParser.STRING_DQ, 0)
def STRING_SQ(self):
return self.getToken(ZmeiLangParser.STRING_SQ, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_link_suffix_val
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_link_suffix_val" ):
listener.enterAn_crud_link_suffix_val(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_link_suffix_val" ):
listener.exitAn_crud_link_suffix_val(self)
def an_crud_link_suffix_val(self):
localctx = ZmeiLangParser.An_crud_link_suffix_valContext(self, self._ctx, self.state)
self.enterRule(localctx, 468, self.RULE_an_crud_link_suffix_val)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2284
_la = self._input.LA(1)
if not(_la==ZmeiLangParser.STRING_DQ or _la==ZmeiLangParser.STRING_SQ):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_item_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_ITEM_NAME(self):
return self.getToken(ZmeiLangParser.KW_ITEM_NAME, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_item_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_item_name" ):
listener.enterAn_crud_item_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_item_name" ):
listener.exitAn_crud_item_name(self)
def an_crud_item_name(self):
localctx = ZmeiLangParser.An_crud_item_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 470, self.RULE_an_crud_item_name)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2286
self.match(ZmeiLangParser.KW_ITEM_NAME)
self.state = 2287
self.match(ZmeiLangParser.COLON)
self.state = 2288
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_object_exprContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_OBJECT_EXPR(self):
return self.getToken(ZmeiLangParser.KW_OBJECT_EXPR, 0)
def code_line(self):
return self.getTypedRuleContext(ZmeiLangParser.Code_lineContext,0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def code_block(self):
return self.getTypedRuleContext(ZmeiLangParser.Code_blockContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_object_expr
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_object_expr" ):
listener.enterAn_crud_object_expr(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_object_expr" ):
listener.exitAn_crud_object_expr(self)
def an_crud_object_expr(self):
localctx = ZmeiLangParser.An_crud_object_exprContext(self, self._ctx, self.state)
self.enterRule(localctx, 472, self.RULE_an_crud_object_expr)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2290
self.match(ZmeiLangParser.KW_OBJECT_EXPR)
self.state = 2294
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.ASSIGN]:
self.state = 2291
self.code_line()
pass
elif token in [ZmeiLangParser.COLON]:
self.state = 2292
self.match(ZmeiLangParser.COLON)
self.state = 2293
self.code_block()
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_can_editContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_CAN_EDIT(self):
return self.getToken(ZmeiLangParser.KW_CAN_EDIT, 0)
def code_line(self):
return self.getTypedRuleContext(ZmeiLangParser.Code_lineContext,0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def code_block(self):
return self.getTypedRuleContext(ZmeiLangParser.Code_blockContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_can_edit
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_can_edit" ):
listener.enterAn_crud_can_edit(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_can_edit" ):
listener.exitAn_crud_can_edit(self)
def an_crud_can_edit(self):
localctx = ZmeiLangParser.An_crud_can_editContext(self, self._ctx, self.state)
self.enterRule(localctx, 474, self.RULE_an_crud_can_edit)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2296
self.match(ZmeiLangParser.KW_CAN_EDIT)
self.state = 2300
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.ASSIGN]:
self.state = 2297
self.code_line()
pass
elif token in [ZmeiLangParser.COLON]:
self.state = 2298
self.match(ZmeiLangParser.COLON)
self.state = 2299
self.code_block()
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_blockContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_BLOCK(self):
return self.getToken(ZmeiLangParser.KW_BLOCK, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_block
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_block" ):
listener.enterAn_crud_block(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_block" ):
listener.exitAn_crud_block(self)
def an_crud_block(self):
localctx = ZmeiLangParser.An_crud_blockContext(self, self._ctx, self.state)
self.enterRule(localctx, 476, self.RULE_an_crud_block)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2302
self.match(ZmeiLangParser.KW_BLOCK)
self.state = 2303
self.match(ZmeiLangParser.COLON)
self.state = 2304
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_pk_paramContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_PK_PARAM(self):
return self.getToken(ZmeiLangParser.KW_PK_PARAM, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_pk_param
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_pk_param" ):
listener.enterAn_crud_pk_param(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_pk_param" ):
listener.exitAn_crud_pk_param(self)
def an_crud_pk_param(self):
localctx = ZmeiLangParser.An_crud_pk_paramContext(self, self._ctx, self.state)
self.enterRule(localctx, 478, self.RULE_an_crud_pk_param)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2306
self.match(ZmeiLangParser.KW_PK_PARAM)
self.state = 2307
self.match(ZmeiLangParser.COLON)
self.state = 2308
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_skipContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_SKIP(self):
return self.getToken(ZmeiLangParser.KW_SKIP, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def an_crud_skip_values(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_skip_valuesContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_skip
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_skip" ):
listener.enterAn_crud_skip(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_skip" ):
listener.exitAn_crud_skip(self)
def an_crud_skip(self):
localctx = ZmeiLangParser.An_crud_skipContext(self, self._ctx, self.state)
self.enterRule(localctx, 480, self.RULE_an_crud_skip)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2310
self.match(ZmeiLangParser.KW_SKIP)
self.state = 2311
self.match(ZmeiLangParser.COLON)
self.state = 2312
self.an_crud_skip_values()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_skip_valuesContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def an_crud_view_name(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_crud_view_nameContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_crud_view_nameContext,i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_skip_values
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_skip_values" ):
listener.enterAn_crud_skip_values(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_skip_values" ):
listener.exitAn_crud_skip_values(self)
def an_crud_skip_values(self):
localctx = ZmeiLangParser.An_crud_skip_valuesContext(self, self._ctx, self.state)
self.enterRule(localctx, 482, self.RULE_an_crud_skip_values)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2314
self.an_crud_view_name()
self.state = 2319
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,239,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 2315
self.match(ZmeiLangParser.COMA)
self.state = 2316
self.an_crud_view_name()
self.state = 2321
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,239,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_view_nameContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_DELETE(self):
return self.getToken(ZmeiLangParser.KW_DELETE, 0)
def KW_LIST(self):
return self.getToken(ZmeiLangParser.KW_LIST, 0)
def KW_CREATE(self):
return self.getToken(ZmeiLangParser.KW_CREATE, 0)
def KW_EDIT(self):
return self.getToken(ZmeiLangParser.KW_EDIT, 0)
def KW_DETAIL(self):
return self.getToken(ZmeiLangParser.KW_DETAIL, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_view_name
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_view_name" ):
listener.enterAn_crud_view_name(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_view_name" ):
listener.exitAn_crud_view_name(self)
def an_crud_view_name(self):
localctx = ZmeiLangParser.An_crud_view_nameContext(self, self._ctx, self.state)
self.enterRule(localctx, 484, self.RULE_an_crud_view_name)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2322
_la = self._input.LA(1)
if not(((((_la - 85)) & ~0x3f) == 0 and ((1 << (_la - 85)) & ((1 << (ZmeiLangParser.KW_DELETE - 85)) | (1 << (ZmeiLangParser.KW_EDIT - 85)) | (1 << (ZmeiLangParser.KW_CREATE - 85)) | (1 << (ZmeiLangParser.KW_DETAIL - 85)) | (1 << (ZmeiLangParser.KW_LIST - 85)))) != 0)):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_fieldsContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_FIELDS(self):
return self.getToken(ZmeiLangParser.KW_FIELDS, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def an_crud_fields_expr(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_fields_exprContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_fields
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_fields" ):
listener.enterAn_crud_fields(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_fields" ):
listener.exitAn_crud_fields(self)
def an_crud_fields(self):
localctx = ZmeiLangParser.An_crud_fieldsContext(self, self._ctx, self.state)
self.enterRule(localctx, 486, self.RULE_an_crud_fields)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2324
self.match(ZmeiLangParser.KW_FIELDS)
self.state = 2325
self.match(ZmeiLangParser.COLON)
self.state = 2326
self.an_crud_fields_expr()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_list_typeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_LIST(self):
return self.getToken(ZmeiLangParser.KW_LIST, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def an_crud_list_type_var(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_list_type_varContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_list_type
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_list_type" ):
listener.enterAn_crud_list_type(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_list_type" ):
listener.exitAn_crud_list_type(self)
def an_crud_list_type(self):
localctx = ZmeiLangParser.An_crud_list_typeContext(self, self._ctx, self.state)
self.enterRule(localctx, 488, self.RULE_an_crud_list_type)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2328
self.match(ZmeiLangParser.KW_LIST)
self.state = 2329
self.match(ZmeiLangParser.COLON)
self.state = 2330
self.an_crud_list_type_var()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_list_type_varContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_INLINE_TYPE_TABULAR(self):
return self.getToken(ZmeiLangParser.KW_INLINE_TYPE_TABULAR, 0)
def KW_INLINE_TYPE_STACKED(self):
return self.getToken(ZmeiLangParser.KW_INLINE_TYPE_STACKED, 0)
def KW_INLINE_TYPE_POLYMORPHIC(self):
return self.getToken(ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_list_type_var
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_list_type_var" ):
listener.enterAn_crud_list_type_var(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_list_type_var" ):
listener.exitAn_crud_list_type_var(self)
def an_crud_list_type_var(self):
localctx = ZmeiLangParser.An_crud_list_type_varContext(self, self._ctx, self.state)
self.enterRule(localctx, 490, self.RULE_an_crud_list_type_var)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2332
_la = self._input.LA(1)
if not(((((_la - 94)) & ~0x3f) == 0 and ((1 << (_la - 94)) & ((1 << (ZmeiLangParser.KW_INLINE_TYPE_TABULAR - 94)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_STACKED - 94)) | (1 << (ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC - 94)))) != 0)):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_headerContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_HEADER(self):
return self.getToken(ZmeiLangParser.KW_HEADER, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def an_crud_header_enabled(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_header_enabledContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_header
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_header" ):
listener.enterAn_crud_header(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_header" ):
listener.exitAn_crud_header(self)
def an_crud_header(self):
localctx = ZmeiLangParser.An_crud_headerContext(self, self._ctx, self.state)
self.enterRule(localctx, 492, self.RULE_an_crud_header)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2334
self.match(ZmeiLangParser.KW_HEADER)
self.state = 2335
self.match(ZmeiLangParser.COLON)
self.state = 2336
self.an_crud_header_enabled()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_header_enabledContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def BOOL(self):
return self.getToken(ZmeiLangParser.BOOL, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_header_enabled
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_header_enabled" ):
listener.enterAn_crud_header_enabled(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_header_enabled" ):
listener.exitAn_crud_header_enabled(self)
def an_crud_header_enabled(self):
localctx = ZmeiLangParser.An_crud_header_enabledContext(self, self._ctx, self.state)
self.enterRule(localctx, 494, self.RULE_an_crud_header_enabled)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2338
self.match(ZmeiLangParser.BOOL)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_fields_exprContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def an_crud_field(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_crud_fieldContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_crud_fieldContext,i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_fields_expr
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_fields_expr" ):
listener.enterAn_crud_fields_expr(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_fields_expr" ):
listener.exitAn_crud_fields_expr(self)
def an_crud_fields_expr(self):
localctx = ZmeiLangParser.An_crud_fields_exprContext(self, self._ctx, self.state)
self.enterRule(localctx, 496, self.RULE_an_crud_fields_expr)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2340
self.an_crud_field()
self.state = 2345
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,240,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 2341
self.match(ZmeiLangParser.COMA)
self.state = 2342
self.an_crud_field()
self.state = 2347
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,240,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_fieldContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def an_crud_field_spec(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_field_specContext,0)
def an_crud_field_filter(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_field_filterContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_field
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_field" ):
listener.enterAn_crud_field(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_field" ):
listener.exitAn_crud_field(self)
def an_crud_field(self):
localctx = ZmeiLangParser.An_crud_fieldContext(self, self._ctx, self.state)
self.enterRule(localctx, 498, self.RULE_an_crud_field)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2348
self.an_crud_field_spec()
self.state = 2350
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.CODE_BLOCK:
self.state = 2349
self.an_crud_field_filter()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_field_specContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def STAR(self):
return self.getToken(ZmeiLangParser.STAR, 0)
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def EXCLUDE(self):
return self.getToken(ZmeiLangParser.EXCLUDE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_field_spec
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_field_spec" ):
listener.enterAn_crud_field_spec(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_field_spec" ):
listener.exitAn_crud_field_spec(self)
def an_crud_field_spec(self):
localctx = ZmeiLangParser.An_crud_field_specContext(self, self._ctx, self.state)
self.enterRule(localctx, 500, self.RULE_an_crud_field_spec)
self._la = 0 # Token type
try:
self.state = 2357
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.STAR]:
self.enterOuterAlt(localctx, 1)
self.state = 2352
self.match(ZmeiLangParser.STAR)
pass
elif token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID, ZmeiLangParser.EXCLUDE]:
self.enterOuterAlt(localctx, 2)
self.state = 2354
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.EXCLUDE:
self.state = 2353
self.match(ZmeiLangParser.EXCLUDE)
self.state = 2356
self.id_or_kw()
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_field_filterContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def code_block(self):
return self.getTypedRuleContext(ZmeiLangParser.Code_blockContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_field_filter
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_field_filter" ):
listener.enterAn_crud_field_filter(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_field_filter" ):
listener.exitAn_crud_field_filter(self)
def an_crud_field_filter(self):
localctx = ZmeiLangParser.An_crud_field_filterContext(self, self._ctx, self.state)
self.enterRule(localctx, 502, self.RULE_an_crud_field_filter)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2359
self.code_block()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_list_fieldsContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_LIST_FIELDS(self):
return self.getToken(ZmeiLangParser.KW_LIST_FIELDS, 0)
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def an_crud_list_fields_expr(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_list_fields_exprContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_list_fields
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_list_fields" ):
listener.enterAn_crud_list_fields(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_list_fields" ):
listener.exitAn_crud_list_fields(self)
def an_crud_list_fields(self):
localctx = ZmeiLangParser.An_crud_list_fieldsContext(self, self._ctx, self.state)
self.enterRule(localctx, 504, self.RULE_an_crud_list_fields)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2361
self.match(ZmeiLangParser.KW_LIST_FIELDS)
self.state = 2362
self.match(ZmeiLangParser.COLON)
self.state = 2363
self.an_crud_list_fields_expr()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_list_fields_exprContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def an_crud_list_field(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_crud_list_fieldContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_crud_list_fieldContext,i)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_list_fields_expr
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_list_fields_expr" ):
listener.enterAn_crud_list_fields_expr(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_list_fields_expr" ):
listener.exitAn_crud_list_fields_expr(self)
def an_crud_list_fields_expr(self):
localctx = ZmeiLangParser.An_crud_list_fields_exprContext(self, self._ctx, self.state)
self.enterRule(localctx, 506, self.RULE_an_crud_list_fields_expr)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2365
self.an_crud_list_field()
self.state = 2370
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,244,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 2366
self.match(ZmeiLangParser.COMA)
self.state = 2367
self.an_crud_list_field()
self.state = 2372
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,244,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_list_fieldContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def an_crud_list_field_spec(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_list_field_specContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_list_field
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_list_field" ):
listener.enterAn_crud_list_field(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_list_field" ):
listener.exitAn_crud_list_field(self)
def an_crud_list_field(self):
localctx = ZmeiLangParser.An_crud_list_fieldContext(self, self._ctx, self.state)
self.enterRule(localctx, 508, self.RULE_an_crud_list_field)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2373
self.an_crud_list_field_spec()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_list_field_specContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def STAR(self):
return self.getToken(ZmeiLangParser.STAR, 0)
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def EXCLUDE(self):
return self.getToken(ZmeiLangParser.EXCLUDE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_list_field_spec
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_list_field_spec" ):
listener.enterAn_crud_list_field_spec(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_list_field_spec" ):
listener.exitAn_crud_list_field_spec(self)
def an_crud_list_field_spec(self):
localctx = ZmeiLangParser.An_crud_list_field_specContext(self, self._ctx, self.state)
self.enterRule(localctx, 510, self.RULE_an_crud_list_field_spec)
self._la = 0 # Token type
try:
self.state = 2380
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.STAR]:
self.enterOuterAlt(localctx, 1)
self.state = 2375
self.match(ZmeiLangParser.STAR)
pass
elif token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID, ZmeiLangParser.EXCLUDE]:
self.enterOuterAlt(localctx, 2)
self.state = 2377
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.EXCLUDE:
self.state = 2376
self.match(ZmeiLangParser.EXCLUDE)
self.state = 2379
self.id_or_kw()
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_postContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_POST(self):
return self.getToken(ZmeiLangParser.AN_POST, 0)
def code_block(self):
return self.getTypedRuleContext(ZmeiLangParser.Code_blockContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_post
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_post" ):
listener.enterAn_post(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_post" ):
listener.exitAn_post(self)
def an_post(self):
localctx = ZmeiLangParser.An_postContext(self, self._ctx, self.state)
self.enterRule(localctx, 512, self.RULE_an_post)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2382
self.match(ZmeiLangParser.AN_POST)
self.state = 2384
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.CODE_BLOCK:
self.state = 2383
self.code_block()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_authContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_AUTH(self):
return self.getToken(ZmeiLangParser.AN_AUTH, 0)
def code_block(self):
return self.getTypedRuleContext(ZmeiLangParser.Code_blockContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_auth
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_auth" ):
listener.enterAn_auth(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_auth" ):
listener.exitAn_auth(self)
def an_auth(self):
localctx = ZmeiLangParser.An_authContext(self, self._ctx, self.state)
self.enterRule(localctx, 514, self.RULE_an_auth)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2386
self.match(ZmeiLangParser.AN_AUTH)
self.state = 2388
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.CODE_BLOCK:
self.state = 2387
self.code_block()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_createContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_CRUD_CREATE(self):
return self.getToken(ZmeiLangParser.AN_CRUD_CREATE, 0)
def an_crud_params(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_paramsContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_create
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_create" ):
listener.enterAn_crud_create(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_create" ):
listener.exitAn_crud_create(self)
def an_crud_create(self):
localctx = ZmeiLangParser.An_crud_createContext(self, self._ctx, self.state)
self.enterRule(localctx, 516, self.RULE_an_crud_create)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2390
self.match(ZmeiLangParser.AN_CRUD_CREATE)
self.state = 2391
self.an_crud_params()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_editContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_CRUD_EDIT(self):
return self.getToken(ZmeiLangParser.AN_CRUD_EDIT, 0)
def an_crud_params(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_paramsContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_edit
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_edit" ):
listener.enterAn_crud_edit(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_edit" ):
listener.exitAn_crud_edit(self)
def an_crud_edit(self):
localctx = ZmeiLangParser.An_crud_editContext(self, self._ctx, self.state)
self.enterRule(localctx, 518, self.RULE_an_crud_edit)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2393
self.match(ZmeiLangParser.AN_CRUD_EDIT)
self.state = 2394
self.an_crud_params()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_listContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_CRUD_LIST(self):
return self.getToken(ZmeiLangParser.AN_CRUD_LIST, 0)
def an_crud_params(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_paramsContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_list
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_list" ):
listener.enterAn_crud_list(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_list" ):
listener.exitAn_crud_list(self)
def an_crud_list(self):
localctx = ZmeiLangParser.An_crud_listContext(self, self._ctx, self.state)
self.enterRule(localctx, 520, self.RULE_an_crud_list)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2396
self.match(ZmeiLangParser.AN_CRUD_LIST)
self.state = 2397
self.an_crud_params()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_menuContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_MENU(self):
return self.getToken(ZmeiLangParser.AN_MENU, 0)
def DOT(self):
return self.getToken(ZmeiLangParser.DOT, 0)
def an_menu_descriptor(self):
return self.getTypedRuleContext(ZmeiLangParser.An_menu_descriptorContext,0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def an_menu_item(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_menu_itemContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_menu_itemContext,i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_menu
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_menu" ):
listener.enterAn_menu(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_menu" ):
listener.exitAn_menu(self)
def an_menu(self):
localctx = ZmeiLangParser.An_menuContext(self, self._ctx, self.state)
self.enterRule(localctx, 522, self.RULE_an_menu)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2399
self.match(ZmeiLangParser.AN_MENU)
self.state = 2400
self.match(ZmeiLangParser.DOT)
self.state = 2401
self.an_menu_descriptor()
self.state = 2402
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 2406
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,249,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 2403
self.match(ZmeiLangParser.NL)
self.state = 2408
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,249,self._ctx)
self.state = 2410
self._errHandler.sync(self)
_alt = 1
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt == 1:
self.state = 2409
self.an_menu_item()
else:
raise NoViableAltException(self)
self.state = 2412
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,250,self._ctx)
self.state = 2417
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.NL:
self.state = 2414
self.match(ZmeiLangParser.NL)
self.state = 2419
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 2420
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_menu_descriptorContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_menu_descriptor
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_menu_descriptor" ):
listener.enterAn_menu_descriptor(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_menu_descriptor" ):
listener.exitAn_menu_descriptor(self)
def an_menu_descriptor(self):
localctx = ZmeiLangParser.An_menu_descriptorContext(self, self._ctx, self.state)
self.enterRule(localctx, 524, self.RULE_an_menu_descriptor)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2422
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_menu_itemContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def an_menu_label(self):
return self.getTypedRuleContext(ZmeiLangParser.An_menu_labelContext,0)
def an_menu_item_code(self):
return self.getTypedRuleContext(ZmeiLangParser.An_menu_item_codeContext,0)
def an_menu_target(self):
return self.getTypedRuleContext(ZmeiLangParser.An_menu_targetContext,0)
def COMA(self):
return self.getToken(ZmeiLangParser.COMA, 0)
def NL(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.NL)
else:
return self.getToken(ZmeiLangParser.NL, i)
def an_menu_item_args(self):
return self.getTypedRuleContext(ZmeiLangParser.An_menu_item_argsContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_menu_item
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_menu_item" ):
listener.enterAn_menu_item(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_menu_item" ):
listener.exitAn_menu_item(self)
def an_menu_item(self):
localctx = ZmeiLangParser.An_menu_itemContext(self, self._ctx, self.state)
self.enterRule(localctx, 526, self.RULE_an_menu_item)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2425
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.COMA:
self.state = 2424
self.match(ZmeiLangParser.COMA)
self.state = 2430
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.NL:
self.state = 2427
self.match(ZmeiLangParser.NL)
self.state = 2432
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 2434
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.SQ_BRACE_OPEN:
self.state = 2433
self.an_menu_item_args()
self.state = 2436
self.an_menu_label()
self.state = 2439
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.ASSIGN]:
self.state = 2437
self.an_menu_item_code()
pass
elif token in [ZmeiLangParser.COLON]:
self.state = 2438
self.an_menu_target()
pass
else:
raise NoViableAltException(self)
self.state = 2444
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,256,self._ctx)
while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER:
if _alt==1:
self.state = 2441
self.match(ZmeiLangParser.NL)
self.state = 2446
self._errHandler.sync(self)
_alt = self._interp.adaptivePredict(self._input,256,self._ctx)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_menu_targetContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def COLON(self):
return self.getToken(ZmeiLangParser.COLON, 0)
def an_menu_item_page(self):
return self.getTypedRuleContext(ZmeiLangParser.An_menu_item_pageContext,0)
def an_menu_item_url(self):
return self.getTypedRuleContext(ZmeiLangParser.An_menu_item_urlContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_menu_target
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_menu_target" ):
listener.enterAn_menu_target(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_menu_target" ):
listener.exitAn_menu_target(self)
def an_menu_target(self):
localctx = ZmeiLangParser.An_menu_targetContext(self, self._ctx, self.state)
self.enterRule(localctx, 528, self.RULE_an_menu_target)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2447
self.match(ZmeiLangParser.COLON)
self.state = 2450
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.KW_PAGE]:
self.state = 2448
self.an_menu_item_page()
pass
elif token in [ZmeiLangParser.STRING_DQ, ZmeiLangParser.STRING_SQ]:
self.state = 2449
self.an_menu_item_url()
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_menu_item_codeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def code_line(self):
return self.getTypedRuleContext(ZmeiLangParser.Code_lineContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_menu_item_code
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_menu_item_code" ):
listener.enterAn_menu_item_code(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_menu_item_code" ):
listener.exitAn_menu_item_code(self)
def an_menu_item_code(self):
localctx = ZmeiLangParser.An_menu_item_codeContext(self, self._ctx, self.state)
self.enterRule(localctx, 530, self.RULE_an_menu_item_code)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2452
self.code_line()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_menu_item_argsContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def SQ_BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.SQ_BRACE_OPEN, 0)
def an_menu_item_arg(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.An_menu_item_argContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.An_menu_item_argContext,i)
def SQ_BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.SQ_BRACE_CLOSE, 0)
def COMA(self, i:int=None):
if i is None:
return self.getTokens(ZmeiLangParser.COMA)
else:
return self.getToken(ZmeiLangParser.COMA, i)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_menu_item_args
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_menu_item_args" ):
listener.enterAn_menu_item_args(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_menu_item_args" ):
listener.exitAn_menu_item_args(self)
def an_menu_item_args(self):
localctx = ZmeiLangParser.An_menu_item_argsContext(self, self._ctx, self.state)
self.enterRule(localctx, 532, self.RULE_an_menu_item_args)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2454
self.match(ZmeiLangParser.SQ_BRACE_OPEN)
self.state = 2455
self.an_menu_item_arg()
self.state = 2460
self._errHandler.sync(self)
_la = self._input.LA(1)
while _la==ZmeiLangParser.COMA:
self.state = 2456
self.match(ZmeiLangParser.COMA)
self.state = 2457
self.an_menu_item_arg()
self.state = 2462
self._errHandler.sync(self)
_la = self._input.LA(1)
self.state = 2463
self.match(ZmeiLangParser.SQ_BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_menu_item_argContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def an_menu_item_arg_key(self):
return self.getTypedRuleContext(ZmeiLangParser.An_menu_item_arg_keyContext,0)
def EQUALS(self):
return self.getToken(ZmeiLangParser.EQUALS, 0)
def an_menu_item_arg_val(self):
return self.getTypedRuleContext(ZmeiLangParser.An_menu_item_arg_valContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_menu_item_arg
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_menu_item_arg" ):
listener.enterAn_menu_item_arg(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_menu_item_arg" ):
listener.exitAn_menu_item_arg(self)
def an_menu_item_arg(self):
localctx = ZmeiLangParser.An_menu_item_argContext(self, self._ctx, self.state)
self.enterRule(localctx, 534, self.RULE_an_menu_item_arg)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2465
self.an_menu_item_arg_key()
self.state = 2466
self.match(ZmeiLangParser.EQUALS)
self.state = 2467
self.an_menu_item_arg_val()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_menu_item_arg_keyContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_menu_item_arg_key
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_menu_item_arg_key" ):
listener.enterAn_menu_item_arg_key(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_menu_item_arg_key" ):
listener.exitAn_menu_item_arg_key(self)
def an_menu_item_arg_key(self):
localctx = ZmeiLangParser.An_menu_item_arg_keyContext(self, self._ctx, self.state)
self.enterRule(localctx, 536, self.RULE_an_menu_item_arg_key)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2469
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_menu_item_arg_valContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def STRING_DQ(self):
return self.getToken(ZmeiLangParser.STRING_DQ, 0)
def STRING_SQ(self):
return self.getToken(ZmeiLangParser.STRING_SQ, 0)
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_menu_item_arg_val
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_menu_item_arg_val" ):
listener.enterAn_menu_item_arg_val(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_menu_item_arg_val" ):
listener.exitAn_menu_item_arg_val(self)
def an_menu_item_arg_val(self):
localctx = ZmeiLangParser.An_menu_item_arg_valContext(self, self._ctx, self.state)
self.enterRule(localctx, 538, self.RULE_an_menu_item_arg_val)
try:
self.state = 2474
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.STRING_DQ]:
self.enterOuterAlt(localctx, 1)
self.state = 2471
self.match(ZmeiLangParser.STRING_DQ)
pass
elif token in [ZmeiLangParser.STRING_SQ]:
self.enterOuterAlt(localctx, 2)
self.state = 2472
self.match(ZmeiLangParser.STRING_SQ)
pass
elif token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID]:
self.enterOuterAlt(localctx, 3)
self.state = 2473
self.id_or_kw()
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_menu_item_urlContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def STRING_DQ(self):
return self.getToken(ZmeiLangParser.STRING_DQ, 0)
def STRING_SQ(self):
return self.getToken(ZmeiLangParser.STRING_SQ, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_menu_item_url
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_menu_item_url" ):
listener.enterAn_menu_item_url(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_menu_item_url" ):
listener.exitAn_menu_item_url(self)
def an_menu_item_url(self):
localctx = ZmeiLangParser.An_menu_item_urlContext(self, self._ctx, self.state)
self.enterRule(localctx, 540, self.RULE_an_menu_item_url)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2476
_la = self._input.LA(1)
if not(_la==ZmeiLangParser.STRING_DQ or _la==ZmeiLangParser.STRING_SQ):
self._errHandler.recoverInline(self)
else:
self._errHandler.reportMatch(self)
self.consume()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_menu_item_pageContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def KW_PAGE(self):
return self.getToken(ZmeiLangParser.KW_PAGE, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def an_menu_item_page_ref(self):
return self.getTypedRuleContext(ZmeiLangParser.An_menu_item_page_refContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_menu_item_page
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_menu_item_page" ):
listener.enterAn_menu_item_page(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_menu_item_page" ):
listener.exitAn_menu_item_page(self)
def an_menu_item_page(self):
localctx = ZmeiLangParser.An_menu_item_pageContext(self, self._ctx, self.state)
self.enterRule(localctx, 542, self.RULE_an_menu_item_page)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2478
self.match(ZmeiLangParser.KW_PAGE)
self.state = 2479
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 2480
self.an_menu_item_page_ref()
self.state = 2481
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_menu_item_page_refContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def id_or_kw(self, i:int=None):
if i is None:
return self.getTypedRuleContexts(ZmeiLangParser.Id_or_kwContext)
else:
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,i)
def DOT(self):
return self.getToken(ZmeiLangParser.DOT, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_menu_item_page_ref
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_menu_item_page_ref" ):
listener.enterAn_menu_item_page_ref(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_menu_item_page_ref" ):
listener.exitAn_menu_item_page_ref(self)
def an_menu_item_page_ref(self):
localctx = ZmeiLangParser.An_menu_item_page_refContext(self, self._ctx, self.state)
self.enterRule(localctx, 544, self.RULE_an_menu_item_page_ref)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2486
self._errHandler.sync(self)
la_ = self._interp.adaptivePredict(self._input,260,self._ctx)
if la_ == 1:
self.state = 2483
self.id_or_kw()
self.state = 2484
self.match(ZmeiLangParser.DOT)
self.state = 2488
self.id_or_kw()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_menu_labelContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def STRING_DQ(self):
return self.getToken(ZmeiLangParser.STRING_DQ, 0)
def STRING_SQ(self):
return self.getToken(ZmeiLangParser.STRING_SQ, 0)
def id_or_kw(self):
return self.getTypedRuleContext(ZmeiLangParser.Id_or_kwContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_menu_label
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_menu_label" ):
listener.enterAn_menu_label(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_menu_label" ):
listener.exitAn_menu_label(self)
def an_menu_label(self):
localctx = ZmeiLangParser.An_menu_labelContext(self, self._ctx, self.state)
self.enterRule(localctx, 546, self.RULE_an_menu_label)
try:
self.state = 2493
self._errHandler.sync(self)
token = self._input.LA(1)
if token in [ZmeiLangParser.STRING_DQ]:
self.enterOuterAlt(localctx, 1)
self.state = 2490
self.match(ZmeiLangParser.STRING_DQ)
pass
elif token in [ZmeiLangParser.STRING_SQ]:
self.enterOuterAlt(localctx, 2)
self.state = 2491
self.match(ZmeiLangParser.STRING_SQ)
pass
elif token in [ZmeiLangParser.KW_AUTH_TYPE_BASIC, ZmeiLangParser.KW_AUTH_TYPE_SESSION, ZmeiLangParser.KW_AUTH_TYPE_TOKEN, ZmeiLangParser.COL_FIELD_TYPE_LONGTEXT, ZmeiLangParser.COL_FIELD_TYPE_HTML, ZmeiLangParser.COL_FIELD_TYPE_HTML_MEDIA, ZmeiLangParser.COL_FIELD_TYPE_FLOAT, ZmeiLangParser.COL_FIELD_TYPE_DECIMAL, ZmeiLangParser.COL_FIELD_TYPE_DATE, ZmeiLangParser.COL_FIELD_TYPE_DATETIME, ZmeiLangParser.COL_FIELD_TYPE_CREATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_UPDATE_TIME, ZmeiLangParser.COL_FIELD_TYPE_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FILE, ZmeiLangParser.COL_FIELD_TYPE_FILER_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_FILER_IMAGE_FOLDER, ZmeiLangParser.COL_FIELD_TYPE_TEXT, ZmeiLangParser.COL_FIELD_TYPE_INT, ZmeiLangParser.COL_FIELD_TYPE_SLUG, ZmeiLangParser.COL_FIELD_TYPE_BOOL, ZmeiLangParser.COL_FIELD_TYPE_ONE, ZmeiLangParser.COL_FIELD_TYPE_ONE2ONE, ZmeiLangParser.COL_FIELD_TYPE_MANY, ZmeiLangParser.COL_FIELD_CHOICES, ZmeiLangParser.KW_THEME, ZmeiLangParser.KW_INSTALL, ZmeiLangParser.KW_HEADER, ZmeiLangParser.KW_SERVICES, ZmeiLangParser.KW_SELENIUM_PYTEST, ZmeiLangParser.KW_CHILD, ZmeiLangParser.KW_FILTER_OUT, ZmeiLangParser.KW_FILTER_IN, ZmeiLangParser.KW_PAGE, ZmeiLangParser.KW_LINK_SUFFIX, ZmeiLangParser.KW_URL_PREFIX, ZmeiLangParser.KW_CAN_EDIT, ZmeiLangParser.KW_OBJECT_EXPR, ZmeiLangParser.KW_BLOCK, ZmeiLangParser.KW_ITEM_NAME, ZmeiLangParser.KW_PK_PARAM, ZmeiLangParser.KW_LIST_FIELDS, ZmeiLangParser.KW_DELETE, ZmeiLangParser.KW_EDIT, ZmeiLangParser.KW_CREATE, ZmeiLangParser.KW_DETAIL, ZmeiLangParser.KW_SKIP, ZmeiLangParser.KW_FROM, ZmeiLangParser.KW_POLY_LIST, ZmeiLangParser.KW_CSS, ZmeiLangParser.KW_JS, ZmeiLangParser.KW_INLINE_TYPE_TABULAR, ZmeiLangParser.KW_INLINE_TYPE_STACKED, ZmeiLangParser.KW_INLINE_TYPE_POLYMORPHIC, ZmeiLangParser.KW_INLINE, ZmeiLangParser.KW_TYPE, ZmeiLangParser.KW_USER_FIELD, ZmeiLangParser.KW_ANNOTATE, ZmeiLangParser.KW_ON_CREATE, ZmeiLangParser.KW_QUERY, ZmeiLangParser.KW_AUTH, ZmeiLangParser.KW_COUNT, ZmeiLangParser.KW_I18N, ZmeiLangParser.KW_EXTENSION, ZmeiLangParser.KW_TABS, ZmeiLangParser.KW_LIST, ZmeiLangParser.KW_READ_ONLY, ZmeiLangParser.KW_LIST_EDITABLE, ZmeiLangParser.KW_LIST_FILTER, ZmeiLangParser.KW_LIST_SEARCH, ZmeiLangParser.KW_FIELDS, ZmeiLangParser.KW_IMPORT, ZmeiLangParser.KW_AS, ZmeiLangParser.WRITE_MODE, ZmeiLangParser.BOOL, ZmeiLangParser.ID]:
self.enterOuterAlt(localctx, 3)
self.state = 2492
self.id_or_kw()
pass
else:
raise NoViableAltException(self)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_crud_detailContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_CRUD_DETAIL(self):
return self.getToken(ZmeiLangParser.AN_CRUD_DETAIL, 0)
def an_crud_params(self):
return self.getTypedRuleContext(ZmeiLangParser.An_crud_paramsContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_crud_detail
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_crud_detail" ):
listener.enterAn_crud_detail(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_crud_detail" ):
listener.exitAn_crud_detail(self)
def an_crud_detail(self):
localctx = ZmeiLangParser.An_crud_detailContext(self, self._ctx, self.state)
self.enterRule(localctx, 548, self.RULE_an_crud_detail)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2495
self.match(ZmeiLangParser.AN_CRUD_DETAIL)
self.state = 2496
self.an_crud_params()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_priority_markerContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_PRIORITY(self):
return self.getToken(ZmeiLangParser.AN_PRIORITY, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_priority_marker
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_priority_marker" ):
listener.enterAn_priority_marker(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_priority_marker" ):
listener.exitAn_priority_marker(self)
def an_priority_marker(self):
localctx = ZmeiLangParser.An_priority_markerContext(self, self._ctx, self.state)
self.enterRule(localctx, 550, self.RULE_an_priority_marker)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2498
self.match(ZmeiLangParser.AN_PRIORITY)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_getContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_GET(self):
return self.getToken(ZmeiLangParser.AN_GET, 0)
def code_block(self):
return self.getTypedRuleContext(ZmeiLangParser.Code_blockContext,0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_get
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_get" ):
listener.enterAn_get(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_get" ):
listener.exitAn_get(self)
def an_get(self):
localctx = ZmeiLangParser.An_getContext(self, self._ctx, self.state)
self.enterRule(localctx, 552, self.RULE_an_get)
self._la = 0 # Token type
try:
self.enterOuterAlt(localctx, 1)
self.state = 2500
self.match(ZmeiLangParser.AN_GET)
self.state = 2502
self._errHandler.sync(self)
_la = self._input.LA(1)
if _la==ZmeiLangParser.CODE_BLOCK:
self.state = 2501
self.code_block()
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_errorContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def AN_ERROR(self):
return self.getToken(ZmeiLangParser.AN_ERROR, 0)
def BRACE_OPEN(self):
return self.getToken(ZmeiLangParser.BRACE_OPEN, 0)
def an_error_code(self):
return self.getTypedRuleContext(ZmeiLangParser.An_error_codeContext,0)
def BRACE_CLOSE(self):
return self.getToken(ZmeiLangParser.BRACE_CLOSE, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_error
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_error" ):
listener.enterAn_error(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_error" ):
listener.exitAn_error(self)
def an_error(self):
localctx = ZmeiLangParser.An_errorContext(self, self._ctx, self.state)
self.enterRule(localctx, 554, self.RULE_an_error)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2504
self.match(ZmeiLangParser.AN_ERROR)
self.state = 2505
self.match(ZmeiLangParser.BRACE_OPEN)
self.state = 2506
self.an_error_code()
self.state = 2507
self.match(ZmeiLangParser.BRACE_CLOSE)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx
class An_error_codeContext(ParserRuleContext):
def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
super().__init__(parent, invokingState)
self.parser = parser
def DIGIT(self):
return self.getToken(ZmeiLangParser.DIGIT, 0)
def getRuleIndex(self):
return ZmeiLangParser.RULE_an_error_code
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterAn_error_code" ):
listener.enterAn_error_code(self)
def exitRule(self, listener:ParseTreeListener):
if hasattr( listener, "exitAn_error_code" ):
listener.exitAn_error_code(self)
def an_error_code(self):
localctx = ZmeiLangParser.An_error_codeContext(self, self._ctx, self.state)
self.enterRule(localctx, 556, self.RULE_an_error_code)
try:
self.enterOuterAlt(localctx, 1)
self.state = 2509
self.match(ZmeiLangParser.DIGIT)
except RecognitionException as re:
localctx.exception = re
self._errHandler.reportError(self, re)
self._errHandler.recover(self, re)
finally:
self.exitRule()
return localctx | zmei-cli | /zmei-cli-2.1.10.tar.gz/zmei-cli-2.1.10/zmei_generator/parser/gen/ZmeiLangParser.py | ZmeiLangParser.py |
from antlr4 import *
if __name__ is not None and "." in __name__:
from .ZmeiLangParser import ZmeiLangParser
else:
from ZmeiLangParser import ZmeiLangParser
# This class defines a complete listener for a parse tree produced by ZmeiLangParser.
class ZmeiLangParserListener(ParseTreeListener):
# Enter a parse tree produced by ZmeiLangParser#col_file.
def enterCol_file(self, ctx:ZmeiLangParser.Col_fileContext):
pass
# Exit a parse tree produced by ZmeiLangParser#col_file.
def exitCol_file(self, ctx:ZmeiLangParser.Col_fileContext):
pass
# Enter a parse tree produced by ZmeiLangParser#page_imports.
def enterPage_imports(self, ctx:ZmeiLangParser.Page_importsContext):
pass
# Exit a parse tree produced by ZmeiLangParser#page_imports.
def exitPage_imports(self, ctx:ZmeiLangParser.Page_importsContext):
pass
# Enter a parse tree produced by ZmeiLangParser#model_imports.
def enterModel_imports(self, ctx:ZmeiLangParser.Model_importsContext):
pass
# Exit a parse tree produced by ZmeiLangParser#model_imports.
def exitModel_imports(self, ctx:ZmeiLangParser.Model_importsContext):
pass
# Enter a parse tree produced by ZmeiLangParser#page_import_statement.
def enterPage_import_statement(self, ctx:ZmeiLangParser.Page_import_statementContext):
pass
# Exit a parse tree produced by ZmeiLangParser#page_import_statement.
def exitPage_import_statement(self, ctx:ZmeiLangParser.Page_import_statementContext):
pass
# Enter a parse tree produced by ZmeiLangParser#model_import_statement.
def enterModel_import_statement(self, ctx:ZmeiLangParser.Model_import_statementContext):
pass
# Exit a parse tree produced by ZmeiLangParser#model_import_statement.
def exitModel_import_statement(self, ctx:ZmeiLangParser.Model_import_statementContext):
pass
# Enter a parse tree produced by ZmeiLangParser#import_statement.
def enterImport_statement(self, ctx:ZmeiLangParser.Import_statementContext):
pass
# Exit a parse tree produced by ZmeiLangParser#import_statement.
def exitImport_statement(self, ctx:ZmeiLangParser.Import_statementContext):
pass
# Enter a parse tree produced by ZmeiLangParser#import_source.
def enterImport_source(self, ctx:ZmeiLangParser.Import_sourceContext):
pass
# Exit a parse tree produced by ZmeiLangParser#import_source.
def exitImport_source(self, ctx:ZmeiLangParser.Import_sourceContext):
pass
# Enter a parse tree produced by ZmeiLangParser#import_list.
def enterImport_list(self, ctx:ZmeiLangParser.Import_listContext):
pass
# Exit a parse tree produced by ZmeiLangParser#import_list.
def exitImport_list(self, ctx:ZmeiLangParser.Import_listContext):
pass
# Enter a parse tree produced by ZmeiLangParser#import_item.
def enterImport_item(self, ctx:ZmeiLangParser.Import_itemContext):
pass
# Exit a parse tree produced by ZmeiLangParser#import_item.
def exitImport_item(self, ctx:ZmeiLangParser.Import_itemContext):
pass
# Enter a parse tree produced by ZmeiLangParser#import_item_name.
def enterImport_item_name(self, ctx:ZmeiLangParser.Import_item_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#import_item_name.
def exitImport_item_name(self, ctx:ZmeiLangParser.Import_item_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#import_item_alias.
def enterImport_item_alias(self, ctx:ZmeiLangParser.Import_item_aliasContext):
pass
# Exit a parse tree produced by ZmeiLangParser#import_item_alias.
def exitImport_item_alias(self, ctx:ZmeiLangParser.Import_item_aliasContext):
pass
# Enter a parse tree produced by ZmeiLangParser#import_item_all.
def enterImport_item_all(self, ctx:ZmeiLangParser.Import_item_allContext):
pass
# Exit a parse tree produced by ZmeiLangParser#import_item_all.
def exitImport_item_all(self, ctx:ZmeiLangParser.Import_item_allContext):
pass
# Enter a parse tree produced by ZmeiLangParser#id_or_kw.
def enterId_or_kw(self, ctx:ZmeiLangParser.Id_or_kwContext):
pass
# Exit a parse tree produced by ZmeiLangParser#id_or_kw.
def exitId_or_kw(self, ctx:ZmeiLangParser.Id_or_kwContext):
pass
# Enter a parse tree produced by ZmeiLangParser#classname.
def enterClassname(self, ctx:ZmeiLangParser.ClassnameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#classname.
def exitClassname(self, ctx:ZmeiLangParser.ClassnameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#model_ref.
def enterModel_ref(self, ctx:ZmeiLangParser.Model_refContext):
pass
# Exit a parse tree produced by ZmeiLangParser#model_ref.
def exitModel_ref(self, ctx:ZmeiLangParser.Model_refContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_list_expr.
def enterField_list_expr(self, ctx:ZmeiLangParser.Field_list_exprContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_list_expr.
def exitField_list_expr(self, ctx:ZmeiLangParser.Field_list_exprContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_list_expr_field.
def enterField_list_expr_field(self, ctx:ZmeiLangParser.Field_list_expr_fieldContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_list_expr_field.
def exitField_list_expr_field(self, ctx:ZmeiLangParser.Field_list_expr_fieldContext):
pass
# Enter a parse tree produced by ZmeiLangParser#write_mode_expr.
def enterWrite_mode_expr(self, ctx:ZmeiLangParser.Write_mode_exprContext):
pass
# Exit a parse tree produced by ZmeiLangParser#write_mode_expr.
def exitWrite_mode_expr(self, ctx:ZmeiLangParser.Write_mode_exprContext):
pass
# Enter a parse tree produced by ZmeiLangParser#python_code.
def enterPython_code(self, ctx:ZmeiLangParser.Python_codeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#python_code.
def exitPython_code(self, ctx:ZmeiLangParser.Python_codeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#code_line.
def enterCode_line(self, ctx:ZmeiLangParser.Code_lineContext):
pass
# Exit a parse tree produced by ZmeiLangParser#code_line.
def exitCode_line(self, ctx:ZmeiLangParser.Code_lineContext):
pass
# Enter a parse tree produced by ZmeiLangParser#code_block.
def enterCode_block(self, ctx:ZmeiLangParser.Code_blockContext):
pass
# Exit a parse tree produced by ZmeiLangParser#code_block.
def exitCode_block(self, ctx:ZmeiLangParser.Code_blockContext):
pass
# Enter a parse tree produced by ZmeiLangParser#cs_annotation.
def enterCs_annotation(self, ctx:ZmeiLangParser.Cs_annotationContext):
pass
# Exit a parse tree produced by ZmeiLangParser#cs_annotation.
def exitCs_annotation(self, ctx:ZmeiLangParser.Cs_annotationContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_suit.
def enterAn_suit(self, ctx:ZmeiLangParser.An_suitContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_suit.
def exitAn_suit(self, ctx:ZmeiLangParser.An_suitContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_suit_app_name.
def enterAn_suit_app_name(self, ctx:ZmeiLangParser.An_suit_app_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_suit_app_name.
def exitAn_suit_app_name(self, ctx:ZmeiLangParser.An_suit_app_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_celery.
def enterAn_celery(self, ctx:ZmeiLangParser.An_celeryContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_celery.
def exitAn_celery(self, ctx:ZmeiLangParser.An_celeryContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_channels.
def enterAn_channels(self, ctx:ZmeiLangParser.An_channelsContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_channels.
def exitAn_channels(self, ctx:ZmeiLangParser.An_channelsContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_docker.
def enterAn_docker(self, ctx:ZmeiLangParser.An_dockerContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_docker.
def exitAn_docker(self, ctx:ZmeiLangParser.An_dockerContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_filer.
def enterAn_filer(self, ctx:ZmeiLangParser.An_filerContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_filer.
def exitAn_filer(self, ctx:ZmeiLangParser.An_filerContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_gitlab.
def enterAn_gitlab(self, ctx:ZmeiLangParser.An_gitlabContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_gitlab.
def exitAn_gitlab(self, ctx:ZmeiLangParser.An_gitlabContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_gitlab_test_declaration.
def enterAn_gitlab_test_declaration(self, ctx:ZmeiLangParser.An_gitlab_test_declarationContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_gitlab_test_declaration.
def exitAn_gitlab_test_declaration(self, ctx:ZmeiLangParser.An_gitlab_test_declarationContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_gitlab_test_declaration_selenium_pytest.
def enterAn_gitlab_test_declaration_selenium_pytest(self, ctx:ZmeiLangParser.An_gitlab_test_declaration_selenium_pytestContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_gitlab_test_declaration_selenium_pytest.
def exitAn_gitlab_test_declaration_selenium_pytest(self, ctx:ZmeiLangParser.An_gitlab_test_declaration_selenium_pytestContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_gitlab_test_services.
def enterAn_gitlab_test_services(self, ctx:ZmeiLangParser.An_gitlab_test_servicesContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_gitlab_test_services.
def exitAn_gitlab_test_services(self, ctx:ZmeiLangParser.An_gitlab_test_servicesContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_gitlab_test_service.
def enterAn_gitlab_test_service(self, ctx:ZmeiLangParser.An_gitlab_test_serviceContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_gitlab_test_service.
def exitAn_gitlab_test_service(self, ctx:ZmeiLangParser.An_gitlab_test_serviceContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_gitlab_test_service_name.
def enterAn_gitlab_test_service_name(self, ctx:ZmeiLangParser.An_gitlab_test_service_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_gitlab_test_service_name.
def exitAn_gitlab_test_service_name(self, ctx:ZmeiLangParser.An_gitlab_test_service_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_gitlab_branch_declaration.
def enterAn_gitlab_branch_declaration(self, ctx:ZmeiLangParser.An_gitlab_branch_declarationContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_gitlab_branch_declaration.
def exitAn_gitlab_branch_declaration(self, ctx:ZmeiLangParser.An_gitlab_branch_declarationContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_gitlab_branch_deploy_type.
def enterAn_gitlab_branch_deploy_type(self, ctx:ZmeiLangParser.An_gitlab_branch_deploy_typeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_gitlab_branch_deploy_type.
def exitAn_gitlab_branch_deploy_type(self, ctx:ZmeiLangParser.An_gitlab_branch_deploy_typeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_gitlab_branch_name.
def enterAn_gitlab_branch_name(self, ctx:ZmeiLangParser.An_gitlab_branch_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_gitlab_branch_name.
def exitAn_gitlab_branch_name(self, ctx:ZmeiLangParser.An_gitlab_branch_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_gitlab_deployment_name.
def enterAn_gitlab_deployment_name(self, ctx:ZmeiLangParser.An_gitlab_deployment_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_gitlab_deployment_name.
def exitAn_gitlab_deployment_name(self, ctx:ZmeiLangParser.An_gitlab_deployment_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_gitlab_deployment_host.
def enterAn_gitlab_deployment_host(self, ctx:ZmeiLangParser.An_gitlab_deployment_hostContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_gitlab_deployment_host.
def exitAn_gitlab_deployment_host(self, ctx:ZmeiLangParser.An_gitlab_deployment_hostContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_gitlab_deployment_variable.
def enterAn_gitlab_deployment_variable(self, ctx:ZmeiLangParser.An_gitlab_deployment_variableContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_gitlab_deployment_variable.
def exitAn_gitlab_deployment_variable(self, ctx:ZmeiLangParser.An_gitlab_deployment_variableContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_gitlab_deployment_variable_name.
def enterAn_gitlab_deployment_variable_name(self, ctx:ZmeiLangParser.An_gitlab_deployment_variable_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_gitlab_deployment_variable_name.
def exitAn_gitlab_deployment_variable_name(self, ctx:ZmeiLangParser.An_gitlab_deployment_variable_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_gitlab_deployment_variable_value.
def enterAn_gitlab_deployment_variable_value(self, ctx:ZmeiLangParser.An_gitlab_deployment_variable_valueContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_gitlab_deployment_variable_value.
def exitAn_gitlab_deployment_variable_value(self, ctx:ZmeiLangParser.An_gitlab_deployment_variable_valueContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_file.
def enterAn_file(self, ctx:ZmeiLangParser.An_fileContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_file.
def exitAn_file(self, ctx:ZmeiLangParser.An_fileContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_file_name.
def enterAn_file_name(self, ctx:ZmeiLangParser.An_file_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_file_name.
def exitAn_file_name(self, ctx:ZmeiLangParser.An_file_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_theme.
def enterAn_theme(self, ctx:ZmeiLangParser.An_themeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_theme.
def exitAn_theme(self, ctx:ZmeiLangParser.An_themeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_theme_install.
def enterAn_theme_install(self, ctx:ZmeiLangParser.An_theme_installContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_theme_install.
def exitAn_theme_install(self, ctx:ZmeiLangParser.An_theme_installContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_theme_name.
def enterAn_theme_name(self, ctx:ZmeiLangParser.An_theme_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_theme_name.
def exitAn_theme_name(self, ctx:ZmeiLangParser.An_theme_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_langs.
def enterAn_langs(self, ctx:ZmeiLangParser.An_langsContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_langs.
def exitAn_langs(self, ctx:ZmeiLangParser.An_langsContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_langs_list.
def enterAn_langs_list(self, ctx:ZmeiLangParser.An_langs_listContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_langs_list.
def exitAn_langs_list(self, ctx:ZmeiLangParser.An_langs_listContext):
pass
# Enter a parse tree produced by ZmeiLangParser#col.
def enterCol(self, ctx:ZmeiLangParser.ColContext):
pass
# Exit a parse tree produced by ZmeiLangParser#col.
def exitCol(self, ctx:ZmeiLangParser.ColContext):
pass
# Enter a parse tree produced by ZmeiLangParser#col_str_expr.
def enterCol_str_expr(self, ctx:ZmeiLangParser.Col_str_exprContext):
pass
# Exit a parse tree produced by ZmeiLangParser#col_str_expr.
def exitCol_str_expr(self, ctx:ZmeiLangParser.Col_str_exprContext):
pass
# Enter a parse tree produced by ZmeiLangParser#col_header.
def enterCol_header(self, ctx:ZmeiLangParser.Col_headerContext):
pass
# Exit a parse tree produced by ZmeiLangParser#col_header.
def exitCol_header(self, ctx:ZmeiLangParser.Col_headerContext):
pass
# Enter a parse tree produced by ZmeiLangParser#col_header_line_separator.
def enterCol_header_line_separator(self, ctx:ZmeiLangParser.Col_header_line_separatorContext):
pass
# Exit a parse tree produced by ZmeiLangParser#col_header_line_separator.
def exitCol_header_line_separator(self, ctx:ZmeiLangParser.Col_header_line_separatorContext):
pass
# Enter a parse tree produced by ZmeiLangParser#col_verbose_name.
def enterCol_verbose_name(self, ctx:ZmeiLangParser.Col_verbose_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#col_verbose_name.
def exitCol_verbose_name(self, ctx:ZmeiLangParser.Col_verbose_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#verbose_name_part.
def enterVerbose_name_part(self, ctx:ZmeiLangParser.Verbose_name_partContext):
pass
# Exit a parse tree produced by ZmeiLangParser#verbose_name_part.
def exitVerbose_name_part(self, ctx:ZmeiLangParser.Verbose_name_partContext):
pass
# Enter a parse tree produced by ZmeiLangParser#col_base_name.
def enterCol_base_name(self, ctx:ZmeiLangParser.Col_base_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#col_base_name.
def exitCol_base_name(self, ctx:ZmeiLangParser.Col_base_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#col_name.
def enterCol_name(self, ctx:ZmeiLangParser.Col_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#col_name.
def exitCol_name(self, ctx:ZmeiLangParser.Col_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#col_field.
def enterCol_field(self, ctx:ZmeiLangParser.Col_fieldContext):
pass
# Exit a parse tree produced by ZmeiLangParser#col_field.
def exitCol_field(self, ctx:ZmeiLangParser.Col_fieldContext):
pass
# Enter a parse tree produced by ZmeiLangParser#col_field_expr_or_def.
def enterCol_field_expr_or_def(self, ctx:ZmeiLangParser.Col_field_expr_or_defContext):
pass
# Exit a parse tree produced by ZmeiLangParser#col_field_expr_or_def.
def exitCol_field_expr_or_def(self, ctx:ZmeiLangParser.Col_field_expr_or_defContext):
pass
# Enter a parse tree produced by ZmeiLangParser#col_field_custom.
def enterCol_field_custom(self, ctx:ZmeiLangParser.Col_field_customContext):
pass
# Exit a parse tree produced by ZmeiLangParser#col_field_custom.
def exitCol_field_custom(self, ctx:ZmeiLangParser.Col_field_customContext):
pass
# Enter a parse tree produced by ZmeiLangParser#col_field_extend.
def enterCol_field_extend(self, ctx:ZmeiLangParser.Col_field_extendContext):
pass
# Exit a parse tree produced by ZmeiLangParser#col_field_extend.
def exitCol_field_extend(self, ctx:ZmeiLangParser.Col_field_extendContext):
pass
# Enter a parse tree produced by ZmeiLangParser#col_field_extend_append.
def enterCol_field_extend_append(self, ctx:ZmeiLangParser.Col_field_extend_appendContext):
pass
# Exit a parse tree produced by ZmeiLangParser#col_field_extend_append.
def exitCol_field_extend_append(self, ctx:ZmeiLangParser.Col_field_extend_appendContext):
pass
# Enter a parse tree produced by ZmeiLangParser#wrong_field_type.
def enterWrong_field_type(self, ctx:ZmeiLangParser.Wrong_field_typeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#wrong_field_type.
def exitWrong_field_type(self, ctx:ZmeiLangParser.Wrong_field_typeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#col_field_expr.
def enterCol_field_expr(self, ctx:ZmeiLangParser.Col_field_exprContext):
pass
# Exit a parse tree produced by ZmeiLangParser#col_field_expr.
def exitCol_field_expr(self, ctx:ZmeiLangParser.Col_field_exprContext):
pass
# Enter a parse tree produced by ZmeiLangParser#col_field_expr_marker.
def enterCol_field_expr_marker(self, ctx:ZmeiLangParser.Col_field_expr_markerContext):
pass
# Exit a parse tree produced by ZmeiLangParser#col_field_expr_marker.
def exitCol_field_expr_marker(self, ctx:ZmeiLangParser.Col_field_expr_markerContext):
pass
# Enter a parse tree produced by ZmeiLangParser#col_feild_expr_code.
def enterCol_feild_expr_code(self, ctx:ZmeiLangParser.Col_feild_expr_codeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#col_feild_expr_code.
def exitCol_feild_expr_code(self, ctx:ZmeiLangParser.Col_feild_expr_codeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#string_or_quoted.
def enterString_or_quoted(self, ctx:ZmeiLangParser.String_or_quotedContext):
pass
# Exit a parse tree produced by ZmeiLangParser#string_or_quoted.
def exitString_or_quoted(self, ctx:ZmeiLangParser.String_or_quotedContext):
pass
# Enter a parse tree produced by ZmeiLangParser#col_field_help_text.
def enterCol_field_help_text(self, ctx:ZmeiLangParser.Col_field_help_textContext):
pass
# Exit a parse tree produced by ZmeiLangParser#col_field_help_text.
def exitCol_field_help_text(self, ctx:ZmeiLangParser.Col_field_help_textContext):
pass
# Enter a parse tree produced by ZmeiLangParser#col_field_verbose_name.
def enterCol_field_verbose_name(self, ctx:ZmeiLangParser.Col_field_verbose_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#col_field_verbose_name.
def exitCol_field_verbose_name(self, ctx:ZmeiLangParser.Col_field_verbose_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#col_field_name.
def enterCol_field_name(self, ctx:ZmeiLangParser.Col_field_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#col_field_name.
def exitCol_field_name(self, ctx:ZmeiLangParser.Col_field_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#col_modifier.
def enterCol_modifier(self, ctx:ZmeiLangParser.Col_modifierContext):
pass
# Exit a parse tree produced by ZmeiLangParser#col_modifier.
def exitCol_modifier(self, ctx:ZmeiLangParser.Col_modifierContext):
pass
# Enter a parse tree produced by ZmeiLangParser#col_field_def.
def enterCol_field_def(self, ctx:ZmeiLangParser.Col_field_defContext):
pass
# Exit a parse tree produced by ZmeiLangParser#col_field_def.
def exitCol_field_def(self, ctx:ZmeiLangParser.Col_field_defContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_longtext.
def enterField_longtext(self, ctx:ZmeiLangParser.Field_longtextContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_longtext.
def exitField_longtext(self, ctx:ZmeiLangParser.Field_longtextContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_html.
def enterField_html(self, ctx:ZmeiLangParser.Field_htmlContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_html.
def exitField_html(self, ctx:ZmeiLangParser.Field_htmlContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_html_media.
def enterField_html_media(self, ctx:ZmeiLangParser.Field_html_mediaContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_html_media.
def exitField_html_media(self, ctx:ZmeiLangParser.Field_html_mediaContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_float.
def enterField_float(self, ctx:ZmeiLangParser.Field_floatContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_float.
def exitField_float(self, ctx:ZmeiLangParser.Field_floatContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_decimal.
def enterField_decimal(self, ctx:ZmeiLangParser.Field_decimalContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_decimal.
def exitField_decimal(self, ctx:ZmeiLangParser.Field_decimalContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_date.
def enterField_date(self, ctx:ZmeiLangParser.Field_dateContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_date.
def exitField_date(self, ctx:ZmeiLangParser.Field_dateContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_datetime.
def enterField_datetime(self, ctx:ZmeiLangParser.Field_datetimeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_datetime.
def exitField_datetime(self, ctx:ZmeiLangParser.Field_datetimeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_create_time.
def enterField_create_time(self, ctx:ZmeiLangParser.Field_create_timeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_create_time.
def exitField_create_time(self, ctx:ZmeiLangParser.Field_create_timeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_update_time.
def enterField_update_time(self, ctx:ZmeiLangParser.Field_update_timeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_update_time.
def exitField_update_time(self, ctx:ZmeiLangParser.Field_update_timeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_file.
def enterField_file(self, ctx:ZmeiLangParser.Field_fileContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_file.
def exitField_file(self, ctx:ZmeiLangParser.Field_fileContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_filer_file.
def enterField_filer_file(self, ctx:ZmeiLangParser.Field_filer_fileContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_filer_file.
def exitField_filer_file(self, ctx:ZmeiLangParser.Field_filer_fileContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_filer_folder.
def enterField_filer_folder(self, ctx:ZmeiLangParser.Field_filer_folderContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_filer_folder.
def exitField_filer_folder(self, ctx:ZmeiLangParser.Field_filer_folderContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_text.
def enterField_text(self, ctx:ZmeiLangParser.Field_textContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_text.
def exitField_text(self, ctx:ZmeiLangParser.Field_textContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_text_size.
def enterField_text_size(self, ctx:ZmeiLangParser.Field_text_sizeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_text_size.
def exitField_text_size(self, ctx:ZmeiLangParser.Field_text_sizeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_text_choices.
def enterField_text_choices(self, ctx:ZmeiLangParser.Field_text_choicesContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_text_choices.
def exitField_text_choices(self, ctx:ZmeiLangParser.Field_text_choicesContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_text_choice.
def enterField_text_choice(self, ctx:ZmeiLangParser.Field_text_choiceContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_text_choice.
def exitField_text_choice(self, ctx:ZmeiLangParser.Field_text_choiceContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_text_choice_val.
def enterField_text_choice_val(self, ctx:ZmeiLangParser.Field_text_choice_valContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_text_choice_val.
def exitField_text_choice_val(self, ctx:ZmeiLangParser.Field_text_choice_valContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_text_choice_key.
def enterField_text_choice_key(self, ctx:ZmeiLangParser.Field_text_choice_keyContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_text_choice_key.
def exitField_text_choice_key(self, ctx:ZmeiLangParser.Field_text_choice_keyContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_int.
def enterField_int(self, ctx:ZmeiLangParser.Field_intContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_int.
def exitField_int(self, ctx:ZmeiLangParser.Field_intContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_int_choices.
def enterField_int_choices(self, ctx:ZmeiLangParser.Field_int_choicesContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_int_choices.
def exitField_int_choices(self, ctx:ZmeiLangParser.Field_int_choicesContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_int_choice.
def enterField_int_choice(self, ctx:ZmeiLangParser.Field_int_choiceContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_int_choice.
def exitField_int_choice(self, ctx:ZmeiLangParser.Field_int_choiceContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_int_choice_val.
def enterField_int_choice_val(self, ctx:ZmeiLangParser.Field_int_choice_valContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_int_choice_val.
def exitField_int_choice_val(self, ctx:ZmeiLangParser.Field_int_choice_valContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_int_choice_key.
def enterField_int_choice_key(self, ctx:ZmeiLangParser.Field_int_choice_keyContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_int_choice_key.
def exitField_int_choice_key(self, ctx:ZmeiLangParser.Field_int_choice_keyContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_slug.
def enterField_slug(self, ctx:ZmeiLangParser.Field_slugContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_slug.
def exitField_slug(self, ctx:ZmeiLangParser.Field_slugContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_slug_ref_field.
def enterField_slug_ref_field(self, ctx:ZmeiLangParser.Field_slug_ref_fieldContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_slug_ref_field.
def exitField_slug_ref_field(self, ctx:ZmeiLangParser.Field_slug_ref_fieldContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_slug_ref_field_id.
def enterField_slug_ref_field_id(self, ctx:ZmeiLangParser.Field_slug_ref_field_idContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_slug_ref_field_id.
def exitField_slug_ref_field_id(self, ctx:ZmeiLangParser.Field_slug_ref_field_idContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_bool.
def enterField_bool(self, ctx:ZmeiLangParser.Field_boolContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_bool.
def exitField_bool(self, ctx:ZmeiLangParser.Field_boolContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_bool_default.
def enterField_bool_default(self, ctx:ZmeiLangParser.Field_bool_defaultContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_bool_default.
def exitField_bool_default(self, ctx:ZmeiLangParser.Field_bool_defaultContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_image.
def enterField_image(self, ctx:ZmeiLangParser.Field_imageContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_image.
def exitField_image(self, ctx:ZmeiLangParser.Field_imageContext):
pass
# Enter a parse tree produced by ZmeiLangParser#filer_image_type.
def enterFiler_image_type(self, ctx:ZmeiLangParser.Filer_image_typeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#filer_image_type.
def exitFiler_image_type(self, ctx:ZmeiLangParser.Filer_image_typeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_image_sizes.
def enterField_image_sizes(self, ctx:ZmeiLangParser.Field_image_sizesContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_image_sizes.
def exitField_image_sizes(self, ctx:ZmeiLangParser.Field_image_sizesContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_image_size.
def enterField_image_size(self, ctx:ZmeiLangParser.Field_image_sizeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_image_size.
def exitField_image_size(self, ctx:ZmeiLangParser.Field_image_sizeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_image_size_dimensions.
def enterField_image_size_dimensions(self, ctx:ZmeiLangParser.Field_image_size_dimensionsContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_image_size_dimensions.
def exitField_image_size_dimensions(self, ctx:ZmeiLangParser.Field_image_size_dimensionsContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_image_size_name.
def enterField_image_size_name(self, ctx:ZmeiLangParser.Field_image_size_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_image_size_name.
def exitField_image_size_name(self, ctx:ZmeiLangParser.Field_image_size_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_image_filters.
def enterField_image_filters(self, ctx:ZmeiLangParser.Field_image_filtersContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_image_filters.
def exitField_image_filters(self, ctx:ZmeiLangParser.Field_image_filtersContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_image_filter.
def enterField_image_filter(self, ctx:ZmeiLangParser.Field_image_filterContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_image_filter.
def exitField_image_filter(self, ctx:ZmeiLangParser.Field_image_filterContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_relation.
def enterField_relation(self, ctx:ZmeiLangParser.Field_relationContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_relation.
def exitField_relation(self, ctx:ZmeiLangParser.Field_relationContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_relation_type.
def enterField_relation_type(self, ctx:ZmeiLangParser.Field_relation_typeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_relation_type.
def exitField_relation_type(self, ctx:ZmeiLangParser.Field_relation_typeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_relation_cascade_marker.
def enterField_relation_cascade_marker(self, ctx:ZmeiLangParser.Field_relation_cascade_markerContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_relation_cascade_marker.
def exitField_relation_cascade_marker(self, ctx:ZmeiLangParser.Field_relation_cascade_markerContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_relation_target_ref.
def enterField_relation_target_ref(self, ctx:ZmeiLangParser.Field_relation_target_refContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_relation_target_ref.
def exitField_relation_target_ref(self, ctx:ZmeiLangParser.Field_relation_target_refContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_relation_target_class.
def enterField_relation_target_class(self, ctx:ZmeiLangParser.Field_relation_target_classContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_relation_target_class.
def exitField_relation_target_class(self, ctx:ZmeiLangParser.Field_relation_target_classContext):
pass
# Enter a parse tree produced by ZmeiLangParser#field_relation_related_name.
def enterField_relation_related_name(self, ctx:ZmeiLangParser.Field_relation_related_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#field_relation_related_name.
def exitField_relation_related_name(self, ctx:ZmeiLangParser.Field_relation_related_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#model_annotation.
def enterModel_annotation(self, ctx:ZmeiLangParser.Model_annotationContext):
pass
# Exit a parse tree produced by ZmeiLangParser#model_annotation.
def exitModel_annotation(self, ctx:ZmeiLangParser.Model_annotationContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_admin.
def enterAn_admin(self, ctx:ZmeiLangParser.An_adminContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_admin.
def exitAn_admin(self, ctx:ZmeiLangParser.An_adminContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_admin_js.
def enterAn_admin_js(self, ctx:ZmeiLangParser.An_admin_jsContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_admin_js.
def exitAn_admin_js(self, ctx:ZmeiLangParser.An_admin_jsContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_admin_css.
def enterAn_admin_css(self, ctx:ZmeiLangParser.An_admin_cssContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_admin_css.
def exitAn_admin_css(self, ctx:ZmeiLangParser.An_admin_cssContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_admin_css_file_name.
def enterAn_admin_css_file_name(self, ctx:ZmeiLangParser.An_admin_css_file_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_admin_css_file_name.
def exitAn_admin_css_file_name(self, ctx:ZmeiLangParser.An_admin_css_file_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_admin_js_file_name.
def enterAn_admin_js_file_name(self, ctx:ZmeiLangParser.An_admin_js_file_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_admin_js_file_name.
def exitAn_admin_js_file_name(self, ctx:ZmeiLangParser.An_admin_js_file_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_admin_inlines.
def enterAn_admin_inlines(self, ctx:ZmeiLangParser.An_admin_inlinesContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_admin_inlines.
def exitAn_admin_inlines(self, ctx:ZmeiLangParser.An_admin_inlinesContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_admin_inline.
def enterAn_admin_inline(self, ctx:ZmeiLangParser.An_admin_inlineContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_admin_inline.
def exitAn_admin_inline(self, ctx:ZmeiLangParser.An_admin_inlineContext):
pass
# Enter a parse tree produced by ZmeiLangParser#inline_name.
def enterInline_name(self, ctx:ZmeiLangParser.Inline_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#inline_name.
def exitInline_name(self, ctx:ZmeiLangParser.Inline_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#inline_type.
def enterInline_type(self, ctx:ZmeiLangParser.Inline_typeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#inline_type.
def exitInline_type(self, ctx:ZmeiLangParser.Inline_typeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#inline_type_name.
def enterInline_type_name(self, ctx:ZmeiLangParser.Inline_type_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#inline_type_name.
def exitInline_type_name(self, ctx:ZmeiLangParser.Inline_type_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#inline_extension.
def enterInline_extension(self, ctx:ZmeiLangParser.Inline_extensionContext):
pass
# Exit a parse tree produced by ZmeiLangParser#inline_extension.
def exitInline_extension(self, ctx:ZmeiLangParser.Inline_extensionContext):
pass
# Enter a parse tree produced by ZmeiLangParser#inline_fields.
def enterInline_fields(self, ctx:ZmeiLangParser.Inline_fieldsContext):
pass
# Exit a parse tree produced by ZmeiLangParser#inline_fields.
def exitInline_fields(self, ctx:ZmeiLangParser.Inline_fieldsContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_admin_tabs.
def enterAn_admin_tabs(self, ctx:ZmeiLangParser.An_admin_tabsContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_admin_tabs.
def exitAn_admin_tabs(self, ctx:ZmeiLangParser.An_admin_tabsContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_admin_tab.
def enterAn_admin_tab(self, ctx:ZmeiLangParser.An_admin_tabContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_admin_tab.
def exitAn_admin_tab(self, ctx:ZmeiLangParser.An_admin_tabContext):
pass
# Enter a parse tree produced by ZmeiLangParser#tab_name.
def enterTab_name(self, ctx:ZmeiLangParser.Tab_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#tab_name.
def exitTab_name(self, ctx:ZmeiLangParser.Tab_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#tab_verbose_name.
def enterTab_verbose_name(self, ctx:ZmeiLangParser.Tab_verbose_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#tab_verbose_name.
def exitTab_verbose_name(self, ctx:ZmeiLangParser.Tab_verbose_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_admin_list.
def enterAn_admin_list(self, ctx:ZmeiLangParser.An_admin_listContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_admin_list.
def exitAn_admin_list(self, ctx:ZmeiLangParser.An_admin_listContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_admin_read_only.
def enterAn_admin_read_only(self, ctx:ZmeiLangParser.An_admin_read_onlyContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_admin_read_only.
def exitAn_admin_read_only(self, ctx:ZmeiLangParser.An_admin_read_onlyContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_admin_list_editable.
def enterAn_admin_list_editable(self, ctx:ZmeiLangParser.An_admin_list_editableContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_admin_list_editable.
def exitAn_admin_list_editable(self, ctx:ZmeiLangParser.An_admin_list_editableContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_admin_list_filter.
def enterAn_admin_list_filter(self, ctx:ZmeiLangParser.An_admin_list_filterContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_admin_list_filter.
def exitAn_admin_list_filter(self, ctx:ZmeiLangParser.An_admin_list_filterContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_admin_list_search.
def enterAn_admin_list_search(self, ctx:ZmeiLangParser.An_admin_list_searchContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_admin_list_search.
def exitAn_admin_list_search(self, ctx:ZmeiLangParser.An_admin_list_searchContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_admin_fields.
def enterAn_admin_fields(self, ctx:ZmeiLangParser.An_admin_fieldsContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_admin_fields.
def exitAn_admin_fields(self, ctx:ZmeiLangParser.An_admin_fieldsContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_api.
def enterAn_api(self, ctx:ZmeiLangParser.An_apiContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_api.
def exitAn_api(self, ctx:ZmeiLangParser.An_apiContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_api_all.
def enterAn_api_all(self, ctx:ZmeiLangParser.An_api_allContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_api_all.
def exitAn_api_all(self, ctx:ZmeiLangParser.An_api_allContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_api_name.
def enterAn_api_name(self, ctx:ZmeiLangParser.An_api_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_api_name.
def exitAn_api_name(self, ctx:ZmeiLangParser.An_api_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest.
def enterAn_rest(self, ctx:ZmeiLangParser.An_restContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest.
def exitAn_rest(self, ctx:ZmeiLangParser.An_restContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_config.
def enterAn_rest_config(self, ctx:ZmeiLangParser.An_rest_configContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_config.
def exitAn_rest_config(self, ctx:ZmeiLangParser.An_rest_configContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_main_part.
def enterAn_rest_main_part(self, ctx:ZmeiLangParser.An_rest_main_partContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_main_part.
def exitAn_rest_main_part(self, ctx:ZmeiLangParser.An_rest_main_partContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_descriptor.
def enterAn_rest_descriptor(self, ctx:ZmeiLangParser.An_rest_descriptorContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_descriptor.
def exitAn_rest_descriptor(self, ctx:ZmeiLangParser.An_rest_descriptorContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_i18n.
def enterAn_rest_i18n(self, ctx:ZmeiLangParser.An_rest_i18nContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_i18n.
def exitAn_rest_i18n(self, ctx:ZmeiLangParser.An_rest_i18nContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_str.
def enterAn_rest_str(self, ctx:ZmeiLangParser.An_rest_strContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_str.
def exitAn_rest_str(self, ctx:ZmeiLangParser.An_rest_strContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_query.
def enterAn_rest_query(self, ctx:ZmeiLangParser.An_rest_queryContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_query.
def exitAn_rest_query(self, ctx:ZmeiLangParser.An_rest_queryContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_on_create.
def enterAn_rest_on_create(self, ctx:ZmeiLangParser.An_rest_on_createContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_on_create.
def exitAn_rest_on_create(self, ctx:ZmeiLangParser.An_rest_on_createContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_filter_in.
def enterAn_rest_filter_in(self, ctx:ZmeiLangParser.An_rest_filter_inContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_filter_in.
def exitAn_rest_filter_in(self, ctx:ZmeiLangParser.An_rest_filter_inContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_filter_out.
def enterAn_rest_filter_out(self, ctx:ZmeiLangParser.An_rest_filter_outContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_filter_out.
def exitAn_rest_filter_out(self, ctx:ZmeiLangParser.An_rest_filter_outContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_read_only.
def enterAn_rest_read_only(self, ctx:ZmeiLangParser.An_rest_read_onlyContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_read_only.
def exitAn_rest_read_only(self, ctx:ZmeiLangParser.An_rest_read_onlyContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_user_field.
def enterAn_rest_user_field(self, ctx:ZmeiLangParser.An_rest_user_fieldContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_user_field.
def exitAn_rest_user_field(self, ctx:ZmeiLangParser.An_rest_user_fieldContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_fields.
def enterAn_rest_fields(self, ctx:ZmeiLangParser.An_rest_fieldsContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_fields.
def exitAn_rest_fields(self, ctx:ZmeiLangParser.An_rest_fieldsContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_fields_write_mode.
def enterAn_rest_fields_write_mode(self, ctx:ZmeiLangParser.An_rest_fields_write_modeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_fields_write_mode.
def exitAn_rest_fields_write_mode(self, ctx:ZmeiLangParser.An_rest_fields_write_modeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_auth.
def enterAn_rest_auth(self, ctx:ZmeiLangParser.An_rest_authContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_auth.
def exitAn_rest_auth(self, ctx:ZmeiLangParser.An_rest_authContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_auth_type.
def enterAn_rest_auth_type(self, ctx:ZmeiLangParser.An_rest_auth_typeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_auth_type.
def exitAn_rest_auth_type(self, ctx:ZmeiLangParser.An_rest_auth_typeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_auth_type_name.
def enterAn_rest_auth_type_name(self, ctx:ZmeiLangParser.An_rest_auth_type_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_auth_type_name.
def exitAn_rest_auth_type_name(self, ctx:ZmeiLangParser.An_rest_auth_type_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_auth_token_model.
def enterAn_rest_auth_token_model(self, ctx:ZmeiLangParser.An_rest_auth_token_modelContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_auth_token_model.
def exitAn_rest_auth_token_model(self, ctx:ZmeiLangParser.An_rest_auth_token_modelContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_auth_token_class.
def enterAn_rest_auth_token_class(self, ctx:ZmeiLangParser.An_rest_auth_token_classContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_auth_token_class.
def exitAn_rest_auth_token_class(self, ctx:ZmeiLangParser.An_rest_auth_token_classContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_annotate.
def enterAn_rest_annotate(self, ctx:ZmeiLangParser.An_rest_annotateContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_annotate.
def exitAn_rest_annotate(self, ctx:ZmeiLangParser.An_rest_annotateContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_annotate_count.
def enterAn_rest_annotate_count(self, ctx:ZmeiLangParser.An_rest_annotate_countContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_annotate_count.
def exitAn_rest_annotate_count(self, ctx:ZmeiLangParser.An_rest_annotate_countContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_annotate_count_field.
def enterAn_rest_annotate_count_field(self, ctx:ZmeiLangParser.An_rest_annotate_count_fieldContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_annotate_count_field.
def exitAn_rest_annotate_count_field(self, ctx:ZmeiLangParser.An_rest_annotate_count_fieldContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_annotate_count_alias.
def enterAn_rest_annotate_count_alias(self, ctx:ZmeiLangParser.An_rest_annotate_count_aliasContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_annotate_count_alias.
def exitAn_rest_annotate_count_alias(self, ctx:ZmeiLangParser.An_rest_annotate_count_aliasContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_inline.
def enterAn_rest_inline(self, ctx:ZmeiLangParser.An_rest_inlineContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_inline.
def exitAn_rest_inline(self, ctx:ZmeiLangParser.An_rest_inlineContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_inline_decl.
def enterAn_rest_inline_decl(self, ctx:ZmeiLangParser.An_rest_inline_declContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_inline_decl.
def exitAn_rest_inline_decl(self, ctx:ZmeiLangParser.An_rest_inline_declContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_rest_inline_name.
def enterAn_rest_inline_name(self, ctx:ZmeiLangParser.An_rest_inline_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_rest_inline_name.
def exitAn_rest_inline_name(self, ctx:ZmeiLangParser.An_rest_inline_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_order.
def enterAn_order(self, ctx:ZmeiLangParser.An_orderContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_order.
def exitAn_order(self, ctx:ZmeiLangParser.An_orderContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_order_fields.
def enterAn_order_fields(self, ctx:ZmeiLangParser.An_order_fieldsContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_order_fields.
def exitAn_order_fields(self, ctx:ZmeiLangParser.An_order_fieldsContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_clean.
def enterAn_clean(self, ctx:ZmeiLangParser.An_cleanContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_clean.
def exitAn_clean(self, ctx:ZmeiLangParser.An_cleanContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_pre_delete.
def enterAn_pre_delete(self, ctx:ZmeiLangParser.An_pre_deleteContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_pre_delete.
def exitAn_pre_delete(self, ctx:ZmeiLangParser.An_pre_deleteContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_tree.
def enterAn_tree(self, ctx:ZmeiLangParser.An_treeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_tree.
def exitAn_tree(self, ctx:ZmeiLangParser.An_treeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_tree_poly.
def enterAn_tree_poly(self, ctx:ZmeiLangParser.An_tree_polyContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_tree_poly.
def exitAn_tree_poly(self, ctx:ZmeiLangParser.An_tree_polyContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_mixin.
def enterAn_mixin(self, ctx:ZmeiLangParser.An_mixinContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_mixin.
def exitAn_mixin(self, ctx:ZmeiLangParser.An_mixinContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_date_tree.
def enterAn_date_tree(self, ctx:ZmeiLangParser.An_date_treeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_date_tree.
def exitAn_date_tree(self, ctx:ZmeiLangParser.An_date_treeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_date_tree_field.
def enterAn_date_tree_field(self, ctx:ZmeiLangParser.An_date_tree_fieldContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_date_tree_field.
def exitAn_date_tree_field(self, ctx:ZmeiLangParser.An_date_tree_fieldContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_m2m_changed.
def enterAn_m2m_changed(self, ctx:ZmeiLangParser.An_m2m_changedContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_m2m_changed.
def exitAn_m2m_changed(self, ctx:ZmeiLangParser.An_m2m_changedContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_post_save.
def enterAn_post_save(self, ctx:ZmeiLangParser.An_post_saveContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_post_save.
def exitAn_post_save(self, ctx:ZmeiLangParser.An_post_saveContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_pre_save.
def enterAn_pre_save(self, ctx:ZmeiLangParser.An_pre_saveContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_pre_save.
def exitAn_pre_save(self, ctx:ZmeiLangParser.An_pre_saveContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_post_delete.
def enterAn_post_delete(self, ctx:ZmeiLangParser.An_post_deleteContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_post_delete.
def exitAn_post_delete(self, ctx:ZmeiLangParser.An_post_deleteContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_sortable.
def enterAn_sortable(self, ctx:ZmeiLangParser.An_sortableContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_sortable.
def exitAn_sortable(self, ctx:ZmeiLangParser.An_sortableContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_sortable_field_name.
def enterAn_sortable_field_name(self, ctx:ZmeiLangParser.An_sortable_field_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_sortable_field_name.
def exitAn_sortable_field_name(self, ctx:ZmeiLangParser.An_sortable_field_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#page.
def enterPage(self, ctx:ZmeiLangParser.PageContext):
pass
# Exit a parse tree produced by ZmeiLangParser#page.
def exitPage(self, ctx:ZmeiLangParser.PageContext):
pass
# Enter a parse tree produced by ZmeiLangParser#page_header.
def enterPage_header(self, ctx:ZmeiLangParser.Page_headerContext):
pass
# Exit a parse tree produced by ZmeiLangParser#page_header.
def exitPage_header(self, ctx:ZmeiLangParser.Page_headerContext):
pass
# Enter a parse tree produced by ZmeiLangParser#page_base.
def enterPage_base(self, ctx:ZmeiLangParser.Page_baseContext):
pass
# Exit a parse tree produced by ZmeiLangParser#page_base.
def exitPage_base(self, ctx:ZmeiLangParser.Page_baseContext):
pass
# Enter a parse tree produced by ZmeiLangParser#page_alias.
def enterPage_alias(self, ctx:ZmeiLangParser.Page_aliasContext):
pass
# Exit a parse tree produced by ZmeiLangParser#page_alias.
def exitPage_alias(self, ctx:ZmeiLangParser.Page_aliasContext):
pass
# Enter a parse tree produced by ZmeiLangParser#page_alias_name.
def enterPage_alias_name(self, ctx:ZmeiLangParser.Page_alias_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#page_alias_name.
def exitPage_alias_name(self, ctx:ZmeiLangParser.Page_alias_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#page_template.
def enterPage_template(self, ctx:ZmeiLangParser.Page_templateContext):
pass
# Exit a parse tree produced by ZmeiLangParser#page_template.
def exitPage_template(self, ctx:ZmeiLangParser.Page_templateContext):
pass
# Enter a parse tree produced by ZmeiLangParser#template_name.
def enterTemplate_name(self, ctx:ZmeiLangParser.Template_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#template_name.
def exitTemplate_name(self, ctx:ZmeiLangParser.Template_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#file_name_part.
def enterFile_name_part(self, ctx:ZmeiLangParser.File_name_partContext):
pass
# Exit a parse tree produced by ZmeiLangParser#file_name_part.
def exitFile_name_part(self, ctx:ZmeiLangParser.File_name_partContext):
pass
# Enter a parse tree produced by ZmeiLangParser#page_url.
def enterPage_url(self, ctx:ZmeiLangParser.Page_urlContext):
pass
# Exit a parse tree produced by ZmeiLangParser#page_url.
def exitPage_url(self, ctx:ZmeiLangParser.Page_urlContext):
pass
# Enter a parse tree produced by ZmeiLangParser#url_part.
def enterUrl_part(self, ctx:ZmeiLangParser.Url_partContext):
pass
# Exit a parse tree produced by ZmeiLangParser#url_part.
def exitUrl_part(self, ctx:ZmeiLangParser.Url_partContext):
pass
# Enter a parse tree produced by ZmeiLangParser#url_param.
def enterUrl_param(self, ctx:ZmeiLangParser.Url_paramContext):
pass
# Exit a parse tree produced by ZmeiLangParser#url_param.
def exitUrl_param(self, ctx:ZmeiLangParser.Url_paramContext):
pass
# Enter a parse tree produced by ZmeiLangParser#url_segment.
def enterUrl_segment(self, ctx:ZmeiLangParser.Url_segmentContext):
pass
# Exit a parse tree produced by ZmeiLangParser#url_segment.
def exitUrl_segment(self, ctx:ZmeiLangParser.Url_segmentContext):
pass
# Enter a parse tree produced by ZmeiLangParser#url_segments.
def enterUrl_segments(self, ctx:ZmeiLangParser.Url_segmentsContext):
pass
# Exit a parse tree produced by ZmeiLangParser#url_segments.
def exitUrl_segments(self, ctx:ZmeiLangParser.Url_segmentsContext):
pass
# Enter a parse tree produced by ZmeiLangParser#page_name.
def enterPage_name(self, ctx:ZmeiLangParser.Page_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#page_name.
def exitPage_name(self, ctx:ZmeiLangParser.Page_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#page_body.
def enterPage_body(self, ctx:ZmeiLangParser.Page_bodyContext):
pass
# Exit a parse tree produced by ZmeiLangParser#page_body.
def exitPage_body(self, ctx:ZmeiLangParser.Page_bodyContext):
pass
# Enter a parse tree produced by ZmeiLangParser#page_code.
def enterPage_code(self, ctx:ZmeiLangParser.Page_codeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#page_code.
def exitPage_code(self, ctx:ZmeiLangParser.Page_codeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#page_field.
def enterPage_field(self, ctx:ZmeiLangParser.Page_fieldContext):
pass
# Exit a parse tree produced by ZmeiLangParser#page_field.
def exitPage_field(self, ctx:ZmeiLangParser.Page_fieldContext):
pass
# Enter a parse tree produced by ZmeiLangParser#page_field_name.
def enterPage_field_name(self, ctx:ZmeiLangParser.Page_field_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#page_field_name.
def exitPage_field_name(self, ctx:ZmeiLangParser.Page_field_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#page_field_code.
def enterPage_field_code(self, ctx:ZmeiLangParser.Page_field_codeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#page_field_code.
def exitPage_field_code(self, ctx:ZmeiLangParser.Page_field_codeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#page_function.
def enterPage_function(self, ctx:ZmeiLangParser.Page_functionContext):
pass
# Exit a parse tree produced by ZmeiLangParser#page_function.
def exitPage_function(self, ctx:ZmeiLangParser.Page_functionContext):
pass
# Enter a parse tree produced by ZmeiLangParser#page_function_name.
def enterPage_function_name(self, ctx:ZmeiLangParser.Page_function_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#page_function_name.
def exitPage_function_name(self, ctx:ZmeiLangParser.Page_function_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#page_function_args.
def enterPage_function_args(self, ctx:ZmeiLangParser.Page_function_argsContext):
pass
# Exit a parse tree produced by ZmeiLangParser#page_function_args.
def exitPage_function_args(self, ctx:ZmeiLangParser.Page_function_argsContext):
pass
# Enter a parse tree produced by ZmeiLangParser#page_function_arg.
def enterPage_function_arg(self, ctx:ZmeiLangParser.Page_function_argContext):
pass
# Exit a parse tree produced by ZmeiLangParser#page_function_arg.
def exitPage_function_arg(self, ctx:ZmeiLangParser.Page_function_argContext):
pass
# Enter a parse tree produced by ZmeiLangParser#page_annotation.
def enterPage_annotation(self, ctx:ZmeiLangParser.Page_annotationContext):
pass
# Exit a parse tree produced by ZmeiLangParser#page_annotation.
def exitPage_annotation(self, ctx:ZmeiLangParser.Page_annotationContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_stream.
def enterAn_stream(self, ctx:ZmeiLangParser.An_streamContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_stream.
def exitAn_stream(self, ctx:ZmeiLangParser.An_streamContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_stream_model.
def enterAn_stream_model(self, ctx:ZmeiLangParser.An_stream_modelContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_stream_model.
def exitAn_stream_model(self, ctx:ZmeiLangParser.An_stream_modelContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_stream_target_model.
def enterAn_stream_target_model(self, ctx:ZmeiLangParser.An_stream_target_modelContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_stream_target_model.
def exitAn_stream_target_model(self, ctx:ZmeiLangParser.An_stream_target_modelContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_stream_target_filter.
def enterAn_stream_target_filter(self, ctx:ZmeiLangParser.An_stream_target_filterContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_stream_target_filter.
def exitAn_stream_target_filter(self, ctx:ZmeiLangParser.An_stream_target_filterContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_stream_field_list.
def enterAn_stream_field_list(self, ctx:ZmeiLangParser.An_stream_field_listContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_stream_field_list.
def exitAn_stream_field_list(self, ctx:ZmeiLangParser.An_stream_field_listContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_stream_field_name.
def enterAn_stream_field_name(self, ctx:ZmeiLangParser.An_stream_field_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_stream_field_name.
def exitAn_stream_field_name(self, ctx:ZmeiLangParser.An_stream_field_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_react.
def enterAn_react(self, ctx:ZmeiLangParser.An_reactContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_react.
def exitAn_react(self, ctx:ZmeiLangParser.An_reactContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_react_type.
def enterAn_react_type(self, ctx:ZmeiLangParser.An_react_typeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_react_type.
def exitAn_react_type(self, ctx:ZmeiLangParser.An_react_typeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_react_descriptor.
def enterAn_react_descriptor(self, ctx:ZmeiLangParser.An_react_descriptorContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_react_descriptor.
def exitAn_react_descriptor(self, ctx:ZmeiLangParser.An_react_descriptorContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_react_child.
def enterAn_react_child(self, ctx:ZmeiLangParser.An_react_childContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_react_child.
def exitAn_react_child(self, ctx:ZmeiLangParser.An_react_childContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_html.
def enterAn_html(self, ctx:ZmeiLangParser.An_htmlContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_html.
def exitAn_html(self, ctx:ZmeiLangParser.An_htmlContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_html_descriptor.
def enterAn_html_descriptor(self, ctx:ZmeiLangParser.An_html_descriptorContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_html_descriptor.
def exitAn_html_descriptor(self, ctx:ZmeiLangParser.An_html_descriptorContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_markdown.
def enterAn_markdown(self, ctx:ZmeiLangParser.An_markdownContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_markdown.
def exitAn_markdown(self, ctx:ZmeiLangParser.An_markdownContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_markdown_descriptor.
def enterAn_markdown_descriptor(self, ctx:ZmeiLangParser.An_markdown_descriptorContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_markdown_descriptor.
def exitAn_markdown_descriptor(self, ctx:ZmeiLangParser.An_markdown_descriptorContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_delete.
def enterAn_crud_delete(self, ctx:ZmeiLangParser.An_crud_deleteContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_delete.
def exitAn_crud_delete(self, ctx:ZmeiLangParser.An_crud_deleteContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud.
def enterAn_crud(self, ctx:ZmeiLangParser.An_crudContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud.
def exitAn_crud(self, ctx:ZmeiLangParser.An_crudContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_params.
def enterAn_crud_params(self, ctx:ZmeiLangParser.An_crud_paramsContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_params.
def exitAn_crud_params(self, ctx:ZmeiLangParser.An_crud_paramsContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_page_override.
def enterAn_crud_page_override(self, ctx:ZmeiLangParser.An_crud_page_overrideContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_page_override.
def exitAn_crud_page_override(self, ctx:ZmeiLangParser.An_crud_page_overrideContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_descriptor.
def enterAn_crud_descriptor(self, ctx:ZmeiLangParser.An_crud_descriptorContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_descriptor.
def exitAn_crud_descriptor(self, ctx:ZmeiLangParser.An_crud_descriptorContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_next_page.
def enterAn_crud_next_page(self, ctx:ZmeiLangParser.An_crud_next_pageContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_next_page.
def exitAn_crud_next_page(self, ctx:ZmeiLangParser.An_crud_next_pageContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_next_page_event_name.
def enterAn_crud_next_page_event_name(self, ctx:ZmeiLangParser.An_crud_next_page_event_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_next_page_event_name.
def exitAn_crud_next_page_event_name(self, ctx:ZmeiLangParser.An_crud_next_page_event_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_next_page_url.
def enterAn_crud_next_page_url(self, ctx:ZmeiLangParser.An_crud_next_page_urlContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_next_page_url.
def exitAn_crud_next_page_url(self, ctx:ZmeiLangParser.An_crud_next_page_urlContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_next_page_url_val.
def enterAn_crud_next_page_url_val(self, ctx:ZmeiLangParser.An_crud_next_page_url_valContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_next_page_url_val.
def exitAn_crud_next_page_url_val(self, ctx:ZmeiLangParser.An_crud_next_page_url_valContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_target_model.
def enterAn_crud_target_model(self, ctx:ZmeiLangParser.An_crud_target_modelContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_target_model.
def exitAn_crud_target_model(self, ctx:ZmeiLangParser.An_crud_target_modelContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_target_filter.
def enterAn_crud_target_filter(self, ctx:ZmeiLangParser.An_crud_target_filterContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_target_filter.
def exitAn_crud_target_filter(self, ctx:ZmeiLangParser.An_crud_target_filterContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_theme.
def enterAn_crud_theme(self, ctx:ZmeiLangParser.An_crud_themeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_theme.
def exitAn_crud_theme(self, ctx:ZmeiLangParser.An_crud_themeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_url_prefix.
def enterAn_crud_url_prefix(self, ctx:ZmeiLangParser.An_crud_url_prefixContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_url_prefix.
def exitAn_crud_url_prefix(self, ctx:ZmeiLangParser.An_crud_url_prefixContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_url_prefix_val.
def enterAn_crud_url_prefix_val(self, ctx:ZmeiLangParser.An_crud_url_prefix_valContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_url_prefix_val.
def exitAn_crud_url_prefix_val(self, ctx:ZmeiLangParser.An_crud_url_prefix_valContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_link_suffix.
def enterAn_crud_link_suffix(self, ctx:ZmeiLangParser.An_crud_link_suffixContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_link_suffix.
def exitAn_crud_link_suffix(self, ctx:ZmeiLangParser.An_crud_link_suffixContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_link_suffix_val.
def enterAn_crud_link_suffix_val(self, ctx:ZmeiLangParser.An_crud_link_suffix_valContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_link_suffix_val.
def exitAn_crud_link_suffix_val(self, ctx:ZmeiLangParser.An_crud_link_suffix_valContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_item_name.
def enterAn_crud_item_name(self, ctx:ZmeiLangParser.An_crud_item_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_item_name.
def exitAn_crud_item_name(self, ctx:ZmeiLangParser.An_crud_item_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_object_expr.
def enterAn_crud_object_expr(self, ctx:ZmeiLangParser.An_crud_object_exprContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_object_expr.
def exitAn_crud_object_expr(self, ctx:ZmeiLangParser.An_crud_object_exprContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_can_edit.
def enterAn_crud_can_edit(self, ctx:ZmeiLangParser.An_crud_can_editContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_can_edit.
def exitAn_crud_can_edit(self, ctx:ZmeiLangParser.An_crud_can_editContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_block.
def enterAn_crud_block(self, ctx:ZmeiLangParser.An_crud_blockContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_block.
def exitAn_crud_block(self, ctx:ZmeiLangParser.An_crud_blockContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_pk_param.
def enterAn_crud_pk_param(self, ctx:ZmeiLangParser.An_crud_pk_paramContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_pk_param.
def exitAn_crud_pk_param(self, ctx:ZmeiLangParser.An_crud_pk_paramContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_skip.
def enterAn_crud_skip(self, ctx:ZmeiLangParser.An_crud_skipContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_skip.
def exitAn_crud_skip(self, ctx:ZmeiLangParser.An_crud_skipContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_skip_values.
def enterAn_crud_skip_values(self, ctx:ZmeiLangParser.An_crud_skip_valuesContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_skip_values.
def exitAn_crud_skip_values(self, ctx:ZmeiLangParser.An_crud_skip_valuesContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_view_name.
def enterAn_crud_view_name(self, ctx:ZmeiLangParser.An_crud_view_nameContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_view_name.
def exitAn_crud_view_name(self, ctx:ZmeiLangParser.An_crud_view_nameContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_fields.
def enterAn_crud_fields(self, ctx:ZmeiLangParser.An_crud_fieldsContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_fields.
def exitAn_crud_fields(self, ctx:ZmeiLangParser.An_crud_fieldsContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_list_type.
def enterAn_crud_list_type(self, ctx:ZmeiLangParser.An_crud_list_typeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_list_type.
def exitAn_crud_list_type(self, ctx:ZmeiLangParser.An_crud_list_typeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_list_type_var.
def enterAn_crud_list_type_var(self, ctx:ZmeiLangParser.An_crud_list_type_varContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_list_type_var.
def exitAn_crud_list_type_var(self, ctx:ZmeiLangParser.An_crud_list_type_varContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_header.
def enterAn_crud_header(self, ctx:ZmeiLangParser.An_crud_headerContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_header.
def exitAn_crud_header(self, ctx:ZmeiLangParser.An_crud_headerContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_header_enabled.
def enterAn_crud_header_enabled(self, ctx:ZmeiLangParser.An_crud_header_enabledContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_header_enabled.
def exitAn_crud_header_enabled(self, ctx:ZmeiLangParser.An_crud_header_enabledContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_fields_expr.
def enterAn_crud_fields_expr(self, ctx:ZmeiLangParser.An_crud_fields_exprContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_fields_expr.
def exitAn_crud_fields_expr(self, ctx:ZmeiLangParser.An_crud_fields_exprContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_field.
def enterAn_crud_field(self, ctx:ZmeiLangParser.An_crud_fieldContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_field.
def exitAn_crud_field(self, ctx:ZmeiLangParser.An_crud_fieldContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_field_spec.
def enterAn_crud_field_spec(self, ctx:ZmeiLangParser.An_crud_field_specContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_field_spec.
def exitAn_crud_field_spec(self, ctx:ZmeiLangParser.An_crud_field_specContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_field_filter.
def enterAn_crud_field_filter(self, ctx:ZmeiLangParser.An_crud_field_filterContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_field_filter.
def exitAn_crud_field_filter(self, ctx:ZmeiLangParser.An_crud_field_filterContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_list_fields.
def enterAn_crud_list_fields(self, ctx:ZmeiLangParser.An_crud_list_fieldsContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_list_fields.
def exitAn_crud_list_fields(self, ctx:ZmeiLangParser.An_crud_list_fieldsContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_list_fields_expr.
def enterAn_crud_list_fields_expr(self, ctx:ZmeiLangParser.An_crud_list_fields_exprContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_list_fields_expr.
def exitAn_crud_list_fields_expr(self, ctx:ZmeiLangParser.An_crud_list_fields_exprContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_list_field.
def enterAn_crud_list_field(self, ctx:ZmeiLangParser.An_crud_list_fieldContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_list_field.
def exitAn_crud_list_field(self, ctx:ZmeiLangParser.An_crud_list_fieldContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_list_field_spec.
def enterAn_crud_list_field_spec(self, ctx:ZmeiLangParser.An_crud_list_field_specContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_list_field_spec.
def exitAn_crud_list_field_spec(self, ctx:ZmeiLangParser.An_crud_list_field_specContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_post.
def enterAn_post(self, ctx:ZmeiLangParser.An_postContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_post.
def exitAn_post(self, ctx:ZmeiLangParser.An_postContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_auth.
def enterAn_auth(self, ctx:ZmeiLangParser.An_authContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_auth.
def exitAn_auth(self, ctx:ZmeiLangParser.An_authContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_create.
def enterAn_crud_create(self, ctx:ZmeiLangParser.An_crud_createContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_create.
def exitAn_crud_create(self, ctx:ZmeiLangParser.An_crud_createContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_edit.
def enterAn_crud_edit(self, ctx:ZmeiLangParser.An_crud_editContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_edit.
def exitAn_crud_edit(self, ctx:ZmeiLangParser.An_crud_editContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_list.
def enterAn_crud_list(self, ctx:ZmeiLangParser.An_crud_listContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_list.
def exitAn_crud_list(self, ctx:ZmeiLangParser.An_crud_listContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_menu.
def enterAn_menu(self, ctx:ZmeiLangParser.An_menuContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_menu.
def exitAn_menu(self, ctx:ZmeiLangParser.An_menuContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_menu_descriptor.
def enterAn_menu_descriptor(self, ctx:ZmeiLangParser.An_menu_descriptorContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_menu_descriptor.
def exitAn_menu_descriptor(self, ctx:ZmeiLangParser.An_menu_descriptorContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_menu_item.
def enterAn_menu_item(self, ctx:ZmeiLangParser.An_menu_itemContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_menu_item.
def exitAn_menu_item(self, ctx:ZmeiLangParser.An_menu_itemContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_menu_target.
def enterAn_menu_target(self, ctx:ZmeiLangParser.An_menu_targetContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_menu_target.
def exitAn_menu_target(self, ctx:ZmeiLangParser.An_menu_targetContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_menu_item_code.
def enterAn_menu_item_code(self, ctx:ZmeiLangParser.An_menu_item_codeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_menu_item_code.
def exitAn_menu_item_code(self, ctx:ZmeiLangParser.An_menu_item_codeContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_menu_item_args.
def enterAn_menu_item_args(self, ctx:ZmeiLangParser.An_menu_item_argsContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_menu_item_args.
def exitAn_menu_item_args(self, ctx:ZmeiLangParser.An_menu_item_argsContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_menu_item_arg.
def enterAn_menu_item_arg(self, ctx:ZmeiLangParser.An_menu_item_argContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_menu_item_arg.
def exitAn_menu_item_arg(self, ctx:ZmeiLangParser.An_menu_item_argContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_menu_item_arg_key.
def enterAn_menu_item_arg_key(self, ctx:ZmeiLangParser.An_menu_item_arg_keyContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_menu_item_arg_key.
def exitAn_menu_item_arg_key(self, ctx:ZmeiLangParser.An_menu_item_arg_keyContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_menu_item_arg_val.
def enterAn_menu_item_arg_val(self, ctx:ZmeiLangParser.An_menu_item_arg_valContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_menu_item_arg_val.
def exitAn_menu_item_arg_val(self, ctx:ZmeiLangParser.An_menu_item_arg_valContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_menu_item_url.
def enterAn_menu_item_url(self, ctx:ZmeiLangParser.An_menu_item_urlContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_menu_item_url.
def exitAn_menu_item_url(self, ctx:ZmeiLangParser.An_menu_item_urlContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_menu_item_page.
def enterAn_menu_item_page(self, ctx:ZmeiLangParser.An_menu_item_pageContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_menu_item_page.
def exitAn_menu_item_page(self, ctx:ZmeiLangParser.An_menu_item_pageContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_menu_item_page_ref.
def enterAn_menu_item_page_ref(self, ctx:ZmeiLangParser.An_menu_item_page_refContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_menu_item_page_ref.
def exitAn_menu_item_page_ref(self, ctx:ZmeiLangParser.An_menu_item_page_refContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_menu_label.
def enterAn_menu_label(self, ctx:ZmeiLangParser.An_menu_labelContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_menu_label.
def exitAn_menu_label(self, ctx:ZmeiLangParser.An_menu_labelContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_crud_detail.
def enterAn_crud_detail(self, ctx:ZmeiLangParser.An_crud_detailContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_crud_detail.
def exitAn_crud_detail(self, ctx:ZmeiLangParser.An_crud_detailContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_priority_marker.
def enterAn_priority_marker(self, ctx:ZmeiLangParser.An_priority_markerContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_priority_marker.
def exitAn_priority_marker(self, ctx:ZmeiLangParser.An_priority_markerContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_get.
def enterAn_get(self, ctx:ZmeiLangParser.An_getContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_get.
def exitAn_get(self, ctx:ZmeiLangParser.An_getContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_error.
def enterAn_error(self, ctx:ZmeiLangParser.An_errorContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_error.
def exitAn_error(self, ctx:ZmeiLangParser.An_errorContext):
pass
# Enter a parse tree produced by ZmeiLangParser#an_error_code.
def enterAn_error_code(self, ctx:ZmeiLangParser.An_error_codeContext):
pass
# Exit a parse tree produced by ZmeiLangParser#an_error_code.
def exitAn_error_code(self, ctx:ZmeiLangParser.An_error_codeContext):
pass | zmei-cli | /zmei-cli-2.1.10.tar.gz/zmei-cli-2.1.10/zmei_generator/parser/gen/ZmeiLangParserListener.py | ZmeiLangParserListener.py |
# Flutter plugin for [Zmei generator](https://github.com/zmei-framework/generator)
[](https://codeclimate.com/github/zmei-framework/zmei-gen-flutter/maintainability)
[](https://codeclimate.com/github/zmei-framework/zmei-gen-flutter/test_coverage)
[](https://travis-ci.org/zmei-framework/zmei-gen-flutter)
This is Zmei generator plugin that adds flutter generator support.
## Features
- Generate pages
- Generate menus
- Automatically fetch data from django page
- Automatically connect to websocket streams if any
## Installation
Generator is written in python. Install with pip python packaging tool (preferably in virtual environment):
`pip install zmei-gen-flutter`
## Quick start
Just add @flutter to any page:
[index: /]
@flutter
Also you may mark all subpages as flutter as well:
[base]
@flutter(child: true)
[base->index]
Plugin understand two types of menu:
// this is drawer menu
@menu.flutter_drawer(
[transition=inFromRight, color=green] "Заказчик": page(client.index)
[transition=inFromRight, color=orange] "Перевозчик": page(carrier.index)
[transition=inFromRight, color=blue] "Водитель": page(driver.index)
[icon=settings] "Настройки": page(settings)
[icon=power_settings_new] "Выход": page(logout)
)
// this is bottom menu
@menu.flutter_bottom(
"Home": page(index)
"Profile": page(profile)
)
## Contribution
Contributions are highly appreciated. Project is huge and it is hard to develop it alone.
You can contribute by:
- Improve documentation
- Test, write bug reports, propose features
- Add new features
- Fix bugs, improve code base, add your features
- Write articles, blog-posts with your experience using the generator
- Write plugins, improve existing ones
## Development
pip install -r requirements-dev.txt
pip install -e .
zmei build
py.test
## Authors
### Conributors
- Alex Rudakov @ribozz (maintainer)
### Thanks to
...
## LEGAL NOTICE
Source code is distributed under GNU General Public License v3.0 licence. Full licence text is available in LICENSE file.
In-short about GPLv3:
- All software that use Zmei-generator as it's part **MUST** be open-sourced as well: plugins, other generators
based on it, etc.
- You **CAN NOT** take Zmei-generator and sell it as a paid service without open-sourcing it
- But, you **CAN** use Zmei generator as a tool to write any software including private closed source software
Software is free for non-commercial use. For commercial use ask for dual-licensing options.
| zmei-gen-flutter | /zmei-gen-flutter-0.1.3.tar.gz/zmei-gen-flutter-0.1.3/README.md | README.md |
from copy import copy
from zmei_generator.domain.extensions import PageExtension
from zmei_generator.parser.gen.ZmeiLangParser import ZmeiLangParser
from zmei_generator.parser.utils import BaseListener
from zmei_generator.contrib.web.extensions.page.block import InlinePageBlock, InlineTemplatePageBlock
class FlutterPageExtension(PageExtension):
def __init__(self, page) -> None:
super().__init__(page)
self.include_child = False
@property
def can_inherit(self):
return self.include_child
def filter_blocks(self, area, blocks, platform):
filtered = []
if platform == FlutterPageExtension:
for block in blocks:
if isinstance(block, InlineTemplatePageBlock):
if block.template_name.startswith('theme/'):
new_context = copy(block.context)
block = InlineTemplatePageBlock(template_name='flutter/' + block.template_name, ref=block.ref)
block.context = new_context
else:
continue
filtered.append(block)
else:
# other platforms:
filtered = []
for block in blocks:
if isinstance(block, InlineTemplatePageBlock):
continue
filtered.append(block)
return filtered
class FlutterPageExtensionParserListener(BaseListener):
def enterAn_flutter(self, ctx: ZmeiLangParser.An_flutterContext):
extension = FlutterPageExtension(self.page)
self.application.extensions.append(
extension
)
self.set_flutter(self.page, extension)
def enterAn_flutter_child(self, ctx: ZmeiLangParser.An_flutter_childContext):
if str(ctx.BOOL()) == 'true':
self.page[FlutterPageExtension].include_child = True
def set_flutter(self, page, extension):
page.register_extension(extension)
if page.get_parent():
parent = page.get_parent()
if not parent.supports(FlutterPageExtension):
self.set_flutter(parent, extension) | zmei-gen-flutter | /zmei-gen-flutter-0.1.3.tar.gz/zmei-gen-flutter-0.1.3/zmei_gen_flutter/extensions/page/flutter.py | flutter.py |
import os
import re
import subprocess
from zmei_generator.contrib.channels.extensions.pages.stream import StreamPageExtension
from zmei_generator.contrib.web.fields.relation import RelationDef
from zmei_generator.domain.reference_field import ReferenceField
from zmei_generator.generator.utils import generate_file, to_camel_case, format_uri, to_camel_case_classname
from zmei_generator.contrib.web.extensions.page.crud import CrudPageExtension
from zmei_generator.contrib.web.extensions.page.menu import MenuPageExtension
from zmei_gen_flutter.extensions.page.flutter import FlutterPageExtension
def generate(target_path, project):
apps = project.applications
has_flutter = any([app.pages_support(FlutterPageExtension) for app in project.applications.values()])
if not has_flutter:
return
generate_file(target_path, 'flutter/pubspec.yaml', 'flutter.pubspec.yaml.tpl')
generate_file(target_path, 'flutter/lib/main.dart', 'flutter.main.dart.tpl', {
'host': os.environ.get('ZMEI_SERVER_HOST')
})
for app_name, application in apps.items():
if application.models:
imports = set()
for col in application.models.values():
for field in col.fields.values():
if isinstance(field, ReferenceField) and field.target_model:
if field.target_model.application != application:
imports.add(field.target_model.application.app_name)
elif isinstance(field, RelationDef) and field.ref_model:
if field.ref_model.application != application:
imports.add(field.ref_model.application.app_name)
generate_file(
target_path,
f'flutter/lib/src/models/{app_name}.dart',
'flutter.model.dart.tpl', {
'app_name': app_name,
'application': application,
'to_camel_case': to_camel_case,
'imports': imports
}
)
if application.pages_support(FlutterPageExtension):
for name, page in application.pages.items():
if page.get_own_or_parent_extension(FlutterPageExtension):
imports = set()
extra_imports = ''
page_items = {}
for item_name in page.own_item_names:
item = page.page_items[item_name]
if item.model_name:
col = application.resolve_model(item.model_name)
# if col.application != application:
imports.add(col.application.app_name)
page_items[item_name] = (item, col)
else:
page_items[item_name] = (item, None)
blocks_rendered = {}
for area, blocks in page.get_blocks(platform=FlutterPageExtension).items():
blocks_rendered[area] = []
for index, block in enumerate(blocks):
rendered = block.render(area=area, index=index)
filtered = ''
for line in rendered.splitlines():
if re.match("^\s*import\s+'[^']+'\s*;\s*$", line):
extra_imports += f"{line.strip()}\n"
else:
filtered += f"{line.strip()}\n"
blocks_rendered[area].append((block.ref, filtered))
generate_file(
target_path,
f'flutter/lib/src/pages/{app_name}/{name}.dart',
'flutter.page.dart.tpl', {
'app_name': app_name,
'app': application,
'page': page,
'blocks': blocks_rendered,
'crud_ext': CrudPageExtension,
'menu_ext': MenuPageExtension,
'stream_ext': StreamPageExtension,
'page_items': page_items,
'imports': imports,
'extra_imports': extra_imports,
'format_uri': format_uri,
'to_camel_case': to_camel_case,
'to_camel_case_classname': to_camel_case_classname,
}
)
generate_file(
target_path,
f'flutter/lib/src/ui/{app_name}/{name}_ui.dart',
'flutter.page.ui.dart.tpl', {
'app_name': app_name,
'app': application,
'page': page,
'to_camel_case': to_camel_case,
'to_camel_case_classname': to_camel_case_classname,
}
)
generate_file(target_path, 'flutter/lib/src/components/menu.dart', 'flutter.cmp.menu.dart.tpl')
generate_file(target_path, 'flutter/lib/src/state.dart', 'flutter.state.dart.tpl')
generate_file(target_path, 'flutter/lib/src/utils.dart', 'flutter.utils.dart.tpl')
generate_file(
target_path,
f'flutter/lib/src/app.dart',
'flutter.app.dart.tpl', {
'apps': apps,
}
)
max_len = 0
app_routes = {}
for app_name, app in apps.items():
if app.pages_support(FlutterPageExtension):
for name, page in app.pages.items():
if page.get_own_or_parent_extension(FlutterPageExtension) and page.uri:
uri = format_uri(page.uri)
app_routes[uri] = f'{page.view_name}StateUi'
max_len = max(max_len, len(uri))
generate_file(
target_path,
f'flutter/lib/src/routes.dart',
'flutter.routes.dart.tpl', {
'apps': apps,
'app_routes': app_routes,
'max_len': max_len,
'len': len,
'ext': FlutterPageExtension,
'format_uri': format_uri,
'to_camel_case': to_camel_case,
'to_camel_case_classname': to_camel_case_classname,
}
)
flutter_dir = os.path.join(target_path, 'flutter')
if os.path.exists(flutter_dir):
subprocess.check_call(['dartfmt', '-w', '-l', '120', flutter_dir], stdout=subprocess.DEVNULL) | zmei-gen-flutter | /zmei-gen-flutter-0.1.3.tar.gz/zmei-gen-flutter-0.1.3/zmei_gen_flutter/generator/flutter.py | flutter.py |
import atexit
import os
import signal
import sys
from glob import glob
import click
from termcolor import colored
from genius_cli.client import GeniusClient, ApiError
from genius_cli.utils import collect_files, extract_files, collect_app_names, migrate_db, install_deps, remove_db, \
wait_for_file_changes, run_django, run_webpack, npm_install, get_watch_paths
def run():
api_token = os.environ.get('GENIUS_TOKEN', None)
features_env = os.environ.get('GENIUS_FEATURES', None)
# if not api_token:
# print('No genius api token. Add GENIUS_TOKEN variable to your profile.')
# sys.exit(1)
genius = GeniusClient(
api_url=os.environ.get('ZMEI_URL', 'http://ng.genius-project.io:9000/api/'),
token=api_token,
)
@click.group()
@click.option('--src', default='.', help='Sources path')
@click.option('--dst', default='.', help='Target path')
def cli(**args):
pass
@cli.command(help='Deploy to hyper.sh')
def config(**args):
print('Deploy!')
pass
@cli.command(help='Deploy to hyper.sh')
def deploy(**args):
print('Deploy!')
@cli.command(help='Generate and start app')
def up(**args):
print('Up!')
gen(up=True, **args)
@cli.command(help='Run application')
@click.option('--nodejs', is_flag=True, help='Initialize nodejs dependencies')
@click.option('--watch', is_flag=True, help='Watch for changes')
@click.option('--webpack', is_flag=True, help='Run webpack with reload when generation ends')
@click.option('--port', default='8000', help='Django host:port to run on')
@click.option('--host', default=None, help='Django host:port to run on')
def run(**kwargs):
print('Run!')
gen(run=True, **kwargs)
@cli.command(help='Just generate the code')
@click.argument('app', nargs=-1)
def generate(app=None, **args):
print('generate!')
gen(install=True, app=app or [])
@cli.command(help='Install project dependencies')
def install():
print('Install!')
gen(install=True)
@cli.group(help='Database related commands')
def db(**args):
pass
@db.command(help='Creates database migrations and apply them')
@click.argument('app', nargs=-1)
def migrate(app, **args):
print('Db migrate!', app)
gen(auto=True, app=app)
@db.command(help='db remove + db migrate')
@click.argument('app', nargs=-1)
def rebuild(app, **args):
print('Db rebuild!', app)
gen(rebuild=True, app=app)
@db.command(help='Rollback all the migrations')
@click.argument('app', nargs=-1)
def remove(app, **args):
print('Db remove!', app)
gen(remove=True, app=app)
def gen(auto=False,
src='.',
dst='.',
install=False,
rebuild=False,
remove=False,
app=None,
run=False,
webpack=False,
nodejs=False,
host=None,
port=8000,
watch=False,
up=False
):
if rebuild:
auto = True
remove = True
if not host:
host = '127.0.0.1:{}'.format(port)
if up:
install = True
auto = True
watch = True
run = True
if not app or len(app) == 0:
app = collect_app_names()
src = os.path.realpath(src)
dst = os.path.realpath(dst)
django_process = None
webpack_process = None
def emergency_stop():
if django_process:
os.killpg(os.getpgid(django_process.pid), signal.SIGTERM)
if webpack_process:
os.killpg(os.getpgid(webpack_process.pid), signal.SIGTERM)
atexit.register(emergency_stop)
for i in wait_for_file_changes(get_watch_paths(), watch=watch):
print('--------------------------------------------')
print('Generating ...')
print('--------------------------------------------')
files = collect_files(src)
try:
files = genius.generate(files, collections=app)
extract_files(dst, files)
if up and os.path.exists('react'):
webpack = True
nodejs = True
if nodejs and os.path.exists('react'):
npm_install()
if remove:
remove_db(apps=app)
if install or rebuild:
django_process = install_deps(django_process)
if auto:
migrate_db(apps=app)
if run and not django_process:
django_process = run_django(run_host=host)
if webpack and not webpack_process:
webpack_process = run_webpack()
except ApiError:
pass
if watch:
print(colored('> ', 'white', 'on_blue'), 'Watching for changes...')
cli() | zmei-gen | /zmei-gen-1.1.0.tar.gz/zmei-gen-1.1.0/genius_cli/main.py | main.py |
import ast
import re
from abc import abstractmethod
import os
from bs4 import BeautifulSoup, NavigableString
from pyparsing import *
from jinja2 import Environment, FileSystemLoader, TemplateNotFound
from termcolor import colored
class Value(object):
def __init__(self, val):
self.val = val
def parsed(self):
return self.expr
@abstractmethod
def expr(self):
pass
@abstractmethod
def __str__(self):
pass
class ExpressionValue(Value):
def parsed(self):
return ast.literal_eval(self.val)
def expr(self):
return self.val
def __str__(self) -> str:
return '{{ ' + self.expr() + ' }}'
class StringValue(Value):
def expr(self):
return '"{}"'.format(self.val.replace('"', "'"))
def __str__(self) -> str:
return self.val
class TranslatableStringValue(StringValue):
def expr(self):
return super().expr() + '|_'
def __str__(self) -> str:
return '{{ ' + self.expr() + ' }}'
loaded_themes = {}
def render_template(theme_folder, template_name, context):
context = context or {}
if theme_folder not in loaded_themes:
loader = FileSystemLoader(theme_folder)
env = Environment(loader=loader,
variable_start_string='<{',
variable_end_string='}>',
block_start_string='<%',
block_end_string='%>'
)
def expr(val):
return val.expr()
env.filters['expr'] = expr
loaded_themes[theme_folder] = env
else:
env = loaded_themes[theme_folder]
template = env.get_template(template_name)
return template.render(**context)
def render_tag(el, theme_name='default', replace=True):
self_content = ""
for child in el.children:
if isinstance(child, NavigableString):
self_content += "\n" + str(child) # str(parse_val(str(child).strip()))
else:
print(type(child), child)
self_content += "\n" + render_tag(child, replace=False)
context = {'_': self_content}
for key, val in el.attrs.items():
context[key] = parse_val(val)
m = re.match('^block:([a-z0-9_]+)$', el.name)
if m:
tag_template = '{{% block {} %}}{}{{% endblock %}}'.format(m.group(1), self_content)
else:
theme_folder = 'col/themes/{}'.format(theme_name)
template_name = '{}.html'.format(el.name.replace('.', '/'))
try:
tag_template = render_template(theme_folder, template_name, context=context)
except TemplateNotFound:
print(colored(
'Warning!', on_color='on_red'),
'Can not load template: ',
colored(template_name, on_color='on_blue'),
'Theme folder:', theme_folder
)
tag_template = self_content
if replace:
el.replaceWith(tag_template)
return tag_template
def parse_val(val):
if len(val) and val[0] == '!':
new_val = ast.literal_eval(val[1:])
elif len(val) and val[0] == '$':
new_val = TranslatableStringValue(val[1:])
elif len(val) and val[0] == '@':
new_val = ExpressionValue(val[1:])
else:
new_val = StringValue(val)
return new_val
def unescape_html(html):
html = html.replace('<', '<')
html = html.replace('>', '>')
html = html.replace('&', '&')
return html
def render_blocks(file_source):
parts = file_source.split('<genius:blocks')
if len(parts) > 0:
content = []
for idx, part in enumerate(parts):
if idx == 0:
content.append(part)
else:
sub = part.split('</genius:blocks>')
if len(sub) != 2:
print('WARN: Error parsing template file: not closed <genius:blocks> tag?')
continue
block_html = '<genius:blocks' + sub[0] + '</genius:blocks>'
block = BeautifulSoup(block_html, "html.parser")
theme = block.attrs.get('theme', 'default')
for block_tag in block.children:
for subtag in block_tag.children:
if isinstance(subtag, str):
continue
render_tag(subtag, theme_name=theme)
first_block = list(block.children)[0]
first_block.unwrap()
source = unescape_html(str(block))
content.append(source)
content.append(sub[1])
file_source = ''.join(content)
return file_source | zmei-gen | /zmei-gen-1.1.0.tar.gz/zmei-gen-1.1.0/genius_cli/blocks.py | blocks.py |
import json
import os
from django.conf import settings
from django.http import HttpResponse
from py_mini_racer import py_mini_racer
from py_mini_racer.py_mini_racer import MiniRacerBaseException
from zmei.json import ZmeiReactJsonEncoder
from .views import ZmeiDataViewMixin, ImproperlyConfigured, ZmeiRemoteInvocationViewMixin
class ZmeiReactServer(object):
def __init__(self):
super().__init__()
self.loaded_files = []
self.loaded_files_mtime = {}
self.jsi = None
self.checksum = None
def reload_interpreter(self):
self.jsi = py_mini_racer.MiniRacer()
code = """
var global = this;
var module = {exports: {}};
var setTimeout = function(){};
var clearTimeout = function(){};var console = {
error: function() {},
log: function() {},
warn: function() {}
};
"""
self.jsi.eval(code)
for filename in self.loaded_files:
self.loaded_files_mtime[filename] = os.path.getmtime(filename)
self.eval_file(filename)
def autreload(self):
if len(self.loaded_files_mtime) == 0:
return
for filename in self.loaded_files:
if self.loaded_files_mtime[filename] != os.path.getmtime(filename):
print('Reloading ZmeiReactServer')
self.reload_interpreter()
break
def evaljs(self, code):
if not self.jsi:
self.reload_interpreter()
return self.jsi.eval(code)
# except JSRuntimeError as e:
# message = str(e)
#
# message = '\n' + colored('Error:', 'white', 'on_red') + ' ' + message
#
# print(message)
# m = re.search('\(line\s+([0-9]+)\)', message)
# if m:
# print('-' * 100)
# print('Source code:')
# print('-' * 100)
# row = int(m.group(1)) - 1
# source = code.splitlines()
#
# line = colored(source[row], 'white', 'on_red')
# print('\n'.join([f'{x+1}:\t{source[x]}' for x in range(max(0, row - 10), row)]))
# print(f'{row+1}:\t{line}')
# print('\n'.join([f'{x+1}:\t{source[x]}' for x in range(row + 1, min(row + 10, len(source) - 1))]))
# print('-' * 100)
def load(self, filename):
self.loaded_files.append(filename)
def eval_file(self, filename):
with open(filename) as f:
self.evaljs(f.read())
class ZmeiReactViewMixin(ZmeiRemoteInvocationViewMixin):
react_server = None
react_components = None
server_render = True
def get_context_data(self, **kwargs):
data = super().get_context_data(**kwargs)
if not isinstance(self.react_server, ZmeiReactServer):
raise ImproperlyConfigured('ZmeiReactViewMixin requires react_server property')
if not isinstance(self.react_components, list):
raise ImproperlyConfigured('ZmeiReactViewMixin requires react_component property')
data['react_state'] = ZmeiReactJsonEncoder(view=self).encode(self._get_data())
if settings.DEBUG:
self.react_server.autreload()
if self.server_render:
for cmp in self.react_components:
try:
data[f'react_page_{cmp}'] = self.react_server.evaljs(f"R.renderServer(R.{cmp}Reducer, R.{cmp}, {data['react_state']});")
# print('WARN! Server-side rendering disabled!')
except MiniRacerBaseException as e:
data[f'react_page_{cmp}'] = f'<script>var err = {json.dumps({"msg": str(e)})}; ' \
f'document.body.innerHTML = ' \
"'<h2>Error rendering React component. See console for details.</h2>' + " \
f'"<pre>" + err.msg + "</pre>" + document.body.innerHTML;</script>'
return data | zmei-utils | /zmei-utils-0.1.15.tar.gz/zmei-utils-0.1.15/zmei/react.py | react.py |
import json
from pprint import pprint
from django.http import HttpResponse
from django.utils.decorators import classonlymethod
from django.views.decorators.csrf import ensure_csrf_cookie, csrf_exempt
from django.views.generic.base import View, ContextMixin, TemplateResponseMixin
from zmei.json import ZmeiReactJsonEncoder
class ImproperlyConfigured(Exception):
pass
class _Data(object):
def __init__(self, data=None):
self.__dict__.update(data or {})
def __add__(self, data):
return _Data({**self.__dict__, **data})
class ZmeiDataViewMixin(ContextMixin, View):
_data = None
def get_data(self, url, request, inherited=False):
return {}
def _get_data(self):
if not self._data:
url = type('url', (object,), self.kwargs)
self._data = self.get_data(
url=url,
request=self.request,
inherited=False
)
self._data['url'] = url
return self._data
def get_context_data(self, **kwargs):
context_data = super().get_context_data(**kwargs)
return {**context_data, **self._get_data()}
class ZmeiRemoteInvocationViewMixin(ZmeiDataViewMixin):
def get(self, request, *args, **kwargs):
context = self.get_context_data(**kwargs)
accept = self.request.META.get('HTTP_ACCEPT')
if accept and 'application/json' in accept:
return HttpResponse(ZmeiReactJsonEncoder(view=self).encode(self._get_data()), content_type='application/json')
return self.render_to_response(context)
@classonlymethod
def as_view(cls, **initkwargs):
return ensure_csrf_cookie(super().as_view(**initkwargs))
def _remote_response(self, data):
return HttpResponse(ZmeiReactJsonEncoder(view=self).encode(data), content_type='application/json')
def state(self, data):
return {'__state__': data}
def error(self, data):
return {'__error__': data}
def post(self, request, *args, **kwargs):
if 'application/json' not in self.request.META['HTTP_ACCEPT']:
raise ValueError('Only json is available as a response type.')
call = json.loads(request.body)
method_name = f"_remote__{call.get('method')}"
if not hasattr(self, method_name):
raise ValueError('Unknown method')
method = getattr(self, method_name)
try:
result = method(
type('url', (object,), self.kwargs),
request,
*(call.get('args') or [])
)
except Exception as e:
return self._remote_response(self.error(str(e)))
if not result:
return self._remote_response(self.state(self._get_data()))
return self._remote_response(result)
class CrudView(TemplateResponseMixin):
def render_to_response(self, context, **response_kwargs):
return context
class CrudMultiplexerView(TemplateResponseMixin, ContextMixin, View):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.crud_views = {}
for cls in self.get_crud_views():
crud = cls(*args, **kwargs)
self.crud_views[crud.name] = crud
def get_crud_views(self):
return ()
def get(self, request, *args, **kwargs):
context = self.get_context_data(**kwargs)
context['crud'] = {}
for crud in self.crud_views.values():
self.populate_crud(args, crud, kwargs, request)
context['crud'][crud.name] = crud.get(request, *args, **kwargs)
return self.render_to_response(context)
def populate_crud(self, args, crud, kwargs, request):
crud.request = request
crud.args = args
crud.kwargs = kwargs
def post(self, request, *args, **kwargs):
form_name = request.POST.get('_form')
crud = self.crud_views.get(form_name)
self.populate_crud(args, crud, kwargs, request)
if not crud:
return self.http_method_not_allowed(request, *args, **kwargs)
return crud.post(request, *args, **kwargs) | zmei-utils | /zmei-utils-0.1.15.tar.gz/zmei-utils-0.1.15/zmei/views.py | views.py |
import atexit
import os
import signal
import sys
from glob import glob
import click
from termcolor import colored
from genius_cli.client import GeniusClient, ApiError
from genius_cli.utils import collect_files, extract_files, collect_app_names, migrate_db, install_deps, remove_db, \
wait_for_file_changes, run_django, run_webpack, npm_install, get_watch_paths
def run():
api_token = os.environ.get('GENIUS_TOKEN', None)
features_env = os.environ.get('GENIUS_FEATURES', None)
# if not api_token:
# print('No genius api token. Add GENIUS_TOKEN variable to your profile.')
# sys.exit(1)
genius = GeniusClient(
api_url=os.environ.get('ZMEI_URL', 'http://ng.genius-project.io:9000/api/'),
token=api_token,
)
@click.group()
@click.option('--src', default='.', help='Sources path')
@click.option('--dst', default='.', help='Target path')
def cli(**args):
pass
@cli.command(help='Deploy to hyper.sh')
def config(**args):
print('Deploy!')
pass
@cli.command(help='Deploy to hyper.sh')
def deploy(**args):
print('Deploy!')
@cli.command(help='Generate and start app')
def up(**args):
print('Up!')
gen(up=True, **args)
@cli.command(help='Run application')
@click.option('--nodejs', is_flag=True, help='Initialize nodejs dependencies')
@click.option('--watch', is_flag=True, help='Watch for changes')
@click.option('--webpack', is_flag=True, help='Run webpack with reload when generation ends')
@click.option('--port', default='8000', help='Django host:port to run on')
@click.option('--host', default=None, help='Django host:port to run on')
def run(**kwargs):
print('Run!')
gen(run=True, **kwargs)
@cli.command(help='Just generate the code')
@click.argument('app', nargs=-1)
def generate(app=None, **args):
print('generate!')
gen(install=True, app=app or [])
@cli.command(help='Install project dependencies')
def install():
print('Install!')
gen(install=True)
@cli.group(help='Database related commands')
def db(**args):
pass
@db.command(help='Creates database migrations and apply them')
@click.argument('app', nargs=-1)
def migrate(app, **args):
print('Db migrate!', app)
gen(auto=True, app=app)
@db.command(help='db remove + db migrate')
@click.argument('app', nargs=-1)
def rebuild(app, **args):
print('Db rebuild!', app)
gen(rebuild=True, app=app)
@db.command(help='Rollback all the migrations')
@click.argument('app', nargs=-1)
def remove(app, **args):
print('Db remove!', app)
gen(remove=True, app=app)
def gen(auto=False,
src='.',
dst='.',
install=False,
rebuild=False,
remove=False,
app=None,
run=False,
webpack=False,
nodejs=False,
host=None,
port=8000,
watch=False,
up=False
):
if rebuild:
auto = True
remove = True
if not host:
host = '127.0.0.1:{}'.format(port)
if up:
install = True
auto = True
watch = True
run = True
if not app or len(app) == 0:
app = collect_app_names()
src = os.path.realpath(src)
dst = os.path.realpath(dst)
django_process = None
webpack_process = None
def emergency_stop():
if django_process:
os.killpg(os.getpgid(django_process.pid), signal.SIGTERM)
if webpack_process:
os.killpg(os.getpgid(webpack_process.pid), signal.SIGTERM)
atexit.register(emergency_stop)
for i in wait_for_file_changes(get_watch_paths(), watch=watch):
print('--------------------------------------------')
print('Generating ...')
print('--------------------------------------------')
files = collect_files(src)
try:
files = genius.generate(files, collections=app)
extract_files(dst, files)
if up and os.path.exists('react'):
webpack = True
nodejs = True
if nodejs and os.path.exists('react'):
npm_install()
if remove:
remove_db(apps=app)
if install or rebuild:
django_process = install_deps(django_process)
if auto:
migrate_db(apps=app)
if run and not django_process:
django_process = run_django(run_host=host)
if webpack and not webpack_process:
webpack_process = run_webpack()
except ApiError:
pass
if watch:
print(colored('> ', 'white', 'on_blue'), 'Watching for changes...')
cli() | zmei | /zmei-1.1.0.tar.gz/zmei-1.1.0/genius_cli/main.py | main.py |
import ast
import re
from abc import abstractmethod
import os
from bs4 import BeautifulSoup, NavigableString
from pyparsing import *
from jinja2 import Environment, FileSystemLoader, TemplateNotFound
from termcolor import colored
class Value(object):
def __init__(self, val):
self.val = val
def parsed(self):
return self.expr
@abstractmethod
def expr(self):
pass
@abstractmethod
def __str__(self):
pass
class ExpressionValue(Value):
def parsed(self):
return ast.literal_eval(self.val)
def expr(self):
return self.val
def __str__(self) -> str:
return '{{ ' + self.expr() + ' }}'
class StringValue(Value):
def expr(self):
return '"{}"'.format(self.val.replace('"', "'"))
def __str__(self) -> str:
return self.val
class TranslatableStringValue(StringValue):
def expr(self):
return super().expr() + '|_'
def __str__(self) -> str:
return '{{ ' + self.expr() + ' }}'
loaded_themes = {}
def render_template(theme_folder, template_name, context):
context = context or {}
if theme_folder not in loaded_themes:
loader = FileSystemLoader(theme_folder)
env = Environment(loader=loader,
variable_start_string='<{',
variable_end_string='}>',
block_start_string='<%',
block_end_string='%>'
)
def expr(val):
return val.expr()
env.filters['expr'] = expr
loaded_themes[theme_folder] = env
else:
env = loaded_themes[theme_folder]
template = env.get_template(template_name)
return template.render(**context)
def render_tag(el, theme_name='default', replace=True):
self_content = ""
for child in el.children:
if isinstance(child, NavigableString):
self_content += "\n" + str(child) # str(parse_val(str(child).strip()))
else:
print(type(child), child)
self_content += "\n" + render_tag(child, replace=False)
context = {'_': self_content}
for key, val in el.attrs.items():
context[key] = parse_val(val)
m = re.match('^block:([a-z0-9_]+)$', el.name)
if m:
tag_template = '{{% block {} %}}{}{{% endblock %}}'.format(m.group(1), self_content)
else:
theme_folder = 'col/themes/{}'.format(theme_name)
template_name = '{}.html'.format(el.name.replace('.', '/'))
try:
tag_template = render_template(theme_folder, template_name, context=context)
except TemplateNotFound:
print(colored(
'Warning!', on_color='on_red'),
'Can not load template: ',
colored(template_name, on_color='on_blue'),
'Theme folder:', theme_folder
)
tag_template = self_content
if replace:
el.replaceWith(tag_template)
return tag_template
def parse_val(val):
if len(val) and val[0] == '!':
new_val = ast.literal_eval(val[1:])
elif len(val) and val[0] == '$':
new_val = TranslatableStringValue(val[1:])
elif len(val) and val[0] == '@':
new_val = ExpressionValue(val[1:])
else:
new_val = StringValue(val)
return new_val
def unescape_html(html):
html = html.replace('<', '<')
html = html.replace('>', '>')
html = html.replace('&', '&')
return html
def render_blocks(file_source):
parts = file_source.split('<genius:blocks')
if len(parts) > 0:
content = []
for idx, part in enumerate(parts):
if idx == 0:
content.append(part)
else:
sub = part.split('</genius:blocks>')
if len(sub) != 2:
print('WARN: Error parsing template file: not closed <genius:blocks> tag?')
continue
block_html = '<genius:blocks' + sub[0] + '</genius:blocks>'
block = BeautifulSoup(block_html, "html.parser")
theme = block.attrs.get('theme', 'default')
for block_tag in block.children:
for subtag in block_tag.children:
if isinstance(subtag, str):
continue
render_tag(subtag, theme_name=theme)
first_block = list(block.children)[0]
first_block.unwrap()
source = unescape_html(str(block))
content.append(source)
content.append(sub[1])
file_source = ''.join(content)
return file_source | zmei | /zmei-1.1.0.tar.gz/zmei-1.1.0/genius_cli/blocks.py | blocks.py |
# simplification (connectomics.npy): 434.549s, 0.31 MVx/sec, N=1
import numpy as np
import zmesh
import time
from tqdm import tqdm
def result(label, dt, data, N):
voxels = data.size
mvx = voxels // (10 ** 6)
print(f"{label}: {dt:02.3f}s, {N * mvx / dt:.2f} MVx/sec, N={N}")
def test_zmesh_marching_cubes():
labels = np.zeros((512,512,512), dtype=np.uint8, order="C")
mesher = zmesh.Mesher((1,1,1))
N = 1
start = time.time()
for _ in range(N):
mesher.mesh(labels)
end = time.time()
result("marching cubes (blank)", end - start, labels, N=N)
labels = np.ones((512,512,512), dtype=np.uint8, order="C")
mesher = zmesh.Mesher((1,1,1))
N = 1
start = time.time()
for _ in range(N):
mesher.mesh(labels, close=True)
end = time.time()
result("marching cubes (filled)", end - start, labels, N=N)
labels = np.load("./connectomics.npy")
labels = np.ascontiguousarray(labels)
mesher = zmesh.Mesher((1,1,1))
N = 1
start = time.time()
for _ in range(N):
mesher.mesh(labels)
end = time.time()
result("marching cubes (connectomics.npy)", end - start, labels, N=N)
labels = np.random.randint(0,1000, size=(448,448,448), dtype=np.uint32)
# labels = np.ascontiguousarray(labels)
mesher = zmesh.Mesher((1,1,1))
N = 1
start = time.time()
for _ in range(N):
mesher.mesh(labels)
end = time.time()
result("marching cubes (random)", end - start, labels, N=N)
def test_scikit_marching_cubes():
import skimage.measure
print("marching cubes (blank) NOT HANDLED")
print("marching cubes (filled) NOT HANDLED")
labels = np.ones((512,512,512))
labels = np.load("./connectomics.npy")
labels = np.ascontiguousarray(labels)
N = 1
start = time.time()
for _ in range(N):
skimage.measure.marching_cubes(labels)
end = time.time()
result("marching cubes (connectomics.npy)", end - start, labels, N=N)
labels = np.random.randint(0,1000, size=(448,448,448), dtype=np.uint32)
labels = np.ascontiguousarray(labels)
N = 1
start = time.time()
for _ in range(N):
skimage.measure.marching_cubes(labels)
end = time.time()
result("marching cubes (random)", end - start, labels, N=N)
# Ran zmesh simplification and summed the sizes
# of the meshes.
# factor 0 max error 0: 1614121164 bytes (1.0x)
# factor 100 max error 0: 503561448 bytes (3.2x)
# factor 100 max error 1: 350636148 bytes (4.6x)
def test_zmesh_simplification():
labels = np.load("./connectomics.npy")
mesher = zmesh.Mesher((1,1,1))
mesher.mesh(labels)
N = 1
start = time.time()
for label in tqdm(mesher.ids()):
mesher.get_mesh(label,
simplification_factor=100,
# Max tolerable error in physical distance
max_simplification_error=1,
)
end = time.time()
result("simplification (connectomics.npy)", end - start, labels, N=N)
print("ZMESH")
test_zmesh_marching_cubes()
print("SKIMAGE")
test_scikit_marching_cubes()
print("ZMESH SIMPLIFICATION")
test_zmesh_simplification() | zmesh | /zmesh-1.7.0.tar.gz/zmesh-1.7.0/perf.py | perf.py |
## zmesh: Multi-Label Marching Cubes & Mesh Simplification
[](https://github.com/seung-lab/zmesh/actions/workflows/test.yml) [](https://badge.fury.io/py/zmesh)
```python
from zmesh import Mesher
labels = ... # some dense volumetric labeled image
mesher = Mesher( (4,4,40) ) # anisotropy of image
# initial marching cubes pass
# close controls whether meshes touching
# the image boundary are left open or closed
mesher.mesh(labels, close=False)
meshes = []
for obj_id in mesher.ids():
meshes.append(
mesher.get(
obj_id,
normals=False, # whether to calculate normals or not
# tries to reduce triangles by this factor
# 0 disables simplification
reduction_factor=100,
# Max tolerable error in physical distance
# note: if max_error is not set, the max error
# will be set equivalent to one voxel along the
# smallest dimension.
max_error=8,
# whether meshes should be centered in the voxel
# on (0,0,0) [False] or (0.5,0.5,0.5) [True]
voxel_centered=False,
)
)
mesher.erase(obj_id) # delete high res mesh
mesher.clear() # clear memory retained by mesher
mesh = meshes[0]
mesh = mesher.simplify(
mesh,
# same as reduction_factor in get
reduction_factor=100,
# same as max_error in get
max_error=40,
compute_normals=False, # whether to also compute face normals
) # apply simplifier to a pre-existing mesh
# compute normals without simplifying
mesh = mesher.compute_normals(mesh)
mesh.vertices
mesh.faces
mesh.normals
mesh.triangles() # compute triangles from vertices and faces
# Extremely common obj format
with open('iconic_doge.obj', 'wb') as f:
f.write(mesh.to_obj())
# Common binary format
with open('iconic_doge.ply', 'wb') as f:
f.write(mesh.to_ply())
# Neuroglancer Precomputed format
with open('10001001:0', 'wb') as f:
f.write(mesh.to_precomputed())
```
Note: As of the latest version, `mesher.get_mesh` has been deprecated in favor of `mesher.get` which fixes a long standing bug where you needed to transpose your data in order to get a mesh in the correct orientation.
## Installation
If binaries are not available for your system, ensure you have a C++ compiler installed.
```bash
pip install zmesh
```
## Performance Tuning & Notes
- The mesher will consume about double memory in 64 bit mode if the size of the
object exceeds <1023, 1023, 511> on the x, y, or z axes. This is due to a limitation
of the 32-bit format.
- The mesher is ambidextrous, it can handle C or Fortran order arrays.
- The maximum vertex range supported `.simplify` after converting to voxel space is 2<sup>20</sup> (appx. 1M) due to the packed 64-bit vertex format.
- There is a longstanding design flaw in `cMesher.hpp` that transposes the returned mesh and resolution. We're working on a backwards compatible solution. That's why you need to do `mesher.mesh(data.T)`.
## Related Projects
- [zi_lib](https://github.com/zlateski/zi_lib) - zmesh makes heavy use of Aleks' C++ library.
- [Igneous](https://github.com/seung-lab/igneous) - Visualization of connectomics data using cloud computing.
## Credits
Thanks to Aleks Zlateski for creating and sharing this beautiful mesher.
Later changes by Will Silversmith, Nico Kemnitz, and Jingpeng Wu.
## References
1. W. Lorensen and H. Cline. "Marching Cubes: A High Resolution 3D Surface Construction Algorithm". pp 163-169. Computer Graphics, Volume 21, Number 4, July 1987. ([link](https://people.eecs.berkeley.edu/~jrs/meshpapers/LorensenCline.pdf))
2. M. Garland and P. Heckbert. "Surface simplification using quadric error metrics". SIGGRAPH '97: Proceedings of the 24th annual conference on Computer graphics and interactive techniques. Pages 209–216. August 1997. doi: 10.1145/258734.258849 ([link](https://mgarland.org/files/papers/quadrics.pdf))
3. H. Hoppe. "New Quadric Metric for Simplifying Meshes with Appearance Attributes". IEEE Visualization 1999 Conference. pp. 59-66. doi: 10.1109/VISUAL.1999.809869 ([link](http://hhoppe.com/newqem.pdf))
| zmesh | /zmesh-1.7.0.tar.gz/zmesh-1.7.0/README.md | README.md |
# zmfcli

[](https://pypi.python.org/pypi/zmfcli)
[](https://codeclimate.com/github/kressi/zmf-cli/maintainability)
[](https://codecov.io/gh/kressi/zmf-cli)
Command line interface (cli) for ChangeMan ZMF through REST API. Using
[fire](https://github.com/google/python-fire) to create the cli.
## Usage
### Credentials
Credentials and url can be exported to `ZMF_REST_*` variables, so those
do not need to be privided with each command execution.
```bash
export ZMF_REST_URL=http://httpbin.org:80/anything/zmfrest
export ZMF_REST_USER=U000000
export ZMF_REST_PWD=pa$$w0rd
zmf build "APP 000001" "['src/SRE/APP00001.sre', 'src/SRB/APP00002.srb', 'src/SRB/APP00003.srb']"
```
### Example
Audit a package
```bash
$ zmf audit "APP 000001"
```
### Commands
Get help for a command
```bash
$ zmf promote --help
```
| Command | Description |
|----------------------|---------------------------------------------|
| checkin | PUT component/checkin |
| build | PUT component/build |
| scratch | PUT component/scratch |
| audit | PUT package/audit |
| promote | PUT package/promote |
| freeze | PUT package/freeze |
| revert | PUT package/revert |
| search-package | GET package/search |
| create-package | POST package |
| get-package | Search or create if package does not exist |
| get-components | GET component |
| get-load-components | GET component/load |
| browse-component | GET component/browse |
### Pretty print result
Some results may return JSON data, this data can be pretty printed with Python
```bash
zmf get-load-components "APP 000001" "LST" | python -m json.tool
```
## ChangeMan ZMF Documents
- [ChangeMan ZMF 8.1 - Web Services Getting Started Guide](https://supportline.microfocus.com/documentation/books/ChangeManZMF/8.1.4/ChangeManZMFWebServices/ZMF%20Web%20Services%20Getting%20Started%20Guide.pdf)
- [ChangeMan ZMF - REST Services Getting Started Guide](https://www.microfocus.com/documentation/changeman-zmf/8.2.2/ZMF%20REST%20Services%20Getting%20Started%20Guide%20(Updated%2024%20October%202019).pdf)
- [ChangeMan ZMF - User’s Guide](https://www.microfocus.com/documentation/changeman-zmf/8.2.1/ZMF%20Users%20Guide.pdf)
- [ChangeMan ZMF 8.1 - XML Services User’s Guide](https://supportline.microfocus.com/documentation/books/ChangeManZMF/8.1.4/ChangeManZMF/ZMF%20XML%20Services%20Users%20Guide.pdf)
| zmfcli | /zmfcli-0.1.17.tar.gz/zmfcli-0.1.17/README.md | README.md |
import logging
import zmq
import threading
import sys
import time
import random
import signal
import os
import json
import pprint
from Utils import Utilities
from Provider.IServiceHandler import ServiceHandler
from Services.Monitor import Monitor
class ServiceMonitor(ServiceHandler):
''' Service for Monitors memory and process for context task services'''
def __init__(self, **kwargs):
''' Service constructor'''
ServiceHandler.__init__(self, **kwargs)
self.logger.debug("Service monitor class constructor")
## Adding monitor information class
self.contextInfo = None
self.isMonitor = False
def DeserializeAction(self, msg):
''' Validates incoming message when called in service section'''
try:
self.tid = Utilities.GetPID()
self.logger.debug("Validating configured action...")
isForDevice = msg['header']['service_name'] == 'monitor' or msg['header']['service_name'] == 'all'
isRightTransaction = False
if 'transaction' in msg['header'].keys():
isRightTransaction = msg['header']['transaction'] == self.transaction
elif 'service_transaction' in msg['header'].keys():
isRightTransaction = msg['header']['service_transaction'] == self.transaction
else:
self.logger.debug("Message without transaction ID")
if isRightTransaction:
self.logger.debug("[%d] Validation [PASSED]"%self.tid)
return isRightTransaction
if not isRightTransaction:
self.logger.debug("Service with different transaction")
return False
result = (isForDevice and isRightTransaction)
if result:
self.logger.debug("[%d] Validation [PASSED]"%self.tid)
return result
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def ParseItems(self, items, resp_format):
''' Obtains data from input parameters'''
try:
self.logger.debug(" + Parsing items in action...")
status = resp_format["content"]["status"]
## Adding more parameters
if items is not None:
itemsKeys = items.keys()
for item in itemsKeys:
status.update({item:items[item]})
resp_format["content"]["status"] = status
return resp_format
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def GetActionHandler(self, msg):
''' '''
self.logger.debug("Creating a monitoring process for task services")
result ="failure"
deviceAction= None
try:
message = msg['Task']['message']
conf = message['content']['configuration']
state = msg['Task']['state']
confKeys = conf.keys()
args = {'onStart': True, 'service': self}
## Parsing parameters
self.logger.debug(" Parsing message parameters")
for key in confKeys:
if key in confKeys:
value = message['content']['configuration'][key]
args.update({key: value})
## Got message, not checking for transaction
header = message['header']
if 'transaction' not in header.keys():
self.logger.debug(" - Missing argument: transaction in header")
transaction = header['transaction']
args.update({'transaction': transaction})
## Creating service object and notify
start_state = 'started'
taskType = state['type']
if not(taskType == 'on_start' or taskType != 'start_now'):
self.logger.debug(" - Process is set and start is on demand")
args['onStart'] = False
start_state = 'created'
## Creating service object and notify
deviceAction = Monitor(**args)
if deviceAction.hasStarted():
result="success"
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
finally:
# Notifying if task was created
tid = Utilities.GetPID()
self.notify("started", result, items={'pid':tid})
return deviceAction
def close(self):
''' Ends process inside the service'''
self.logger.debug("Stopping Monitors memory and process for context task services service")
def ControlAction(self, msg):
''' Actions taken if another process reports with control topic'''
try:
## Validating transaction
isRightTransaction = self.ValidateTransaction(msg)
if not isRightTransaction:
self.logger.debug("Error: Service with different transaction")
return isRightTransaction
header = msg['header']
content = msg['content']
#print "===> header:"
#pprint.pprint(header)
#print "===> content:"
#pprint.pprint(content)
if 'status' not in content.keys():
self.logger.debug("Error: message without status part")
return
status = msg['content']['status']
if 'service_name' not in header.keys():
self.logger.debug("Error: message without service_name part")
return
service_name = header['service_name']
if 'device_action' not in status.keys():
self.logger.debug("Error: message without device_action part")
return
device_action = status['device_action']
## Looking into context information messages
if service_name == 'context' and device_action == "context_info":
#self.logger.debug("Received message with [context_info]")
## Allocating track information in case it is present
if 'data' not in status.keys():
self.logger.debug("Found successful [sniffer] control action but without track report")
return
## Getting context information, we want to have
## a service name, pid and action
data = status['data']
if self.actionHandler is not None:
#self.logger.debug("Parsing message with context information")
self.actionHandler.GotContextInfo(data)
## Pass messages only with context information
elif device_action != 'context_info':
#self.logger.debug("Ignoring message not with context information")
return
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def SetMonitor(self, monitor):
''' Setting monitoring object in local service'''
self.logger.debug(" Assigning local reference of context informator")
self.contextInfo = monitor
self.isMonitor = True | zmicroservices | /zmicroservices-1.0.3.tar.gz/zmicroservices-1.0.3/Services/Monitor/ServiceMonitor.py | ServiceMonitor.py |
import json
import time, datetime
import sys, os
import json
import logging
import threading
import zmq
import multiprocessing
import imp
import pprint
from optparse import OptionParser
## Checking if Utilities module exists
## Otherwise, force it find it assuming this module
## is in /Services/Sniffer/NetworkSniffer.py
try:
from Utils import Utilities
from Utils.MongoHandler import MongoAccess
from Services.ContextService import ContextInfo
except ImportError:
currentPath = sys.path[0]
path = ['/'.join(currentPath.split('/')[:-2])+'/Utils/']
name = 'Utilities'
print "Importing libraries from [%s]"%name
try:
fp = None
(fp, pathname, description) = imp.find_module(name, path)
Utilities = imp.load_module(name, fp, pathname, description)
print " Libraries for [%s] imported"%name
except ImportError:
print " Error: Module ["+name+"] not found"
sys.exit()
finally:
# Since we may exit via an exception, close fp explicitly.
if fp is not None:
fp.close()
fp=None
print "Imported libraries for [%s]"%name
name = 'MongoHandler'
print "Importing libraries from [%s]"%name
try:
fp = None
(fp, pathname, description) = imp.find_module(name, path)
MongoAccess = imp.load_module(name, fp, pathname, description).MongoAccess
print " Libraries for [%s] imported"%name
except ImportError:
print " Error: Module ["+name+"] not found"
sys.exit()
finally:
''' '''
# Since we may exit via an exception, close fp explicitly.
if fp is not None:
fp.close()
fp=None
path = ['/'.join(currentPath.split('/')[:-2])+'/Services/ContextService/']
name = 'ContextInfo'
print "Importing libraries from [%s]"%name
try:
fp = None
(fp, pathname, description) = imp.find_module(name, path)
ContextInfo = imp.load_module(name, fp, pathname, description).ContextInfo
print " Libraries for [%s] imported"%name
except ImportError:
print " Error: Module ["+name+"] not found"
sys.exit()
finally:
''' '''
# Since we may exit via an exception, close fp explicitly.
if fp is not None:
fp.close()
fp=None
## TODO: Monitor more than one transaction from same context
class Monitor(threading.Thread):
def __init__(self, **kwargs):
'''Service task constructor'''
#Initialising thread parent class
threading.Thread.__init__(self)
try:
# Initialising class variables
self.component = self.__class__.__name__
self.logger = Utilities.GetLogger(self.component)
# Thread action variables
self.tStop = threading.Event()
self.lock = multiprocessing.Lock()
self.threads = []
self.tid = None
self.running = False
self.taskQueue = None
self.info = []
## Adding local variables
self.service = None
self.onStart = True
self.logger.debug(" + Creating process monitoring service")
self.lContextInfo = []
## Variables for monitoring service
self.service_endpoint = None
self.service_freq = None
self.service_type = None
self.transaction = None
self.memory_maps = False
self.open_connections = False
self.opened_files = False
self.store_records = False
self.pub_socket = None
self.context = None
## Database variables
self.database = None
self.collection = None
self.host = None
self.port = None
self.db_handler = None
self.connected = False
## Generating instance of strategy
for key, value in kwargs.iteritems():
#print "===>",key,":", value
if "service" == key: # (/)
self.service = value
elif "onStart" == key: # (/)
self.onStart = value
elif "msg" == key:
self.msg = value
elif "transaction" == key: # (/)
self.transaction = value
self.logger.debug(' Setting up transaction [%s]'%self.transaction)
elif "db_connection" == key:
self.logger.debug(' Found options for [%s]'%key)
valueKeys = value.keys()
for vKey in valueKeys:
vKValue = value[vKey]
#print " ===>",vKey,":", vKValue
if "host" == vKey:
self.host = vKValue
self.logger.debug(' Setting up DB host [%s]'%self.host)
elif "port" == vKey:
self.port = int(vKValue)
self.logger.debug(' Setting up DB port [%s]'%self.port)
elif "collection" == vKey:
self.collection = vKValue
self.logger.debug(' Setting up DB collection [%s]'%self.collection)
elif "database" == vKey:
self.database = vKValue
self.logger.debug(' Setting up DB [%s]'%self.database)
elif "monitor_options" == key:
self.logger.debug(' Found options for [%s]'%key)
valueKeys = value.keys()
for vKey in valueKeys:
vKValue = value[vKey]
#print " ===>",vKey,":", vKValue
if "memory_maps" == vKey: # (/)
self.memory_maps = bool(vKValue)
store = 'ON' if self.memory_maps else 'OFF'
self.logger.debug(' Setting to get memory maps in dB [%s]'%store)
elif "open_connections" == vKey: # (/)
self.open_connections = bool(vKValue)
store = 'ON' if self.open_connections else 'OFF'
self.logger.debug(' Setting to get open connections in dB [%s]'%store)
elif "opened_files" == vKey: # (/)
self.opened_files = bool(vKValue)
store = 'ON' if self.opened_files else 'OFF'
self.logger.debug(' Setting to get opened files in dB [%s]'%store)
elif "store_records" == vKey:
self.store_records = bool(vKValue)
store = 'ON' if self.store_records else 'OFF'
self.logger.debug(' Setting to store records in dB [%s]'%store)
elif "publisher" == key:
self.logger.debug(' Found options for [%s]'%key)
valueKeys = value.keys()
for vKey in valueKeys:
vKValue = value[vKey]
#print " ___>",vKey,":", vKValue
if "frequency_s" == vKey: # (/)
self.service_freq = float(vKValue)
self.logger.debug(' Setting up service frequency [%f]'%self.service_freq)
elif "endpoint" == vKey: # (/)
self.service_endpoint = vKValue
self.logger.debug(' Setting up endpoint [%s]'%self.service_endpoint)
elif "type" == vKey: # (/)
self.service_type = vKValue
self.logger.debug(' Setting up service type [%s]'%self.service_type)
## Starting action thread
if self.onStart:
self.logger.debug(" + Process is set to start from the beginning")
self.start()
# Connecting to Mongo client
if self.ConnectDB():
self.logger.debug(" + Created mongo client for [%s] in catalogue [%s]"%(self.database, self.collection))
else:
self.logger.debug("Error: Creationg of Mongo client failed")
### Adding monitor thread to the list of references
self.threads.append(self)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def hasStarted(self):
''' Reports task thread status'''
return self.running and not self.tStop.isSet()
def hasFinished(self):
''' Reports task thread status'''
return not self.running and self.tStop.isSet()
def run(self):
'''Threaded action '''
try:
# Getting thread GetPID
self.running = True
self.tid = Utilities.GetPID()
self.logger.debug(' Starting task endpoint service in [%d]'%(self.tid))
socket = self.SetSocket()
## Checking if socket exists
if socket is None:
## If socket is invalid, can't do anything
self.logger.debug('Error: Could not connect to [%s] in [%d]'
%(self.service_endpoint, self.tid))
self.running = False
self.tStop.set()
return
self.logger.debug(' Looping for capture monitoring [%d]'%self.tid)
while not self.tStop.isSet():
## Parsing context data into a JSON message
start_time = time.time()
## Getting available data from local copy of context
with self.lock:
contextInfo = list(self.lContextInfo)
## Getting process memory data
processInfo = self.FormatContextData(contextInfo)
process_timer = (time.time() - start_time)*1000 ## ms
if processInfo is not None:
json_msg = json.dumps(processInfo)
## Sending status message
if json_msg is not None and len(json_msg)>0:
send_msg = "%s @@@ %s" % ("monitor", json_msg)
utfEncodedMsg = send_msg.encode('utf-8').strip()
self.logger.debug(' Sending message of [%d] bytes'%(len(utfEncodedMsg)))
socket.send(utfEncodedMsg)
## Inserting record in database
if self.store_records and self.connected:
self.logger.debug(' Storing record for [%s]'%self.transaction)
self.KeepMongoRecord(processInfo)
## Waiting for sending next message
lapsed_time = time.time() - start_time
self.logger.debug(' @ Process operations done in [%.4f]ms' % (lapsed_time*1000))
waitingTime = self.service_freq - lapsed_time
if waitingTime<1.0:
waitingTime = 1.0
#self.logger.debug(' Waiting [%4.4f]s'% waitingTime )
self.tStop.wait(waitingTime)
# Destroying temporal context for publisher
self.logger.debug(' Destroying context for monitoring process in [%d]'%self.tid)
self.context.destroy()
time.sleep(0.3)
# Ending thread routine
self.logger.debug(' Ending thread [%d]'%self.tid)
self.running = False
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def close(self):
''' Ending task service'''
def execute(self, service):
''' Execute ContextMonitor task by calling a "run" method in the service'''
def stop_all_msg(self):
''' Implement if the service task requires to stop any other running process'''
def FormatContextData(self, contextInfo):
''' Prepares a JSON message from context information'''
try:
processInfo = {self.transaction:[]}
if contextInfo is None:
self.logger.debug(' Error: Context information is empty')
return contextInfo
## Looking for right context in a list of contexts
for contextInDict in contextInfo:
contextInfoKeys = contextInDict.keys()
## Looking into context keys as transaction
for transaction in contextInfoKeys:
if self.transaction == transaction:
context = contextInDict[transaction]
## Got the right context, now look for tasks state and pids
tasks = context['tasks']
for task in tasks:
action = task['action']
## Checking if process is active (not stopped)
if action == 'stopped':
self.logger.debug(' Service [%s] is stopped'%(serviceId))
continue
## Getting relevant context data
state = task['state']
pid = task['pid']
serviceId = task['service_id']
self.logger.debug(' Got service [%s] with action [%s], state [%s] and pid [%d]'%
(serviceId, action, state, pid))
## Looking into process memory information
if pid is not None and pid>0:
process_memory = Utilities.MemoryUsage(pid,
serviceId=serviceId,
log=self.logger,
memMap =self.memory_maps,
openFiles=self.opened_files,
openConn =self.open_connections)
process_memory.update({'action':action, 'state':state, 'pid':pid})
processInfo[self.transaction].append(process_memory)
return processInfo
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def SetSocket(self):
'''Threaded function for publishing process monitoring '''
socket = None
try:
# Creating temporal context for publisher
self.logger.debug(" Creating monitor backend ZMQ endpoint [%s] in [%d]"%
(self.service_endpoint, self.tid))
self.context = zmq.Context()
socket = self.context.socket(zmq.PUB)
socket.bind(self.service_endpoint)
time.sleep(0.1)
except Exception as inst:
Utilities.ParseException(inst)
finally:
return socket
def GotContextInfo(self, data):
'''
Parses message with context information. This method exposes
monitor base data structure (context information) to a local
variable. The data is passed straight away as it is assigned
from the desearilisation (published message) and it does not
validates its content.
'''
try:
## Loading context in JSON format
with self.lock:
self.lContextInfo = data
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def ConnectDB(self):
''' Establish connection to mongo database'''
try:
if self.port is not None and self.host is not None and self.collection is not None and self.database is not None:
self.db_handler = MongoAccess()
self.logger.debug(" + Creating Mongo client")
self.connected = self.db_handler.connect(self.database,
self.collection,
host=self.host,
port=self.port)
else:
self.connected = False
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
self.connected = False
return self.connected
def KeepMongoRecord(self, processInfo):
''' '''
result = False
try:
if self.transaction is None:
self.logger.debug('Error: Invalid transaction, record not stored')
else:
## Getting stored data
value = processInfo[self.transaction]
## Preparing current time as inserting condition
now = datetime.datetime.utcnow()
currentDate = datetime.datetime(now.year,
now.month,
now.day,
now.hour,
0, 0, 0)
## Preparing time series model
## 1) Condition to search item
condition = {
'timestamp_hour': currentDate,
'type': self.transaction
}
## 2) Update/Insert item in DB
valueKey = 'values.%d.%d'%(now.minute, now.second)
itemUpdate = {valueKey: value }
self.db_handler.Update(condition =condition,
substitute =itemUpdate,
upsertValue=True)
result = True
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
finally:
return result
## Standalone main method
LOG_NAME = 'TaskTool'
def call_task(options):
''' Command line method for running sniffer service'''
try:
logger = Utilities.GetLogger(LOG_NAME, useFile=False)
logger.debug('Calling sniffer from command line')
dbConnection = {
'database': 'monitor',
'collection': 'memory',
'host': 'localhost',
'port': '27017'
}
if options.graph:
i=0
else:
return
args = {}
args.update({'db_connection': dbConnection})
args.update({'option2': options.opt2})
taskAction = Monitor(**args)
except Exception as inst:
Utilities.ParseException(inst, logger=logger)
if __name__ == '__main__':
logger = Utilities.GetLogger(LOG_NAME, useFile=False)
myFormat = '%(asctime)s|%(name)30s|%(message)s'
logging.basicConfig(format=myFormat, level=logging.DEBUG)
logger = Utilities.GetLogger(LOG_NAME, useFile=False)
logger.debug('Logger created.')
usage = "usage: %prog option1=string option2=bool"
parser = OptionParser(usage=usage)
parser.add_option('--opt1',
type="string",
action='store',
default=None,
help='Write here something helpful')
parser.add_option("--graph",
action="store_true",
default=False,
help='Write here something helpful')
(options, args) = parser.parse_args()
if options.opt1 is None:
parser.error("Missing required option: --opt1='string'")
sys.exit()
call_task(options) | zmicroservices | /zmicroservices-1.0.3.tar.gz/zmicroservices-1.0.3/Services/Monitor/Monitor.py | Monitor.py |
import multiprocessing
import signal
import itertools
import logging
import zmq
import threading
import sys, os
import time
import json
import pprint
import logging.handlers
from threading import Thread
from Context import ContextGroup
from Utils import ParseXml2Dict
from Provider.Service import MultiProcessTasks
from Utils import Utilities
import Utils
def init_worker():
signal.signal(signal.SIGINT, signal.SIG_IGN)
def run_forwarder(id_, *args, **kwargs):
try:
frontendURL = args[0]
backendURL = args[1]
# Creating context and sockets
context = zmq.Context(1)
frontend = context.socket(zmq.SUB)
backend = context.socket(zmq.PUB)
# Socket facing clients
frontend.bind(frontendURL)
frontend.setsockopt(zmq.SUBSCRIBE, '')
# Socket facing services
backend.bind(backendURL)
#Setting up forwarder device
zmq.device(zmq.FORWARDER, frontend, backend)
except KeyboardInterrupt as e:
pass
def CreateSafeFowarder(frontBind, backendBind, logger):
logger.debug(' Creating frontend/backend binder with signal handler')
args = (frontBind, backendBind, logger)
pool = multiprocessing.Pool(1)
args, kw = (frontBind, backendBind), {}
sol = pool.apply_async(run_forwarder, (0,) + args, kw)
return pool
def main(filename):
myFormat = '%(asctime)s|%(process)6d|%(name)25s|%(message)s'
logging.basicConfig(format=myFormat, level=logging.DEBUG)
joined = 0
keepAlive = True
threads = []
pool = None
rootName = 'Context'
testConf = ParseXml2Dict(filename, rootName)
log_name = testConf['TaskLogName']
# Setting up logger
logger = Utilities.GetLogger(logName=log_name)
logger.debug('Parsing tree [' + rootName + '] in file: ' + filename)
try:
# Getting local vairables
frontend = testConf['FrontEndEndpoint']
backend = testConf['BackendEndpoint']
frontBind = testConf['FrontBind']
backendBind = testConf['BackendBind']
contextID = testConf['ContextID']
testConfKeys = testConf.keys()
stopper = multiprocessing.Event()
stopper.set()
# Running forwarder
pool = CreateSafeFowarder(frontBind, backendBind, logger)
# Getting log name
if 'TaskLogName' not in testConfKeys:
logger.debug('Log name not found in file: ' + filename)
return
# Starting threaded services
logger.debug('Creating a context provider')
s1 = MultiProcessTasks(0, frontend=frontend,
backend=backend,
strategy=ContextGroup,
topic='context',
contextID=contextID,
stopper=stopper)
threads.append(s1)
time.sleep(0.5)
# Looping service provider
threadSize = len(threads)
while stopper.is_set():
if joined != threadSize:
for i in range(threadSize):
if threads[i] is not None:
logger.debug('Joining thread %d...' % i)
threads[i].join(1)
joined += 1
else:
time.sleep(1)
logger.debug('Joining pool...')
pool.terminate()
pool.join()
except KeyboardInterrupt:
logger.debug('Ctrl-C received! Sending kill to all threads...')
# Stopping thread execution
threadSize = len(threads)
for i in range(threadSize):
logger.debug('Killing thread [%d]...' % i)
if threads[i] is not None:
threads[i].stop()
# Stopping pool
logger.debug('Stopping process pool')
if pool is not None:
pool.close()
except Exception as inst:
Utilities.ParseException(inst, logger=logger)
finally:
##TODO: Do not reach this point until all processes are stopped
logger.debug('Ending main thread...')
keepAlive = False
if __name__ == '__main__':
if len(sys.argv) > 1:
print 'usage: ContextService.py '
raise SystemExit
main(sys.argv[1]) | zmicroservices | /zmicroservices-1.0.3.tar.gz/zmicroservices-1.0.3/Services/ContextService/ContextProvider.py | ContextProvider.py |
import pprint
import copy
import json
from Utils import Utilities
from ContextExceptions import ContextError
class ContextMonitor:
'''Class that keeps active control of task services. It
starts, stops and restarts task services.
'''
## Structure of task state
def __init__(self):
component = self.__class__.__name__
self.logger = Utilities.GetLogger(logName=component)
self.states = []
self.configuration = []
def StoreControl(self, msg):
''' Storing control information for each process'''
try:
## Header and content are already validated
header = msg['header']
content = msg['content']
## Validating message variables
contenKeys=content.keys()
if 'configuration' not in contenKeys:
raise ContextError('Warning:', 'Message header missing "configuration"')
return
configuration = content['configuration']
## Validating task service data
if 'TaskService' not in configuration.keys():
raise ContextError('Warning:', 'Message header missing "configuration"')
return
taskService = configuration['TaskService']
if len(taskService)>0 and type(taskService) != type([]):
raise ContextError('Warning:', 'TaskService list is empty in content configuration')
taskService = [taskService]
## Storing context configuration
self.logger.debug('Storing context configuration')
self.StoreCxtConf(taskService)
## At this point the list of task services is available
## TODO: Validate inner content of task? Maybe with a general grammar-based validation
for tServ in taskService:
taskId = tServ['id']
state = copy.copy(tServ['Task']['state'])
stateType = state['type']
## Choosing only states list of keys
for st in state.keys():
if 'on_' not in st:
del state[st]
## Creating task data
self.logger.debug('Creating state control for [%s] service'%taskId)
self.states.append({'task_id': taskId, 'task_states': state})
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def StoreCxtConf(self, taskServices):
''' Stores context configuration and
check task by task and add if different
'''
try:
self.logger.debug(' Validating task services')
# Check if it is a list
if type(taskServices) != type([]):
taskServices = [taskServices]
## Find task in existing conviguration
for tService in taskServices:
## Validating ID exists in message received configuration
if 'id' not in tService.keys():
self.logger.debug(' Warning: service [%s] without ID'%str(tService))
continue
## Looing for configured task
configuredTask = filter(lambda task: task['id'] == tService['id'], self.configuration)
## Task does not exists, adding it
if len(configuredTask) < 1:
self.logger.debug(' Adding non-existing task to current configuration')
self.configuration.append(tService)
## There are two task with that ID
elif len(configuredTask) > 1:
self.logger.debug(' Task [%s] has more than one configured task, not adding it...'
%tService['id'])
## It already exists, update it...
else:
self.logger.debug(' Task [%s] exists in configuration, updating current configuration'
%tService['id'])
taskID = configuredTask[0]['id']
index = [i for i in range(len(self.configuration)) if self.configuration[i]['id'] == taskID]
if len(index)<1:
raise ContextError('Warning:', 'Task if [%s] not found in configuration'%taskID)
return
self.logger.debug(' Updating task [%s] in existing configuration'%index[0])
self.configuration[index[0]] = tService
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def MonitorServicesProcess(self, transaction, task, context):
''' Inteprets process messages for keeping contex service logic'''
try:
taskTopic = task['topic']
taskId = task['id']
## Adding transaction to the message
task['Task']['message']["header"].update({'transaction' : transaction})
## Setting message for starting a task service
task['Task']['message']["header"].update({'action' : 'start'})
## Preparing message to send
json_msg = json.dumps(task, sort_keys=True, indent=4, separators=(',', ': '))
start_msg = "%s @@@ %s" % (taskTopic, json_msg)
# Sending message for starting service
self.logger.debug("==> [%s] Sending message for starting service"%taskId )
context.serialize(start_msg)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def MonitorServicesControl(self, msg, context):
''' Inteprets control messages for keeping contex service logic'''
try:
## Header and content are already validated
header = msg['header']
content = msg['content']
## Checking if there are state to control
if len(self.states)<1:
raise ContextError('Runtime Error:', 'Monitoring of service disabled, state empty')
return
## Getting state control variables from message
headerKeys=header.keys()
contenKeys=content.keys()
if 'service_transaction' not in headerKeys:
raise ContextError('Warning:', 'Message header missing "service_transaction" in monitoring services')
return
if 'service_id' not in headerKeys:
raise ContextError('Warning:', 'Message header missing "service_id" in monitoring services')
return
if 'action' not in headerKeys:
raise ContextError('Warning:', 'Message header missing "action" in monitoring services')
return
serviceId = header['service_id']
action = header['action']
result = content['status']['result']
transaction= header['service_transaction']
## Searching object state
## TODO: Do it with a real state machine and use it as a black box
for state in self.states:
if state['task_id'] == serviceId:
actionName = None
if action == 'started':
actionName = 'on_start'
elif action == 'updated':
actionName = 'on_update'
elif action == 'failed':
actionName = 'on_fail'
elif action == 'exited':
actionName = 'on_exit'
else:
self.logger.debug("Warning: Message state action missing in monitoring services, exiting...")
return
if actionName not in state['task_states'].keys():
self.logger.debug(" Action [%s] NOT FOUND for task ID [%s]"%
(actionName, serviceId))
return
self.logger.debug(" Action [%s] FOUND for task ID [%s]"%
(actionName, serviceId))
## Creating message with action state and state call item
stateAction = state['task_states'][actionName]['action']
callAction = state['task_states'][actionName]['call']
if len(stateAction)<1 and len(callAction)<1:
self.logger.debug(" Nothing to call for [%s]"%(serviceId))
break
else:
self.logger.debug(" (:<>:) [%s] should call [%s] to execute [%s]"%
(serviceId, callAction, stateAction))
processMsg = self.MakeProcessMessage(transaction, stateAction, callAction)
if processMsg is None:
errorMsg = "Caller [%s] for action [%s]"%(callAction, stateAction)
raise ContextError('Warning:'+errorMsg, '')
return
# Sending message for starting service
self.logger.debug(" Sending process message for [%s] with action [%s]"%(callAction, stateAction))
context.serialize(processMsg)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def ValidteContextMessage(self, msg):
''' '''
try:
## Header and content are already validated
header = msg['header']
content = msg['content']
## Validating message variables
headerKeys=header.keys()
contenKeys=content.keys()
if 'action' not in headerKeys:
raise ContextError('Warning:', 'Message header missing "action"')
return
if 'service_id' not in headerKeys:
raise ContextError('Warning:', 'Message header missing "service_id"')
return
if 'service_transaction' not in headerKeys:
raise ContextError('Warning:', 'Message header missing "service_transaction"')
return
if 'status' not in contenKeys:
raise ContextError('Warning:', 'Message content missing "status"')
return
if 'result' not in content['result']:
raise ContextError('Warning:', 'Message content missing "result"')
return
action = header['action']
serviceId = header['service_id']
transaction = header['service_transaction']
status = content['status']
result = status['result']
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def MakeProcessMessage(self, transaction, stateAction, callAction):
''' Returns JSON message of configuration for process topic'''
try:
## Check if task is already in configuration, otherwise add task
if len(self.configuration)<1:
raise ContextError('Error:', 'Context configuration empty')
return
self.logger.debug(" Looking into existing configuration")
for task in self.configuration:
if task['id'] == callAction:
task['Task']['message']['header']['action'] = stateAction
task['Task']['message']['header']['transaction'] = transaction
task['Task']['message']['header']['service_id'] = callAction
## Preparing message to send
json_msg = json.dumps(task, sort_keys=True, indent=4, separators=(',', ': '))
json_msg = "%s @@@ %s" % ('process', json_msg)
self.logger.debug(" Making JSON message for state [%s] in transaction [%s] and call action [%s]"%
(stateAction, transaction, callAction))
return json_msg
## Action ID not found
self.logger.debug("Error: Configuration without valid tasks")
return None
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger) | zmicroservices | /zmicroservices-1.0.3.tar.gz/zmicroservices-1.0.3/Services/ContextService/ContextMonitor.py | ContextMonitor.py |
import sys, os
import imp
import logging
import pprint
## Checking if Utilities module exists
## Otherwise, force it find it assuming this module
## is in /Services/Sniffer/NetworkSniffer.py
try:
from Utils import Utilities
except ImportError:
currentPath = sys.path[0]
path = ['/'.join(currentPath.split('/')[:-2])+'/Utils/']
name = 'Utilities'
print "Exporing libraries from [%s]"%name
try:
fp = None
(fp, pathname, description) = imp.find_module(name, path)
Utilities = imp.load_module(name, fp, pathname, description)
except ImportError:
print " Error: Module ["+name+"] not found"
sys.exit()
finally:
# Since we may exit via an exception, close fp explicitly.
if fp is not None:
fp.close()
fp=None
class ContextInfo:
def __init__(self, stateInfo=None, debug=False):
''' Class constructor'''
component = self.__class__.__name__
self.logger = Utilities.GetLogger(logName=component)
if not debug:
self.logger.setLevel(logging.INFO)
if stateInfo is not None:
self.stateInfo = stateInfo
else:
#self.stateInfo = {}
self.stateInfo = []
def TransactionNotExists(self, transaction):
''' Return true if transaction ID does not exists'''
for context in self.stateInfo:
for tran in context.keys():
if tran == transaction:
## It actually exists!
return False
# Could not find it, there for it does not exists!
return True
def TransactionExists(self, transaction):
''' Return true if transaction ID does not exists'''
return not self.TransactionNotExists(transaction)
def UpdateControlState(self, msg):
'''Updates context state data structure '''
try:
resultRet = False
## Adding process state and PID in context information
header = msg['header']
action = header['action']
status = msg['content']['status']
result = status['result']
## Updating context info with new data
serviceId = header['service_id']
transaction = header['service_transaction']
## Adding or removing from data structure according to reported action
if result == 'success':
data = {}
pid = ''
if 'pid' in status.keys():
pid = status['pid']
data.update({'pid' : pid})
self.logger.debug(" Updating PID [%s in service ID ][%s]"%
(str(pid), serviceId))
data.update({
'state': result,
'action': action
})
## Updating context information
resultRet = self.SetServiceIdData(transaction, serviceId, data)
else:
self.logger.debug("Warning: Received failed control message in transaction [%s]"%transaction)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
resultRet = False
finally:
return resultRet
def UpdateProcessState(self, msg, state=''):
''' Updates context state based in process messages'''
try:
taskHeader = msg['Task']['message']['header']
## Generating data for update
self.logger.debug(" Filtering useful data for keeping in context")
data = {
'state' : state,
'action' : taskHeader['action'],
'serviceName' : taskHeader['service_name'],
'instance' : msg['instance'],
'task' : msg
}
## Updating context info with new data
self.logger.debug(" Updating process context information")
transaction = taskHeader['transaction']
serviceId = taskHeader['service_id']
ret = self.SetServiceIdData(transaction, serviceId, data)
if not ret:
self.logger.debug("Warning: Updating service ID data failed in transaction [%s]"%transaction)
return ret
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
return False
def GenerateContext(self, transaction, data):
''' Generates space for context)'''
try:
## Search for transaction data
if self.TransactionNotExists(transaction):
## If thread does not exists, create thread's PID
self.logger.debug(" Adding new transaction [%s] to context info"% transaction)
self.AddContext(transaction)
else:
self.logger.debug(" Transaction [%s] found in context"% transaction)
## Adding context data to transaction
for context in self.stateInfo:
for tran in context.keys():
if tran == transaction:
context[transaction].update(data)
self.logger.debug(" Context info updated for transaction [%s]"%transaction)
return True
self.logger.debug("Warning: Generation of context failed in transaction [%s]"%transaction)
return False
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def SetServiceIdData(self, transaction, serviceId, data):
''' Sets data for a service ID and transaction'''
result = False
try:
## Search for transaction data
if self.TransactionNotExists(transaction):
## If thread does not exists, create thread's PID
self.logger.debug(" Transaction [%s] not Found"% transaction)
else:
## Setting service ID in context
for context in self.stateInfo:
for tran in context.keys():
if tran == transaction and 'tasks' in context[transaction].keys():
tasks = context[transaction]['tasks']
## Searching for task
for task in tasks:
if task['service_id'] == serviceId:
task.update(data)
self.logger.debug(" Updating service [%s] in transaction [%s]"%
(serviceId, transaction))
result = True
return result
self.logger.debug(" Adding service [%s] in transaction [%s]"%
(serviceId, transaction))
context[transaction]['tasks'].append(serviceData)
self.logger.debug("Warning: Setting of service [%s] Id data failed in transaction [%s]"
%(serviceId, transaction))
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
finally:
self.logger.debug(" Ending set service data with a finally")
return result
def SetTaskStart(self, transaction, serviceId):
'''Setting PID value as None into state data structure '''
result = False
try:
## Search for transaction data
if self.TransactionNotExists(transaction):
## If thread does not exists, create thread's PID
self.logger.debug(" Adding transaction [%s] to context info"% transaction)
self.AddContext(transaction)
else:
self.logger.debug(" Transaction [%s] found in context"% transaction)
## Setting service ID in context
for context in self.stateInfo:
for tran in context.keys():
if tran == transaction and 'tasks' in context[transaction].keys():
serviceData = {'service_id': serviceId,
'pid':None,
'action': 'defined',
'state': 'success'
}
## TODO: Update instead of appending
tasks = context[transaction]['tasks']
for task in tasks:
if task['service_id'] == serviceId:
self.logger.debug(" Updating service [%s] of transaction [%s]"%
(serviceId, transaction))
task.update(serviceData)
result = True
return result
self.logger.debug(" Adding service [%s] of transaction [%s]"%
(serviceId, transaction))
context[transaction]['tasks'].append(serviceData)
result = True
return result
self.logger.debug("Warning: Generation of service [%s] data failed in transaction [%s]"
%(serviceId, transaction))
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
finally:
self.logger.debug(" Ending set service data with a finally")
return result
def GetContext(self, transaction):
''' Generates space for context)'''
try:
## Search for transaction data
if self.TransactionNotExists(transaction):
self.logger.debug(" Transaction [%s] not found in context"% transaction)
return None
## Adding context data to transaction
for context in self.stateInfo:
for tran in context.keys():
if tran == transaction:
self.logger.debug(" Retrieving context from transaction [%s]"%transaction)
return context[transaction]
## If it comes here is because nothing was found!
self.logger.debug("Warning: Getting context failed in transaction [%s]"
%(serviceId, transaction))
return None
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def SetContextTask(self, transaction, serviceId):
''' Generates space for context)'''
try:
## Search for transaction data
if self.TransactionNotExists(transaction):
self.logger.debug(" Transaction [%s] not found in context"% transaction)
return None
## Adding context data to transaction
for context in self.stateInfo:
for tran in context.keys():
if tran == transaction:
self.logger.debug(" Retrieving context from transaction [%s]"%transaction)
cntxt = context[transaction]
## Getting context Services
for service in cntxt['tasks']:
if service ['service_id']:
self.logger.debug(" Found context from transaction [%s]"%transaction)
self.logger.debug("Warning: Getting context failed in transaction [%s]"
%(serviceId, transaction))
return None
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def GetContextData(self, transaction):
''' Search a transaction in a list of transactions.
Returns transaction data if found, otherwise None
'''
try:
for context in self.stateInfo:
contextKeys = context.keys()
if len(contextKeys)>0 and contextKeys[0] == transaction:
return context
self.logger.debug("Warning: Transaction [%s] NOT found"%transaction)
return None
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def SetContext(self, transaction, data):
''' Updates context content by transaction ID'''
try:
## Search for transaction data
if self.TransactionNotExists(transaction):
self.logger.debug(" Transaction [%s] not found in context"% transaction)
return None
## Adding context data to transaction
for context in self.stateInfo:
for tran in context.keys():
if tran == transaction:
self.logger.debug(" Updating context from transaction [%s]"%transaction)
context[transaction].update(data)
## If it comes here is because nothing was found!
self.logger.debug("Warning: Getting context failed in transaction [%s]"
%(serviceId, transaction))
return None
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def GetServiceID(self, transaction, serviceId):
'''
Searches for service ID in a list of transaction
Returns task information, otherwise None
'''
try:
context = self.GetContextData(transaction)
if context is not None:
context = context[transaction]
## Validating task data exists in context
if 'tasks' not in context.keys():
self.logger.debug("Warning: Task data NOT found in transaction [%s]"%transaction)
return
## Getting a list of taks
lTasks = context['tasks']
for task in lTasks:
t = task['task']
## Validating ID exists in task data
if 'id' not in t.keys():
self.logger.debug("Warning: ID not found in task for transaction [%s]"%transaction)
## Looking into task data
if t['id'] == serviceId:
return task
self.logger.debug("Warning: Service ID [%s] NOT found"%transaction)
return None
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def UpdateContext(self, transaction, data={}):
'''Generates a tramsaction space'''
returnValue = False
try:
if self.TransactionNotExists(transaction):
self.logger.debug(" Adding context data in transaction [%s]"%transaction)
returnValue = True
self.stateInfo.append({transaction:data})
return returnValue
else:
self.logger.debug(" Updating context data in transaction [%s]"%transaction)
context = self.GetContext(transaction)
if context is not None:
## Updating context data by keys
dataKeys = data.keys()
contextKeys = context.keys()
for dataKey in dataKeys:
if dataKey != 'tasks':
## Checking if keys in data exists already in context
self.logger.debug(" Updating key [%s] in context "%dataKey)
context[dataKey] = data[dataKey]
## All updates are done!
returnValue = True
return returnValue
## If it comes here is because nothing was found!
self.logger.debug("Warning: Getting context failed in transaction [%s]"
%(serviceId, transaction))
except Exception as inst:
Utilities.ParseException(inst, logger=logger)
returnValue = False
finally:
return returnValue
def ContextExists(self, transaction, contextId):
''' Returns context configuration'''
try:
## Search for transaction data
if self.TransactionNotExists(transaction):
self.logger.debug(" Not getting context data from transaction [%s]"% transaction)
return False
else:
self.logger.debug(" |@| Getting context data from transaction [%s]"% transaction)
# TODO: Look in a list of ID's
storedId = self.GetContextID(transaction)
contextExists = contextId == storedId
if contextExists:
self.logger.debug(" - Context ID [%s] found in transaction [%s]"
%(contextId, transaction))
else:
self.logger.debug(" - Context ID [%s] NOT found in transaction [%s]"
%(contextId, transaction))
return contextExists
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def GetContextConf(self, transaction):
''' Returns context configuration'''
try:
conf = None
## Search for transaction data
if self.TransactionNotExists(transaction):
self.logger.debug(" Not getting context data from transaction [%s]"% transaction)
else:
self.logger.debug(" |@| Getting context data from transaction [%s]"% transaction)
# TODO: Look inside a list of transactions
## Looking for transaction
for context in self.stateInfo:
for tran in context.keys():
if tran == transaction:
return context[transaction]
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def GetContextID(self, transaction):
'''Returns a value of service, othewise returns None'''
try:
## Search for transaction data
if self.TransactionNotExists(transaction):
self.logger.debug(" Transaction [%s] is not in context info"% transaction)
return None
## Search for context in list of transactions
contextData = self.GetContext(transaction)
if 'contextId' not in contextData.keys():
self.logger.debug(" Context ID not found for transaction [%s]"%
(serviceId, transaction))
return None
#FIX: Look in a list of contexts
return contextData['contextId']
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def GetContextServices(self, transaction):
''' Returns a list of available services ID, otherwise empty list'''
try:
## Getting a list of available services from context information
conf = None
## Search for transaction data
if self.TransactionNotExists(transaction):
self.logger.debug(" Not getting context data from transaction [%s]"% transaction)
else:
self.logger.debug(" |@| Getting context data from transaction [%s]"% transaction)
# TODO: Look inside a list of transactions
## Looking for transaction
for context in self.stateInfo:
for tran in context.keys():
if tran == transaction:
contextData = context[transaction]
lServices = []
self.logger.debug(" |@| Found [%d] sevices"% len(contextData['tasks']))
## Looking for active processes
for task in contextData['tasks']:
if (task['action']=='started' or task['action']=='updated') and task['state'] =='success':
self.logger.debug(" |@| Service [%s] is available in context"%(task['service_id']))
lServices.append(task)
return lServices
return lServices
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def GetServiceData(self, transaction, serviceId):
''' Returns content of a services ID, otherwise empty dictionary'''
serviceData = {}
try:
## Getting a list of available services from context information
## Search for transaction data
if self.TransactionNotExists(transaction):
## If thread does not exists, create thread's PID
self.logger.debug(" Transaction [%s] not Found"% transaction)
else:
## Setting service ID in context
for context in self.stateInfo:
for tran in context.keys():
if tran == transaction and 'tasks' in context[transaction].keys():
tasks = context[transaction]['tasks']
## Searching for task
for task in tasks:
if task['service_id'] == serviceId:
self.logger.debug(" Found service [%s] of transaction [%s]"%
(serviceId, transaction))
serviceData = task
return serviceData
self.logger.debug("Warning: Setting data failed in [%s]"%(serviceId))
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
finally:
self.logger.debug(" Ending get service data with a finally")
return serviceData
LOG_NAME = 'ContextInfoTest'
def load_file(fileName):
with open(fileName,'r') as inf:
return eval(inf.read())
def test_GetData():
''' Test for obtaining data from context information'''
try:
contextInfo = test_CreateInfo()
transaction = '5HGAHZ3WPZUI71PACRPP'
logger.debug( "Test 3.1: Getting context information")
ctxData = contextInfo.GetContext( transaction)
assert(ctxData is not None)
logger.debug("========= PASSED")
if ctxData is not None:
frontend = ctxData['configuration']['FrontEndEndpoint']
backend = ctxData['configuration']['BackendEndpoint']
contextId = ctxData['contextId']
logger.debug( "Test 3.1.1: Testing front end value")
assert('tcp://127.0.0.1:6556' == frontend)
logger.debug("========= PASSED")
logger.debug( "Test 3.1.2: Testing back end value")
assert('tcp://127.0.0.1:6557' == backend)
logger.debug("========= PASSED")
logger.debug( "Test 3.1.3: Testing context ID value")
assert('context001' == contextId)
logger.debug("========= PASSED")
except Exception as inst:
Utilities.ParseException(inst, logger=logger)
def test_SearchMethods():
'''Test search methods'''
try:
## Load file
logger.debug('Loading file with sample data')
fileName = 'SampleContextInfo.json'
sample_dict = load_file(fileName)
## Create object
logger.debug('Creating context information container')
contextInfo = ContextInfo(sample_dict, debug=True)
## Test1: Search in a list of transactions
logger.debug( "Test 1.1: Looking for transaction IDs")
lTrans = ['5HGAHZ3WPZUI71PACRPP', '4OCYDIAL04J7LLGBHVSL', '3YS4K694FWILKL9390ZW']
for l in lTrans:
tran = contextInfo.GetContextData(l).keys()[0]
assert(l == tran)
logger.debug("========= PASSED")
## Test2: Getting service ID data
lServices = ['ts000', 'ts001', 'ts002', 'ts003', 'ts004']
logger.debug("Test 1.2: Getting service ID data in context")
transaction = lTrans[0]
for service in lServices:
serviceData = contextInfo.GetServiceID(transaction, service)
assert(service == serviceData['task']['id'])
logger.debug("========= PASSED")
except Exception as inst:
Utilities.ParseException(inst, logger=logger)
def test_CreateInfo():
''' Test generation of context info'''
try:
## Create object
logger.debug('Creating context information container')
contextInfo = ContextInfo(debug=True)
## Generate context state from start
logger.debug( "Test 2.1: Generate context state from start")
transaction = '5HGAHZ3WPZUI71PACRPP'
data = {'configuration': {'BackendBind': u'tcp://*:6556',
'BackendEndpoint': u'tcp://127.0.0.1:6557',
'FrontBind': u'tcp://*:6557',
'FrontEndEndpoint': u'tcp://127.0.0.1:6556'},
'contextId': u'context001',
'contextLogName': u'CaptureTrack',
'contextName': u'context',
'tasks': [],}
result = contextInfo.GenerateContext(transaction, data)
assert(result)
logger.debug("========= PASSED")
logger.debug( "Test 2.2: Generate service ID space in right transaction")
### Generating service task space
result = contextInfo.SetTaskStart(transaction, 'ts001')
assert(result)
logger.debug("========= PASSED")
## Method from deserialize in topic process
logger.debug( "Test 2.3: Method from deserialize in topic process")
msg = {u'Task': {u'description': u'Sniff network device for track information',
u'message': {u'content': {u'configuration': {u'device_action': u'sniff',
u'interface': u'wlan0'}},
u'header': {u'action': u'start',
u'service_id': u'ts001',
u'service_name': u'sniffer',
u'transaction': u'5HGAHZ3WPZUI71PACRPP'}},
u'state': {u'on_exit': {u'action': u'', u'call': u''},
u'on_fail': {u'action': u'restart', u'call': u'ts001'},
u'on_start': {u'action': u'', u'call': u''},
u'on_update': {u'action': u'', u'call': u''},
u'type': u'on_start'}},
u'id': u'ts001',
u'instance': u'Sniffer',
u'serviceType': u'Process',
u'topic': u'process'}
result = contextInfo.UpdateProcessState(msg, state='in_progress')
assert(result)
logger.debug("========= PASSED")
## Method from deserialize in topic control
logger.debug( "Test 2.4: Method from deserialize in topic control")
msg = {u'content': {u'status': {u'device_action': u'sniff',
u'pid': 26907,
u'result': u'success'}},
u'header': {u'action': u'started',
u'service_id': u'ts001',
u'service_name': u'sniffer',
u'service_transaction': u'5HGAHZ3WPZUI71PACRPP'}}
result = contextInfo.UpdateControlState(msg)
assert(result)
logger.debug("========= PASSED")
return contextInfo
except Exception as inst:
Utilities.ParseException(inst, logger=logger)
def test_ListServices():
'''Test search methods'''
try:
## Load file
logger.debug('Loading file with sample data')
fileName = 'SampleContextInfo.json'
sample_dict = load_file(fileName)
## Create object
logger.debug('Creating context information container')
contextInfo = ContextInfo(sample_dict, debug=True)
## Test1: Search in a list of transactions
logger.debug( "Test 4.1: Getting list of services")
lTrans = ['5HGAHZ3WPZUI71PACRPP', '4OCYDIAL04J7LLGBHVSL', '3YS4K694FWILKL9390ZW']
lSamples = ['ts000', 'ts001', 'ts003', 'ts004']
lServices = contextInfo.GetContextServices(lTrans[0])
assert(len(lSamples) == len(lServices))
logger.debug("========= PASSED")
logger.debug( "Test 4.2: Checking service IDs")
for i in range(len(lServices)):
service = lServices[i]
assert(service['service_id'] == lSamples[i])
logger.debug("========= PASSED")
except Exception as inst:
Utilities.ParseException(inst, logger=logger)
if __name__ == '__main__':
logger = Utilities.GetLogger(LOG_NAME, useFile=False)
myFormat = '%(asctime)s|%(name)30s|%(message)s'
logging.basicConfig(format=myFormat, level=logging.DEBUG)
logger = Utilities.GetLogger(LOG_NAME, useFile=False)
logger.debug('Logger created.')
test_SearchMethods()
test_GetData()
test_ListServices() | zmicroservices | /zmicroservices-1.0.3.tar.gz/zmicroservices-1.0.3/Services/ContextService/ContextInfo.py | ContextInfo.py |
import time
import sys
import json
import zmq
import threading
import pprint
import imp
import multiprocessing
from threading import Thread
from collections import deque
from datetime import datetime
from Utils import Utilities
from Utils import ModuleLoader
from Utils.Utilities import *
from Provider.Service import MultiProcessTasks, ThreadTasks
from ContextMonitor import ContextMonitor
from ContextInfo import ContextInfo
class ContextGroup:
''' '''
def __init__(self, **kwargs):
''' Class constructor'''
try:
component = self.__class__.__name__
self.logger = Utilities.GetLogger(logName=component)
self.trialTimes = 0
self.threads = {}
self.joined = 0
self.frontend = ''
self.backend = ''
self.tasks = None
self.topic = None
self.service_id = None
self.loader = ModuleLoader()
self.contextInfo = ContextInfo()
self.contextMonitor= ContextMonitor()
self.counter = 1
self.service = None
## Variables for thread management
self.lThreads = []
self.lock = multiprocessing.Lock()
self.context = None
self.actionHandler= None
# Generating instance of strategy
for key, value in kwargs.iteritems():
if "service" == key:
if value is not None:
self.logger.debug(" Setting up service")
self.service = value
elif "topic" == key:
self.topic = value
elif "tasks" == key:
self.tasks = value
elif "frontend" == key:
self.frontend = value
elif "backend" == key:
self.backend = value
elif "contextID" == key:
self.service_id = value
self.logger.debug(" Setting up context ID [%s]" % str(self.service_id))
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def deserialize(self, service, rec_msg):
''' '''
try:
topic, json_msg = rec_msg.split("@@@")
topic = topic.strip()
json_msg = json_msg.strip()
if len(json_msg)<1 or json_msg == 'null':
self.logger.debug("Error: Empty message received")
return
json_msg = json_msg.strip()
msg = json.loads(json_msg)
msgKeys = msg.keys()
# Processing messages with context enquires for 'context' topic
if topic == service.topic:
header = msg["header"]
content = msg["content"]
transaction = header['service_transaction']
serviceAction = header['action']
contextId = header['service_id']
serviceName = header['service_name']
# Blocking request and reply messages
self.logger.debug(" - Looking for service [%s] in context messages" %
(header["service_id"]))
if "service_id" in header.keys() and len(header["service_id"])>0:
self.logger.debug("Received service ID [%s]"%header["service_id"])
else:
self.logger.debug("No service ID was provided")
return
# Giving message interpreation within actions
if self.DeserializeAction(msg):
self.logger.debug(" - Service [%s] received message of size %d" %
(service.tid, len(json_msg)))
## Managing thread actions start/stop
if serviceAction == 'exit':
self.logger.debug("Shutting down content provider")
self.ShutDown(service)
return
elif serviceAction == 'stop':
if serviceName == 'all':
self.stop(msg=msg)
else:
## Go to each task
tasks = content['configuration']['TaskService']
for task in tasks:
taskId = task['id']
self.logger.debug(" Stoping action, stopping service [%s]"%taskId)
self.StopService( transaction, service_id=taskId)
#TODO: Set up an action when linger time is expired
elif serviceAction == 'start':
## Starting context services
self.logger.debug(" Starting action, starting service")
self.start(msg=msg)
# Restarting service
elif header['action'] == 'restart':
## First stopping the service task
if serviceName == 'all':
self.stop(msg=msg)
else:
## Go to each task
tasks = content['configuration']['TaskService']
for task in tasks:
taskId = task['id']
self.logger.debug(" Restarting action, stopping service [%s]"%taskId)
self.StopService( transaction, service_id=taskId)
## Second start the service task
self.logger.debug(" Restarting action, starting service [%s]"%header["service_id"])
self.start(msg=msg)
## Store service state control for task service monitoring
self.logger.debug(" - Storing service state control for task service monitoring")
self.contextMonitor.StoreControl(msg)
else:
self.logger.debug("Warning: Message was deserialized but not validated!")
elif topic == 'state':
header = msg["header"]
if header['action'] == 'request':
self.request(msg)
elif header['action'] == 'top':
self.GetTaskMonitor(msg)
elif topic == 'process':
'''Analysing process message'''
## Adding process starter in context information
if 'Task' in msgKeys:
task = msg['Task']
transaction = task['message']["header"]['transaction']
message = task['message']
header = message["header"]
content = message["content"]
serviceAction = header['action']
serviceId = header['service_id']
serviceName = header['service_name']
## Check if transaction is defined in context information
if self.contextInfo.TransactionExists(transaction):
self.logger.debug(" -> Updating context information based in [process] messages")
result = self.contextInfo.UpdateProcessState(msg, state='in_progress')
## Notifying context update message
state = "success" if result else "failed"
self.logger.debug(" -> Notifying control message as [%s]"%state)
self.notify('control', 'update', state, transaction, "context_info")
taskKeys = task.keys()
if 'state' in taskKeys and 'message' in taskKeys:
taskHeader = task['message']['header']
action = taskHeader['action']
if serviceAction == 'restart':
self.logger.debug(" - Should do a RE-START here in [%s]!!!"%serviceId)
self.logger.debug(" - Needs: service_id, frontend, backend, task, transaction")
## Stopping service as in context topic
self.logger.debug(" Restarting, stopping services with process message")
serviceId = taskHeader['service_id']
self.StopService( transaction, service_id=serviceId)
## Gathering data for starting a service
## Getting context info for front and back ends
ctxData = self.contextInfo.GetContextConf(transaction)
if ctxData is not None:
frontend = ctxData['configuration']['FrontEndEndpoint']
backend = ctxData['configuration']['BackendEndpoint']
## Starting context services
self.logger.debug(" Restarting, starting service with process message")
self.StartService(msg, frontend, backend, transaction)
elif topic == 'control':
'''Looking for process control activities '''
## Checking message components are in the message
if 'header' in msgKeys and 'content' in msgKeys:
## Updating context state
header = msg["header"]
content = msg["content"]
transaction = header["service_transaction"]
serviceId = header["service_id"]
action = header["action"]
result = content["status"]['result']
device_action = content["status"]['device_action']
serviceName = header["service_name"]
if serviceName == 'context' or device_action == 'context_info':
#self.logger.debug(" -> Ignoring message with service name [%s]"%serviceName)
return
self.logger.debug(" -> Updating context from [control] messages from [%s]"%serviceName)
ret = self.contextInfo.UpdateControlState(msg)
## Notifying context update message
state = "success" if ret else "failed"
self.logger.debug(" -> Notifying control message as [%s]"%state)
self.notify('control', 'update', state, transaction, "context_info")
## If service is started do not send further messages
if not action.startswith('start'):
self.logger.debug(" -> Monitoring services based in [control] messages")
self.contextMonitor.MonitorServicesControl(msg, self)
elif action.startswith('start') and result == 'failure':
self.logger.debug(" - Service failed to start, stopping service [%s]"%serviceId)
self.StopService( transaction, service_id=serviceId)
else:
self.logger.debug(" -> Service [%s] already started", serviceId)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def ShutDown(self, service):
''' Prepares everything for shutting down'''
try:
## Preparing context information
contexts = self.contextInfo.stateInfo
contextSize = len(contexts)
if contextSize<1:
self.logger.debug(" No context to shutdown in context information")
else:
''''''
## Looking into context state information for
## available context and non-stopped service
## transactions.
for context in contexts:
contextKeys = context.keys()
for transaction in contextKeys:
aContext = context[transaction]
## Looking into available context tasks
## and stopping services
tasks = aContext['tasks']
for task in tasks:
action = task['action']
serviceId = task['service_id']
self.logger.debug(" Found service [%s] in state [%s]"%
(serviceId, action))
if action != 'stopped':
self.StopService(transaction, service_id=serviceId)
## Now is time to shut down all
if service is not None:
self.logger.debug(" Shutting down context provider")
service.stop()
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def serialize(self, msg):
''' '''
try:
if len(self.backend) < 1:
self.logger.debug("Serialise called but no backend endpoint set in service")
return
#self.logger.debug(" Creating context for publisher")
context = zmq.Context()
socket = context.socket(zmq.PUB)
socket.connect(self.backend)
time.sleep(0.1)
# Sending message
#self.logger.debug(" Sending message of [%s] bytes" % len(msg))
utfEncodedMsg = msg.encode('utf-8').strip()
socket.send(utfEncodedMsg)
socket.close()
#self.logger.debug(" Closing socket: %s"%str(socket.closed))
#self.logger.debug(" Destroying context for publisher")
context.destroy()
#self.logger.debug(" Closing context: %s"%str(context.closed))
time.sleep(0.1)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def execute(self, service):
''' '''
self.logger.debug(" Starting context functionlity")
def stop(self, msg=None):
''' This method is called for stopping as a service action'''
try:
if msg != None:
transaction = msg["header"]["service_transaction"]
service_id = msg["header"]["service_id"]
## Checking if transaction exists in context
if self.contextInfo.TransactionNotExists(transaction):
self.logger.debug( "Transaction [%s] does not exits in this context, stop action"%transaction)
return
## Sending message to stop independently logic of processes
## with the same transaction ID
lServices = self.contextInfo.GetContextServices(transaction)
if lServices is None:
self.logger.debug( "Error: No services in context information data structure, stop action")
return
for service in lServices:
self.StopService(transaction, service_id=service['service_id'])
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def start(self, msg=None):
''' Starts context processing'''
if msg != None:
try:
header = msg["header"]
content = msg["content"]
configuration = content['configuration']
taskedServices = configuration['TaskService']
frontend = configuration['FrontEndEndpoint']
backend = configuration['BackendEndpoint']
logName = configuration['TaskLogName']
transaction = header["service_transaction"]
service_id = header["service_id"]
self.joined = 0
taskTopic = 'process'
self.logger.debug("==> Message for setting up process [%s] has been received"%
(header["service_id"]))
## Setting up context configuration in context state
data = {
'contextId': self.service_id,
'contextName': header['service_name'],
'contextLogName': configuration['TaskLogName'],
'tasks':[],
'configuration':
{
'BackendBind' : configuration['BackendBind'],
'BackendEndpoint' : backend,
'FrontBind' : configuration['FrontBind'],
'FrontEndEndpoint': frontend
}
}
result = self.contextInfo.UpdateContext(transaction, data)
## Notifying context update message
state = "success" if result else "failed"
self.logger.debug(" -> Notifying control message as [%s]"%state)
self.notify('control', 'update', state, transaction, "context_info")
## Checking if single task is not list type
if type(taskedServices) != type([]):
taskedServices= [taskedServices]
sizeTasks = len(taskedServices)
## Adding transaction context if not defined
if sizeTasks>0:
self.AddTaskContext(transaction)
## Looping configured tasks
for i in range(sizeTasks):
self.counter += 1
task = taskedServices[i]
## Starting task service from given configuration
self.logger.debug("[\/] Starting task service from given configuration")
self.StartService(task, frontend, backend, transaction)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def StartService(self, task, frontend, backend, transaction):
''' Starts process/thread task from given configuration'''
try:
## Skipping context message if not defined as "on_start"
taskType = task['Task']['state']['type']
taskId = task['id']
taskTopic = task['topic']
taskInstance = task['instance']
serviceType = task['serviceType']
message = task['Task']['message']
msg_conf = message["content"]["configuration"]
msg_header = message["header"]
serviceName = msg_header['service_name']
args = {}
location = None
confKeys = msg_conf.keys()
args.update({'topic': taskTopic})
args.update({'transaction': transaction})
args.update({'backend': backend})
args.update({'frontend': frontend})
args.update({'isMonitor': False})
if taskInstance == 'Monitor':
args.update({'isMonitor': True})
## TODO: Before committing this change, test with coreography
self.logger.debug("==> Starting task service [%s]"%(taskId))
if (taskType != 'on_start' and taskType != 'start_now'):
self.logger.debug("==> Task [%s] not required to start yet"%(taskId))
## Preparing action task if it is a process monitor
serviceName = msg_header['service_name']
self.logger.debug("==> Preparing action task [%s]"%(taskInstance))
if serviceName == 'monitor':
self.logger.debug(" [%s]: Adding context info objecto to arguments"%(taskId))
args.update({'contextInfo': self.contextInfo})
## Getting task location if available
if 'location' in confKeys:
self.logger.debug("==> [%s] Found task location"%taskId)
location = msg_conf['location']
## Getting instance if it should be started only
self.logger.debug("==> [%s] Getting instance of action [%s]"%(taskId, taskInstance))
taskStrategy, taskObj = self.FindInstance(taskInstance, location)
if taskStrategy is None:
self.logger.debug("Error: Unknown task service [%s] with location [%s], no service started"%
(taskInstance, location))
return
## TODO: This is a local checking up, should not be here!!!
## Checking if hosts is defined as a list
if 'hosts' in confKeys and not type(msg_conf['hosts']) == type([]):
task['Task']['message']["content"]["configuration"]["hosts"] = [msg_conf['hosts']]
## Checking if service ID is included in header
if 'service_id' not in msg_header.keys():
task['Task']['message']["header"].update({'service_id' : taskId})
## Checking if device action exists in content configuration
## and passing it as arguments
if 'device_action' in confKeys:
self.logger.debug("==> [%s] Setting device action in class arguments"%(taskId))
args.update({'device_action': msg_conf['device_action']})
## Create task with configured strategy
if taskStrategy is not None:
try:
## Starting threaded services
self.logger.debug("==> [%s] Creating worker for [%s] of type [%s]"%
(taskId, taskInstance, serviceType))
args.update({'strategy': taskStrategy})
#args.update({'taskAction': taskObj})
args.update({'context': self})
## Setting context instance in action task
taskStrategy.context = self
if serviceType == 'Process':
tService = MultiProcessTasks(self.counter, **args)
elif serviceType == 'Thread':
tService = ThreadTasks(self.counter,**args)
time.sleep(0.1)
self.logger.debug("==> [%s] Adding process [%s] for joining context"%
(taskId, taskInstance))
self.AddJoiner(tService, taskId)
## Generates a task space in context state with empty PID
## It is later used to filter whether the task is started
## if it has a valid PID
self.contextInfo.SetTaskStart(transaction, taskId)
## Managing process services
self.logger.debug("==> Monitoring service process for task [%s]"%taskId )
self.contextMonitor.MonitorServicesProcess(transaction, task, self)
except zmq.error.ZMQError:
self.logger.debug("Message not send in backend endpoint: [%s]"%self.backend)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def StopService(self, transaction, service_id=''):
'''Message for stopping services with process message'''
try:
## Preparing message for stopping each of the available service
serviceDetails = self.contextInfo.GetServiceData(transaction, service_id)
if serviceDetails is None:
self.logger.debug( " Error: Invalid value for service details")
return
serviceDetailsKeys = serviceDetails.keys()
if 'task' not in serviceDetailsKeys:
self.logger.debug( " Task key not found in context's service details...")
else:
msg = serviceDetails['task']
msg['Task']['message']['header']['action'] = 'stop'
## Preparing message for stopping services
json_msg = json.dumps(msg, sort_keys=True, indent=4, separators=(',', ': '))
msg = "%s @@@ %s" % ("process", json_msg)
## Sending message for each task in services
self.logger.debug( " Sending message to stop service [%s]..."%(service_id))
self.serialize(msg)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def stop_all_msg(self):
''' '''
if len(self.threads)>0:
threadKeys = self.threads.keys()
for key in threadKeys:
msg = {
"header": {
"action": "stop",
"service_id": "",
"service_name": "context",
"service_transaction": key
}
}
self.logger.debug( "Stopping services...")
self.stop(msg=msg)
time.sleep(0.1)
def request(self, msg):
''' Requests information about context state'''
try:
self.logger.debug(" Getting context information")
header = msg["header"]
transaction = header["service_transaction"]
## Getting all context info
contextData = self.contextInfo.GetContext(transaction)
## Getting context data with service transaction
if contextData is None:
self.logger.debug( "No context data found for transaction [%s]", transaction)
return
## Preparing reply/publshed message
header['action'] = 'reply_context'
pubMsg = {
'header':header,
'content':contextData
}
## Encapsulating message to reply
json_msg = json.dumps(pubMsg, sort_keys=True, indent=4, separators=(',', ': '))
self.logger.debug( "Sending context data in [%d] bytes"%(len(json_msg)))
message = "%s @@@ %s" % ('state', json_msg)
self.serialize(message)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def UpdateThreadState(self, transaction, state=None, tid=None, thread=None):
''' '''
try:
# Checking if PID exists
if tid != None and state != None and thread != None:
## Search for thread PID and define a state
threadSize = len(self.threads[transaction])
## If thread exists, update existing information
for i in range(threadSize):
t = self.threads[transaction][i]
isNotZero = 'tid' in t.keys() and t['tid'] >0
matchesPID=t['tid'] == tid
if isNotZero and matchesPID:
self.threads[transaction][i]['state'] = state
self.threads[transaction][i]['thread'] = thread
return
## If thread does not exists, create thread's PID
tContext = {'tid': tid, 'state': state, 'thread': thread}
self.threads[transaction].append(tContext)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def AddTaskContext(self, transaction):
''' Generates a context space in dictionary with transaction as a Key'''
threadKeys = self.threads.keys()
if transaction not in threadKeys:
self.threads.update({transaction: []})
def FindInstance(self, sObjName, location):
''' Returns an insance of an available service'''
try:
## Compile task before getting instance
#taskClassName = "RadioStationBrowser"
#taskPath = 'Services.'+sObjName+'.'+taskClassName
#self.logger.debug(" Getting an instance of ["+taskPath+"]")
## Returns None because the task is not contained in itself
#taskObj = self.loader.GetInstance(taskPath)
if location is None:
self.logger.debug(" + Getting action class instance for [%s] from system"%(sObjName))
serviceName = "Service"+sObjName
path = "Services."+sObjName+'.'+serviceName
if not any(path in s for s in sys.modules.keys()):
self.logger.debug(" - Module [%s] not found in system modules"%path)
return None, None
else:
## Getting action class instance
self.logger.debug(" + Preparing action class from [%s]"%location)
serviceName = "Service"+sObjName
path = sObjName+'.'+serviceName
location = [location]
self.logger.debug(" + Loading an nstance of ["+path+"]")
classObj = self.loader.GetInstance(path, location)
return classObj, None #, taskObj
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
return None
def DeserializeAction(self, msg):
'''
The validation for context desearilisation conisderes the following table:
Exit Start Stop Restart
Transaction Exists OK OK OK
Transaction NOT Exists OK FAIL OK
Context ID Exists OK OK OK
Context ID NOT Exists OK FAIL OK
Service ID Exists OK OK OK
Service ID NOT Exists OK FAIL OK
Service STATE stopped OK OK OK
Service STATE failed FAIL OK OK -> Needs to be stopped first
Service STATE started FAIL OK OK
Service STATE updated FAIL OK OK -> Same as started
'''
try:
result = True
transaction = msg['header']['service_transaction']
if 'service_transaction' not in msg['header'].keys():
self.logger.debug("[VALIDATE] Transaction [%s] not found in message" %(transaction))
return False
self.logger.debug("[VALIDATE] Validating context service name...")
serviceName = msg["header"]['service_name']
if serviceName != 'context':
self.logger.debug("[VALIDATE] Service name not for context [%s]" %(serviceName))
result = False
## If exits, stop all contexts and safely exit
headerAction = msg["header"]["action"]
if headerAction == 'exit':
self.logger.debug("[VALIDATE] Received exiting command")
return True
else:
## Check if transaction is already defined the processes
self.logger.debug("[VALIDATE] Validating task service transaction...")
## TODO: Check state of the processes to see if they all would be stopped.
## If so, the could be started...
action = msg['header']['action']
isStartAction = action == 'start'
isStopAction = action == 'stop'
isRetartAction = action == 'restart'
transactionExists = self.contextInfo.TransactionExists(transaction)
## Checking if is a restart allow everything
if isRetartAction:
self.logger.debug("[VALIDATE] - Validating restart action for [%s]" %(transaction))
elif isStartAction or isStopAction:
''' '''
## Checking if transaction exists for 'start' and 'stop'
## exit False if it does not exists
if not transactionExists and isStopAction:
self.logger.debug( "[VALIDATE] Transaction [%s] does not exits, failed exiting..."%transaction)
return False
self.logger.debug("[VALIDATE] - Using transaction with ID [%s]" %(transaction))
## Checking if context ID exists for 'start' and 'stop'
## exit False if it does not exists
contextId = msg['header']['service_id']
contextExists = self.contextInfo.ContextExists(transaction, contextId)
if not contextExists and isStopAction:
self.logger.debug("[VALIDATE] - Context ID [%s] NOT found in transaction [%s], failed exiting"
%(contextId, transaction))
return False
self.logger.debug("[VALIDATE] - Found context ID [%s] in transaction [%s]"
%(contextId, transaction))
## Checking if action exists is different return value
tasks = msg['content']['configuration']['TaskService']
for lTask in tasks:
serviceId = lTask['id']
service = self.contextInfo.GetServiceID(transaction, serviceId)
if service is None:
self.logger.debug("[VALIDATE] - Invalid service [%s] in transaction [%s], failed exiting"
%(serviceId, transaction))
break
serviceExists = service is not None
if not serviceExists and isStopAction:
self.logger.debug("[VALIDATE] - Service [%s] not found in transaction [%s], failed exiting"
%(serviceId, transaction))
return False
elif serviceExists:
self.logger.debug("[VALIDATE] - Service [%s] found in transaction [%s]"
%(serviceId, transaction))
## Checking service state not to be stopped
## Fail if it its current state is updated, failed or started and incmoing action is started
serviceState = service['action']
isStoppedService = serviceState == 'stopped'
isFailedService = serviceState == 'failed'
isStartedService = serviceState == 'started'
isUpdatedService = serviceState == 'updated'
nonAcceptedServices = isFailedService or isStartedService or isUpdatedService
if serviceState is not None and (nonAcceptedServices and isStartAction):
self.logger.debug("[VALIDATE] - Service [%s] current state is [%s] and action [%s], failed exiting"
%(serviceId, serviceState, action))
return False
self.logger.debug("[VALIDATE] - Found service [%s] with state [%s] and received action [%s]"
%(serviceId, serviceState, action))
self.logger.debug("[VALIDATE] - Service ID [%s] in transaction [%s] has been validated"
%(serviceId, transaction))
else:
self.logger.debug( "[VALIDATE] Unkown action [%s], failed exiting..."%action)
return False
## PASSED all tests...
return True
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def GetTaskMonitor(self, msg):
''' Method for replying with monitoring status of all task services'''
try:
self.logger.debug(" Getting task service monitoring data")
memUsage = []
## Collecting task service PID's
## Getting context data
header = msg["header"]
content = msg["content"]
configuration = content['configuration']
transaction = header["service_transaction"]
memory_maps = configuration["memory_maps"]
open_connections = configuration["open_connections"]
opened_files = configuration["opened_files"]
## Checking if service is required
if "service" in configuration.keys():
## Validating transaction
if self.contextInfo.TransactionNotExists(transaction):
self.logger.debug(" Transaction [%s] does not exists" %(transaction))
return False
## Getting service monitoring data
service = configuration["service"]
service_endpoint= service["endpoint"]
service_freq = service["frequency_s"]
service_type = service["type"]
self.logger.debug(" Openning [%s] service in [%s] with [%4.2f]s of frequency"
%(service_type, service_endpoint, service_freq))
else:
contextData = self.contextInfo.GetContext(transaction)
dataKeys = contextData.keys()
for key in dataKeys:
if key != 'context':
## TODO: Validate if there is no valid PID
## Catch exception and continue with other processes
## Obtaining memory usage
pid = int(contextData[key]['pid'])
process_memory = Utilities.MemoryUsage(pid,
log=self.logger,
memMap=memory_maps,
openFiles=opened_files,
openConn=open_connections)
## Preparing task service identifiers
memUsage.append({'service_id':key,
'pid':pid,
'serviceName':contextData[key]['serviceName'],
'instance':contextData[key]['instance'],
'memory':process_memory
})
## Preparing reply/publshed message
header['action'] = 'reply_top'
pubMsg = {
'header':header,
'content':memUsage
}
## Encapsulating message to reply
json_msg = json.dumps(pubMsg, sort_keys=True, indent=4, separators=(',', ': '))
self.logger.debug( "Sending context data in [%d] bytes"%(len(json_msg)))
message = "%s @@@ %s" % ('state', json_msg)
self.serialize(message)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def JoinToContext(self):
'''Joins processes available in list of threads'''
try:
with self.lock:
while len(self.lThreads)>0:
proc = self.lThreads.pop(0)
self.logger.debug(" @ Joining process [%d]"%proc.pid)
proc.join(0.0001)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def AddJoiner(self, tService, tName):
''' '''
try:
with self.lock:
self.logger.debug(" -> Adding [%s] process/thread"%tName)
self.lThreads.append(tService)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def notify(self, topic, action, result, transaction, device_action):
'''Notifies '''
try:
## Get context information
stateInfo = self.contextInfo.stateInfo
ctxData = self.contextInfo.GetContextConf(transaction)
contextId = ctxData['contextId']
## Prepare message header
header = {
"action": action, ## has to be 'update'
"service_id": contextId,
"service_name": "context",
"service_transaction": transaction
}
## Prepare messsage content
content = {
"status": {
"device_action": device_action,
"result": result,
"data": stateInfo
}
}
## Prepare pubished message
pubMsg = {
'header':header,
'content':content
}
## Parsing message to json format
json_msg = json.dumps(pubMsg, sort_keys=True, indent=4, separators=(',', ': '))
send_msg = "%s @@@ %s" % (topic, json_msg)
self.serialize(send_msg)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger) | zmicroservices | /zmicroservices-1.0.3.tar.gz/zmicroservices-1.0.3/Services/ContextService/Context.py | Context.py |
import zmq
import random
import re
import time
import random
import json
import sys, os
import pprint
import datetime
import string
from optparse import OptionParser, OptionGroup
from operator import xor
from Utils import Utilities
'''
## For getting context information:
$ python Tools/conf_command.py --endpoint='tcp://127.0.0.1:6557' --service_name='state' --transaction="5HGAHZ3WPZUI71PACRPP" --action='request'
## For obtaining memory usage (top):
$ python Tools/conf_command.py --endpoint='tcp://127.0.0.1:6557' --service_name='state' --transaction="5HGAHZ3WPZUI71PACRPP" --action='top'
$ python Tools/conf_command.py --endpoint='tcp://127.0.0.1:6557' --service_name='state' --transaction="5HGAHZ3WPZUI71PACRPP" --action='top' --open_connections --opened_files --memory_maps
## For starting service for memory monitoring
python Tools/conf_command.py --endpoint='tcp://127.0.0.1:6557' --service_name='state' --transaction="5HGAHZ3WPZUI71PACRPP" --action='top' --use_service --service_type="pub" --service_freq=1 --service_endpoint="tcp://127.0.0.1:6558"
python Tools/conf_command.py --endpoint='tcp://127.0.0.1:6557' --context_file='Conf/Context-CaptureTrack.xml' --service_name='context' --service_id='context001' --transaction='6FDAHH3WPRVV7FGZCRIN' --action='start'
python Tools/conf_command.py --endpoint='tcp://127.0.0.1:6557' --service_name='sniffer' --action='stop' --service_id='ts010' --transaction='6FDAHH3WPRVV7FGZCRIN' --device_action='sniff'
python Tools/conf_command.py --endpoint='tcp://127.0.0.1:6557' --service_name='sniffer' --action='restart' --service_id='ts010' --transaction='6FDAHH3WPRVV7FGZCRIN' --device_action='sniff' --result='success' --sniffer_filter='http>0 and ip.addr == 70.42.73.72' --sniffer_header='4.json' --interface='eth0'
python Tools/conf_command.py --use_file --endpoint='tcp://127.0.0.1:6557' --service_name='context' --context_file='Conf/Context-CaptureTrack.xml' --transaction='6FDAHH3WPRVV7FGZCRIN' --action='start' --service_id='ts001'
python Tools/conf_command.py --use_file --endpoint='tcp://127.0.0.1:5557' --service_name='context' --context_file='Conf/Context-MicroservicesExample.xml' --service_id='context002' --transaction='5HGAHZ3WPZUI71PACRPP' --action='start' --task_id='all'
'''
'''
Instructions:
python Tools/conf_command.py --endpoint='tcp://127.0.0.1:5557' --service_name='sniffer' --action='updated' --service_id='ts004' --transaction='WN932J6QP6T8HNZEE9CX' --device_action='track_found' --topic='control' --result='success' --track_title='track1' --track_title='track2' --track_title='track3'
python Tools/conf_command.py --endpoint='tcp://127.0.0.1:5557' --service_name='music_search' --action='updated' --service_id='ts003' --transaction='WN932J6QP6T8HNZEE9CX' --device_action='track_report' --result='success' --track_title='track1' --track_title='track2' --track_title='track3' --topic='control' --query="Home (Ben Watt Remix) - Zero 7"
1) If you want to send message to annotator for storing found tracks:
python Tools/conf_command.py --endpoint='tcp://127.0.0.1:5557'
--service_name='sniffer'
--action='updated'
--service_id='ts010'
--transaction='WN932J6QP6T8HNZEE9CX'
--device_action='track_found'
--result='success'
2) If you want to send message to annotator for storing reported tittles:
python Tools/conf_command.py --endpoint='tcp://127.0.0.1:5557'
--service_name='music_search'
--action='updated'
--service_id='ts003'
--transaction='WN932J6QP6T8HNZEE9CX'
--device_action='track_report'
--result='success'
--track_title='track1' --track_title='track2' --track_title='track3'
--topic='control' --query="Home (Ben Watt Remix) - Zero 7"
'''
sUsage = "usage:\n"\
" For sending a message to an annotator service\n"\
"\t python Tools/conf_command.py --endpoint='tcp://127.0.0.1:5557'\\ \n"\
"\t\t--service_name='sniffer'\ \n" \
"\t\t--action='updated'\ \n"\
"\t\t--service_id='ts010'\ \n"\
"\t\t--transaction='WN932J6QP6T8HNZEE9CX'\ \n"\
"\t\t--device_action='track_found'\ \n"\
"\t\t--result='success'\ \n"\
"\t\t--track_title='track1' --track_title='track2' --track_title='track3'\n"
def IdGenerator(size=6, chars=string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for _ in range(size))
def ParseTasks(options):
'''Generates JSON task configuration from XML file'''
# Adding utils path based on current location
# TODO: Change this!
try:
optKeys = options.__dict__.keys()
currPath = os.path.abspath(__file__)
utilsPath = currPath[:currPath.find("Tools")]+"Utils"
sys.path.append(utilsPath)
testConf = None
if options.context_file is not None:
# Importing XML parser
try:
from XMLParser import ParseXml2Dict
print "Parser found locally"
except ImportError:
print "Parser not found locally"
try:
from Utils.XMLParser import ParseXml2Dict
print "Parser found in system"
except ImportError:
print "Parser not found in system"
# Parsing test file
rootName = 'Context'
testConf = ParseXml2Dict(options.context_file, rootName)
# If an interface is set
if 'service_id' in optKeys and options.interface is not None:
'''' '''
# Checking task is a list
if type(testConf['TaskService']) != type([]):
testConf['TaskService'] = [testConf['TaskService']]
# Overwriting network interface if defined as arguments
for lTask in testConf['TaskService']:
if lTask['instance'] == 'Sniffer':
task = lTask['Task']
conf = task['message']['content']['configuration']
conf['interface'] = options.interface
return testConf
except Exception as inst:
Utilities.ParseException(inst)
def GetTask(configuration, options):
'''Getting task configuration from XML with an specific service ID'''
try:
''' '''
## Setting header data
header = {}
header['action'] = options.action
header['service_id'] = configuration['ContextID']
header['service_name'] = options.service_name
header['service_transaction']= options.transaction
fileTasks = configuration['TaskService']
options.topic = 'context'
serviceTask = {}
## If configuration file has only one task it will not be a list
if not isinstance(fileTasks, list):
fileTasks = [fileTasks]
## Preparing task configuration message
print "+ Preparing task configuration message"
taskConfMsg = {
'content':
{'configuration':
{
'BackendBind' : configuration['BackendBind'],
'BackendEndpoint' : configuration['BackendEndpoint'],
'FrontBind' : configuration['FrontBind'],
'FrontEndEndpoint': configuration['FrontEndEndpoint'],
'TaskLogName' : configuration['TaskLogName'],
'ContextID' : configuration['ContextID'],
'TaskService' : {}
}
},
'header':header
}
if options.task_id == None:
## Reusing task ID from given message
for lTask in fileTasks:
print "+ Reusing task ID [%s] for task service control message"%lTask['id']
lTask['Task']['message']['header'].update({'action':options.action})
lTask['Task']['message']['header'].update({'service_id':lTask['id']})
lTask['Task']['message']['header'].update({'transaction':options.transaction})
taskConfMsg['content']['configuration']['TaskService'] = [lTask]
print "+ Preparing message for service [%s]"%(lTask['Task']['message']['header']['service_id'])
return taskConfMsg
return taskConfMsg
elif options.task_id == 'all':
print "+ Preparing broadcast message"
taskConfMsg['content']['configuration']['TaskService'] = configuration['TaskService']
for lTask in fileTasks:
lTask['Task']['message']['header']['action'] = options.action
return taskConfMsg
else:
print "+ Looking into file tasks"
## Looking into file tasks
taskConfMsg['content']['configuration']['TaskService'] = []
for lTask in fileTasks:
lTask['Task']['message']['header']['action'] = options.action
lTask['Task']['message']['header']['service_id'] = lTask['id']
lTask['Task']['message']['header']['transaction']= options.transaction
taskConfMsg['content']['configuration']['TaskService'].append(lTask)
print "+ Preparing message for service [%s]"%(lTask['Task']['message']['header']['service_id'])
if options.task_id != 'ts000' and options.task_id != configuration['ContextID']:
print "- Task ID not found in configuration file..."
sys.exit(0)
return taskConfMsg
return serviceTask
except Exception as inst:
Utilities.ParseException(inst)
def message(options):
''' '''
try:
optKeys = options.__dict__.keys()
msg = {}
header = {
"service_name": '' ,
"action": '',
"service_id": ''
}
configuration = {}
content = {}
if options.action is not None:
header["action"] = options.action
if options.service_name is not None:
header["service_name"] = options.service_name
if 'service_id' in optKeys and options.service_id is not None:
header["service_id"] = options.service_id
# Settting up transaction
if options.transaction is not None:
''' '''
if len(options.transaction) < 1:
transactionID = IdGenerator(size=20)
header["service_transaction"] = transactionID
options.transaction = transactionID
else:
header["service_transaction"] = options.transaction
if header["service_name"] == 'state':
''' '''
# If a request of context is sent, we do not need some of the fields
if options.action == "request":
header["service_transaction"] = options.transaction
header["service_id"] = ''
options.topic = header["service_name"]
if options.action == "top":
header["service_transaction"] = options.transaction
header["service_id"] = ''
options.topic = header["service_name"]
## Setting up monitoring service configuration
## options in message
configuration = {
"open_connections":options.open_connections,
"memory_maps":options.memory_maps,
"opened_files":options.opened_files
}
if options.use_service:
service = {
"service":{
"type":options.service_type,
"frequency_s":options.service_freq,
"endpoint":options.service_endpoint,
}
}
configuration.update(service)
content = {"content": {"configuration": configuration}}
elif header["service_name"] == 'context' and options.use_file==False:
header["service_name"] = options.service_name
options.topic = header["service_name"]
## Getting XML and interface from arguments
configuration = ParseTasks(options)
print "===>configuration:", configuration
if configuration is None:
print "- Task parsing failed..."
sys.exit(0)
return
if header["action"] == 'stop':
configuration = {}
content = {"content": {"configuration": configuration}}
elif header["service_name"] == 'all' and options.use_file==False and header["action"] == 'stop':
content = {"content": {}}
elif header["service_name"] == 'sniffer':
configuration = {
"device_action": ''
}
if options.device_action is not None:
configuration["device_action"] = options.device_action
if options.service_name == 'track_found':
if options.result != 'none':
configuration["result"] = options.result
if options.track_title is not None or len(options.track_title)>0:
configuration["tracks"] = []
for i in range(len(options.track_title)):
track = options.track_title[i]
item = {'track':track, 'timestamp': ''}
#print "track:", options.track_title
try:
timestamp = options.track_timestamp[i]
item['timestamp'] = timestamp
except IndexError:
item['timestamp'] = str(datetime.datetime.now())
except Exception as inst:
exc_type, exc_obj, exc_tb = sys.exc_info()
exception_fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
exception_line = str(exc_tb.tb_lineno)
exception_type = str(type(inst))
exception_desc = str(inst)
print " %s: %s in %s:%s"%(exception_type,
exception_desc,
exception_fname,
exception_line )
## Adding track item to content
configuration["tracks"].append(item)
content = {"content": {"status": configuration}}
elif options.service_name == 'sniffer' and (options.action == 'start' or options.action == 'restart'):
configuration.update({"filter": options.sniffer_filter})
configuration.update({"headerPath": options.sniffer_header})
configuration.update({"interface": options.interface})
content = {"content": {"configuration": configuration}}
elif options.service_name == 'sniffer' and options.action == 'stop':
header["action"] = options.action
header = {
'service_name':header["service_name"],
'service_id':header["service_id"],
'service_transaction' : header["service_transaction"],
'action' : options.action
}
content = {"Task": {"message": {'header':header}}}
elif header["service_name"] == 'music_search':
configuration = {
"device_action": '',
"query": '',
"report": {'items':[], 'status':''},
"result": '',
"timestamp": '',
}
if options.device_action is not None:
configuration["device_action"] = options.device_action
if options.result is not None:
configuration["result"] = options.result
if options.query is not None:
configuration["query"] = options.query
if len(options.track_timestamp)>0:
configuration["timestamp"] = options.track_timestamp[0]
else:
configuration["timestamp"] = str(datetime.datetime.now())
configuration['report']['status'] = 'found'
## Tracks here are treated as titles inside report
if options.track_title is not None or len(options.track_title)>0:
for i in range(len(options.track_title)):
track = options.track_title[i]
youtubeId = IdGenerator(size=11)
ratio = random.randint(75,101)/100.00
item = {'title':track, 'id': youtubeId, 'ratio': ratio}
configuration['report']['items'].append(item)
content = {"content": {"status": configuration}}
elif options.use_file==True:
''''''
## Getting XML and interface from arguments
configuration = ParseTasks(options)
## Getting task by service ID
msg= GetTask(configuration, options)
return msg
msg.update({"header": header})
msg.update(content)
return msg
except Exception as inst:
Utilities.ParseException(inst)
def main(msg):
''' '''
topic = options.topic
endpoint = options.endpoint
print "+ Connecting endpoint ["+endpoint+ "] in topic ["+topic+"]"
ctx = zmq.Context()
socket = ctx.socket(zmq.PUB)
socket.connect(endpoint)
time.sleep(0.3)
json_msg = json.dumps(msg, sort_keys=True, indent=4, separators=(',', ': '))
print "+ Sending message of [%d] bytes"%(len(json_msg))
message = "%s @@@ %s" % (topic, json_msg)
socket.send(message)
if __name__ == '__main__':
''' '''
available_services = ['browser', 'ftp', 'portal', 'device', 'local', 'context', 'state', 'sniffer', 'music_search', 'all']
available_action_cmds = ['new_songs', 'none']
available_device_actions = ['firefox', 'syslog', 'downloader', 'track_found', 'track_report', 'sniff', 'none']
available_actions = ['start', 'stop', 'restart', 'request', 'updated', 'none', 'top', 'exit']
available_topics = ['process', 'context', 'control']
available_results = ['success', 'failure', 'none']
usage = sUsage
parser = OptionParser(usage=usage)
parser.add_option('--endpoint',
metavar="URL",
default=None,
help="sets the IPC end point, normally it is an URL")
parser.add_option('--service_id',
metavar="SERVICE_ID",
default='none',
help="sets a service SERVICE_ID for remote process")
parser.add_option('--action',
type='choice',
action='store',
dest='action',
choices=available_actions,
default='none',
help='sets action from [start|stop|restart|none]')
parser.add_option('--service_name',
type='choice',
action='store',
dest='service_name',
choices=available_services,
default=None,
help='defines destination process from '+str(available_services))
parser.add_option('--topic',
metavar="TOPIC",
default='process',
help="sets the topic of the message")
deviceOpts = OptionGroup(parser, "Device inspection",
"These options are for setting up process for"
"inspecting device syslog entries")
deviceOpts.add_option('--device_action',
type='choice',
action='store',
dest='device_action',
choices=available_device_actions,
default='none',
help='defines destination process from [syslog, none]')
contextOpts = OptionGroup(parser, "Context generation",
"These options are for generating contexts of services"
"based in XML configuration")
contextOpts.add_option('--context_file',
type="string",
action='store',
default=None,
help='Input similar file name for all accessed devices')
contextOpts.add_option('--transaction',
type="string",
action='store',
default=None,
help='sets transaction ID')
contextOpts.add_option('--interface',
type="string",
action='store',
default=None,
help='Overwrites XML configuration interface')
contextOpts.add_option('--use_file',
dest='use_file',
action='store_true',
default=False,
help='Makes use of configuration file for configuring task services')
contextOpts.add_option('--task_id',
metavar="TASK_ID",
default=None,
help="Service ID to control found in XML configuration file")
annotatorOpts = OptionGroup(parser, "Song annotation service",
"These options are for handling track annotations in Mongo DB"
"")
annotatorOpts.add_option('--result',
type='choice',
action='store',
dest='result',
choices=available_results,
default='none',
help='sets result of a tasked service from '+str(available_results))
annotatorOpts.add_option("--track_title",
action="append",
default=[],
type="string",
help="list of found track")
annotatorOpts.add_option("--track_timestamp",
action="append",
default=[],
type="string",
help="list of timestamps for found track")
annotatorOpts.add_option('--query',
type="string",
action='store',
default=None,
help='sets report track query. Text to be found in DB record.')
snifferOpts = OptionGroup(parser, "Sniffer service",
"These options are for configuring sniffer command"
"")
snifferOpts.add_option('--sniffer_filter',
type="string",
action='store',
default=None,
help='path where local files are found')
snifferOpts.add_option('--sniffer_header',
type="string",
action='store',
default=None,
help='path where local files are found')
monitorOpts = OptionGroup(parser, "Monitoring services",
"Options for configuring and setting up a memory"
"process monitoring")
monitorOpts.add_option('--open_connections',
dest='open_connections',
action='store_true',
default=False,
help='Monitors opened connections for parent process')
monitorOpts.add_option('--opened_files',
dest='opened_files',
action='store_true',
default=False,
help='Monitors opened files for parent process')
monitorOpts.add_option('--memory_maps',
dest='memory_maps',
action='store_true',
default=False,
help='Monitors memory maps for parent process')
monitorOpts.add_option('--use_service',
dest='use_service',
action='store_true',
default=False,
help='Defines a reporting service for monitoring processes')
monitorOpts.add_option('--service_type',
type="string",
action='store',
default='pub',
help='Defines type of service for monitoring service [pub, rep]')
monitorOpts.add_option('--service_endpoint',
metavar="URL",
default="tcp://127.0.0.1:6558",
help='Overwrites XML option "MonitorEndpoint" for endpoint of monitoring service')
monitorOpts.add_option('--service_freq',
metavar="NUMBER",
default=1.0,
dest='service_freq',
type="float",
help="Sets frequency for reporting process monitoring")
parser.add_option_group(deviceOpts)
parser.add_option_group(contextOpts)
parser.add_option_group(annotatorOpts)
parser.add_option_group(snifferOpts)
parser.add_option_group(monitorOpts)
(options, args) = parser.parse_args()
if options.service_name == 'state':
if options.action == 'none':
parser.error("Missing required option: action")
elif options.transaction is None:
parser.error("Missing required option: transaction")
if options.service_name == 'sniffer':
if options.action == 'none':
parser.error("Missing required option: action")
if options.service_id == 'none':
parser.error("Missing required option: service_id")
if options.service_name is None:
parser.error("Missing required option: service_name")
if options.transaction is None:
parser.error("Missing required option: transaction")
if options.device_action == 'none':
parser.error("Missing required option: device_action")
#if options.result is not 'none':
if options.result == 'track_found':
#parser.error("Missing required option: result")
if len(options.track_title)<1:
parser.error("Missing required option: track_title")
if options.service_name == 'sniffer' and (options.action == 'start' or options.action == 'restart'):
if options.sniffer_filter is None:
parser.error("Missing required option: sniffer_filter")
if options.sniffer_header is None:
parser.error("Missing required option: sniffer_header")
if options.interface is None:
parser.error("Missing required option: interface")
if options.service_name == 'music_search':
if options.action == 'none':
parser.error("Missing required option: action")
if options.service_id == 'none':
parser.error("Missing required option: service_id")
if options.service_name is None:
parser.error("Missing required option: service_name")
if options.transaction is None:
parser.error("Missing required option: transaction")
if options.device_action == 'none':
parser.error("Missing required option: device_action")
if options.result == 'none':
parser.error("Missing required option: result")
if len(options.track_title)<1:
parser.error("Missing required option: track_title")
if options.query is None:
parser.error("Missing required option: query")
if options.service_name == 'state' and options.action == 'top':
if options.endpoint is None:
parser.error("Missing required option: endpoint")
elif options.transaction is None:
parser.error("Missing required option: transaction")
# Forcing list types for single itemss
if type(options.track_title) != type([]):
options.track_title = [options.track_title]
if options.use_file:
if options.context_file is None:
parser.error("Missing required option: --context_file")
if options.transaction is None:
parser.error("Missing required option: --transaction")
if options.action is 'none':
parser.error("Missing required option: --action")
if options.endpoint is None:
parser.error("Missing required option: --endpoint")
if options.service_name is None:
parser.error("Missing required option: --service_name")
msg = message(options)
main(msg) | zmicroservices | /zmicroservices-1.0.3.tar.gz/zmicroservices-1.0.3/Tools/conf_command.py | conf_command.py |
import sys, os
from optparse import OptionParser, OptionGroup
import xml.etree.ElementTree as ET
## Importing Utils from parent path
file_path = os.path.dirname(__file__)
join_path = os.path.join(file_path, '../Utils')
abs_path = os.path.abspath(join_path)
sys.path.append(abs_path)
from Utils import Utilities
from Utils.XMLParser import ParseXml2Dict
class AutoCodeError(Exception):
def __init__(self, message, reason):
self.message = message
self.reason = reason
class AutoCode(object):
'''
Service instance is the type of created service as defined in task
service parameters as 'instance' in the configuration file
'''
ServiceType = 'TestServiceType'
'''
Task file name is for defining specific operations from task class.
It will be imported from created directory and used to instance a
task class.
'''
TaskFile = 'TestTaskFile'
'''
Name of the autogenerated task class. It should have the logic for
producing a service. It is called by the service and imported by file name.
'''
TaskClass = 'TestTaskClass'
'''
Required for logging and identifying task operations.
'''
TaskDescription = 'TestTaskDescription'
'''
Logging context name. It is used in 'TaskLogName' in the configuration file.
'''
ContextName = 'TestContextName'
'''
Defines a service name for the identifying service process messages.
It is called in process configuration configuration file.
'''
ServiceName = 'TestServiceName'
'''
IP address of server endpoint. It is used in 'FrontEndEndpoint' and 'BackendEndpoint'
in the configuration file.
'''
ServerIP = 'TestServerIP'
'''
Front end port for subscriber and back end binding ports. It is used in 'FrontEndEndpoint'
and 'BackendBind' in the configuration file.
'''
SubPort = 'TestSubPort'
'''
Back end port for subscriber and front end binding ports. It is used in 'BackendEndpoint'
and 'FrontBind' in the configuration file.
'''
PubPort = 'TestPubPort'
'''
Task service ID identifier. It is used as parameter 'id' in 'TaskService' label in the
configuration file.
'''
TaskID = 'TestTaskID'
'''
Task device action used for message identification. It is used as 'device_action'
of the content configuration of the task service in the configuration file.
'''
DeviceAction = 'TestDeviceAction'
'''
Defines entry action to be executed upon entry to a state associated with
other states. It is not to transitions and it is called regardless of how a
state is resulted. This fixture is related to UML statechart.
'''
EntryAction = 'TestEntryAction'
'''
If it exists, defines the type of task template to use: "Single" or "Looped".
The "Single" process is executed from start to finish. The "Looped" is
a process that continously executes itself.
'''
TaskType = 'TestTaskType'
'''
User-defined identifier for context. It should be a unique alpha-numeric
identifier.
'''
ContextID = 'TestContextID'
'''
Used to refer the absolute path location of non-system services.
'''
ModuleLocation = 'TestModuleLocation'
def __init__(self, options):
''' Class constructor'''
try:
self.ServicePath = None
self.HomePath = None
self.ServiceType = None
self.TaskFile = None
self.TaskClass = None
self.TaskDescription = None
self.ServiceName = None
self.ServerIP = None
self.SubPort = None
self.PubPort = None
self.ContextName = None
self.TaskID = None
self.DeviceAction = None
self.EntryAction = None
self.TaskType = 'Looped'
self.ModuleLocation = None
self.ContextID = None
self.StateConf = []
self.log = True
## Service configuration location
self.ServicePath = options['service_path']
self.HomePath = options['home_path']
## Service generation stub variables
self.ServiceType = options['task_service']
self.TaskFile = options['task_service']
self.TaskClass = options['task_class']
self.TaskDescription= options['task_desc']
## Service XML configuration options
self.ServiceName = options['service_name']
self.ServerIP = options['server_ip']
self.SubPort = options['sub_port']
self.PubPort = options['pub_port']
self.ContextName = options['context_name']
self.TaskID = options['task_id']
self.DeviceAction = options['device_action']
self.EntryAction = options['entry_action']
self.StateConf = options['state']
self.ContextID = options['context_id']
self.ModuleLocation= options['location']
## Setting logger
self.log = options['log_on']
# Validating state values whether they would be incomplete
if 'task_type' in options.keys():
self.TaskType = options['task_type']
if len(self.StateConf) != 4:
raise AutoCodeError('Failure in constructor', 'State transitions are not complete')
reason = "Analysing... ["+self.ServicePath+"]"
self.PrintLog("- "+reason)
servicesPath = self.ServicePath+'/Services'
if not os.path.exists(servicesPath):
self.PrintLog("- Context service root path not found, creating [Services] directory")
os.makedirs(servicesPath)
else:
self.PrintLog(" Nothing to do")
except Exception as inst:
Utilities.ParseException(inst)
def PrintLog(self, msg):
''' Internal logger method'''
if self.log:
print msg
def CreateInit(self):
'''Create init file for service'''
try:
servicePath = self.ServicePath+'/Services/'+self.ServiceType
if not os.path.exists(servicePath):
message = "Warning:"
reason = "Root path is not valid"
print message+" : "+reason
return servicePath
## Open init template
#$TaskFile import $TaskClass
self.PrintLog("+ Generating init template file")
initName = '__init__.'
initPath = self.HomePath+'/Tools/Templates/'+initName+'tmpl'
with open(initPath, 'r') as openedFile:
data=openedFile.read()
data = data.replace('$TaskFile', self.TaskFile)
data = data.replace('$TaskClass', self.TaskClass)
initOutput = servicePath+'/'+initName+'py'
#print "==>", initOutput
with open(initOutput, "w") as init_file:
init_file.write(data)
except Exception as inst:
Utilities.ParseException(inst)
finally:
return servicePath
def CreateDirectory(self):
'''Create directoy with service name '''
try:
servicePath = self.ServicePath+'/Services/'+self.ServiceType
if os.path.exists(servicePath):
message = "Warning: Couldn't create service path"
reason = "Path already exists ["+servicePath+"]"
self.PrintLog(message+" "+reason)
return servicePath
## If directory does not exists, create it
self.PrintLog("+ Creating service directory [%s]"%servicePath)
os.makedirs(servicePath)
except Exception as inst:
Utilities.ParseException(inst)
finally:
return servicePath
def CreateServiceStub(self):
'''Create service task stub file'''
try:
servicePath = self.ServicePath+'/Services/'+self.ServiceType
if not os.path.exists(servicePath):
message = "Warning:"
reason = "Root path is not valid"
print message+" : "+reason
return servicePath
## Open service task template
#$TaskFile import $TaskClass
self.PrintLog("+ Loading task service stub template file")
fileName = 'Service'+self.ServiceType+'.py'
filePath = self.HomePath+'/Tools/Templates/ServiceTask.tmpl'
with open(filePath, 'r') as openedFile:
data=openedFile.read()
data = data.replace('$ServiceType', self.ServiceType)
data = data.replace('$TaskFile', self.TaskFile)
data = data.replace('$TaskDescription', self.TaskDescription)
data = data.replace('$ServiceName', self.ServiceName)
data = data.replace('$TaskClass', self.TaskClass)
fileOutput = servicePath+'/'+fileName
with open(fileOutput, "w") as init_file:
init_file.write(data)
except Exception as inst:
Utilities.ParseException(inst)
def CreateTaskStub(self):
'''Create strategy task stub file'''
try:
servicePath = self.ServicePath+'/Services/'+self.ServiceType
if not os.path.exists(servicePath):
message = "Warning:"
reason = "Root path is not valid"
print message+" : "+reason
##TODO: Should create an exception
sys.exit(0)
## Open service task template
self.PrintLog("+ Loading task template file")
fileName = self.TaskFile+'.py'
## Defining the type of task
if self.TaskType == 'Looped':
filePath = self.HomePath+'/Tools/Templates/Task.tmpl'
elif self.TaskType == 'Single':
filePath = self.HomePath+'/Tools/Templates/TaskSingle.tmpl'
else:
message = "Warning:"
reason = "Invalid type of task template"
print message+" : "+reason
##TODO: Should create an exception
sys.exit(0)
self.PrintLog("+ Loading a task for [%s]"%self.TaskType)
with open(filePath, 'r') as openedFile:
data=openedFile.read()
data = data.replace('$TaskClass', self.TaskClass)
fileOutput = servicePath+'/'+fileName
with open(fileOutput, "w") as init_file:
init_file.write(data)
except Exception as inst:
Utilities.ParseException(inst)
def AdaptConfFile(self):
'''Create strategy task stub file'''
try:
servicePath = self.ServicePath+'/Services/'+self.ServiceType
if not os.path.exists(servicePath):
message = "Warning:"
reason = "Root path is not valid"
print message+" : "+reason
return servicePath
## Open configuration template file
self.PrintLog("+ Adapting configuration file")
fileName = 'Context-'+self.ContextName+'.xml'
filePath = self.HomePath+'/Tools/Templates/Context.tmpl'
## Creating conf path
confFilePath = self.HomePath+'/Conf/'
if not os.path.exists(confFilePath):
self.PrintLog("- Creating configuration directory")
os.makedirs(confFilePath)
confFileName = confFilePath+fileName
if os.path.isfile(confFileName):
''' '''
## File already exists,
self.PrintLog("+ Updating configuration file [%s]"%fileName)
with open(confFileName, 'r') as openedFile:
''''''
## Loading file content as XML
data=openedFile.read()
root = ET.fromstring(data)
## Checking for already defined configuration processes
nodes = root.findall("./TaskService")
for child in nodes:
#print "==>1 ", child.tag, child.attrib
attribs = child.attrib
## Checking if process is already defined
if attribs['instance']==self.ServiceType or attribs['id']==self.TaskID:
self.PrintLog("+ Process is already defined")
return
## Merging both XML's
self.PrintLog("+ Verifying for exisiting content")
## Opening template file to get task service model
with open(filePath, 'r') as openedFile:
templateData = openedFile.read()
templateData = self.SetValues(templateData)
templateRoot = ET.fromstring(templateData)
## Removing non required items for merging
templateRoot.remove(templateRoot.find('FrontEndEndpoint'))
templateRoot.remove(templateRoot.find('BackendEndpoint'))
templateRoot.remove(templateRoot.find('FrontBind'))
templateRoot.remove(templateRoot.find('BackendBind'))
templateRoot.remove(templateRoot.find('TaskLogName'))
templateRoot.remove(templateRoot.find('ContextID'))
## Merging XML trees and obtaining merged XML file
self.PrintLog("+ Merging XML processes")
root.append(templateRoot[0])
mergedXML = ET.tostring(root, encoding='utf8', method='xml')
## Writing new appended file
self.PrintLog("+ Writing on merged file: [%s]"%confFilePath)
with open(confFileName, "w") as init_file:
init_file.write(mergedXML)
else:
## Generating a new file
self.PrintLog("+ Opening task template file")
with open(filePath, 'r') as openedFile:
data = openedFile.read()
data = self.SetValues(data)
self.PrintLog("+ Creating a new [%s] configuration file"%fileName)
with open(confFileName, "w") as init_file:
init_file.write(data)
## TODO: Add extended configuration if it exists
except Exception as inst:
Utilities.ParseException(inst)
def SetValues(self, data):
'''Setting values to template '''
data = data.replace('$ServerIP', self.ServerIP)
data = data.replace('$SubPort', self.SubPort)
data = data.replace('$PubPort', self.PubPort)
data = data.replace('$ContextName', self.ContextName)
data = data.replace('$ContextID', self.ContextID)
data = data.replace('$TaskID', self.TaskID)
data = data.replace('$DeviceAction',self.DeviceAction)
data = data.replace('$TaskDescription',self.TaskDescription)
data = data.replace('$ServiceName', self.ServiceName)
data = data.replace('$ServiceType', self.ServiceType)
data = data.replace('$EntryAction', self.EntryAction)
data = data.replace('$ModuleLocation',self.ModuleLocation)
## Replacing state information
confSize = len(self.StateConf)
for i in range(confSize):
confData = self.StateConf[i]
indexDoc = str(i+1)
self.PrintLog("+ [%s] Setting up data for triggering [%s]"%(indexDoc, confData['trigger']))
## Replacing state information: trigger, action and state ID
data = data.replace('$Trigger'+indexDoc, confData['trigger'])
data = data.replace('$Action'+indexDoc , confData['action'])
data = data.replace('$State'+indexDoc , confData['state_id'])
return data
def CreateFiles(self):
''' Generate code for:
1) Create service directory
2) __init__.py
3) Service<NAME>.py stub file
4) Strategy file stub
'''
try:
## 1) Create service directory
## TODO: Change to a dynamic path in context services
servicesPath = self.CreateDirectory()
## 2) Creating __init__.py
self.CreateInit()
## 3) Service<NAME>.py stub file
self.CreateServiceStub()
## 4) Strategy file stub
self.CreateTaskStub()
## 5) Create or update configuration file
self.AdaptConfFile()
except AutoCodeError as e:
print e.message+" : "+e.reason
except Exception as inst:
Utilities.ParseException(inst)
sUsage = "usage:\n"\
" For sending a message to an annotator service\n"\
"\t python Tools/create_service.py \n"\
"\t\t--service_path='/abs/path/unix/style' \n"\
"\t\t--home_path='/abs/path/unix/style' \n"\
"\t\t--task_service='instance_type' \n"\
"\t\t--task_class='task_class_name' \n"\
"\t\t--service_name='service_name' \n"\
"\t\t--task_desc='task_description' \n"\
"\t\t--server_ip='127.0.0.1' \n"\
"\t\t--sub_port='XXXX' \n"\
"\t\t--pub_port='YYYY' \n"\
"\t\t--context_name='context_test_name' \n"\
"\t\t--task_id='task_ID' \n"\
"\t\t--device_action='device_action_id' \n"
if __name__ == '__main__':
try:
available_entry_actions = ['on_exit', 'on_fail', 'on_start', 'on_update']
usage = sUsage
parser = OptionParser(usage=usage)
systemOpts = OptionGroup(parser, "Service configuration location")
systemOpts.add_option('--service_path',
metavar="PATH",
default=None,
help="Absolute root path where context services are located")
systemOpts.add_option('--xml_file',
metavar="PATH XML FILE",
default=None,
help="Absolute root path where xml configuration file is located")
contextOpts= OptionGroup(parser, "Service generation stub variables")
contextOpts.add_option('--task_service',
metavar="SERVICE",
default=None,
help="Service instance is the type of created service as defined "
"in task service parameters in the configuration file")
contextOpts.add_option('--task_class',
metavar="TASK_CLASS",
default=None,
help="Name of the autogenerated task class. It should have the "
"logic for producing a service. It is called by the service and "
"and imported by file name")
contextOpts.add_option('--task_desc',
metavar="TASK_DESCRIPTION",
default=None,
help="Required for logging and identifying task operations.")
xmltOpts= OptionGroup(parser, "Service XML configuration options")
xmltOpts.add_option('--context_name',
metavar="CONTEXTNAME",
default=None,
help="Logging context name. It is used in 'TaskLogName' in the "
"configuration file.")
xmltOpts.add_option('--service_name',
metavar="SERVICE_NAME",
default=None,
help="Defines a service name for the identifying service process "
"messages. It is called in process configuration configuration file")
xmltOpts.add_option('--server_ip',
metavar="SERVERIP",
default=None,
help="IP address of server endpoint. It is used in "
"'FrontEndEndpoint' and 'BackendEndpoint' in the "
"configuration file.")
xmltOpts.add_option('--sub_port',
metavar="SUBPORT",
default=None,
help="Front end port for subscriber and back end binding ports. "
"It is used in 'FrontEndEndpoint' and 'BackendBind' in the "
"configuration file.")
xmltOpts.add_option('--pub_port',
metavar="PUBPORT",
default=None,
help="Back end port for subscriber and front end binding ports. "
"It is used in 'BackendEndpoint' and 'FrontBind' in the "
"configuration file.")
xmltOpts.add_option('--task_id',
metavar="TASKID",
default=None,
help="Task service ID identifier. It is used as parameter"
"'id' in 'TaskService' label in the configuration file")
xmltOpts.add_option('--device_action',
metavar="DEVICEACTION",
default=None,
help="Task device action used for message identification. messages."
"It is called in process configuration configuration file It is "
"used as 'device_action of the content configuration of the task "
"service in the configuration file.")
xmltOpts.add_option('--entry_action',
type='choice',
action='store',
dest='entry_action',
choices=available_entry_actions,
default=None,
help="Defines entry action to be executed upon entry to a state associated with "
"other states. It is not to transitions and it is called regardless of how a "
"state is resulted. This fixture is related to UML statechart from the following "
"choices: "+str(available_entry_actions))
parser.add_option_group(systemOpts)
parser.add_option_group(contextOpts)
parser.add_option_group(xmltOpts)
(options, args) = parser.parse_args()
if options.xml_file is None and options.service_path is None:
parser.error("Missing required option: service_path or xml_file")
parser.print_help()
if options.xml_file is None and options.home_path is None:
parser.error("Missing required option: home_path or xml_file")
parser.print_help()
if options.xml_file is not None:
''' '''
## Use if many services are generated at the same time
services = ParseXml2Dict(options.xml_file, 'MetaServiceConf')
if type(services['Service']) is not type([]):
services['Service'] = [services['Service']]
for service in services['Service']:
service.update({'context_name': services['context_name']})
service.update({'server_ip': services['server_ip']})
service.update({'sub_port': services['sub_port']})
service.update({'pub_port': services['pub_port']})
service.update({'service_path': services['service_path']})
service.update({'home_path': services['home_path']})
service.update({'context_id': services['context_id']})
service.update({'log_on': bool(int(services['log_on']))})
#pprint.pprint(service)
## Checking if there is a type of task
taskType = 'Looped'
if 'task_type' in service.keys():
taskType = service['task_type']
service.update({'taskType': taskType})
## Calling code autogenerator
autogenerator = AutoCode(service)
autogenerator.CreateFiles()
else:
''' Checking argument values '''
if options.task_service is None:
parser.error("Missing required option: task_service")
parser.print_help()
if options.task_class is None:
parser.error("Missing required option: task_class")
parser.print_help()
if options.task_desc is None:
parser.error("Missing required option: task_desc")
parser.print_help()
if options.context_name is None:
parser.error("Missing required option: context_name")
parser.print_help()
if options.service_name is None:
parser.error("Missing required option: service_name")
parser.print_help()
if options.server_ip is None:
parser.error("Missing required option: server_ip")
parser.print_help()
if options.sub_port is None:
parser.error("Missing required option: sub_port")
parser.print_help()
if options.pub_port is None:
parser.error("Missing required option: pub_port")
parser.print_help()
if options.task_id is None:
parser.error("Missing required option: task_id")
parser.print_help()
if options.device_action is None:
parser.error("Missing required option: device_action")
parser.print_help()
if options.entry_action is None:
parser.error("Missing required option: entry_action")
parser.print_help()
## Calling code autogenerator
options_dict = vars(options)
autogenerator = AutoCode(options_dict)
autogenerator.CreateFiles()
except AutoCodeError as e:
print('Error: %s, %s'%(e.message, e.reason)) | zmicroservices | /zmicroservices-1.0.3.tar.gz/zmicroservices-1.0.3/Tools/create_service.py | create_service.py |
import threading
import sys, os
import time
import datetime
import pyshark
import imp
import pprint
import ast
import logging
import logging.handlers
import xmltodict, json
from lxml import etree
from trollius.executor import TimeoutError
from optparse import OptionParser
from threading import Thread
from Queue import Queue
import Utilities
class PacketHandler(threading.Thread):
def __init__(self, **kwargs):
"""Class for filtering packets for finding track information from live streaming """
try:
threading.Thread.__init__(self)
component = self.__class__.__name__
self.logger = Utilities.GetLogger(component)
self.tStop = threading.Event()
self.tid = None
self.cap = None
self.interface = None
self.filter = None
self.running = False
self.db_record = Queue()
self.onStart = True
self.service = None
self.only_summary = False
self.decode_as = "{}"
self.db_watermark = 3
self.identifier = None
for key, value in kwargs.iteritems():
if 'interface' == key:
self.interface = value
self.logger.debug(' + Setting interface [%s] in packet hanlder' % self.interface)
elif 'filter' == key:
self.filter = value
self.logger.debug(' + Setting filter in packet handler')
elif 'onStart' == key:
self.onStart = bool(value)
elif 'service' == key:
self.service = value
elif 'only_summary' == key:
self.logger.debug(' + Setting option for only summary in packet handler')
self.only_summary = bool(value)
self.service = value
elif 'decode_as' == key:
self.decode_as = value
self.logger.debug(' + Setting option for protocol decoder [%s]' % self.decode_as)
elif 'identifier' == key:
self.identifier = value
self.logger.debug(' + Setting idenfier [%s]' % self.identifier)
if self.onStart:
self.logger.debug(' + Process is set to start from the beginning')
self.start()
self.logger.debug(' Joining thread...')
self.join(1)
else:
self.running = True
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def run(self):
try:
self.tid = Utilities.GetPID()
if self.logger is not None:
self.logger.debug('Starting thread [%d]' % self.tid)
self.logger.debug('Starting network packet capture in thread [%d]' % self.tid)
self.CaptureThread()
if self.logger is not None:
self.logger.debug('Looping for capture monitoring [%d]' % self.tid)
while not self.tStop.isSet():
self.tStop.wait(1)
self.SearchData()
self.logger.debug('Ending DB packet capture [%d]' % self.tid)
except Exception as inst:
Utilities.ParseException(inst)
def CaptureThread(self):
try:
t1 = Thread(target=self.start_capture)
t1.start()
self.logger.debug('Capture started in thread [%d]', self.tid)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def start_capture(self):
"""Calls PyShark live capture """
try:
self.logger.debug('Starting to capture tracks from network interface [%s]' % self.interface)
self.running = True
self.logger.debug(' + Using filter [%s]' % self.filter)
decodeAs = ast.literal_eval(self.decode_as)
self.cap = pyshark.LiveCapture(self.interface,
display_filter=self.filter,
decode_as=decodeAs,
only_summaries=self.only_summary)
if self.cap is not None:
self.cap.apply_on_packets(self.FilterCapture)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def close(self):
"""Closing capture service"""
self.CloseCapturer()
self.logger.debug(' Stopping packet handling thread...')
self.tStop.set()
time.sleep(0.5)
self.logger.debug(' Stopping packet capture...')
if self.tStop.isSet() and self.cap is not None:
self.cap.close()
self.cap = None
if self.is_alive():
self.logger.debug(' Stopping the thread and wait for it to end')
threading.Thread.join(self, 1)
self.logger.debug(' Thread [%d] stopped' % self.tid)
self.running = False
def FilterCapture(self, pkt):
"""Function defined in child class"""
self.logger.debug(" No 'FilterCapture' function defined in parent class")
def CloseCapturer(self):
"""Function defined in child class"""
self.logger.debug(" No 'CloseCapturer' function defined in parent class")
def SearchData(self):
"""Function defined in child class for exposing beahviour within collected data """
def AddNewItem(self, item):
"""Adds an item to local storage only if it is NOT already there """
try:
if self.db_record.qsize() > 0:
lQueue = list(self.db_record.queue)
for element in lQueue:
shared_items = set(item.items()) & set(element.items())
if len(shared_items) < 1:
self.logger.debug(' ===> Adding new captured data to queue')
self.db_record.put(item)
else:
self.logger.debug(' ===> Data already exists in queue...')
else:
self.logger.debug(' ===> Queue is empty, adding new items')
self.db_record.put(item)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def hasStarted(self):
return self.running and not self.tStop.isSet()
def hasFinished(self):
""" Reports task thread status"""
return not self.running and self.tStop.isSet() | zmicroservices | /zmicroservices-1.0.3.tar.gz/zmicroservices-1.0.3/Utils/PacketHandler.py | PacketHandler.py |
import pprint
import json
import xml.etree.cElementTree as ET
import Utilities
def LateXML2Dict(node, ind=''):
try:
nodeSize = len(node)
dDict = {}
#print ind+"nodeSize:", nodeSize
if nodeSize>0:
childDict = {}
for child_of_root in node:
itDict = LateXML2Dict(child_of_root, ind+' ')
#print ind+"itDict:", itDict
childTag = child_of_root.tag
#print ind+"childTag:", childTag
#childDict.update(itDict)
#print ind+"childDict:", childDict
childDictKeys = childDict.keys()
#print ind+"==>childDictKeys:", childDictKeys
#print ind+"==>["+childTag+"] in keys:", (childTag in childDictKeys)
if childTag in childDictKeys:
#print ind+"==>SWAPPING", childDict
tmp = childDict[childTag]
#print ind+"==>ELEMENT LIST:", tmp, ":", type(tmp)
if type(childDict[childTag]) is not type([]):
#print ind+"==>NOT A LIST:", childDict[childTag]
childDict[childTag] = []
childDict[childTag].append(tmp)
#else:
#print ind+"==>IS A LIST:", childDict[childTag]
#print ind+"==>NOW A LIST tag:"+childTag+":", childDict[childTag]
#print ind+"==>SWAPPING WITH", itDict[childTag], ":", type(itDict[childTag])
childDict[childTag].append(itDict[childTag])
#print ind+"==>SWAP RESULT:", childDict[childTag]
else:
childDict.update(itDict)
#print ind+"==>NOT SWAPPING", childDict
attrib = node.attrib.items()
attribSize = len(attrib)
#print ind+"==>#attrib:", attribSize
if attribSize>0:
for attrTag, attrText in attrib:
#print ind+"-->",attrTag,":", attrText
childDict.update({attrTag: attrText})
#print ind+"--> childDict:", childDict
tag = node.tag
#print ind+"--> tag:", tag
#print ind+"-->childDict:", childDict
dDict[tag] = childDict
else:
tag = node.tag
text= node.text
if text is not None and len(text)>0:
text= text.strip()
else:
text = ''
#textSize = len(text)
attrib = node.attrib.items()
attribSize = len(attrib)
#print ind+"tag:", tag
#print ind+"text(",len(text), "):", text
#print ind+"#attrib:", attribSize
dDict[tag] = text
if attribSize>0:
for attrTag, attrText in attrib:
#print ind+"APPEND:",attrTag,":", attrText
dDict.update({attrTag: attrText})
#print ind+"dDict:"
#pprint.pprint(dDict)
#print ind+"================================"
return dDict
except Exception as inst:
Utilities.ParseException(inst, logger=logger)
def ParseXml2Dict(sFile, rootName):
with open(sFile, 'r') as myfile:
data = myfile.read().replace('\n', '').replace('&', '%26')
root = ET.fromstring(data)
result = LateXML2Dict(root)
return result[rootName]
def Schedule2Dict(node, ind=''):
nodeSize = len(node)
dDict = {}
#print ind+"nodeSize:", nodeSize
if nodeSize>0:
childDict = {}
for child_of_root in node:
itDict = Schedule2Dict(child_of_root, ind+' ')
#print ind+"itDict:", itDict
childTag = child_of_root.tag
#print ind+"childTag:", childTag
#childDict.update(itDict)
#print ind+"childDict:", childDict
itDictKeys = itDict.keys()
#print ind+"==>itDictKeys:", itDictKeys, (childTag in itDictKeys)
childDictKeys = childDict.keys()
#print ind+"==>childDictKeys:", childDictKeys
#print ind+"==>["+childTag+"] in keys:", (childTag in childDictKeys)
if childTag in childDictKeys:
#print ind+"==>SWAPPING", childTag
if type(childDict[childTag]) is not type([]):
#print ind+"==>NOT A LIST:", childDict[childTag]
tmp = childDict[childTag]
childDict[childTag] = [tmp]
#else:
#print ind+"==>IS A LIST:", len(childDict[childTag])
childDict[childTag].append(itDict[childTag])
#print ind+"==>SWAP RESULT:"
#pprint.pprint(childDict)
#print ind+("="*60)
#tmp = childDict[childTag]
##if type(childDict[childTag]) is not type([]):
#print ind+"==>NOT A LIST:", childDict[childTag]
#childDict[childTag] = []
#childDict[childTag].append(tmp)
#else:
#print ind+"==>IS A LIST:", childDict[childTag]
#print ind+"==>NOW A LIST childDict["+childTag+"]:", childDict[childTag]
#print ind+"==>SWAPPING WITH", itDict[childTag], ":", type(itDict[childTag])
#childDict[childTag].append(itDict[childTag])
#print ind+"==>SWAP RESULT:", childDict[childTag]
else:
#isOk= childTag in itDictKeys and childTag in childDictKeys
#print ind+"==> isOk", isOk
childDict.update(itDict)
#print ind+"==>NOT SWAPPING", childDict
#if childTag in itDictKeys and childTag not in childDictKeys:
#print ind+"==> childDict", childDict
##print ind+"==> itDict", itDict
#childDict.update(itDict)
#print ind+"==>NOT SWAPPING", childDict
#else:
#print ind+"==>APPEND ITER", itDict[childTag]
#childDict.update(itDict[childTag])
attrib = node.attrib.items()
attribSize = len(attrib)
#print ind+"==>#attrib:", attribSize
if attribSize>0:
for attrTag, attrText in attrib:
#print ind+"-->",attrTag,":", attrText
childDict.update({attrTag: attrText})
#print ind+"--> childDict:", childDict
tag = node.tag
#print ind+"--> tag:", tag
#print ind+"-->childDict:", childDict
dDict[tag] = childDict
else:
tag = node.tag
text= node.text
if text is not None and len(text)>0:
text= text.strip()
else:
text = ''
#textSize = len(text)
attrib = node.attrib.items()
attribSize = len(attrib)
#print ind+"tag:", tag
#print ind+"text(",len(text), "):", text
#print ind+"#attrib:", attribSize
#dDict[tag] = text
#print ind+"dDict["+tag+"]:", dDict[tag]
if attribSize>0:
for attrTag, attrText in attrib:
#print ind+"APPEND:",attrTag,":", attrText
dDict.update({attrTag: attrText})
newDict = {tag:{}}
newDict[tag] = dDict
dDict = newDict
#print ind+"dDict:"
#pprint.pprint(dDict)
#print ind+"================================"
return dDict
def ParseSchedule2Dict(sFile, rootName):
tree = ET.ElementTree(file=sFile)
root = tree.getroot()
result = Schedule2Dict(root)
wrong_result = result[rootName]['Schedule']['Items']['Items']['Item']
corrected = {'Schedule' : {'Items' : wrong_result}}
return corrected
if __name__ == '__main__':
fileName = 'Schedule_215.xml'
fileName = 'tmp/'+fileName
rootName = 'Schedule'
schedule = ParseSchedule2Dict(fileName, rootName)
print json.dumps(schedule, sort_keys=True, indent=4, separators=(',', ': ')) | zmicroservices | /zmicroservices-1.0.3.tar.gz/zmicroservices-1.0.3/Utils/XMLParser.py | XMLParser.py |
import imp
import py_compile
import logging
import sys, os
from Utils import Utilities
from optparse import OptionParser
class ModuleLoader:
''' Loads modules dynamically'''
module_types = { imp.PY_SOURCE: 'source',
imp.PY_COMPILED: 'compiled',
imp.C_EXTENSION: 'extension',
imp.PY_RESOURCE: 'resource',
imp.PKG_DIRECTORY: 'package',
}
def __init__(self, **kwargs):
''' Class constructor'''
component = self.__class__.__name__
self.logger = Utilities.GetLogger(component)
def GetInstance(self, path, searchPath, className=None):
'''
To get an instance is required to:
1) Know the name of loaded class inside the found python module
2) Expect the loaded class has the same name as the found python module
## TODO: This method has too many if's
'''
try:
self.logger.debug(" Getting instance in [%s]" % (path))
## If it is system module do not recompile class
recompile = True
if searchPath is None:
recompile = False
## Start splitting module dotted name in parts
path_parts= path.split('.')
sModules = len(path_parts)
lastPackage =''
for i in range(sModules):
moduleName = path_parts[i]
## Preparing file for method arguments
## TODO: Is there a better way of doing it?
if searchPath is not None:
if type(searchPath) is not list:
searchPath = [searchPath]
if len(searchPath)>0:
fSlash = '' if searchPath[0].endswith('/') else '/'
searchPath = [searchPath[0]+fSlash+lastPackage]
## Getting information from given path
f, fileName, description = imp.find_module(moduleName, searchPath)
importType = self.module_types[description[2]]
self.logger.debug(" Loading [%s] of type [%s]" % ( moduleName, importType))
## Loading module
loadingObject = imp.load_module(moduleName, f, fileName, description)
moduleType = self.module_types[description[2]]
self.logger.debug(" [%s] is a [%s]"%(moduleName, moduleType))
## Concatenating last package in the search directory as we may
### find the class inside it
if moduleType == 'package':
## This is not smart at all, the end is removed and added later to
## keep consitency with non-installed modules
if fileName.endswith(moduleName):
removeSpaces = -1 * len(moduleName)
fileName = fileName[:removeSpaces]
## Not happy at all why this is happening?
lastPackage = moduleName
searchPath = fileName
# If the module is source, get the class,
# will raise AttributeError if class cannot be found
elif moduleType == 'source':
## If it was a system module, all is done...
if not recompile:
self.logger.debug(" Found system module [%s]"%path)
## Class is somewhere inside the modules
if moduleName in loadingObject.__dict__.keys():
classObject = loadingObject.__dict__[moduleName]
return classObject
## Recompiling module
recompiledClass = moduleName+description[0]
self.logger.debug(" Re-compiling class [%s]"%(recompiledClass))
py_compile.compile(fileName)
## Reloading class
reloadedClass = fileName+"c"
self.logger.debug(" Re-loading class [%s]"%(recompiledClass))
newLoaded = imp.load_compiled(moduleName, reloadedClass)
## Reloading module in case code has been updated
for m in sys.modules:
if moduleName in m and '.' in m:
self.logger.debug(" Re-loading module [%s]"%(moduleName))
imp.reload(sys.modules[m])
## Choosing the class to load
loadedClass = None
if className is not None and className in newLoaded.__dict__:
loadedClass = className
elif moduleName in newLoaded.__dict__:
loadedClass = moduleName
## NOTE: The class would not be loaded if loaded class has
## not the same name as the found module or it was
## not input in the parameters of this method
if loadedClass is not None:
self.logger.debug(" Getting a class [%s]"%(loadedClass))
classObj = getattr(newLoaded, loadedClass)
return classObj
else:
## TODO: The class is somewhere in the new loaded module
## and should be gotten
self.logger.debug(" Class not found in module [%s]"%moduleName)
return None
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
## Usage samples:
## NOT WORKING
## $ python ModuleLoader.py --searchPath='/home/renato/workspace/Services/Sniffer' --modulePath='PacketCollector'
## WORKING
## $ python ModuleLoader.py --searchPath='/home/renato/workspace/Services/Sniffer' --modulePath='PacketCollector' --className="CaptureTrack"
## $ python ModuleLoader.py --searchPath='/home/renato/workspace/Services' --modulePath='Sniffer.ServiceSniffer'
## $ python ModuleLoader.py --searchPath='/home/renato/workspace/Services' --modulePath='Sniffer.ServiceSniffer' --className="ServiceSniffer"
LOG_NAME = 'ModuleLoaderTool'
def call_tool(options):
''' Command line method for running sniffer service'''
try:
path = options.modulePath
location = options.searchPath
className = options.className
loader = ModuleLoader()
logger.debug(" Getting an instance of ["+path+"]")
classObj = loader.GetInstance(path, location, className=className)
assert(classObj)
except Exception as inst:
Utilities.ParseException(inst, logger=logger)
if __name__ == '__main__':
logger = Utilities.GetLogger(LOG_NAME, useFile=False)
myFormat = '%(asctime)s|%(name)30s|%(message)s'
logging.basicConfig(format=myFormat, level=logging.DEBUG)
logger = Utilities.GetLogger(LOG_NAME, useFile=False)
logger.debug('Logger created.')
usage = "usage: %prog interface=arg1 filter=arg2"
parser = OptionParser(usage=usage)
parser.add_option('--searchPath',
type="string",
action='store',
default=None,
help='Module location')
parser.add_option('--modulePath',
type="string",
action='store',
default=None,
help='Module python path')
parser.add_option('--className',
type="string",
action='store',
default=None,
help='Class name inside module')
(options, args) = parser.parse_args()
if options.searchPath is None:
parser.error("Missing required option: --searchPath='/home/path'")
if options.modulePath is None:
parser.error("Missing required option: --modulePath='Service.Task.Module'")
call_tool(options) | zmicroservices | /zmicroservices-1.0.3.tar.gz/zmicroservices-1.0.3/Utils/ModuleLoader.py | ModuleLoader.py |
import sys, os
import time
import json
import pymongo
import ast
import logging
import logging.handlers
from optparse import OptionParser, OptionGroup
from pymongo import MongoClient
import Utilities
class MongoAccess:
def __init__(self, debug=False):
''' '''
component = self.__class__.__name__
self.logger = Utilities.GetLogger(component)
if not debug:
self.logger.setLevel(logging.INFO)
self.collection = None
self.db = None
self.debug = debug
self.logger.debug("Creating mongo client with debug mode [%s]"%
('ON' if self.debug else 'OFF'))
def connect(self, database, collection, host='localhost', port=27017):
''' '''
result = False
try:
self.logger.debug("Creating mongo client")
# Creating mongo client
client = MongoClient(host, port)
# Getting instance of database
self.logger.debug("Getting instance of database")
self.db = client[database]
# Getting instance of collection
self.logger.debug("Getting instance of collection")
self.collection = self.db[collection]
result = self.collection is not None
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
finally:
return result
def Insert(self, document):
post_id = None
try:
self.logger.debug("Inserting document in collection [%s]"%(self.collection))
post_id = self.collection.insert(document)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
return post_id
def Find(self, condition={}):
'''Collects data from database '''
posts = None
try:
self.logger.debug("Finding document in collection [%s]"%(self.collection))
posts = self.collection.find(condition)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
return posts
def Print(self, posts, with_id=False):
'''Prints collection of posts '''
try:
if not isinstance(posts,type(None)):
sizePosts= posts.count()
for i in range(sizePosts):
post = posts[i]
postKeys = post.keys()
line = ''
for key in postKeys:
if not with_id and key=='_id':
continue
line += ('{'+key+': '+str(post[key])+"} ")
line = line.strip()
self.logger.debug(' '+str(line))
else:
self.logger.debug("Invalid input posts for printing")
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def Remove(self, condition=None):
'''Deletes data from database '''
result = None
if condition is not None:
if len(condition)<1:
self.logger.debug("Deleting all documents from collection")
posts = self.collection.find(condition)
## Deleting documents
result = self.collection.remove(condition)
if result['ok']>0:
self.logger.debug(" Deleted %s documents in %sms"% (str(result['n']), str(result['syncMillis'])))
else:
self.logger.debug(" Deleted failed: %s", str(result))
else:
self.logger.debug("Invalid condition for deleting")
return result
def Size(self):
collSize = None
try:
collSize = self.collection.count()
self.logger.debug("Collection [%s] has size of [%d]"%(self.collection, collSize))
except Exception as inst:
Utilities.ParseException(inst, logger=logger)
return collSize
def Update(self, condition=None, substitute=None, upsertValue=False):
'''
Updates data from database.
condition dictionary with lookup condition
substitue item to substitute
upsertValue True for insert if not exist, False otherwise
returns True if update was OK, otherwise False
'''
try:
result = False
if condition is not None and substitute is not None:
if '_id' in substitute.keys():
substitute.pop('_id', 0)
if len(condition)<1:
self.logger.debug("Updating documents from collection")
resultSet = self.collection.update(condition,{
'$set': substitute
}, upsert=upsertValue, multi=False)
self.logger.debug("Updated existing:"+str(resultSet['updatedExisting']))
result = resultSet['ok'] == 1
else:
self.logger.debug("Invalid condition for updateing")
result = True
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
finally:
return result
def db_handler_call(options):
''' Method for calling MongoAccess handler'''
#print options
try:
logger = Utilities.GetLogger(LOG_NAME, useFile=False)
database = MongoAccess()
database.connect(options.database, options.collections)
if options.insert:
post_id = database.Insert(options.document)
if post_id is not None:
logger.debug("Item inserted with ID: %s"%(str(post_id)))
if options.report:
posts = database.Find(options.condition)
database.Print(posts, with_id=options.with_ids)
if options.delete:
result = database.Remove(condition=options.removal)
if options.update:
result = database.Update(condition=options.referal,
substitute=options.replace)
except Exception as inst:
Utilities.ParseException(inst, logger=logger)
if __name__ == '__main__':
''''''
LOG_NAME = 'MongoAccessTool'
logger = Utilities.GetLogger(LOG_NAME, useFile=False)
myFormat = '%(asctime)s|%(name)30s|%(message)s'
logging.basicConfig(format=myFormat, level=logging.DEBUG)
logger = Utilities.GetLogger(LOG_NAME, useFile=False)
logger.debug('Logger created.')
usage = "usage: %prog opt1=arg1 opt2=arg2"
parser = OptionParser(usage=usage)
parser.add_option("-d", '--database',
metavar="DB",
dest='database',
default=None,
help="Database name")
parser.add_option("-c", '--collections',
metavar="CATALAGUE",
dest='collections',
default=None,
help="Database collections")
dbOperations = OptionGroup(parser, "Database insert operations",
"These options are for using handler operations")
dbOperations.add_option("-i", "--insert",
action="store_true",
dest="insert",
default=False,
help="Inserts an item")
dbOperations.add_option('--document',
metavar="JSON",
dest='document',
default='',
help="Document to insert in text format")
findOps = OptionGroup(parser, "Database finding operations",
"These options are for using handler operations")
findOps.add_option("-l", "--report",
action="store_true",
dest="report",
default=False,
help="Reports items")
findOps.add_option('--condition',
metavar="JSON",
dest='condition',
default='',
help="Search condition to find documents")
findOps.add_option("--with_ids",
action="store_true",
dest="with_ids",
default=False,
help="Set this option to print object IDs")
delOps = OptionGroup(parser, "Database deleting operations",
"These options are for using handler operations")
delOps.add_option("-r", "--delete",
action="store_true",
dest="delete",
default=False,
help="Delete items")
delOps.add_option('--removal',
metavar="JSON",
dest='removal',
default='',
help="Condition to delete documents")
updateOps = OptionGroup(parser, "Database updating operations",
"These options are for using handler operations")
updateOps.add_option("-u", "--update",
action="store_true",
dest="update",
default=False,
help="Update items")
updateOps.add_option('--referal',
metavar="JSON",
dest='referal',
default='',
help="Condition to update documents")
updateOps.add_option('--replace',
metavar="JSON",
dest='replace',
default='',
help="Substitute document for update method")
parser.add_option_group(dbOperations)
parser.add_option_group(findOps)
parser.add_option_group(delOps)
parser.add_option_group(updateOps)
(options, args) = parser.parse_args()
#print options
printHelp = False
if options.database is None:
parser.error("Missing required option: database")
printHelp = True
if options.collections is None:
parser.error("Missing required option: collections")
printHelp = True
if options.insert:
if len(options.document)<1:
parser.error("Missing required INSERT option: document")
else:
options.document = ast.literal_eval(options.document)
if options.report:
if len(options.condition)<1:
options.condition = {}
else:
options.condition = ast.literal_eval(options.condition)
if options.delete:
if len(options.removal)<1:
parser.error("Missing required DELETE option: removal")
else:
options.removal = ast.literal_eval(options.removal)
if options.update:
if len(options.referal)<1:
parser.error("Missing required UPDATE option: referal")
if len(options.replace)<1:
parser.error("Missing required UPDATE option: replace")
else:
options.referal = ast.literal_eval(options.referal)
options.replace = ast.literal_eval(options.replace)
if printHelp:
parser.print_help()
db_handler_call(options) | zmicroservices | /zmicroservices-1.0.3.tar.gz/zmicroservices-1.0.3/Utils/MongoHandler.py | MongoHandler.py |
import time
import psutil
import ctypes
import sys, os
import string
import random
import pycurl
import logging
import logging.handlers
from StringIO import StringIO
''' Base name for file logger'''
LOG_FILENAME = 'context_provider.log'
''' Base name for logger'''
LOG_NAME = 'ContextProvider'
def GetUnicode(line):
if isinstance(line, unicode) == False:
line = unicode(line, 'utf-8')
return u''.join(line).encode('utf-8').strip()
def GetHTML(url_):
''' '''
try:
buffer = StringIO()
c = pycurl.Curl()
c.setopt(c.URL, url_)
c.setopt(c.WRITEDATA, buffer)
c.perform()
c.close()
body = buffer.getvalue()
return body.decode('utf8')
except Exception as inst:
ParseException(inst)
def FindChilden(pid, logger=None):
try:
## Getting process information
process = psutil.Process(pid)
children = process.children()
if logger:
logger.debug(" Found [%d] children processes"%(len(children)))
for child in children:
state = "alive" if child.is_alive() else "dead"
logger.debug(" Found process with PID [%d] is [%s]"%(child.pid, state))
threads = process.threads()
if logger:
logger.debug(" Found [%d] threads processes"%(len(threads)))
for t in threads:
data = psutil.Process(t.id)
status = data.status()
logger.debug(" Thread with PID [%d] is [%s]"%(t.id, status))
except Exception as inst:
ParseException(inst, logger=logger)
def GetHumanReadable(size,precision=2):
suffixes=['B','KB','MB','GB','TB']
suffixIndex = 0
while size > 1024 and suffixIndex < 4:
suffixIndex += 1 #increment the index of the suffix
size = size/1024.0 #apply the division
return "%.*f%s"%(precision,size,suffixes[suffixIndex])
def MemoryUsage(pid, serviceId='', log=None, memMap=False, openFiles=False, openConn=False):
'''Returns the memory usage in MB'''
start = time.time()
try:
## Getting process information
process = psutil.Process(pid)
## Getting process memory (RSS, VMS and %)
mem_info = process.memory_info()
status = process.status()
mem = {'status': status}
mem.update({'rss': mem_info[0] / float(2 ** 20)})
mem.update({'vms': mem_info[1] / float(2 ** 20)})
mem.update({'percent':process.memory_percent()})
mem.update({'children':[]})
mem.update({'total':{'percent':mem['percent'], 'rss':mem['rss'], 'vms':mem['vms']}})
## Getting connections of parent thread
if openConn:
mem.update({'connections':[]})
conns = process.connections()
for item in conns:
conn = []
keys = item._fields
for key in keys:
conn.append({ key: item.__dict__[key]})
mem['connections'].append(conn)
## Getting opened files of parent thread
if openFiles:
mem.update({'opened_files':[]})
opened_items = process.open_files()
for item in opened_items:
process_file = []
keys = item._fields
for key in keys:
process_file.append({ key: item.__dict__[key]})
mem['opened_files'].append(process_file)
## Getting memory map of parent thread
if memMap:
mem.update({'memory_map':[]})
mapped_items = process.memory_maps()
for item in mapped_items:
process_map = []
keys = item._fields
for key in keys:
process_map.append({ key: item.__dict__[key]})
mem['memory_map'].append(process_map)
## Getting memory from children processes
kids = process.children()
for child in kids:
try:
## Double check if pid attribute exists in
## process object. May not be useful
data = psutil.Process(child.pid)
childMem = data.memory_info()
child_status = data.status()
childData = {'status': child_status, 'pid':data.pid, 'create_time':data.create_time(),
'rss': childMem[0] / float(2 ** 20), 'vms': childMem[1] / float(2 ** 20),
'percent':data.memory_percent()}
mem['children'].append(childData)
## Calculating total values with process and children's heap
mem['total']['percent'] += childData['percent']
mem['total']['rss'] += childData['rss']
mem['total']['vms'] += childData['vms']
except NoSuchProcess as inst:
log.debug('Error: Process not found')
threads = process.threads()
for t in threads:
try:
data = psutil.Process(t.id)
childMem = data.memory_info()
child_status = data.status()
childData = {'status': child_status, 'pid':data.pid, 'create_time':data.create_time(),
'rss': childMem[0] / float(2 ** 20), 'vms': childMem[1] / float(2 ** 20),
'percent':data.memory_percent()}
mem['children'].append(childData)
except NoSuchProcess as inst:
log.debug('Error: Process not found')
elapsed = time.time() - start
mem.update({'elapsed':elapsed, 'serviceId':serviceId, 'timestamp':time.time()})
return mem
except Exception as inst:
ParseException(inst, logger=log)
def GetLogger(logName=LOG_NAME, useFile=True):
''' Returns an instance of logger '''
logger = logging.getLogger(logName)
if useFile:
fileHandler = GetFileLogger()
logger.addHandler(fileHandler)
return logger
def GetFileLogger(fileLength=1000000, numFiles=5):
''' Sets up file handler for logger'''
myFormat = '%(asctime)s|%(process)6d|%(name)25s|%(message)s'
formatter = logging.Formatter(myFormat)
fileHandler = logging.handlers.RotatingFileHandler(
filename=LOG_FILENAME,
maxBytes=fileLength,
backupCount=numFiles)
fileHandler.setFormatter(formatter)
return fileHandler
def ParseException(inst, logger=None):
''' Takes out useful information from incoming exceptions'''
exc_type, exc_obj, exc_tb = sys.exc_info()
exception_fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
exception_line = str(exc_tb.tb_lineno)
exception_type = str(type(inst))
exception_desc = str(inst)
if logger:
logger.error( " %s: %s in %s:%s"%(exception_type,
exception_desc,
exception_fname,
exception_line ))
else:
print " %s: %s in %s:%s"%(exception_type,
exception_desc,
exception_fname,
exception_line )
def IdGenerator(size=6, chars=string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for _ in range(size))
def GetPID():
return ctypes.CDLL('libc.so.6').syscall(186)
class TailingError(RuntimeError):
def __init__(self, arg, host):
self.args = arg
self.host = host
class TaskError(RuntimeError):
def __init__(self, arg, name):
self.args = arg
self.name = name
class HTMLParseException(Exception):
def __init__(self, transition, state):
self.value = "transition [%s] failed in state [%s]"%(transition, state)
def __str__(self):
return repr(self.value) | zmicroservices | /zmicroservices-1.0.3.tar.gz/zmicroservices-1.0.3/Utils/Utilities.py | Utilities.py |
import logging
import zmq
import threading
import sys
import time
import random
import signal
import os
import json
from Utils import Utilities
## TODO:Join any created thread
## Create a list of thread pointers every
## time a service creates sub processes
class ServiceHandler:
def __init__(self, **kwargs):
''' Constructor of simple service'''
self.component = self.__class__.__name__
self.logger = Utilities.GetLogger(logName=self.component)
self.logger.debug("Service handler class constructor")
self.stopped = True
self.actionHandler = None
self.service_id = None
self.device_action = None
self.transaction = None
self.frontend = ''
self.endpoint = ''
self.backend = ''
self.tStop = threading.Event()
self.resp_format = {"header":{}, "content":{}}
self.threads = []
self.context = None
## Added for being used by non-looped actions
self.task = None
# Setting up response message
self.header = {"service_name": "", "action": "", "service_id": ""}
self.content = {"status": {"result":""}}
# Generating instance of strategy
for key, value in kwargs.iteritems():
if "frontend" == key:
self.frontend = value
elif "service_id" == key:
self.service_id = value
self.logger.debug(' Setting service ID [%s]' %(self.service_id))
elif "backend" == key:
self.backend = value
elif "transaction" == key:
self.transaction = value
elif "device_action" == key:
self.device_action = value
def deserialize(self, service, rec_msg):
'''Deserialises a JSON message'''
try:
if self.task is None:
self.logger.debug("Setting service instance locally")
self.task = service
topic, json_msg = rec_msg.split("@@@")
topic = topic.strip()
json_msg = json_msg.strip()
msg = json.loads(json_msg)
#self.logger.debug("Received message with topic [%s] of [%s] bytes"%(
#topic, str(len(json_msg))))
# Checking if it is the right topic
if topic == service.topic:
''' '''
# Getting Message task from message
if 'Task' not in msg.keys():
self.logger.debug("Task key not found")
return
# Getting header and configuration content
message = msg['Task']['message']
header = message['header']
# Giving message interpreation within actions
if header['service_name'] == 'all' or (self.DeserializeAction(message)):
json_msg = json.dumps(message, sort_keys=True, indent=4, separators=(',', ': '))
self.logger.debug("[%s] thread [%s] received message of size %d" %
(self.service_id, service.tid, len(json_msg)))
# Setting service ID if it exists and is not set already
if self.service_id is None:
if "service_id" in header.keys() and len(header["service_id"])>0:
self.resp_format["header"].update({"service_name":header["service_name"]})
self.resp_format["header"].update({"service_id" :header["service_id"]})
self.resp_format["header"].update({"action" : ""})
self.logger.debug("Setting service ID [%s] in PID [%s]"
%(self.service_id, service.tid))
self.service_id=header["service_id"]
else:
self.logger.debug("No service ID was provided in PID[%s]"%service.tid)
## Checking if it is right service ID, otherwise exit
elif self.service_id != header["service_id"]:
self.logger.debug("Service ID [%s] is different to message's service ID [%s]" %
(self.service_id, header["service_id"]))
return
# Stopping service
if header['action'] == 'stop':
if self.stopped == False:
self.logger.debug(" Stopping service instances")
self.stop()
self.logger.debug(" Stopping service process")
service.stop()
else:
self.logger.debug(" Service is already stopped")
# Starting service
elif header['action'] == 'start':
if self.stopped:
self.logger.debug(" Starting service instances")
self.start(msg)
else:
self.logger.debug(" Service is already started")
# Restarting service
elif header['action'] == 'restart':
self.logger.debug(" Doing nothing in process for a [restart]")
## NOTE: The service needs to re-start at context level
## here it should not do these sort of operations
elif topic == 'control':
self.ControlAction(msg)
except ValueError:
''' '''
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def execute(self, service):
''' '''
self.logger.debug(" No execute in service [%s]" % service.threadID)
def stop(self):
''' This method is called for stopping as a service action'''
try:
if self.actionHandler is not None:
## Cleaning up environment variables
if hasattr(self.actionHandler, 'tStop'):
self.logger.debug(" Setting event thread")
self.actionHandler.tStop.set()
# Closing service
self.logger.debug(" Closing service handler")
self.actionHandler.close()
self.stopped = True
elif self.actionHandler is not None:
self.logger.debug("Service action handler is not available")
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def notify(self, action, result, items=None):
'''Notifies '''
try:
## Preparing header service ID
self.header["service_id"] = self.service_id
## Preparing response message
resp_format = {"header":self.header, "content":self.content}
resp_format["header"]["action"] = action
resp_format["header"]["service_transaction"] = self.transaction
resp_format["header"]["service_name"] = self.resp_format["header"]["service_name"]
resp_format["content"]["status"]["result"] = result
## Getting device action
if self.device_action is not None:
self.content["status"]["device_action"] = self.device_action
else:
resp_format["content"]["status"]["device_action"] = ''
if items != None:
resp_format = self.ParseItems(items, resp_format)
## Preparing JSON message
json_msg = json.dumps(resp_format, sort_keys=True, indent=4, separators=(',', ': '))
send_msg = "%s @@@ %s" % ("control", json_msg)
self.serialize(send_msg)
# Cleaning up the message template
contentKeys = self.content.keys()
for key in contentKeys:
if key == 'status':
self.content['status'] = {}
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def serialize(self, msg):
'''Serialises message for local endpoint '''
topic = msg[:msg.find('@@@')-1]
try:
if len(self.backend) < 1:
self.logger.debug("Serialise called but no backend endpoint set in service")
return
# Creating temporal context for publisher
context = zmq.Context()
socket = context.socket(zmq.PUB)
socket.connect(self.backend)
self.tStop.wait(0.1)
self.logger.debug("Sending message of [%s] bytes" % len(msg))
utfEncodedMsg = msg.encode('utf-8').strip()
socket.send(utfEncodedMsg)
# Destroying temporal context for publisher
context.destroy()
self.tStop.wait(0.1)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def start(self, msg):
'''Start specific service implementation'''
self.logger.debug(" Starting service handler")
message = msg['Task']['message']
reason = ''
try:
msgKeys = message.keys()
## Validating process starting based on message content
if 'header' not in msgKeys:
reason = 'Error: Handler not made because received message without header'
self.logger.debug(" - %s"%reason)
return False, reason
header = message['header']
if 'content' not in msgKeys:
reason = 'Error: Handler not made because received message without content'
self.logger.debug(" - %s"%reason)
return False, reason
contentKeys = message['content'].keys()
if 'configuration' not in contentKeys:
reason = 'Error: Handler not made because received message without content configuration'
self.logger.debug(" - %s"%reason)
return False, reason
conf = message['content']['configuration']
## NOTE: Before it was setting the handler to None in the closing,
## now it leaves it will reset to None here.
if self.actionHandler is not None:
self.logger.debug(" Action handler already exists, replacing for new one...")
self.actionHandler = None
## Getting action handler
self.stopped = False
self.logger.debug(" Getting action handler")
self.actionHandler = self.GetActionHandler(msg)
## Something went wrong, lets inform it...
if self.actionHandler == None:
reason = 'Error: Handler not made properly'
self.logger.debug(" - %s"%reason)
raise Utilities.TaskError(["Missing action handler"], self.component)
return False, reason
## Keeping starting values
self.logger.debug(" Allocating service ID [%s]"%header["service_id"])
self.service_id = header["service_id"]
## Ending successfully
self.logger.debug(" Started service handler successfully")
return True, reason
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def stop_all_msg(self):
''' Sends a stop notification'''
# Sending last stop notification before closing IPC connection
self.logger.debug(" Notifying stopping state for process")
tid = Utilities.GetPID()
self.notify("stopped", 'success', items={'pid':tid})
def ControlAction(self, msg):
''' '''
def ValidateTransaction(self, msg):
''' Method for validating transaction ID'''
try:
isRightTransaction = False
if 'transaction' in msg['header'].keys():
isRightTransaction = msg['header']['transaction'] == self.transaction
elif 'service_transaction' in msg['header'].keys():
isRightTransaction = msg['header']['service_transaction'] == self.transaction
else:
self.logger.debug("Message without transaction ID")
return isRightTransaction
if not isRightTransaction:
self.logger.debug("Service with different transaction")
return isRightTransaction
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def JoinToContext(self):
return | zmicroservices | /zmicroservices-1.0.3.tar.gz/zmicroservices-1.0.3/Provider/IServiceHandler.py | IServiceHandler.py |
import logging
import zmq
import threading
import multiprocessing
import sys
import time
import random
import ctypes
import json
import psutil
from zmq.devices import ProcessDevice
from Utils.Utilities import *
from Utils import Utilities
REQUEST_TIMEOUT = 100
class TaskedService(object):
'''
A service is an interface for executing self contained
programs within different logic
'''
## Process state variables
STOPPED_STATUS = [
psutil.STATUS_IDLE,
psutil.STATUS_STOPPED,
#psutil.STATUS_SUSPENDED,
psutil.STATUS_WAITING
]
FAILED_STATUS = [
psutil.STATUS_DEAD,
psutil.STATUS_ZOMBIE
]
BUSY_STATUS = [psutil.STATUS_DISK_SLEEP,
psutil.STATUS_LOCKED,
psutil.STATUS_TRACING_STOP,
#psutil.STATUS_WAKE_KILL
]
STARTED_STATUS = [psutil.STATUS_WAKING,
psutil.STATUS_RUNNING,
psutil.STATUS_SLEEPING]
def __init__(self, threadID, **kwargs):
''' '''
try:
# Initialising thread parent class
component = self.__class__.__name__
self.threadID = threadID
self.logger = Utilities.GetLogger(logName=component + str(self.threadID))
self.ipc_ready = False
self.tStop = threading.Event()
self.frontend = None
self.backend = None
self.topic = None
self.socketCtxt = None
self.action = None
self.tid = None
self.transaction = None
self.context = None
self.stopper = None
## Variables for process monitor
self.contextInfo = None
self.isMonitor = False
# Parsing extra arguments
self.logger.debug('[%s] Parsing constructor arguments' % str(self.threadID))
for key, value in kwargs.iteritems():
if 'strategy' == key:
self.action = value(**kwargs)
self.logger.debug('[%s] Setting up action task' % str(self.threadID))
elif 'context' == key:
self.context = value
elif 'topic' == key:
self.topic = value
elif 'transaction' == key:
self.transaction = value
elif 'frontend' == key:
self.frontend = value
elif 'backend' == key:
self.backend = value
elif 'contextInfo' == key:
self.contextInfo = value
elif 'isMonitor' == key:
self.isMonitor = value
elif 'stopper' == key:
self.logger.debug('[%s] Setting main thread stopper'% str(self.threadID))
self.stopper = value
## Including context information in local service
if self.isMonitor:
self.action.SetMonitor(self.contextInfo)
## Alarm time setup
self.time_out_alarm = 60
self.check_in_time = time.time() + self.time_out_alarm
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def IsIPCReady(self):
""" """
return self.ipc_ready
def set_ipc(self):
""" Setting up ZMQ connection"""
socket = []
poller = None
if len(self.frontend) > 0:
self.logger.debug('[%s] Creating Backend ZMQ endpoint %s' % (self.threadID, self.frontend))
self.socketCtxt = zmq.Context()
# Preparing type of socket communication from arguments
self.logger.debug('[%s] Preparing a pollin subscriber' % self.threadID)
if len(self.frontend) > 0:
socket = self.socketCtxt.socket(zmq.SUB)
socket.setsockopt(zmq.SUBSCRIBE, '')
socket.connect(self.frontend)
time.sleep(0.1)
poller = zmq.Poller()
poller.register(socket, zmq.POLLIN)
else:
self.logger.debug('[%s] Endpoint not found' % self.threadID)
# Saying set_ipc is finished from initialisation
self.ipc_ready = True
self.tStop.set()
self.logger.debug('[%s] Endpoints had been set' % self.threadID)
return (socket, poller)
def is_process_running(self, proc_data):
""" Identifies non-running states in current and children processses"""
try:
def ReduceProcessStatus(status):
"""' Reduces all process status into four stages"""
is_working = ''
try:
## Checking if process status matches any of non working states
if status in self.STOPPED_STATUS:
is_working = 'stopped'
## Checking if process status matches any of non working states
elif status in self.FAILED_STATUS:
is_working = 'failed'
## Checking if process status matches any of working states
elif status in self.STARTED_STATUS:
is_working = 'started'
## Checking if process status matches any of special cases
elif status in self.BUSY_STATUS:
is_working = 'busy'
## Checking if process status does NOT match any status
else:
is_working = 'unkown'
return is_working
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
## Getting main process state
has_failed = False
state = {'ppid': self.tid}
## Checking if process data is valid
if proc_data is None:
state.update({'reason': 'process data invalid'})
return (has_failed, state)
elif 'status' in proc_data.keys():
main_state = ReduceProcessStatus(proc_data['status'])
## Reporting parent state description and only failing children
state.update({'ppid': self.tid,
'status': proc_data['status'],
'children': []})
if main_state != 'started':
self.logger.debug(' Process [%d] is [%s]' % (self.tid, main_state))
has_failed = True
## Getting children state
for child in proc_data['children']:
child_state = ReduceProcessStatus(child['status'])
if child_state != 'started':
state['children'].append({'pid': child['pid'],
'status': child['status']})
self.logger.debug(' Child [%d] of [%d] is [%s]' % (child['pid'], self.tid, child_state))
has_failed = True
else:
self.logger.debug(' Warning: Status not found in process memory data')
return (has_failed, state)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def run(self):
"""
An action is a self contained program with
an execute method
"""
try:
## Creating IPC connections
self.tid = GetPID()
self.logger.debug('[%s] Setting PID [%d]' % (self.threadID, self.tid))
self.socket, poller = self.set_ipc()
self.logger.debug('[%s] Starting task endpoint service in [%d]' % (self.threadID, self.tid))
## Running service action
## NOTE: This action could block message pulling, it should be used as
## preparation task before subscribing for messages
if self.action is not None:
self.action.execute(self)
else:
raise UnboundLocalError('Exception raised, no execute action supplied to Service!')
## Running IPC communication
self.logger.debug('[%s] Running IPC communication on frontend' % self.threadID)
while self.tStop.isSet():
socks = dict(poller.poll(REQUEST_TIMEOUT))
if socks.get(self.socket) == zmq.POLLIN and len(self.frontend) > 0:
msg = self.socket.recv().strip()
self.action.deserialize(self, msg)
## Calculating current process memory
## NOTE: For the moment is only printed every N seconds
## TODO: Make a KF for predicting a dangerous case
## Make a context message for informing process states
## like missing, growing, not running.
## TODO: Publish memory size with process information (name, PID)
## TODO: This has to be done in a separate class
## Look for new threads to add
start_context_timer = time.time()
## Joining process into context if:
## 1) The action is a context
## 2) There are elements to join
self.action.JoinToContext()
## Log processing time if it was too long!
context_timer = time.time() - start_context_timer
if context_timer > 0.00025:
self.logger.debug(' @ Context operations done in [%.4f]' % context_timer)
## Check if it is time for looking into memory usage state
if self.check_in_time - time.time() < 0:
service_id = self.action.service_id
process_memory = Utilities.MemoryUsage(self.tid, serviceId=service_id, log=self.logger)
## Getting current service and action task states
service_has_failed, type_state = self.is_process_running(process_memory)
action_is_context = self.action is not None and self.action.context is None
## If process state is failed and it is because there are zombie
## processes, remove them and notify
if service_has_failed:
## Cleaning up zombie processes
self.logger.debug('[%s] Cleaning up zombie processes' % self.threadID)
active = multiprocessing.active_children()
## Send failure notification if it happens in service
## TODO: What would happen if failure occurs in context?
if self.action.actionHandler is not None:
self.logger.debug('[%s] Notifying failed state [%s] for process with PID [%d]' % (self.threadID, type_state, self.tid))
## Notifying failure
## TODO: Report why is it failing!
items = {'pid': self.tid,
'reason': type_state}
self.action.notify('failed', 'sucess', items=items)
## Logging simplified process monitoring information
self.logger.debug('[%s] Service [%s, %d] has (rss=%.2f MiB, vms=%.2f MiB, mem=%3.4f%%) in %.2fms'
% (self.threadID,
service_id,
self.tid,
process_memory['total']['rss'],
process_memory['total']['vms'],
process_memory['total']['percent'],
process_memory['elapsed'] * 1000))
self.check_in_time = time.time() + self.time_out_alarm
## Destroying IPC connections and mark process as stopped
self.logger.debug('[%s] Loop finished, stopping action task' % self.threadID)
self.action.stop()
## Stopping service
if self.action.actionHandler is not None and self.action.actionHandler.hasFinished():
self.logger.debug('[%s] Stopping service' % self.threadID)
self.stop()
self.logger.debug('[%s] Destroying zmq context' % self.threadID)
## Destroying IPC processes
self.socketCtxt.destroy()
self.tStop.wait(0.1)
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def stop(self):
""" """
try:
if not self.tStop.isSet():
self.logger.debug(' Service event is already set, stop is not required')
return
if self.action:
self.logger.debug(' Stopping action in service ...')
self.action.stop_all_msg()
self.logger.debug(' Clearing thread event in service')
self.tStop.clear()
if self.stopper is not None:
self.logger.debug(' Clearing main thread stopper')
self.stopper.wait(1)
self.stopper.clear()
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
def execute(self):
""" """
self.logger.debug('Caling execute in thread [%d]' % self.tid)
def AddContext(self, tService, tName):
''' '''
if self.context is None:
self.logger.debug('[%s] Context is not defined' % self.threadID)
return
self.logger.debug('[%s] Preparing a joiner' % self.threadID)
self.context.AddJoiner(tService, tName)
class ThreadTasks(threading.Thread, TaskedService):
'''Creates a services task in a thread '''
def __init__(self, threadID, **kwargs):
''' '''
TaskedService.__init__(self, threadID, **kwargs)
try:
# Initialising multiprocessing parent class
self.logger.debug('Initialising thread parent class')
threading.Thread.__init__(self)
# Starting thread
self.start()
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger)
class MultiProcessTasks(TaskedService, multiprocessing.Process):
'''Creates a service task in a process '''
def __init__(self, threadID, **kwargs):
''' '''
TaskedService.__init__(self, threadID, **kwargs)
try:
# Initialising multiprocessing parent class
self.logger.debug('Initialising multiprocessing parent class')
multiprocessing.Process.__init__(self)
# Starting thread
self.start()
self.logger.debug('Multiprocessing class initialisation finished')
except Exception as inst:
Utilities.ParseException(inst, logger=self.logger) | zmicroservices | /zmicroservices-1.0.3.tar.gz/zmicroservices-1.0.3/Provider/Service.py | Service.py |
# zmipc
[](https://github.com/mzy2240/zmipc/blob/master/LICENSE)
[](https://pypi.python.org/pypi/zmipc/)
## Description
A Zero-copy Memory-sharing based IPC which intends to be handy in some cases where socket-based communications do not work well.
## Getting Started
The usage of zmipc intends to be straight-forward. Here is an example:
```python
from zmipc import ZMClient
sender = ZMClient()
receiver = ZMClient()
sender.add_publication(topic='test')
receiver.add_subscription(topic'test')
sender.publish(topic='test', msg='Hello World!')
print(receiver.receive(topic='test'))
```
| zmipc | /zmipc-0.5.tar.gz/zmipc-0.5/README.md | README.md |
==========
EasyModels
==========
.. image:: https://img.shields.io/pypi/v/zmodels.svg
:target: https://pypi.python.org/pypi/zmodels
.. image:: https://img.shields.io/travis/tchappui/zmodels.svg
:target: https://travis-ci.org/tchappui/zmodels
.. image:: https://readthedocs.org/projects/zmodels/badge/?version=latest
:target: https://zmodels.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
.. image:: https://pyup.io/repos/github/tchappui/zmodels/shield.svg
:target: https://pyup.io/repos/github/tchappui/zmodels/
:alt: Updates
Basic implementation of the repository pattern for database access.
* Free software: MIT license
* Documentation: https://zmodels.readthedocs.io.
Features
--------
* TODO
Credits
-------
This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
| zmodels | /zmodels-0.1.5.tar.gz/zmodels-0.1.5/README.rst | README.rst |
.. highlight:: shell
============
Contributing
============
Contributions are welcome, and they are greatly appreciated! Every little bit
helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions
----------------------
Report Bugs
~~~~~~~~~~~
Report bugs at https://github.com/tchappui/zmodels/issues.
If you are reporting a bug, please include:
* Your operating system name and version.
* Any details about your local setup that might be helpful in troubleshooting.
* Detailed steps to reproduce the bug.
Fix Bugs
~~~~~~~~
Look through the GitHub issues for bugs. Anything tagged with "bug" and "help
wanted" is open to whoever wants to implement it.
Implement Features
~~~~~~~~~~~~~~~~~~
Look through the GitHub issues for features. Anything tagged with "enhancement"
and "help wanted" is open to whoever wants to implement it.
Write Documentation
~~~~~~~~~~~~~~~~~~~
EasyModels could always use more documentation, whether as part of the
official EasyModels docs, in docstrings, or even on the web in blog posts,
articles, and such.
Submit Feedback
~~~~~~~~~~~~~~~
The best way to send feedback is to file an issue at https://github.com/tchappui/zmodels/issues.
If you are proposing a feature:
* Explain in detail how it would work.
* Keep the scope as narrow as possible, to make it easier to implement.
* Remember that this is a volunteer-driven project, and that contributions
are welcome :)
Get Started!
------------
Ready to contribute? Here's how to set up `zmodels` for local development.
1. Fork the `zmodels` repo on GitHub.
2. Clone your fork locally::
$ git clone [email protected]:your_name_here/zmodels.git
3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development::
$ mkvirtualenv zmodels
$ cd zmodels/
$ python setup.py develop
4. Create a branch for local development::
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
5. When you're done making changes, check that your changes pass flake8 and the
tests, including testing other Python versions with tox::
$ flake8 zmodels tests
$ python setup.py test or py.test
$ tox
To get flake8 and tox, just pip install them into your virtualenv.
6. Commit your changes and push your branch to GitHub::
$ git add .
$ git commit -m "Your detailed description of your changes."
$ git push origin name-of-your-bugfix-or-feature
7. Submit a pull request through the GitHub website.
Pull Request Guidelines
-----------------------
Before you submit a pull request, check that it meets these guidelines:
1. The pull request should include tests.
2. If the pull request adds functionality, the docs should be updated. Put
your new functionality into a function with a docstring, and add the
feature to the list in README.rst.
3. The pull request should work for Python 2.7, 3.4, 3.5 and 3.6, and for PyPy. Check
https://travis-ci.org/tchappui/zmodels/pull_requests
and make sure that the tests pass for all supported Python versions.
Tips
----
To run a subset of tests::
$ py.test tests.test_zmodels
Deploying
---------
A reminder for the maintainers on how to deploy.
Make sure all your changes are committed (including an entry in HISTORY.rst).
Then run::
$ bumpversion patch # possible: major / minor / patch
$ git push
$ git push --tags
Travis will then deploy to PyPI if tests pass.
| zmodels | /zmodels-0.1.5.tar.gz/zmodels-0.1.5/CONTRIBUTING.rst | CONTRIBUTING.rst |
.. highlight:: shell
============
Installation
============
Stable release
--------------
To install EasyModels, run this command in your terminal:
.. code-block:: console
$ pip install zmodels
This is the preferred method to install EasyModels, as it will always install the most recent stable release.
If you don't have `pip`_ installed, this `Python installation guide`_ can guide
you through the process.
.. _pip: https://pip.pypa.io
.. _Python installation guide: http://docs.python-guide.org/en/latest/starting/installation/
From sources
------------
The sources for EasyModels can be downloaded from the `Github repo`_.
You can either clone the public repository:
.. code-block:: console
$ git clone git://github.com/tchappui/zmodels
Or download the `tarball`_:
.. code-block:: console
$ curl -OL https://github.com/tchappui/zmodels/tarball/master
Once you have a copy of the source, you can install it with:
.. code-block:: console
$ python setup.py install
.. _Github repo: https://github.com/tchappui/zmodels
.. _tarball: https://github.com/tchappui/zmodels/tarball/master
| zmodels | /zmodels-0.1.5.tar.gz/zmodels-0.1.5/docs/installation.rst | installation.rst |
ZMON CLI
========
.. _zmon-cli: https://github.com/zalando-zmon/zmon-cli
.. _PyPI: https://pypi.org/project/zmon-cli/
Command line client for the Zalando Monitoring solution (ZMON).
Installation
============
Requires Python 3.4+
.. code-block:: bash
$ sudo pip3 install --upgrade zmon-cli
Example
=======
Creating or updating a single check definition from its YAML file:
.. code-block:: bash
$ zmon check-definitions update examples/check-definitions/zmon-stale-active-alerts.yaml
Release
=======
1. Update zmon_cli/__init__.py in a PR with new version and merge
2. Approve Release step manually in the CDP pipeline
| zmon-cli | /zmon-cli-1.1.74.tar.gz/zmon-cli-1.1.74/README.rst | README.rst |
import json
import time
import yaml
import calendar
from clickclick import print_table, OutputFormat, action, secho, error, ok, info
# fields to dump as literal blocks
LITERAL_FIELDS = set(['command', 'condition', 'description'])
# custom sorting of YAML fields (i.e. we are not using the default lexical YAML ordering)
FIELD_ORDER = ['id', 'check_definition_id', 'type', 'name', 'team', 'owning_team', 'responsible_team', 'description',
'condition',
'command', 'interval', 'entities', 'entities_exclude', 'status', 'last_modified_by']
FIELD_SORT_INDEX = {k: chr(i) for i, k in enumerate(FIELD_ORDER)}
LAST_MODIFIED_FMT = '%Y-%m-%d %H:%M:%S.%f'
LAST_MODIFIED_FMT_ZERO = '%Y-%m-%d %H:%M:%S'
class literal_unicode(str):
'''Empty class to serialize value as literal YAML block'''
pass
class CustomDumper(yaml.Dumper):
'''Custom dumper to sort mapping fields as we like'''
def represent_mapping(self, tag, mapping, flow_style=None):
node = yaml.Dumper.represent_mapping(self, tag, mapping, flow_style)
node.value = sorted(node.value, key=lambda x: FIELD_SORT_INDEX.get(x[0].value, x[0].value))
return node
def literal_unicode_representer(dumper, data):
node = dumper.represent_scalar('tag:yaml.org,2002:str', data, style='|')
return node
def remove_trailing_whitespace(text: str):
'''Remove all trailing whitespace from all lines'''
return '\n'.join([line.rstrip() for line in text.strip().split('\n')])
def dump_yaml(data):
if isinstance(data, dict):
for key, val in data.items():
if key in LITERAL_FIELDS:
# trailing whitespace would force YAML emitter to use doublequoted string
data[key] = literal_unicode(remove_trailing_whitespace(val))
return yaml.dump(data, default_flow_style=False, allow_unicode=True, Dumper=CustomDumper)
yaml.add_representer(literal_unicode, literal_unicode_representer)
def log_http_exception(e, act=None):
err = act.error if act else error
try:
err('HTTP error: {} - {}'.format(e.response.status_code, e.response.reason))
try:
err(json.dumps(e.response.json(), indent=4))
except Exception:
err(e.response.text)
except Exception:
err('HTTP ERROR: {}'.format(e))
########################################################################################################################
# RENDERERS
########################################################################################################################
class Output:
def __init__(self, msg, ok_msg=' OK', nl=False, output='text', pretty_json=False, printer=None,
suppress_exception=False):
self.msg = msg
self.ok_msg = ok_msg
self.output = output
self.nl = nl
self.errors = []
self.printer = printer
self.indent = 4 if pretty_json else None
self._suppress_exception = suppress_exception
def __enter__(self):
if self.output == 'text' and not self.printer:
action(self.msg)
if self.nl:
secho('')
return self
def __exit__(self, exc_type, exc_val, exc_tb):
if exc_type is None:
if self.output == 'text' and not self.printer and not self.errors:
ok(self.ok_msg)
elif not self._suppress_exception:
error(' EXCEPTION OCCURRED: {}'.format(exc_val))
def error(self, msg, **kwargs):
error(' {}'.format(msg), **kwargs)
self.errors.append(msg)
def echo(self, out):
if self.output == 'yaml':
print(dump_yaml(out))
elif self.output == 'json':
print(json.dumps(out, indent=self.indent))
elif self.printer:
self.printer(out, self.output)
else:
print(out)
def render_entities(entities, output):
rows = []
for e in entities:
row = e
s = sorted(e.keys())
key_values = []
for k in s:
if k not in ('id', 'type'):
if k == 'last_modified':
mod = row.pop('last_modified')
try:
row['last_modified_time'] = (
calendar.timegm(time.strptime(mod, LAST_MODIFIED_FMT)))
except ValueError:
row['last_modified_time'] = (
calendar.timegm(time.strptime(mod, LAST_MODIFIED_FMT_ZERO)))
else:
key_values.append('{}={}'.format(k, e[k]))
row['data'] = ' '.join(key_values)
rows.append(row)
rows.sort(key=lambda r: (r['last_modified_time'], r['id'], r['type']))
with OutputFormat(output):
print_table('id type last_modified_time data'.split(),
rows, titles={'last_modified_time': 'Modified'})
def render_status(status, output=None):
secho('Alerts active: {}'.format(status.get('alerts_active')))
info('Service Level Status:')
in_tier = status.get('service_level_status', {}).get('ingest_max_check_tier', 3)
if in_tier == 3:
info("Ingest unlimited")
elif in_tier == 2:
info("Ingest only critial and important checks")
else:
info("Ingest only critial checks")
q_tier = status.get('service_level_status', {}).get('query_max_check_tier', 3)
q_dist = status.get('service_level_status', {}).get('query_distance_hours_limit', 0)
if q_dist == 0:
info("Query distance unlimited")
else:
info("Query distance limited to {} hours".format(q_dist))
if q_tier == 3:
info("Query metrics unlimited")
elif q_tier == 2:
info("Query metrics limited to critical and important checks")
else:
info("Query metrics limited to critical checks")
def render_checks(checks, output=None):
rows = []
for check in checks:
row = check
row['last_modified_time'] = calendar.timegm(time.gmtime(row.pop('last_modified') / 1000))
row['name'] = row['name'][:60]
row['owning_team'] = row['owning_team'][:60].replace('\n', '')
rows.append(row)
rows.sort(key=lambda c: c['id'])
# Not really used since all checks are ACTIVE!
check_styles = {
'ACTIVE': {'fg': 'green'},
'DELETED': {'fg': 'red'},
'INACTIVE': {'fg': 'yellow'},
}
print_table(['id', 'name', 'owning_team', 'last_modified_time', 'last_modified_by', 'status', 'link'], rows,
titles={'last_modified_time': 'Modified', 'last_modified_by': 'Modified by'}, styles=check_styles)
def render_alerts(alerts, output=None):
rows = []
for alert in alerts:
row = alert
row['last_modified_time'] = calendar.timegm(time.gmtime(row.pop('last_modified') / 1000))
row['name'] = row['name'][:60]
row['responsible_team'] = row['responsible_team'][:40].replace('\n', '')
row['team'] = row['team'][:40].replace('\n', '')
priorities = {1: 'HIGH', 2: 'MEDIUM', 3: 'LOW'}
row['priority'] = priorities.get(row['priority'], 'LOW')
rows.append(row)
rows.sort(key=lambda c: c['id'])
check_styles = {
'ACTIVE': {'fg': 'green'},
'REJECTED': {'fg': 'red'},
'INACTIVE': {'fg': 'yellow'},
'HIGH': {'fg': 'red'},
'MEDIUM': {'fg': 'yellow', 'bold': True},
'LOW': {'fg': 'yellow'},
}
titles = {
'last_modified_time': 'Modified',
'last_modified_by': 'Modified by',
'check_definition_id': 'Check ID',
}
headers = [
'id', 'name', 'check_definition_id', 'responsible_team', 'team', 'priority', 'last_modified_time',
'last_modified_by', 'status', 'link',
]
print_table(headers, rows, titles=titles, styles=check_styles)
def render_search(search, output):
def _print_table(title, rows):
info(title)
rows.sort(key=lambda x: x.get('title'))
print_table(['id', 'title', 'team', 'link'], rows)
secho('')
_print_table('Checks:', search['checks'])
_print_table('Alerts:', search['alerts'])
_print_table('Dashboards:', search['dashboards'])
_print_table('Grafana Dashboards:', search['grafana_dashboards']) | zmon-cli | /zmon-cli-1.1.74.tar.gz/zmon-cli-1.1.74/zmon_cli/output.py | output.py |
import os
import logging
import yaml
import click
import clickclick
import zign.api
import requests
from clickclick import Action, error
DEFAULT_CONFIG_FILE = '~/.zmon-cli.yaml'
DEFAULT_TIMEOUT = 10
def configure_logging(loglevel):
# configure file logger to not clutter stdout with log lines
logging.basicConfig(level=loglevel, filename='/tmp/zmon-cli.log',
format='%(asctime)s %(levelname)s %(name)s: %(message)s')
logging.getLogger('urllib3.connectionpool').setLevel(logging.WARNING)
logging.getLogger('requests.packages.urllib3.connectionpool').setLevel(logging.WARNING)
def get_config_data(config_file=DEFAULT_CONFIG_FILE):
fn = os.path.expanduser(config_file)
data = {}
try:
if os.path.exists(fn):
with open(fn) as fd:
data = yaml.safe_load(fd)
else:
clickclick.warning('No configuration file found at [{}]'.format(config_file))
data['url'] = click.prompt('ZMON Base URL (e.g. https://zmon.example.org/api/v1)')
# TODO: either ask for fixed token or Zign
data['user'] = click.prompt('ZMON username', default=os.environ['USER'])
with open(fn, mode='w') as fd:
yaml.dump(data, fd, default_flow_style=False,
allow_unicode=True,
encoding='utf-8')
except Exception as e:
error(e)
return validate_config(data)
def set_config_file(config_file, default_url):
while True:
url = click.prompt('Please enter the ZMON base URL (e.g. https://demo.zmon.io)', default=default_url)
with Action('Checking {}..'.format(url)):
requests.get(url, timeout=5, allow_redirects=False)
break
data = {'url': url}
fn = os.path.expanduser(config_file)
with Action('Writing configuration to {}..'.format(fn)):
with open(fn, 'w') as fd:
yaml.safe_dump(data, fd, default_flow_style=False)
def validate_config(data):
"""
>>> validate_config({'url': 'foo', 'token': '123'})['url']
'foo'
"""
if not data.get('url'):
raise Exception('Config file improperly configured: key "url" is missing')
if 'token' not in data:
data['token'] = zign.api.get_token('zmon', ['uid'])
return data | zmon-cli | /zmon-cli-1.1.74.tar.gz/zmon-cli-1.1.74/zmon_cli/config.py | config.py |
import logging
import json
import functools
import re
import requests
from requests.adapters import HTTPAdapter
from datetime import datetime
from urllib.parse import urljoin, urlsplit, urlunsplit, SplitResult
from opentracing_utils import trace, extract_span_from_kwargs
from urllib3 import Retry
from zmon_cli import __version__
from zmon_cli.config import DEFAULT_TIMEOUT
API_VERSION = 'v1'
ZMON_USER_AGENT = 'zmon-client/{}'.format(__version__)
ACTIVE_ALERT_DEF = 'checks/all-active-alert-definitions'
ACTIVE_CHECK_DEF = 'checks/all-active-check-definitions'
ALERT_DATA = 'status/alert'
ALERT_DEF = 'alert-definitions'
CHECK_DEF = 'check-definitions'
DASHBOARD = 'dashboard'
DOWNTIME = 'downtimes'
ENTITIES = 'entities'
GRAFANA = 'visualization/dashboards'
GROUPS = 'groups'
MEMBER = 'member'
PHONE = 'phone'
SEARCH = 'quick-search'
STATUS = 'status'
TOKENS = 'onetime-tokens'
ALERT_DETAILS_VIEW_URL = '#/alert-details/'
CHECK_DEF_VIEW_URL = '#/check-definitions/view/'
DASHBOARD_VIEW_URL = '#/dashboards/views/'
GRAFANA_DASHBOARD_URL = 'visualization/dashboard/'
TOKEN_LOGIN_URL = 'tv/'
BACKOFF_FACTOR = 0.3
logger = logging.getLogger(__name__)
parentheses_re = re.compile('[(]+|[)]+')
invalid_entity_id_re = re.compile('[^a-zA-Z0-9-@_.\\[\\]\\:]+')
class JSONDateEncoder(json.JSONEncoder):
def default(self, obj):
return obj.isoformat() if isinstance(obj, datetime) else super().default(obj)
class ZmonError(Exception):
"""ZMON client error."""
def __init__(self, message=''):
super().__init__('ZMON client error: {}'.format(message))
class ZmonArgumentError(ZmonError):
"""A ZMON client error indicating that a supplied object has missing or invalid attributes."""
pass
def logged(f):
@functools.wraps(f)
def wrapper(*args, **kwargs):
try:
return f(*args, **kwargs)
except Exception:
logger.error('ZMON client failed in: {}'.format(f.__name__))
raise
return wrapper
def compare_entities(e1, e2):
try:
e1_copy = e1.copy()
e1_copy.pop('last_modified', None)
e2_copy = e2.copy()
e2_copy.pop('last_modified', None)
return (json.loads(json.dumps(e1_copy, cls=JSONDateEncoder)) ==
json.loads(json.dumps(e2_copy, cls=JSONDateEncoder)))
except Exception:
# We failed during json serialiazation/deserialization, fallback to *not-equal*!
logger.exception('Failed in `compare_entities`')
return False
def get_valid_entity_id(e):
return invalid_entity_id_re.sub('-', parentheses_re.sub(lambda m: '[' if '(' in m.group() else ']', e.lower()))
class Zmon:
"""ZMON client class that enables communication with ZMON backend.
:param url: ZMON backend base url.
:type url: str
:param token: ZMON authentication token.
:type token: str
:param username: ZMON authentication username. Ignored if ``token`` is used.
:type username: str
:param password: ZMON authentication password. Ignored if ``token`` is used.
:type password: str
:param timeout: HTTP requests timeout. Default is 10 sec.
:type timeout: int
:param verify: Verify SSL connection. Default is ``True``.
:type verify: bool
:param user_agent: ZMON user agent. Default is generated by ZMON client and includes lib version.
:type user_agent: str
"""
def __init__(
self,
url,
token=None,
username=None,
password=None,
timeout=DEFAULT_TIMEOUT,
verify=True,
user_agent=ZMON_USER_AGENT,
retry_count=None,
*args,
**kwargs,
):
"""Initialize ZMON client."""
self.timeout = timeout
split = urlsplit(url)
self.base_url = urlunsplit(SplitResult(split.scheme, split.netloc, '', '', ''))
self.url = urljoin(self.base_url, self._join_path(['api', API_VERSION, '']))
self._session = requests.Session()
if retry_count:
retry = Retry(
total=retry_count,
read=retry_count,
connect=retry_count,
backoff_factor=BACKOFF_FACTOR,
)
adapter = HTTPAdapter(max_retries=retry)
self._session.mount('http://', adapter)
self._session.mount('https://', adapter)
self._timeout = timeout
self.user_agent = user_agent
if username and password and token is None:
self._session.auth = (username, password)
self._session.headers.update({'User-Agent': user_agent, 'Content-Type': 'application/json'})
if token:
self._session.headers.update({'Authorization': 'Bearer {}'.format(token)})
if not verify:
logger.warning('ZMON client will skip SSL verification!')
requests.packages.urllib3.disable_warnings()
self._session.verify = False
@property
def session(self):
return self._session
@staticmethod
def is_valid_entity_id(entity_id):
return invalid_entity_id_re.search(entity_id) is None
def _join_path(self, parts):
return '/'.join(str(p).strip('/') for p in parts)
def endpoint(self, *args, trailing_slash=True, base_url=None):
parts = list(args)
# Ensure trailing slash!
if trailing_slash:
parts.append('')
url = self.url if not base_url else base_url
return urljoin(url, self._join_path(parts))
def json(self, resp):
resp.raise_for_status()
return resp.json()
########################################################################################################################
# DEEPLINKS
########################################################################################################################
def check_definition_url(self, check_definition: dict) -> str:
"""
Return direct deeplink to check definition view on ZMON UI.
:param check_definition: check_difinition dict.
:type check_definition: dict
:return: Deeplink to check definition view.
:rtype: str
"""
return self.endpoint(CHECK_DEF_VIEW_URL, check_definition['id'], base_url=self.base_url)
def alert_details_url(self, alert: dict) -> str:
"""
Return direct deeplink to alert details view on ZMON UI.
:param alert: alert dict.
:type alert: dict
:return: Deeplink to alert details view.
:rtype: str
"""
return self.endpoint(ALERT_DETAILS_VIEW_URL, alert['id'], base_url=self.base_url)
def dashboard_url(self, dashboard_id: int) -> str:
"""
Return direct deeplink to ZMON dashboard.
:param dashboard_id: ZMON Dashboard ID.
:type dashboard_id: int
:return: Deeplink to dashboard.
:rtype: str
"""
return self.endpoint(DASHBOARD_VIEW_URL, dashboard_id, base_url=self.base_url)
def token_login_url(self, token: str) -> str:
"""
Return direct deeplink to ZMON one-time login.
:param token: One-time token.
:type token: str
:return: Deeplink to ZMON one-time login.
:rtype: str
"""
return self.endpoint(TOKEN_LOGIN_URL, token, base_url=self.base_url)
def grafana_dashboard_url(self, dashboard: dict) -> str:
"""
Return direct deeplink to Grafana dashboard.
:param dashboard: Grafana dashboard dict.
:type dashboard: dict
:return: Deeplink to Grafana dashboard.
:rtype: str
"""
if dashboard.get('id', None):
return self.endpoint(GRAFANA_DASHBOARD_URL, dashboard['id'], base_url=self.base_url, trailing_slash=False)
return ""
@logged
def status(self) -> dict:
"""
Return ZMON status from status API.
:return: ZMON status.
:rtype: dict
"""
resp = self.session.get(self.endpoint(STATUS), timeout=self._timeout)
return self.json(resp)
########################################################################################################################
# ENTITIES
########################################################################################################################
@trace(pass_span=True)
@logged
def get_entities(self, query=None, **kwargs) -> list:
"""
Get ZMON entities, with optional filtering.
:param query: Entity filtering query. Default is ``None``. Example query ``{'type': 'instance'}`` to return
all entities of type: ``instance``.
:type query: dict
:return: List of entities.
:rtype: list
"""
query_str = json.dumps(query) if query else ''
logger.debug('Retrieving entities with query: {} ...'.format(query_str))
current_span = extract_span_from_kwargs(**kwargs)
current_span.log_kv({'query': query_str})
params = {'query': query_str} if query else None
resp = self.session.get(self.endpoint(ENTITIES), params=params, timeout=self._timeout)
return self.json(resp)
@trace(pass_span=True)
@logged
def get_entity(self, entity_id: str, **kwargs) -> str:
"""
Retrieve single entity.
:param entity_id: Entity ID.
:type entity_id: str
:return: Entity dict.
:rtype: dict
"""
logger.debug('Retrieving entities with id: {} ...'.format(entity_id))
current_span = extract_span_from_kwargs(**kwargs)
current_span.set_tag('entity_id', entity_id)
resp = self.session.get(self.endpoint(ENTITIES, entity_id, trailing_slash=False), timeout=self._timeout)
return self.json(resp)
@trace(pass_span=True)
@logged
def add_entity(self, entity: dict, **kwargs) -> requests.Response:
"""
Create or update an entity on ZMON.
.. note::
ZMON PUT entity API doesn't return JSON response.
:param entity: Entity dict.
:type entity: dict
:return: Response object.
:rtype: :class:`requests.Response`
"""
if 'id' not in entity or 'type' not in entity:
raise ZmonArgumentError('Entity "id" and "type" are required.')
if not self.is_valid_entity_id(entity['id']):
raise ZmonArgumentError('Invalid entity ID.')
logger.debug('Adding new entity: {} ...'.format(entity['id']))
current_span = extract_span_from_kwargs(**kwargs)
current_span.set_tag('entity_id', entity['id'])
data = json.dumps(entity, cls=JSONDateEncoder)
resp = self.session.put(self.endpoint(ENTITIES, trailing_slash=False), data=data, timeout=self._timeout)
resp.raise_for_status()
return resp
@trace(pass_span=True)
@logged
def delete_entity(self, entity_id: str, **kwargs) -> bool:
"""
Delete entity from ZMON.
.. note::
ZMON DELETE entity API doesn't return JSON response.
:param entity_id: Entity ID.
:type entity_id: str
:return: True if succeeded, False otherwise.
:rtype: bool
"""
logger.debug('Removing existing entity: {} ...'.format(entity_id))
current_span = extract_span_from_kwargs(**kwargs)
current_span.set_tag('entity_id', entity_id)
resp = self.session.delete(self.endpoint(ENTITIES, entity_id))
resp.raise_for_status()
return resp.text == '1'
########################################################################################################################
# DASHBOARD
########################################################################################################################
@trace(pass_span=True)
@logged
def get_dashboard(self, dashboard_id: str, **kwargs) -> dict:
"""
Retrieve a ZMON dashboard.
:param dashboard_id: ZMON dashboard ID.
:type dashboard_id: int, str
:return: Dashboard dict.
:rtype: dict
"""
current_span = extract_span_from_kwargs(**kwargs)
current_span.set_tag('dashboard_id', dashboard_id)
resp = self.session.get(self.endpoint(DASHBOARD, dashboard_id), timeout=self._timeout)
return self.json(resp)
@trace(pass_span=True)
@logged
def update_dashboard(self, dashboard: dict, **kwargs) -> dict:
"""
Create or update dashboard.
If dashboard has an ``id`` then dashboard will be updated, otherwise a new dashboard is created.
:param dashboard: ZMON dashboard dict.
:type dashboard: int, str
:return: Dashboard dict.
:rtype: dict
"""
current_span = extract_span_from_kwargs(**kwargs)
if 'id' in dashboard and dashboard['id']:
logger.debug('Updating dashboard with ID: {} ...'.format(dashboard['id']))
current_span.set_tag('dashboard_id', dashboard['id'])
resp = self.session.post(self.endpoint(DASHBOARD, dashboard['id']), json=dashboard, timeout=self._timeout)
else:
# new dashboard
logger.debug('Adding new dashboard ...')
resp = self.session.post(self.endpoint(DASHBOARD), json=dashboard, timeout=self._timeout)
resp.raise_for_status()
return self.json(resp)
########################################################################################################################
# CHECK-DEFS
########################################################################################################################
@trace(pass_span=True)
@logged
def get_check_definition(self, definition_id: int, **kwargs) -> dict:
"""
Retrieve check defintion.
:param defintion_id: Check defintion id.
:type defintion_id: int
:return: Check definition dict.
:rtype: dict
"""
current_span = extract_span_from_kwargs(**kwargs)
current_span.set_tag('check_id', definition_id)
resp = self.session.get(self.endpoint(CHECK_DEF, definition_id), timeout=self._timeout)
# TODO: total hack! API returns 200 if check def does not exist!
if resp.text == '':
resp.status_code = 404
resp.reason = 'Not Found'
return self.json(resp)
@trace()
@logged
def get_check_definitions(self) -> list:
"""
Return list of all ``active`` check definitions.
:return: List of check-defs.
:rtype: list
"""
resp = self.session.get(self.endpoint(ACTIVE_CHECK_DEF), timeout=self._timeout)
return self.json(resp).get('check_definitions')
@trace(pass_span=True)
@logged
def update_check_definition(self, check_definition, **kwargs) -> dict:
"""
Update existing check definition.
Atrribute ``owning_team`` is required. If ``status`` is not set, then it will be set to ``ACTIVE``.
:param check_definition: ZMON check definition dict.
:type check_definition: dict
:return: Check definition dict.
:rtype: dict
"""
current_span = extract_span_from_kwargs(**kwargs)
if 'owning_team' not in check_definition:
current_span.set_tag('error', True)
current_span.log_kv({'exception': 'Check definition must have "owning_team"'})
raise ZmonArgumentError('Check definition must have "owning_team"')
if 'status' not in check_definition:
check_definition['status'] = 'ACTIVE'
resp = self.session.post(self.endpoint(CHECK_DEF), json=check_definition, timeout=self._timeout)
return self.json(resp)
@trace(pass_span=True)
@logged
def delete_check_definition(self, check_definition_id: int, **kwargs) -> requests.Response:
"""
Delete existing check definition.
:param check_definition_id: ZMON check definition ID.
:type check_definition_id: int
:return: HTTP response.
:rtype: :class:`requests.Response`
"""
current_span = extract_span_from_kwargs(**kwargs)
current_span.set_tag('check_id', str(check_definition_id))
resp = self.session.delete(self.endpoint(CHECK_DEF, check_definition_id))
resp.raise_for_status()
return resp
########################################################################################################################
# ALERT-DEFS & DATA
########################################################################################################################
@trace(pass_span=True)
@logged
def get_alert_definition(self, alert_id: int, **kwargs) -> dict:
"""
Retrieve alert definition.
:param alert_id: Alert definition ID.
:type alert_id: int
:return: Alert definition dict.
:rtype: dict
"""
current_span = extract_span_from_kwargs(**kwargs)
current_span.set_tag('alert_id', str(alert_id))
resp = self.session.get(self.endpoint(ALERT_DEF, alert_id), timeout=self._timeout)
return self.json(resp)
@trace()
@logged
def get_alert_definitions(self) -> list:
"""
Return list of all ``active`` alert definitions.
:return: List of alert-defs.
:rtype: list
"""
resp = self.session.get(self.endpoint(ACTIVE_ALERT_DEF), timeout=self._timeout)
return self.json(resp).get('alert_definitions')
@trace(pass_span=True)
@logged
def create_alert_definition(self, alert_definition: dict, **kwargs) -> dict:
"""
Create new alert definition.
Attributes ``last_modified_by`` and ``check_definition_id`` are required.
If ``status`` is not set, then it will be set to ``ACTIVE``.
:param alert_definition: ZMON alert definition dict.
:type alert_definition: dict
:return: Alert definition dict.
:rtype: dict
"""
current_span = extract_span_from_kwargs(**kwargs)
if 'last_modified_by' not in alert_definition:
current_span.set_tag('error', True)
current_span.log_kv({'exception': 'Alert definition must have "last_modified_by"'})
raise ZmonArgumentError('Alert definition must have "last_modified_by"')
if 'status' not in alert_definition:
alert_definition['status'] = 'ACTIVE'
if 'check_definition_id' not in alert_definition:
current_span.set_tag('error', True)
current_span.log_kv({'exception': 'Alert definition must have "last_modified_by"'})
raise ZmonArgumentError('Alert defintion must have "check_definition_id"')
current_span.set_tag('check_id', alert_definition['check_definition_id'])
resp = self.session.post(self.endpoint(ALERT_DEF), json=alert_definition, timeout=self._timeout)
return self.json(resp)
@trace(pass_span=True)
@logged
def update_alert_definition(self, alert_definition: dict, **kwargs) -> dict:
"""
Update existing alert definition.
Atrributes ``id``, ``last_modified_by`` and ``check_definition_id`` are required.
If ``status`` is not set, then it will be set to ``ACTIVE``.
:param alert_definition: ZMON alert definition dict.
:type alert_definition: dict
:return: Alert definition dict.
:rtype: dict
"""
current_span = extract_span_from_kwargs(**kwargs)
if 'last_modified_by' not in alert_definition:
current_span.set_tag('error', True)
current_span.log_kv({'exception': 'Alert definition must have "last_modified_by"'})
raise ZmonArgumentError('Alert definition must have "last_modified_by"')
if 'id' not in alert_definition:
current_span.set_tag('error', True)
current_span.log_kv({'exception': 'Alert definition must have "id"'})
raise ZmonArgumentError('Alert definition must have "id"')
current_span.set_tag('alert_id', alert_definition['id'])
if 'check_definition_id' not in alert_definition:
current_span.set_tag('error', True)
current_span.log_kv({'exception': 'Alert definition must have "check_definition_id"'})
raise ZmonArgumentError('Alert defintion must have "check_definition_id"')
current_span.set_tag('check_id', alert_definition['check_definition_id'])
if 'status' not in alert_definition:
alert_definition['status'] = 'ACTIVE'
resp = self.session.put(
self.endpoint(ALERT_DEF, alert_definition['id']), json=alert_definition, timeout=self._timeout)
return self.json(resp)
@trace(pass_span=True)
@logged
def delete_alert_definition(self, alert_definition_id: int, **kwargs) -> dict:
"""
Delete existing alert definition.
:param alert_definition_id: ZMON alert definition ID.
:type alert_definition_id: int
:return: Alert definition dict.
:rtype: dict
"""
current_span = extract_span_from_kwargs(**kwargs)
current_span.set_tag('alert_id', str(alert_definition_id))
resp = self.session.delete(self.endpoint(ALERT_DEF, alert_definition_id))
return self.json(resp)
@trace(pass_span=True)
@logged
def get_alert_data(self, alert_id: int, **kwargs) -> dict:
"""
Retrieve alert data.
Response is a ``dict`` with entity ID as a key, and check return value as a value.
:param alert_id: ZMON alert ID.
:type alert_id: int
:return: Alert data dict.
:rtype: dict
Example:
.. code-block:: json
{
"entity-id-1": 122,
"entity-id-2": 0,
"entity-id-3": 100
}
"""
current_span = extract_span_from_kwargs(**kwargs)
current_span.set_tag('alert_id', str(alert_id))
resp = self.session.get(self.endpoint(ALERT_DATA, alert_id, 'all-entities'), timeout=self._timeout)
return self.json(resp)
########################################################################################################################
# SEARCH
########################################################################################################################
@trace(pass_span=True)
@logged
def search(self, q, limit=None, teams=None, **kwargs) -> dict:
"""
Search ZMON dashboards, checks, alerts and grafana dashboards with optional team filtering.
:param q: search query.
:type q: str
:param teams: List of team IDs. Default is None.
:type teams: list
:return: Search result.
:rtype: dict
Example:
.. code-block:: json
{
"alerts": [{"id": "123", "title": "ZMON alert", "team": "ZMON"}],
"checks": [{"id": "123", "title": "ZMON check", "team": "ZMON"}],
"dashboards": [{"id": "123", "title": "ZMON dashboard", "team": "ZMON"}],
"grafana_dashboards": [{"id": "123", "title": "ZMON grafana", "team": ""}],
}
"""
current_span = extract_span_from_kwargs(**kwargs)
if teams and type(teams) not in (list, tuple):
current_span.set_tag('error', True)
current_span.log_kv({'exception': '"teams" should be a list'})
raise ZmonArgumentError('"teams" should be a list!')
params = {'query': q}
if limit:
params.update({'limit': limit})
if teams:
params['teams'] = ','.join(teams)
current_span.log_kv({'query', json.dumps(params)})
resp = self.session.get(self.endpoint(SEARCH), params=params, timeout=self._timeout)
return self.json(resp)
########################################################################################################################
# ONETIME-TOKENS
########################################################################################################################
@trace() # noqa: E301
@logged
def list_onetime_tokens(self) -> list:
"""
List exisitng one-time tokens.
:return: List of one-time tokens, with relevant attributes.
:retype: list
Example:
.. code-block:: yaml
- bound_at: 2016-09-08 14:00:12.645999
bound_expires: 1503744673506
bound_ip: 192.168.20.16
created: 2016-08-26 12:51:13.506000
token: 9pSzKpcO
"""
resp = self.session.get(self.endpoint(TOKENS), timeout=self._timeout)
return self.json(resp)
@trace()
@logged
def get_onetime_token(self) -> str:
"""
Retrieve new one-time token.
You can use :func:`zmon_cli.client.Zmon.token_login_url` to return a deeplink to one-time login.
:return: One-time token.
:retype: str
"""
resp = self.session.post(self.endpoint(TOKENS), json={}, timeout=self._timeout)
resp.raise_for_status()
return resp.text
########################################################################################################################
# GRAFANA
########################################################################################################################
@trace(pass_span=True)
@logged
def get_grafana_dashboard(self, grafana_dashboard_uid: str, **kwargs) -> dict:
"""
Retrieve Grafana dashboard.
:param grafana_dashboard_uid: Grafana dashboard UID.
:type grafana_dashboard_uid: str
:return: Grafana dashboard dict.
:rtype: dict
"""
current_span = extract_span_from_kwargs(**kwargs)
current_span.set_tag('grafana_dashboard_uid', grafana_dashboard_uid)
url = self.endpoint(GRAFANA, grafana_dashboard_uid, trailing_slash=False)
resp = self.session.get(url, timeout=self._timeout)
return self.json(resp)
@trace(pass_span=True)
@logged
def update_grafana_dashboard(self, grafana_dashboard: dict, **kwargs) -> dict:
"""
Update existing Grafana dashboard.
Atrributes ``uid`` and ``title`` are required.
:param grafana_dashboard: Grafana dashboard dict.
:type grafana_dashboard: dict
:return: Grafana dashboard dict.
:rtype: dict
"""
current_span = extract_span_from_kwargs(**kwargs)
if 'uid' not in grafana_dashboard['dashboard']:
current_span.set_tag('error', True)
current_span.log_kv({'exception': 'Grafana dashboard must have "uid". Use Grafana6 dashboard format.'})
raise ZmonArgumentError('Grafana dashboard must have "uid". Hint: Use Grafana6 dashboard format.')
elif 'title' not in grafana_dashboard['dashboard']:
current_span.set_tag('error', True)
current_span.log_kv({'exception': 'Grafana dashboard must have "title"'})
raise ZmonArgumentError('Grafana dashboard must have "title"')
current_span.set_tag('grafana_dashboard_uid', grafana_dashboard['dashboard']['uid'])
if 'id' in grafana_dashboard['dashboard'] and grafana_dashboard['dashboard']['id'] is not None:
current_span.set_tag('grafana_dashboard_id', grafana_dashboard['dashboard']['id'])
req = {'dashboard': grafana_dashboard['dashboard'],
'overwrite': True}
if 'folderId' in grafana_dashboard.get('meta', {}):
req['folderId'] = grafana_dashboard['meta']['folderId']
resp = self.session.post(self.endpoint(GRAFANA), json=json.dumps(req), timeout=self._timeout)
return self.json(resp)
########################################################################################################################
# DOWNTIMES
########################################################################################################################
@trace(pass_span=True)
@logged
def create_downtime(self, downtime: dict, **kwargs) -> dict:
"""
Create a downtime for specific entities.
Atrributes ``entities`` list, ``start_time`` and ``end_time`` timestamps are required.
:param downtime: Downtime dict.
:type downtime: dict
:return: Downtime dict.
:rtype: dict
Example downtime:
.. code-block:: json
{
"entities": ["entity-id-1", "entity-id-2"],
"comment": "Planned maintenance",
"start_time": 1473337437.312921,
"end_time": 1473341037.312921,
}
"""
current_span = extract_span_from_kwargs(**kwargs)
if not downtime.get('entities'):
current_span.set_tag('error', True)
current_span.log_kv({'exception': 'At least one entity ID should be specified'})
raise ZmonArgumentError('At least one entity ID should be specified')
if not downtime.get('start_time') or not downtime.get('end_time'):
current_span.set_tag('error', True)
current_span.log_kv({'exception': 'Downtime must specify "start_time" and "end_time"'})
raise ZmonArgumentError('Downtime must specify "start_time" and "end_time"')
current_span.set_tag('entity_ids', str(downtime.get('entities')))
# FIXME - those also?
# current_span.set_tag('start_time', str(downtime.get('start_time')))
# current_span.set_tag('end_time', str(downtime.get('end_time')))
resp = self.session.post(self.endpoint(DOWNTIME), json=downtime, timeout=self._timeout)
return self.json(resp)
########################################################################################################################
# GROUPS - MEMBERS - ???
########################################################################################################################
@logged
def get_groups(self):
resp = self.session.get(self.endpoint(GROUPS), timeout=self._timeout)
return self.json(resp)
@logged
def switch_active_user(self, group_name, user_name):
resp = self.session.delete(self.endpoint(GROUPS, group_name, 'active'))
if not resp.ok:
logger.error('Failed to de-activate group: {}'.format(group_name))
resp.raise_for_status()
logger.debug('Switching active user: {}'.format(user_name))
resp = self.session.put(self.endpoint(GROUPS, group_name, 'active', user_name), timeout=self._timeout)
if not resp.ok:
logger.error('Failed to switch active user {}'.format(user_name))
resp.raise_for_status()
return resp.text == '1'
@logged
def add_member(self, group_name, user_name):
resp = self.session.put(self.endpoint(GROUPS, group_name, MEMBER, user_name), timeout=self._timeout)
resp.raise_for_status()
return resp.text == '1'
@logged
def remove_member(self, group_name, user_name):
resp = self.session.delete(self.endpoint(GROUPS, group_name, MEMBER, user_name))
resp.raise_for_status()
return resp.text == '1'
@logged
def add_phone(self, member_email, phone_nr):
resp = self.session.put(self.endpoint(GROUPS, member_email, PHONE, phone_nr), timeout=self._timeout)
resp.raise_for_status()
return resp.text == '1'
@logged
def remove_phone(self, member_email, phone_nr):
resp = self.session.delete(self.endpoint(GROUPS, member_email, PHONE, phone_nr))
resp.raise_for_status()
return resp.text == '1'
@logged
def set_name(self, member_email, member_name):
resp = self.session.put(self.endpoint(GROUPS, member_email, PHONE, member_name), timeout=self._timeout)
resp.raise_for_status()
return resp | zmon-cli | /zmon-cli-1.1.74.tar.gz/zmon-cli-1.1.74/zmon_cli/client.py | client.py |
import yaml
import click
from clickclick import AliasedGroup, Action, ok
from zmon_cli.cmds.command import cli, get_client, yaml_output_option, pretty_json
from zmon_cli.output import dump_yaml, Output
@cli.group('dashboard', cls=AliasedGroup)
@click.pass_obj
def dashboard(obj):
"""Manage ZMON dashboards"""
pass
@dashboard.command('init')
@click.argument('yaml_file', type=click.File('wb'))
@click.pass_obj
def init(obj, yaml_file):
"""Initialize a new dashboard YAML file"""
name = click.prompt('Dashboard name', default='Example dashboard')
alert_teams = click.prompt('Alert Teams (comma separated)', default='Team1, Team2')
user = obj.config.get('user', 'unknown')
data = {
'id': '',
'name': name,
'last_modified_by': user,
'alert_teams': [t.strip() for t in alert_teams.split(',')],
'tags': [],
'view_mode': 'FULL',
'shared_teams': [],
'widget_configuration': [],
}
yaml_file.write(dump_yaml(data).encode('utf-8'))
ok()
@dashboard.command('get')
@click.argument("dashboard_id", type=int)
@click.pass_obj
@yaml_output_option
@pretty_json
def dashboard_get(obj, dashboard_id, output, pretty):
"""Get ZMON dashboard"""
client = get_client(obj.config)
with Output('Retrieving dashboard ...', nl=True, output=output, pretty_json=pretty) as act:
dashboard = client.get_dashboard(dashboard_id)
act.echo(dashboard)
@dashboard.command('update')
@click.argument('yaml_file', type=click.Path(exists=True))
@click.pass_obj
def dashboard_update(obj, yaml_file):
"""Create/Update a single ZMON dashboard"""
client = get_client(obj.config)
dashboard = {}
with open(yaml_file, 'rb') as f:
dashboard = yaml.safe_load(f)
msg = 'Creating new dashboard ...'
if 'id' in dashboard:
msg = 'Updating dashboard {} ...'.format(dashboard.get('id'))
with Action(msg, nl=True):
dash_id = client.update_dashboard(dashboard)
ok(client.dashboard_url(dash_id))
@dashboard.command('help')
@click.pass_context
def help(ctx):
print(ctx.parent.get_help()) | zmon-cli | /zmon-cli-1.1.74.tar.gz/zmon-cli-1.1.74/zmon_cli/cmds/dashboard.py | dashboard.py |
import yaml
import click
from clickclick import AliasedGroup, Action, ok
from zmon_cli.cmds.command import (
cli,
get_client,
yaml_output_option,
pretty_json,
output_option,
)
from zmon_cli.output import dump_yaml, Output, render_checks
from zmon_cli.client import ZmonArgumentError
@cli.group('check-definitions', cls=AliasedGroup)
@click.pass_obj
def check_definitions(obj):
"""Manage check definitions"""
pass
@check_definitions.command('init')
@click.argument('yaml_file', type=click.File('wb'))
def init(yaml_file):
"""Initialize a new check definition YAML file"""
# NOTE: sorted like FIELD_SORT_INDEX
name = click.prompt('Check definition name', default='Example Check')
owning_team = click.prompt('Team owning this check definition (i.e. your team)', default='Example Team')
data = {
'name': name,
'owning_team': owning_team,
'description': "Example ZMON check definition which returns a HTTP status code.\n" +
"You can write multiple lines here, including unicode ☺",
'command': "# GET request on example.org and return HTTP status code\n" +
"http('http://example.org/', timeout=5).code()",
'interval': 60,
'entities': [{'type': 'GLOBAL'}],
'status': 'ACTIVE'
}
yaml_file.write(dump_yaml(data).encode('utf-8'))
ok()
@check_definitions.command('get')
@click.argument('check_id', type=int)
@click.pass_obj
@yaml_output_option
@pretty_json
def get_check_definition(obj, check_id, output, pretty):
"""Get a single check definition"""
client = get_client(obj.config)
with Output('Retrieving check definition ...', nl=True, output=output, pretty_json=pretty) as act:
check = client.get_check_definition(check_id)
keys = list(check.keys())
for k in keys:
if check[k] is None:
del check[k]
act.echo(check)
@check_definitions.command('list')
@click.pass_obj
@output_option
@pretty_json
def list_check_definitions(obj, output, pretty):
"""List all active check definitions"""
client = get_client(obj.config)
with Output('Retrieving active check definitions ...', nl=True, output=output, pretty_json=pretty,
printer=render_checks) as act:
checks = client.get_check_definitions()
for check in checks:
check['link'] = client.check_definition_url(check)
act.echo(checks)
@check_definitions.command('filter')
@click.argument('field')
@click.argument('value')
@click.pass_obj
@output_option
@pretty_json
def filter_check_definitions(obj, field, value, output, pretty):
"""Filter active check definitions"""
client = get_client(obj.config)
with Output('Retrieving and filtering check definitions ...', nl=True, output=output, pretty_json=pretty,
printer=render_checks) as act:
checks = client.get_check_definitions()
filtered = [check for check in checks if check.get(field) == value]
for check in filtered:
check['link'] = client.check_definition_url(check)
act.echo(filtered)
@check_definitions.command('update')
@click.argument('yaml_file', type=click.File('rb'))
@click.option('--skip-validation', is_flag=True, hidden=True, help='Skip check command syntax validation.')
@click.pass_obj
def update(obj, yaml_file, skip_validation):
"""Update a single check definition"""
check = yaml.safe_load(yaml_file)
check['last_modified_by'] = obj.get('user', 'unknown')
client = get_client(obj.config)
with Action('Updating check definition ...', nl=True) as act:
try:
check = client.update_check_definition(check)
ok(client.check_definition_url(check))
except ZmonArgumentError as e:
act.error(str(e))
@check_definitions.command('delete')
@click.argument('check_id', type=int)
@click.pass_obj
def delete_check_definition(obj, check_id):
"""Delete an orphan check definition"""
client = get_client(obj.config)
with Action('Deleting check {} ...'.format(check_id)) as act:
resp = client.delete_check_definition(check_id)
if not resp.ok:
act.error(resp.text)
@check_definitions.command('help')
@click.pass_context
def help(ctx):
print(ctx.parent.get_help()) | zmon-cli | /zmon-cli-1.1.74.tar.gz/zmon-cli-1.1.74/zmon_cli/cmds/check.py | check.py |
import click
import logging
import os
from clickclick import AliasedGroup
from easydict import EasyDict
from zmon_cli import __version__
from zmon_cli.config import DEFAULT_CONFIG_FILE, DEFAULT_TIMEOUT
from zmon_cli.config import get_config_data, configure_logging, set_config_file
from zmon_cli.output import Output, render_status
from zmon_cli.client import Zmon
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
output_option = click.option('-o', '--output', type=click.Choice(['text', 'json', 'yaml']), default='text',
help='Use alternative output format')
yaml_output_option = click.option('-o', '--output', type=click.Choice(['text', 'json', 'yaml']), default='yaml',
help='Use alternative output format. Default is YAML.')
pretty_json = click.option('--pretty', is_flag=True,
help='Pretty print JSON output. Ignored if output format is not JSON')
retries = click.option(
"--retries",
default=0,
help='Number of retries.',
type=int,
)
def print_version(ctx, param, value):
if not value or ctx.resilient_parsing:
return
click.echo('ZMON CLI {}'.format(__version__))
ctx.exit()
def get_client(config, **kwargs):
verify = config.get("verify", True)
common_arguments = {
"url": config["url"],
"verify": verify,
"timeout": config.get("timeout", DEFAULT_TIMEOUT),
**kwargs,
}
if "user" in config and "password" in config:
return Zmon(
**common_arguments,
username=config["user"],
password=config["password"],
)
elif os.environ.get("ZMON_TOKEN"):
return Zmon(
**common_arguments,
token=os.environ.get("ZMON_TOKEN"),
)
elif "token" in config:
return Zmon(
**common_arguments,
token=config["token"],
)
raise RuntimeError("Failed to intitialize ZMON client. Invalid configuration!")
########################################################################################################################
# CLI
########################################################################################################################
@click.group(cls=AliasedGroup, context_settings=CONTEXT_SETTINGS)
@click.option('-c', '--config-file', help='Use alternative config file', default=DEFAULT_CONFIG_FILE, metavar='PATH')
@click.option('-v', '--verbose', help='Verbose logging', is_flag=True)
@click.option('-V', '--version', is_flag=True, callback=print_version, expose_value=False, is_eager=True)
@click.option('-t', '--timeout', help='timeout for calls', default=DEFAULT_TIMEOUT)
@click.pass_context
def cli(ctx, config_file, verbose, timeout=DEFAULT_TIMEOUT):
"""
ZMON command line interface
"""
configure_logging(logging.DEBUG if verbose else logging.INFO)
fn = os.path.expanduser(config_file)
config = {}
if os.path.exists(fn):
config = get_config_data(config_file)
config['timeout'] = timeout
ctx.obj = EasyDict(config=config)
@cli.command()
@click.option('-c', '--config-file', help='Use alternative config file', default=DEFAULT_CONFIG_FILE, metavar='PATH')
@click.pass_obj
def configure(obj, config_file):
"""Configure ZMON URL and credentials"""
set_config_file(config_file, obj.config.get('url'))
@cli.command()
@click.pass_obj
@output_option
@pretty_json
def status(obj, output, pretty):
"""Check ZMON system status"""
client = get_client(obj.config)
with Output('Retrieving status ...', printer=render_status, output=output, pretty_json=pretty) as act:
status = client.status()
act.echo(status)
@click.command()
@click.pass_context
def help(ctx):
print(ctx.get_help())
cli.add_command(help) | zmon-cli | /zmon-cli-1.1.74.tar.gz/zmon-cli-1.1.74/zmon_cli/cmds/command.py | command.py |
import os
import sys
import json
import yaml
import requests
import click
from clickclick import AliasedGroup, Action, action, ok, fatal_error
from zmon_cli.cmds.command import cli, get_client, output_option, yaml_output_option, pretty_json
from zmon_cli.output import render_entities, Output, log_http_exception
from zmon_cli.client import ZmonArgumentError
from calendar import timegm
from time import strptime
LAST_MODIFIED_FMT = '%Y-%m-%d %H:%M:%S.%f'
LAST_MODIFIED_FMT_ZERO = '%Y-%m-%d %H:%M:%S'
def entity_last_modified(e):
try:
return timegm(strptime(e.get('last_modified'), LAST_MODIFIED_FMT))
except ValueError:
return timegm(strptime(e.get('last_modified'), LAST_MODIFIED_FMT_ZERO))
except Exception:
return 0
########################################################################################################################
# ENTITIES
########################################################################################################################
@cli.group('entities', cls=AliasedGroup, invoke_without_command=True)
@click.pass_context
@output_option
@pretty_json
def entities(ctx, output, pretty):
"""Manage entities"""
if not ctx.invoked_subcommand:
client = get_client(ctx.obj.config)
print("Fetching ALL entities, this might take some time\n", file=sys.stderr)
with Output('Retrieving all entities ...', output=output, printer=render_entities, pretty_json=pretty) as act:
entities = client.get_entities()
act.echo(entities)
@entities.command('get')
@click.argument('entity_id')
@click.pass_obj
@yaml_output_option
@pretty_json
def get_entity(obj, entity_id, output, pretty):
"""Get a single entity by ID"""
client = get_client(obj.config)
with Output('Retrieving entity {} ...'.format(entity_id), nl=True, output=output, pretty_json=pretty) as act:
entity = client.get_entity(entity_id)
act.echo(entity)
@entities.command('filter')
@click.argument('filters', nargs=-1)
@click.pass_obj
@output_option
@pretty_json
def filter_entities(obj, filters, output, pretty):
"""
List entities filtered by key values pairs
E.g.:
zmon entities filter type instance application_id my-app
"""
client = get_client(obj.config)
if len(filters) % 2:
fatal_error('Invalid filters count: expected even number of args!')
if len(filters) == 0:
print("Fetching ALL entities, this might take some time\n", file=sys.stderr)
with Output('Retrieving and filtering entities ...', nl=True, output=output, printer=render_entities,
pretty_json=pretty) as act:
query = dict(zip(filters[0::2], filters[1::2]))
entities = client.get_entities(query=query)
entities = sorted(entities, key=entity_last_modified)
act.echo(entities)
@entities.command('push')
@click.argument('entity')
@click.pass_obj
def push_entity(obj, entity):
"""Push one or more entities"""
client = get_client(obj.config)
if (entity.endswith('.json') or entity.endswith('.yaml')) and os.path.exists(entity):
with open(entity, 'rb') as fd:
data = yaml.safe_load(fd)
else:
data = json.loads(entity)
if not isinstance(data, list):
data = [data]
with Action('Creating new entities ...', nl=True) as act:
for e in data:
action('Creating entity {} ...'.format(e['id']))
try:
client.add_entity(e)
ok()
except ZmonArgumentError as e:
act.error(str(e))
except requests.HTTPError as e:
log_http_exception(e, act)
except Exception as e:
act.error('Failed: {}'.format(str(e)))
@entities.command('delete')
@click.argument('entity_id')
@click.pass_obj
def delete_entity(obj, entity_id):
"""Delete a single entity by ID"""
client = get_client(obj.config)
with Action('Deleting entity {} ...'.format(entity_id)) as act:
deleted = client.delete_entity(entity_id)
if not deleted:
act.error('Failed')
@entities.command('help')
@click.pass_context
def help(ctx):
print(ctx.parent.get_help()) | zmon-cli | /zmon-cli-1.1.74.tar.gz/zmon-cli-1.1.74/zmon_cli/cmds/entity.py | entity.py |
import json
import yaml
import click
from clickclick import AliasedGroup, Action, ok
from zmon_cli.cmds.command import (
cli,
get_client,
yaml_output_option,
output_option,
pretty_json,
retries,
)
from zmon_cli.output import dump_yaml, Output, render_alerts
from zmon_cli.client import ZmonArgumentError
@cli.group('alert-definitions', cls=AliasedGroup)
@click.pass_obj
def alert_definitions(obj):
"""Manage alert definitions"""
pass
@alert_definitions.command('init')
@click.argument('yaml_file', type=click.File('wb'))
def init(yaml_file):
"""Initialize a new alert definition YAML file"""
name = click.prompt('Alert name', default='Example Alert')
check_id = click.prompt('Check ID')
team = click.prompt('(Responsible-) Team', default='Example Team')
data = {
'check_definition_id': check_id,
'condition': '>100',
'description': 'Example Alert Description',
'entities': [],
'entities_exclude': [],
'id': '',
'name': name,
'parameters': {},
'parent_id': '',
'priority': 2,
'responsible_team': team,
'status': 'ACTIVE',
'tags': [],
'team': team,
'template': False,
}
yaml_file.write(dump_yaml(data).encode('utf-8'))
ok()
@alert_definitions.command('get')
@click.argument('alert_id', type=int)
@retries
@click.pass_obj
@yaml_output_option
@pretty_json
def get_alert_definition(obj, alert_id, retries, output, pretty):
"""Get a single alert definition"""
client = get_client(obj.config, retry_count=retries)
with Output('Retrieving alert definition ...', nl=True, output=output, pretty_json=pretty) as act:
alert = client.get_alert_definition(alert_id)
keys = list(alert.keys())
for k in keys:
if alert[k] is None:
del alert[k]
act.echo(alert)
@alert_definitions.command('list')
@click.pass_obj
@output_option
@pretty_json
def list_alert_definitions(obj, output, pretty):
"""List all active alert definitions"""
client = get_client(obj.config)
with Output('Retrieving active alert definitions ...', nl=True, output=output, pretty_json=pretty,
printer=render_alerts) as act:
alerts = client.get_alert_definitions()
for alert in alerts:
alert['link'] = client.alert_details_url(alert)
act.echo(alerts)
@alert_definitions.command('filter')
@click.argument('field')
@click.argument('value')
@click.pass_obj
@output_option
@pretty_json
def filter_alert_definitions(obj, field, value, output, pretty):
"""Filter active alert definitions"""
client = get_client(obj.config)
with Output('Retrieving and filtering alert definitions ...', nl=True, output=output, pretty_json=pretty,
printer=render_alerts) as act:
alerts = client.get_alert_definitions()
if field == 'check_definition_id':
value = int(value)
filtered = [alert for alert in alerts if alert.get(field) == value]
for alert in filtered:
alert['link'] = client.alert_details_url(alert)
act.echo(filtered)
@alert_definitions.command('create')
@click.argument('yaml_file', type=click.File('rb'))
@click.pass_obj
def create_alert_definition(obj, yaml_file):
"""Create a single alert definition"""
client = get_client(obj.config)
alert = yaml.safe_load(yaml_file)
alert['last_modified_by'] = obj.config.get('user', 'unknown')
with Action('Creating alert definition ...', nl=True) as act:
try:
new_alert = client.create_alert_definition(alert)
ok(client.alert_details_url(new_alert))
except ZmonArgumentError as e:
act.error(str(e))
@alert_definitions.command('update')
@click.argument('yaml_file', type=click.File('rb'))
@retries
@click.pass_obj
def update_alert_definition(obj, yaml_file, retries):
"""Update a single alert definition"""
alert = yaml.safe_load(yaml_file)
alert['last_modified_by'] = obj.config.get('user', 'unknown')
client = get_client(obj.config, retry_count=retries)
with Action('Updating alert definition ...', nl=True) as act:
try:
# Workaround API inconsistency!
if alert.get('parameters'):
for k, v in alert['parameters'].items():
if type(v) is str:
alert['parameters'][k] = json.loads(v)
client.update_alert_definition(alert)
ok(client.alert_details_url(alert))
except ZmonArgumentError as e:
act.error(str(e))
@alert_definitions.command('delete')
@click.argument('alert_id', type=int)
@click.pass_obj
def delete_alert_definition(obj, alert_id):
"""Delete a single alert definition"""
client = get_client(obj.config)
with Action('Deleting alert definition ...'):
client.delete_alert_definition(alert_id)
@alert_definitions.command('help')
@click.pass_context
def help(ctx):
print(ctx.parent.get_help()) | zmon-cli | /zmon-cli-1.1.74.tar.gz/zmon-cli-1.1.74/zmon_cli/cmds/alert.py | alert.py |
import click
from clickclick import Action
from zmon_cli.cmds.command import cli, get_client
@cli.group(invoke_without_command=True)
@click.pass_context
def groups(ctx):
"""Manage contact groups"""
client = get_client(ctx.obj.config)
if not ctx.invoked_subcommand:
with Action('Retrieving groups ...', nl=True) as act:
groups = client.get_groups()
if len(groups) == 0:
act.warning('No groups found!')
for g in groups:
print('Name: {} Id: {}'.format(g['name'], g['id']))
print('\tMembers:')
for m in g['members']:
member = client.get_member(m)
print('\t\t{} {} {}'.format(member['name'], member['email'], member['phones']))
print('\tActive:')
for m in g['active']:
member = client.get_member(m)
print('\t\t{} {} {}'.format(member['name'], member['email'], member['phones']))
@groups.command('switch')
@click.argument('group_name')
@click.argument('user_name')
@click.pass_obj
def switch_active(obj, group_name, user_name):
client = get_client(obj.config)
with Action('Switching active user ...') as act:
switched = client.switch_active_user(group_name, user_name)
if not switched:
act.error('Failed to switch')
@cli.group()
@click.pass_obj
def members(obj):
"""Manage group membership"""
pass
@members.command('add')
@click.argument('group_name')
@click.argument('user_name')
@click.pass_obj
def member_add(obj, group_name, user_name):
client = get_client(obj.config)
with Action('Adding user ...') as act:
added = client.add_member(group_name, user_name)
if not added:
act.error('Failed to add member')
@members.command('remove')
@click.argument('group_name')
@click.argument('user_name')
@click.pass_obj
def member_remove(obj, group_name, user_name):
client = get_client(obj.config)
with Action('Removing user ...') as act:
removed = client.remove_member(group_name, user_name)
if not removed:
act.error('Failed to remove member')
@members.command('add-phone')
@click.argument('member_email')
@click.argument('phone_nr')
@click.pass_obj
def add_phone(obj, member_email, phone_nr):
client = get_client(obj.config)
with Action('Adding phone ...') as act:
added = client.add_phone(member_email, phone_nr)
if not added:
act.error('Failed to add phone')
@members.command('remove-phone')
@click.argument('member_email')
@click.argument('phone_nr')
@click.pass_obj
def remove_phone(obj, member_email, phone_nr):
client = get_client(obj.config)
with Action('Removing phone number ...') as act:
removed = client.remove_phone(member_email, phone_nr)
if not removed:
act.error('Failed to remove phone')
@members.command('change-name')
@click.argument('member_email')
@click.argument('member_name')
@click.pass_obj
def set_name(obj, member_email, member_name):
client = get_client(obj.config)
with Action('Changing user name ...'):
client.set_name(member_email, member_name)
@members.command('help')
@click.pass_context
def help(ctx):
print(ctx.parent.get_help()) | zmon-cli | /zmon-cli-1.1.74.tar.gz/zmon-cli-1.1.74/zmon_cli/cmds/group.py | group.py |
===========
ZMON Worker
===========
.. image:: https://travis-ci.org/zalando/zmon-worker.svg?branch=master
:target: https://travis-ci.org/zalando/zmon-worker
:alt: Build Status
.. image:: https://coveralls.io/repos/zalando/zmon-worker/badge.svg
:target: https://coveralls.io/r/zalando/zmon-worker
:alt: Coverage Status
ZMON's Python worker is doing the heavy lifting of executing tasks against entities, and evaluating all alerts assigned to check.
Tasks are picked up from Redis and the resulting check values plus alert state changes are written back to Redis.
Local Development
=================
Start Redis on localhost:6379:
.. code-block:: bash
$ docker run -p 6379:6379 -it redis
Install the required development libraries:
.. code-block:: bash
$ sudo apt-get install build-essential python2.7-dev libpq-dev libldap2-dev libsasl2-dev libsnappy-dev
$ sudo pip2 install -r requirements.txt
Start the ZMON worker process:
.. code-block:: bash
$ python2 -m zmon_worker_monitor
You can query the worker monitor via RPC:
.. code-block:: bash
$ python2 -m zmon_worker_monitor.rpc_client http://localhost:23500/zmon_rpc list_stats
Running Unit Tests
==================
.. code-block:: bash
$ sudo pip2 install -r test_requirements.txt
$ python2 setup.py test
Building the Docker Image
=========================
.. code-block:: bash
$ docker build -t zmon-worker .
$ docker run -it zmon-worker
Running the Docker image
========================
The Docker image supports many configuration options via environment variables.
Configuration options are explained in the `ZMON Documentation <http://zmon.readthedocs.org/en/latest/installation/configuration.html#worker>`_.
| zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/README.rst | README.rst |
import inspect
import json
import xmlrpclib
from SimpleXMLRPCServer import SimpleXMLRPCServer
from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler
import logging
logger = logging.getLogger(__name__)
class RpcProxy(object):
"""
This is a base class to subclass in order to expose an instance object through remote RPC
It serves as a container for some idiosyncrasies of Python XML_RPC
like the private methods: _listMethods , _methodHelp and _dispatch, which purpose isn't obvious at firsts.
Here we try to take advantage of these idiosyncrasies.
"""
exposed_obj_class = object # override with the class of the object to expose
valid_methods = [] # override with the list of methods you want to call from RPC
def __init__(self, exposed_obj):
assert type(exposed_obj) is self.exposed_obj_class, "Error in RpcProxy: exposed_obj is not declared class"
self.exposed_obj = exposed_obj
def _listMethods(self):
# this method must be present for system.listMethods to work
return self.valid_methods
def _methodHelp(self, method):
# Override this method for system.methodHelp to work
if method == 'example_method':
return "example_method(2,3) => 5"
else:
# By convention, return empty string if no help is available
return ""
def get_exposed_obj(self):
#Never add this method to valid_methods
return self.exposed_obj
def on_exit(self):
#Override this to provide a logic to be executed when server is finishing
pass
def signal_termination(self, terminate):
self._signal_terminate_and_exit = bool(terminate)
def _dispatch(self, method, params):
#This method is automatically called by Python's SimpleXMLRPCServer for every incoming rpc call
if method in self.valid_methods:
obj = self if hasattr(self, method) else self.exposed_obj
try:
kw = {}
m = getattr(obj, method)
if len(params) and str(params[-1]).startswith('js:'):
# let's try to interpret the last argument as keyword args in json format
_kw = json.loads(str(params[-1])[len('js:'):])
aspec = inspect.getargspec(m)
if isinstance(_kw, dict) and _kw and [k in aspec.args for k in _kw]:
params = params[:-1]
kw = _kw
return getattr(obj, method)(*params, **kw)
except Exception:
logger.exception("Exception encountered in rpc_server while attempting to call: %s with params: %s ",
method, params)
raise
else:
raise Exception('method "%s" is not supported' % method)
def get_rpc_client(endpoint):
"""
Get an rpc client object to remote server listening at endpoint
:param endpoint: http://host:port/rpc_path
:return: rpc_client object
"""
return xmlrpclib.ServerProxy(endpoint)
#TODO: move to a method in RpcProxy
def start_RPC_server(host, port, rpc_path, rpc_proxy):
"""
Starts the RPC server and expose some methods of rpc_proxy
:param host:
:param port:
:param rpc_proxy:
:return:
"""
# Restrict to a particular path.
class RequestHandler(SimpleXMLRPCRequestHandler):
#rpc_paths = ('/RPC2',)
rpc_paths = ('/' + rpc_path.lstrip('/'), )
# Create server
server = SimpleXMLRPCServer((host, port), requestHandler=RequestHandler, allow_none=True)
server.register_introspection_functions()
server.register_instance(rpc_proxy)
try:
# Run the server's main loop
server.serve_forever()
except (KeyboardInterrupt, SystemExit):
logger.info("Server interrupted: Exiting!")
rpc_proxy.on_exit() | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/rpc_utils.py | rpc_utils.py |
from emu_kombu import parse_redis_conn
import redis
import os
import logging
import time
from threading import current_thread
from threading import local as thread_local
import collections
import math
from traceback import format_exception
logger = logging.getLogger(__name__)
WAIT_RECONNECT_MIN = 0.1
WAIT_RECONNECT_MAX = 20
class _ThreadLocal(thread_local):
can_init = False
instance = None
class RedisConnHandler(object):
"""
This is a connection manager for redis implemented as a context handler. When used inside a with statement
it intercepts RedisConnection exceptions as well as its own IdleLoopException in order to keep score of
failures and idle cycles. Based in this counters it reacts to connection errors by introducing small exponential
time delays and making several attempts to regain the connection, if t_wait_per_server seconds pass without
success it switches to the next redis server from the list it given when configured.
It also switches to the next server after t_wait_no_tasks seconds without getting any task.
You also get thread safety (connections are not shared among threads), and an easy way to get the connection
without passing the reference around.
"""
# Constants
__CONS_SUPPRESS_EXCEPTION = True
__CONS_PROPAGATE_EXCEPTION = False
STATUS_ERROR = 'STATUS_ERROR'
STATUS_IDLE = 'STATUS_IDLE'
STATUS_OK = 'STATUS_OK'
# class variables
servers = []
t_wait0 = WAIT_RECONNECT_MIN
reties_per_server = 5
t_wait_per_server = 30 # if 30 seconds pass and we have connection errors we switch server
t_wait_no_tasks = 5 * 60 # if 5 minutes pass without getting any message we switch server
#t_reconnect_master = 10 * 60 # in 10 minutes it will attempt to connect to server 0 again
_pid = None
_max_wait_step = 15 # a top value for our exponential increase in waiting time
_thread_local = _ThreadLocal()
# Counters and dates markers for connection errors
_active_index = 0
_retries_count = -1
_idle_count = -1
message_count = 0
_last_failure_tstamp = 0
_last_success_tstamp = time.time()
_last_message_tstamp = time.time()
class IdleLoopException(Exception):
pass
@classmethod
def configure(cls, **config):
cls._pid = os.getpid()
cls.t_wait0 = float(config.get('t_wait0', cls.t_wait0))
cls.t_wait_no_tasks = float(config.get('t_wait_no_tasks', cls.t_wait_no_tasks))
cls.t_wait_per_server = float(config.get('t_wait_per_server', cls.t_wait_per_server))
# estimate the reties_per_server from the wait_time_per_server
cls.reties_per_server = cls.calculate_reties_per_server(cls.t_wait_per_server, cls.t_wait0)
#cls.t_reconnect_master = int(config.get('t_reconnect_master', cls.t_reconnect_master))
servers = config.get('redis_servers')
if servers:
if isinstance(servers, basestring):
servers = [s.strip() for s in servers.split(',')]
elif not isinstance(servers, collections.Iterable):
raise Exception("wrong servers parameter")
cls.servers = list(servers)
# parse all server urls to detect config errors beforehand
[parse_redis_conn(s) for s in cls.servers]
logger.warn('Pid=%s ==> RedisConnHandler configured with reties_per_server(estimated)=%s, t_wait_per_server=%s, '
't_wait_no_tasks=%s, servers=%s', cls._pid, cls.reties_per_server, cls.t_wait_per_server,
cls.t_wait_no_tasks, cls.servers)
def __init__(self):
# we could use a metaclass or some trick on __new__ for enforcing the use of get_instance()
if not self._thread_local.can_init:
raise AssertionError('You must use get_instance() to get an instance')
assert len(self.servers) > 0, 'Fatal Error: No servers have been configured'
self._pid = os.getpid() if not self._pid else self._pid
self._conn = None
self._parsed_redis = parse_redis_conn(self.servers[self._active_index])
@classmethod
def get_instance(cls):
if cls._thread_local.instance is None:
cls._thread_local.can_init = True
cls._thread_local.instance = cls()
cls._thread_local.can_init = False
return cls._thread_local.instance
def __enter__(self):
return self
def __exit__(self, exc_type, exc_val, exc_tb):
if exc_type is not None:
if issubclass(exc_type, redis.ConnectionError):
self.mark(self.STATUS_ERROR)
logger.error('Pid=%s, thread_id=%s ==> Lost connection to redis server: %s. Waiting %s seconds. '
'Exception detail follows:\n%s', self._pid, current_thread().name,
self.get_active_server(), self.get_wait_time(),
''.join(format_exception(exc_type, exc_val, exc_tb)))
self.wait_on_error()
return self.__CONS_PROPAGATE_EXCEPTION
if issubclass(exc_type, self.IdleLoopException):
self.mark(self.STATUS_IDLE)
logger.info("IdleLoop: %s... pid=%s, count: %s", exc_val, self._pid, self.get_message_count())
return self.__CONS_SUPPRESS_EXCEPTION
self.mark(self.STATUS_OK)
return self.__CONS_PROPAGATE_EXCEPTION
@staticmethod
def calculate_wait_time_per_server(reties_per_server, t_wait0):
return t_wait0 * (2**(reties_per_server + 1) - 1)
@staticmethod
def calculate_reties_per_server(wait_time_per_server, t_wait0):
return int(round(math.log(wait_time_per_server * 1.0 / t_wait0 + 1, 2) - 1))
def get_active_server(self):
if self.should_switch_server(): #or self.should_reconnect_master():
self.switch_active_server() # (force_master=self.should_reconnect_master())
return self.servers[self._active_index]
def get_parsed_redis(self):
return self._parsed_redis
def should_switch_server(self):
cur_time = time.time()
return (self.is_previous_error() and cur_time - self._last_success_tstamp > self.t_wait_per_server) or \
(self.is_previous_idle() and cur_time - self._last_message_tstamp > self.t_wait_no_tasks)
def is_previous_ok(self):
return self._retries_count == -1
def is_previous_error(self):
return self._retries_count > -1
def is_previous_idle(self):
return self._idle_count > -1
def switch_active_server(self, force_master=False):
self._active_index = (0 if force_master or self._active_index >= len(self.servers) - 1 else
self._active_index + 1)
self._parsed_redis = parse_redis_conn(self.servers[self._active_index])
self.mark(self.STATUS_OK) # mark a fresh status OK for the new server
logger.warn('Pid=%s, thread_id=%s ==> Redis Active server switched to %s, force_master=%s', self._pid,
current_thread().name, self.servers[self._active_index], force_master)
def get_wait_time(self):
return min(self.t_wait0 * (2 ** self._retries_count) if self._retries_count >= 0 and not
self.should_switch_server() else 0, self._max_wait_step)
def get_message_count(self):
return self.message_count
def wait_on_error(self):
time.sleep(self.get_wait_time())
def mark(self, status):
if status == self.STATUS_ERROR:
self._retries_count += 1
self._last_failure_tstamp = time.time()
self._idle_count = -1
self._conn = None # force the recreation of the thread local connection in any case
elif status == self.STATUS_IDLE:
self._idle_count += 1
self._retries_count = -1 # and idle loop is still a success, so clear previous errors
self._last_success_tstamp = time.time()
elif status == self.STATUS_OK:
self._retries_count = -1
self._idle_count = -1
self._last_success_tstamp = time.time()
self.message_count += 1
self._last_message_tstamp = time.time()
else:
raise Exception('Non valid status: {}'.format(status))
def get_healthy_conn(self):
return self.get_conn()
def get_conn(self):
if self._conn is not None and not self.should_switch_server():
return self._conn
else:
self._conn = None
active_server = self.get_active_server()
c = parse_redis_conn(active_server)
logger.warn('Pid=%s, thread_id=%s ==> Opening new redis connection to host=%s, port=%s, db=%s', self._pid,
current_thread().name, c.hostname, c.port, c.virtual_host)
self._conn = redis.StrictRedis(host=c.hostname, port=c.port, db=c.virtual_host)
return self._conn | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/redis_context_manager.py | redis_context_manager.py |
import sys
import xmlrpclib
DEBUG = True
_cmd_struct = {
'endpoint': None,
'method_name': None,
'args': []
}
def parse_cmd_line(args):
admitted_types = ('int', 'float', 'str')
cmd_parts = dict(_cmd_struct)
cmd_parts['endpoint'] = args[1]
cmd_parts['method_name'] = args[2]
cmd_parts['args'] = []
raw_method_args = args[3:]
for raw_arg in raw_method_args:
#arg_parts = raw_arg.strip('"\'').split(':')
arg_parts = raw_arg.split(':')
if len(arg_parts) == 1 or arg_parts[0] not in admitted_types:
arg_type, arg_value = 'str', ':'.join(arg_parts[0:])
if arg_value.isdigit():
arg_type = 'int'
elif not (arg_value.startswith('.') or arg_value.endswith('.')) and arg_value.replace('.', '', 1).isdigit():
arg_type = 'float'
else:
arg_type, arg_value = arg_parts[0], ':'.join(arg_parts[1:])
try:
value = eval('{0}({1})'.format(arg_type, arg_value)) if arg_type != 'str' else arg_value
except Exception:
print >> sys.stderr, "\n Error: Detected argument with wrong format"
sys.exit(3)
cmd_parts['args'].append(value)
return cmd_parts
def get_rpc_client(endpoint):
"""
Get an rpc client object to remote server listening at endpoint
:param endpoint: http://host:port/rpc_path
:return: rpc_client object
"""
return xmlrpclib.ServerProxy(endpoint)
if __name__ == '__main__':
if len(sys.argv) <= 2:
print >>sys.stderr, 'usage: {0} http://<host>:<port>/<rpc_path> <method_name> [ [int|float|str]:arg1 ' \
'[int|float|str]:arg2 ...[int|float|str]:argN ...]'.format(sys.argv[0])
sys.exit(1)
cmd_line = parse_cmd_line(sys.argv[:])
if DEBUG:
print 'Parsed cmd_line: ', cmd_line
client = get_rpc_client(cmd_line['endpoint'])
#Executing now the remote method
result = getattr(client, cmd_line['method_name'])(*cmd_line['args'])
if result is not None:
print ">>Result:\n", result | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/rpc_client.py | rpc_client.py |
import os
import sys
from datetime import datetime, timedelta
import base64
import json
import logging
import time
import threading
from rpc_client import get_rpc_client
from contextlib import contextmanager
import settings
import eventloghttp
import snappy
import plugin_manager
from redis_context_manager import RedisConnHandler
from tasks import load_config_from_file, configure_tasks
from tasks import check_and_notify, trial_run, cleanup
logger = logging.getLogger(__name__)
TASK_POP_TIMEOUT = 5
__config = None
def get_config():
global __config
if __config is None:
__config = settings.get_external_config() or load_config_from_file()
return __config
def flow_simple_queue_processor(queue='', **execution_context):
'''
Simple logic to connect to a redis queue, listen to messages, decode them and execute the tasks
:param queue: (str) queue to connect to
:param execution_context: (dict) other kwargs that may have been passed when worker was spawn
:return:
Some info to understand celery messages:
1. An example of a celery message as first received (base64-encoded body shortened):
('zmon:queue:default',
'{
"body": "eyJleHBpcm...t9fQ==", "headers": {}, "content-type": "application/json",
"properties": {
"body_encoding": "base64",
"correlation_id": "check-277-de_zalando:access-control-kit-1409826332.92",
"reply_to": "abc5c87f-74eb-3570-a1cf-e426eaf91ca7",
"delivery_info": {
"priority": 0,
"routing_key": "default",
"exchange": "zmon"
},
"delivery_mode": 2,
"delivery_tag": "94288433-cb4e-4d33-be29-c63e2bbce39a"
},
"content-encoding": "utf-8"}'
)
2. An example of the message['body'] after being base64-decoded (args list shortened):
{
u'utc': True,
u'chord': None,
u'args': [{u'check_id': 277, u'interval': 60, u'entity': {u'instance_type': u'zomcat', ...}, u'condition': u'>100', ...}],
u'retries': 0,
u'expires': u'2014-09-04T10:27:32.919152+00:00',
u'task': u'check_and_notify',
u'callbacks': None,
u'errbacks': None,
u'timelimit': [90, 60],
u'taskset': None,
u'kwargs': {},
u'eta': None,
u'id': u'check-277-de_zalando:access-control-kit-1409826332.92'
}
'''
known_tasks = {'check_and_notify': check_and_notify, 'trial_run': trial_run, 'cleanup': cleanup}
#get configuration and configure tasks
config = get_config()
configure_tasks(config)
logger.info('Connecting simple_queue_consumer to queue=%s, execution_context=%s', queue, execution_context)
RedisConnHandler.configure(**dict(config))
eventloghttp.set_target_host(config.get('eventlog.host','localhost'), config.get('eventlog.port', 8081))
eventloghttp.enable_http(config.get('eventlog.http', True))
reactor = FlowControlReactor.get_instance()
conn_handler = RedisConnHandler.get_instance()
# try cleanup captures queue in aws context
r = conn_handler.get_healthy_conn()
r.delete('zmon:captures2graphite')
expired_count = 0
count = 0
while True:
try:
with conn_handler as ch:
r_conn = ch.get_healthy_conn()
encoded_task = r_conn.blpop(queue, TASK_POP_TIMEOUT)
if encoded_task is None:
raise ch.IdleLoopException('No task received')
queue, msg = encoded_task
if not msg[:1] == '{':
msg = snappy.decompress(msg)
msg_obj = json.loads(msg)
msg_body = None
body_encoding = msg_obj.get("properties", {}).get("body_encoding")
if body_encoding == "nested":
msg_body = msg_obj["body"]
elif body_encoding == "base64":
msg_body = json.loads(base64.b64decode(msg_obj['body']))
elif body_encoding == "snappy":
msg_body = json.loads(snappy.decompress(base64.b64decode(msg_obj['body'])))
taskname = msg_body['task']
func_args = msg_body['args']
func_kwargs = msg_body['kwargs']
timelimit = msg_body.get('timelimit') # [90, 60]
t_hard, t_soft = timelimit
# we pass task metadata as a kwargs right now, later will be put in the function context by our decorator
task_context = {
'queue': queue,
'taskname': taskname,
'delivery_info': msg_obj.get('properties', {}).get('delivery_info', {}),
'task_properties': {
'task': taskname,
'id': msg_body.get('id', ''),
'expires': msg_body.get('expires'), # '2014-09-04T10:27:32.919152+00:00'
'timelimit': timelimit, # [90, 60]
'utc': msg_body.get('utc', True)
},
}
# discard tasks that are expired if expire metadata comes with the message
cur_time = datetime.utcnow() if task_context['task_properties']['utc'] else datetime.now()
expire_time = datetime.strptime(msg_body.get('expires').replace("Z", "").rsplit('+', 1)[0], '%Y-%m-%dT%H:%M:%S.%f') \
if msg_body.get('expires') else cur_time + timedelta(seconds=10)
check_id = (msg_body['args'][0].get('check_id', 'xx') if len(msg_body['args']) > 0 and isinstance(msg_body['args'][0], dict) else 'XX')
logger.debug('task loop analyzing time: check_id=%s, cur_time: %s , expire_time: %s, msg_body["expires"]=%s', check_id, cur_time, expire_time, msg_body.get('expires'))
if cur_time < expire_time:
with reactor.enter_task_context(taskname, t_hard, t_soft):
known_tasks[taskname](*func_args, task_context=task_context, **func_kwargs)
else:
logger.warn('Discarding task due to time expiration. cur_time: %s , expire_time: %s, msg_body["expires"]=%s ---- msg_body=%s', cur_time, expire_time, msg_body.get('expires'), msg_body)
expired_count += 1
if expired_count % 500 == 0:
logger.warning("expired tasks count: %s", expired_count)
count += 1
except Exception:
logger.exception('Exception in redis loop. Details: ')
time.sleep(5) # avoid heavy log spam here
# some exit condition on failure: maybe when number of consecutive failures > n ?
# TODO: Clean redis connection... very important!!!!
# disconnect_all()
def flow_forked_child(queue='', **kwargs):
"""
Implement forking a work horse process per message as seen in python_rq
"""
#TODO: implement
pass
def flow_forked_childs(queue='', **kwargs):
"""
Implement forking several work horses process per message?
"""
#TODO: implement
pass
def flow_multiprocessing_pool(queue='', **kwargs):
"""
Implement spawning a pool of workers of multiprocessing process
"""
#TODO: implement
pass
class FlowControlReactor(object):
"""
Implements a singleton object with a permanently running action loop, that can communicate with the
parent process (ProcessController) to request certain actions or submit information about the health
of this worker.
Only implemented capability till now is a "Hard Kill" functionality that kicks in when a task is
taking too long to complete. We use a context manager to signal when we enter or leave this mode of operations.
Future capabilities may include periodical reports to the parent process about number of processed tasks,
mean time spent by the N slowest running tasks. Also a soft kill feature.
"""
_initialized = False
_can_init = False
_instance = None
t_wait = 0.2
def __init__(self):
#self.task_agg_info = {} # we could aggregate some info about how tasks are running in this worker
assert not self._initialized and self._can_init, 'Call get_instance() to instantiate'
self._initialized = True
self._pid = os.getpid()
self._rpc_client = get_rpc_client('http://{}:{}{}'.format(settings.RPC_SERVER_CONF['HOST'],
settings.RPC_SERVER_CONF['PORT'],
settings.RPC_SERVER_CONF['RPC_PATH']))
self._current_task_by_thread = {} # {thread_id: (taskname, t_hard, t_soft, tstart)}
self.action_on = False
self._thread = threading.Thread(target=self.action_loop)
self._thread.daemon = True
@classmethod
def get_instance(cls):
if cls._instance is None:
cls._can_init = True
cls._instance = cls()
return cls._instance
@contextmanager
def enter_task_context(self, taskname, t_hard, t_soft):
self.task_received(taskname, t_hard, t_soft)
try:
yield self
except Exception as e:
self.task_ended(exc=e)
raise
else:
self.task_ended()
def action_loop(self):
while self.action_on:
try:
# hard kill logic
for th_name, (taskname, t_hard, t_soft, ts) in self._current_task_by_thread.copy().items():
if time.time() > ts + t_hard:
logger.warn('Hard Kill request started for worker pid=%s, task: %s, t_hard=%d', self._pid,
taskname, t_hard)
self._rpc_client.mark_for_termination(self._pid) # rpc call to parent asking for a kill
self._current_task_by_thread.pop(th_name, {})
except Exception:
logger.exception('Scary Error in FlowControlReactor.action_loop(): ')
time.sleep(self.t_wait)
def start(self):
self.action_on = True
self._thread.start()
def stop(self):
self.action_on = False
def task_received(self, taskname, t_hard, t_soft):
# this sets a timer for this task, there is only one task per thread, and right now only main thread produce
self._current_task_by_thread[threading.currentThread().getName()] = (taskname, t_hard, t_soft, time.time())
def task_ended(self, exc=None):
# delete the task from the list
self._current_task_by_thread.pop(threading.currentThread().getName(), {})
def start_worker_for_queue(flow='simple_queue_processor', queue='zmon:queue:default', **execution_context):
"""
Starting execution point to the workflows
"""
known_flows = {'simple_queue_processor': flow_simple_queue_processor}
if flow not in known_flows:
logger.exception("Bad role: %s" % flow)
sys.exit(1)
logger.info("Starting worker with pid=%s, flow type: %s, queue: %s, execution_context: %s", os.getpid(), flow,
queue, execution_context)
# init the plugin manager
plugin_manager.init_plugin_manager()
# load external plugins (should be run only once)
plugin_manager.collect_plugins(global_config=get_config(), load_builtins=True, load_env=True)
# start Flow Reactor here
FlowControlReactor.get_instance().start()
exit_code = 0
try:
known_flows[flow](queue=queue, **execution_context)
except (KeyboardInterrupt, SystemExit):
logger.warning("Caught user signal to stop consumer: finishing!")
except Exception:
logger.exception("Exception in start_worker(). Details: ")
exit_code = 2
finally:
FlowControlReactor.get_instance().stop()
sys.exit(exit_code) | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/workflow.py | workflow.py |
import os
import cherrypy
import argparse
import settings
import logging
if __name__ == '__main__':
import logging.config
logging.config.dictConfig(settings.RPC_SERVER_CONF['LOGGING'])
logger = logging.getLogger(__name__)
# env vars get droped via zompy startup
os.environ["ORACLE_HOME"] = "/opt/oracle/instantclient_12_1/"
os.environ["LD_LIBRARY_PATH"] = os.environ.get("LD_LIBRARY_PATH", '') + ":/opt/oracle/instantclient_12_1/"
import rpc_server
DEFAULT_NUM_PROC = 16
def parse_args(args):
parser = argparse.ArgumentParser()
parser.add_argument("-c", "--config-file", help="path to config file")
parser.add_argument('--no-rpc', action='store_true', help='Do not start XML-RPC server')
return parser.parse_args(args)
def main(args=None):
# add src dir to sys.path
# src_dir = os.path.abspath(os.path.dirname(__file__))
# if src_dir not in sys.path:
# sys.path.append(src_dir)
args = parse_args(args)
main_proc = rpc_server.MainProcess()
# load cherrypy configuration
if args.config_file and os.path.exists(args.config_file):
cherrypy.config.update(args.config_file)
elif os.path.exists('/app/web.conf'):
cherrypy.config.update('/app/web.conf')
else:
cherrypy.config.update('web.conf')
for key in cherrypy.config.keys():
env_key = key.upper().replace('.', '_')
if env_key in os.environ:
cherrypy.config[key] = os.environ[env_key]
# save cherrypy config in owr settings module
settings.set_workers_log_level(cherrypy.config.get('loglevel', 'INFO'))
settings.set_external_config(cherrypy.config)
settings.set_rpc_server_port('2{}'.format('3500'))
# start the process controller
main_proc.start_proc_control()
# start some processes per queue according to the config
queues = cherrypy.config['zmon.queues']['local']
for qn in queues.split(','):
queue, N = (qn.rsplit('/', 1) + [DEFAULT_NUM_PROC])[:2]
main_proc.proc_control.spawn_many(int(N), kwargs={"queue": queue, "flow": "simple_queue_processor"})
if not args.no_rpc:
main_proc.start_rpc_server()
return main_proc
if __name__ == '__main__':
main() | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/web.py | web.py |
import os
import signal
import time
import copy
import logging
from multiprocessing import Process
from threading import Thread
logger = logging.getLogger(__name__)
class ProcessController(object):
"""
Class to handle a bunch of child processes
what can it do:
0. define a common target function for every process?
1. spawn N processes that execute the target function, store references to objects and its pid
2. spawn more process after some are running
3. terminate some process *(by pid?)
4. spawn a thread loop for checking the health of child processes *(and take some action if some process dies)?
5. dynamically change the policy on how to react to process dies *(use queue for incoming requests?)
"""
action_policies = ('report', 'dynamic_num', 'dynamic_throughput')
proc_stat_element = {'begin_time': -1, 'end_time': -1, 'alive': False, 'rebel': False, 'pid': 0, 'exitcode': 0,
'mem': -1, 'abnormal_termination': False}
def __init__(self, default_target=None, default_args=None, default_kwargs=None, always_add_kwargs=None,
action_policy='report', min_processes=2, max_processes=1000, start_action_loop=True):
self.default_target = default_target
self.default_args = default_args if isinstance(default_args, (tuple, list)) else ()
self.default_kwargs = default_kwargs if isinstance(default_kwargs, dict) else {}
self.always_add_kwargs = always_add_kwargs if isinstance(always_add_kwargs, dict) else {}
self.proc_dict = {} # { proc_name : proc}
self.proc_rebel = {} # { proc_name : proc} -> for processes that refuse to die
self.proc_stats = {} # { proc_name : {'begin_time':T0, 'end_time': T1, 'alive' : bool1, ... } }
self.proc_args = {} # { proc_name : {'target':None, 'args':[...], 'kwargs'={...} }}
self.pid_to_pname = {} # {pid: proc_name}
self.pids_for_termination = [] # [ pid1, pid2, ....]
self.limbo_proc_dict = {} # {proc_name : proc}
self.max_killed_stats = 5000 # max number of dead proc stats to keep around in memory
self.min_processes = min_processes
self.max_processes = max_processes
self.count_stop_condition = 0 # counter of consecutive stop conditions found
self.consecutive_stop_condition = 5 # counter of consecutive stop conditions found
self.gracetime_stop_condition = 60 # number of seconds to wait before a final stop condition check
self._thread_action_loop = None
self.stop_action = True
self.action_loop_interval = 2 # seconds between each actions pass
self.set_action_policy(action_policy)
self.set_dynamic_num_processes(5) # number of process to maintain alive when action_policy == 'dynamic_num'
self._tstamp_clean_old_proc_stats = -1 # timestamp of the last execution of _clean_old_proc_stats()
self._tdelta_clean_old_proc_stats = 300 # frequency of __clean_old_proc_stats()
if start_action_loop:
self.start_action_loop()
def spawn_process(self, target=None, args=None, kwargs=None):
args = args if isinstance(args, (tuple, list)) else ()
kwargs = kwargs if isinstance(kwargs, dict) else {}
if self.max_processes == len(self.proc_dict):
raise Exception("maximum number of processes reached!!!")
target = target or self.default_target
args = args or self.default_args
kwargs = dict(kwargs if kwargs else self.default_kwargs)
kwargs.update(self.always_add_kwargs)
try:
proc = Process(target=target, args=args, kwargs=kwargs)
proc.start()
pname = proc.name
# creating entry in running process table
self.proc_dict[pname] = proc
# mapping pid -> pname
self.pid_to_pname[proc.pid] = pname
# store process arguments to relaunch it if it dies
self.proc_args[pname] = dict(target=target, args=args, kwargs=kwargs)
# creating entry in stats table
self.proc_stats[pname] = dict(self.proc_stat_element)
self.proc_stats[pname]['pid'] = proc.pid
self.proc_stats[pname]['alive'] = proc.is_alive()
self.proc_stats[pname]['begin_time'] = time.time() # use self._format_time() to get datetime format
except Exception:
logger.exception("Spawn of process failed. Caught exception with details: ")
raise
return pname
def spawn_many(self, N, target=None, args=None, kwargs=None):
logger.info('>>>>>>> spawn_many: %d, %s, %s', N, args, kwargs)
args = args if isinstance(args, (tuple, list)) else ()
kwargs = kwargs if isinstance(kwargs, dict) else {}
n_success = 0
for i in range(N):
try:
self.spawn_process(target=target, args=args, kwargs=kwargs)
except Exception:
logger.exception('Failed to start process. Reason: ')
else:
n_success += 1
return n_success == N
def terminate_process(self, proc_name, kill_wait=0.5):
proc = self.proc_dict.get(proc_name)
if not proc:
logger.warn('process: %s not found!!!!!!!!!!!!!!!!!', proc_name)
return False
if proc.is_alive():
logger.warn('terminating process: %s', proc_name)
proc.terminate()
time.sleep(kill_wait)
if proc.is_alive():
logger.warn('Sending SIGKILL to process with pid=%s', proc.pid)
os.kill(proc.pid, signal.SIGKILL)
abnormal_termination = False
else:
logger.warn('process: %s is not alive!!!!!!!!!!!!!!!!!', proc_name)
abnormal_termination = True
# move proc to limbo and record end time in stats
self.proc_dict.pop(proc_name, None)
self.limbo_proc_dict[proc_name] = proc
self._close_proc_stats(proc, abnormal_termination)
return True
def terminate_all_processes(self):
self.stop_action_loop() # very important: stop action loop before starting to terminate child processes
all_pnames = list(self.proc_dict.keys())
for proc_name in all_pnames:
self.terminate_process(proc_name, kill_wait=0.1)
logger.info("proc_stats after terminate_all_processes() : %s", self.list_stats())
return True
def _close_proc_stats(self, proc, abnormal_termination=False):
# Update proc_stats {'proc_name' : {'begin_time':T0, 'end_time': T1, 'alive' : bool1,... } }
pn = proc.name
if proc.is_alive():
self.proc_stats[pn]['alive'] = True
self.proc_stats[pn]['rebel'] = True
else:
self.proc_stats[pn]['abnormal_termination'] = abnormal_termination
self.proc_stats[pn]['end_time'] = time.time()
self.proc_stats[pn]['alive'] = False
self.proc_stats[pn]['exitcode'] = proc.exitcode
def get_info(self, proc_name):
"""
Get all the info I can of this process, for example:
1. How long has it been running? *(Do I need an extra pid table for statistics?)
2. How much memory does it use?
"""
raise NotImplementedError('Method get_info not implemented yet')
def list_running(self):
return [(proc_name, proc.pid) for proc_name, proc in self.proc_dict.items()]
def list_stats(self):
proc_stats = copy.deepcopy(self.proc_stats)
for proc_name, stats in proc_stats.items():
stats['begin_time'] = self._format_time(stats['begin_time'])
stats['end_time'] = self._format_time(stats['end_time'])
return proc_stats
def _format_time(self, seconds):
return time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(seconds)) if seconds else '--'
def get_action_policy(self):
return self.action_policy
def set_action_policy(self, action_policy):
if action_policy not in self.action_policies:
raise Exception('Invalid action policy, possible values are: %s' % ', '.join(self.action_policies))
self.action_policy = action_policy
def available_action_policies(self):
return self.action_policies
def is_action_loop_running(self):
return not self.stop_action
def get_dynamic_num_processes(self):
return self.dynamic_num_processes
def set_dynamic_num_processes(self, dynamic_num_processes):
try:
assert type(dynamic_num_processes) is int and \
self.min_processes <= dynamic_num_processes <= self.max_processes
except AssertionError:
raise Exception('dynamic_num_processes passed is not in correct range')
self.dynamic_num_processes = dynamic_num_processes
def _clean_old_proc_stats(self):
""" Remove old stats from dead processes to avoid high memory usage """
if time.time() - self._tstamp_clean_old_proc_stats > self._tdelta_clean_old_proc_stats:
self._tstamp_clean_old_proc_stats = time.time()
et_pn = sorted([(stats['end_time'], pn) for pn, stats in self.proc_stats.copy().items() if stats['end_time'] > 0])
del_et_pn = et_pn[:len(et_pn)-self.max_killed_stats] if len(et_pn) > self.max_killed_stats else []
for end_time, pn in del_et_pn:
stats = self.proc_stats.pop(pn, None)
logger.warn('Deleting stats of killed process %s to preserve memory: %s', pn, stats)
def _clean_limbo_procs(self):
limbo_dict = dict(self.limbo_proc_dict)
for pname, proc in limbo_dict.items():
if proc.is_alive():
logger.error('Fatal: process in limbo in undead state!!!!!')
else:
self.pid_to_pname.pop(proc.pid, None)
self.proc_args.pop(pname, None)
self.limbo_proc_dict.pop(pname, None)
def mark_for_termination(self, pid):
"""Given pid will be stored in local variable that marks them for termination in the next action pass"""
self.pids_for_termination.append(pid)
def _respawn(self, proc_name):
# terminate process and spawn another process with same arguments
pargs = self.proc_args.get(proc_name, {})
proc = self.proc_dict.get(proc_name)
pid = proc.pid if proc else '???'
was_alive = proc.is_alive() if proc else '???'
self.terminate_process(proc_name, kill_wait=1.0)
proc_name2 = self.spawn_process(**pargs)
proc2 = self.proc_dict.get(proc_name2)
pid2 = proc2.pid if proc2 else '???'
logger.warn('Respawned process: proc_name=%s, pid=%s, was_alive=%s --> proc_name=%s, pid=%s, args=%s', proc_name, pid, was_alive, proc_name2, pid2, pargs)
def _action_loop(self):
"""
A threaded loop that runs every interval seconds to perform autonomous actions
"""
while not self.stop_action:
try:
# action 1: respond to kill requests: terminate marked pid and spawn them again
term_pids = self.pids_for_termination[:]
del self.pids_for_termination[:len(term_pids)]
for pid in term_pids:
pname = self.pid_to_pname.get(pid)
if pname is not None:
if not self.stop_action:
self._respawn(pname)
else:
logger.warn('action_loop found non valid pid: %s', pid)
# action 2: inspect all processes and react to those that died unexpectedly
for pname, proc in self.proc_dict.items():
if not proc.is_alive() and not self.stop_action:
logger.warn('Detected abnormal termination of process pid=%s... attempting restart', proc.pid)
self._respawn(pname)
self._clean_limbo_procs()
self._clean_old_proc_stats()
except Exception:
logger.exception('Error in ProcessController action_loop: ')
if not self.stop_action:
time.sleep(self.action_loop_interval)
def start_action_loop(self, interval=1):
self.stop_action = False
self.action_loop_interval = interval
self._thread_action_loop = Thread(target=self._action_loop)
self._thread_action_loop.daemon = True
self._thread_action_loop.start()
def stop_action_loop(self):
self.stop_action = True | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/process_controller.py | process_controller.py |
import os
import sys
import signal
import settings
import logging
if __name__ == '__main__':
import logging.config
logging.config.dictConfig(settings.RPC_SERVER_CONF['LOGGING'])
logger = logging.getLogger(__name__)
from pprint import pformat
from process_controller import ProcessController
import worker
import rpc_utils
def save_pid(abort_pidfile=False):
pid = os.getpid()
pid_file = os.path.join(settings.data_dir, 'rpc_server.pid')
if abort_pidfile and os.path.isfile(pid_file):
print >>sys.stderr, 'pid file {} already exists. Is another process running? Aborting!'.format(pid_file)
sys.exit(1)
with open(pid_file, 'w') as f:
f.write(str(pid))
def sigterm_handler(signum, frame):
# this will propagate the SystemExit exception all around, so we can quit listening loops, cleanup and exit
sys.exit(0)
class ProcessControllerProxy(rpc_utils.RpcProxy):
"""
A proxy class to expose some methods of multiprocess manager server to listen to remote requests,
possible request are:
1. start N more child processes
2. terminate processes with pid1, pid2, ...
3. report running statistics
4. report status of process with pid1
5. terminate all child processes
6. terminate yourself
"""
exposed_obj_class = ProcessController
valid_methods = ['spawn_many', 'list_running', 'list_stats', 'start_action_loop', 'stop_action_loop',
'is_action_loop_running', 'get_dynamic_num_processes', 'set_dynamic_num_processes',
'get_action_policy', 'set_action_policy', 'available_action_policies', 'terminate_all_processes',
'terminate_process', 'mark_for_termination']
def list_running(self):
return pformat(self.get_exposed_obj().list_running())
def list_stats(self):
return pformat(self.get_exposed_obj().list_stats())
def on_exit(self):
self.get_exposed_obj().terminate_all_processes() # TODO: Think why exit codes are sometimes -15 and others 0
class MainProcess(object):
def __init__(self):
save_pid()
signal.signal(signal.SIGTERM, sigterm_handler)
def start_proc_control(self):
self.proc_control = ProcessController(default_target=worker.start_worker, action_policy='report')
def start_rpc_server(self):
rpc_proxy = ProcessControllerProxy(self.proc_control)
rpc_utils.start_RPC_server(settings.RPC_SERVER_CONF['HOST'],
settings.RPC_SERVER_CONF['PORT'],
settings.RPC_SERVER_CONF['RPC_PATH'],
rpc_proxy)
def main(config=None):
save_pid(abort_pidfile=True)
signal.signal(signal.SIGTERM, sigterm_handler)
proc_control = ProcessController(default_target=worker.start_worker,
action_policy='report', always_add_kwargs={'external_config': config})
rpc_proxy = ProcessControllerProxy(proc_control)
rpc_utils.start_RPC_server(settings.RPC_SERVER_CONF['HOST'],
settings.RPC_SERVER_CONF['PORT'],
settings.RPC_SERVER_CONF['RPC_PATH'],
rpc_proxy)
if __name__ == '__main__':
main() | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/rpc_server.py | rpc_server.py |
import logging
import os
import sys
from yapsy.PluginManager import PluginManagerSingleton
import pkg_resources
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin
logger = logging.getLogger(__name__)
# Some constants to define global behaviour
PLUGIN_INFO_EXT = 'worker_plugin'
PLUGIN_BUILTINS = ('zmon_worker_monitor.builtins.plugins',)
PLUGIN_ENV_VAR = 'ZMON_PLUGINS'
PLUGIN_CATEGORIES_FILTER = {
'Function': IFunctionFactoryPlugin,
}
GLOBAL_CONFIG_PREFIX = 'plugin.{plugin_name}.'
class PluginError(Exception):
pass
class PluginRecoverableError(PluginError):
pass
class PluginFatalError(PluginError):
pass
def _builtins_paths(subpackages, raise_errors=True):
if not subpackages:
return []
folders = []
for subpkg in (subpackages if isinstance(subpackages, (tuple, list)) else [subpackages]):
try:
parts = subpkg.split('.')
path = pkg_resources.resource_filename('.'.join(parts[:-1]), parts[-1])
if not os.path.isdir(path):
raise Exception('path is not a directory: {}'.format(path))
except Exception:
logger.exception('erroneous plugins package: %s. Exception: ', subpkg)
if raise_errors:
_, ev, tb = sys.exc_info()
raise PluginFatalError('Builtins plugins error in {}. Reason: {}'.format(subpkg, ev)), None, tb
else:
folders.append(path)
return folders
def _env_dirs(env_var, raise_errors=True):
env_value = os.environ.get(env_var)
if not env_value:
return []
folders = []
for d in env_value.split(os.pathsep):
if not os.path.isdir(d):
logger.warn('Wrong path %s in env variable %s', d, env_var)
if raise_errors:
raise PluginFatalError('Env plugins error in path: {}, from env_var: {}'.format(d, env_var))
continue
folders.append(d)
return folders
def _filter_additional_dirs(path_list, raise_errors=True):
if not path_list:
return []
folders = []
for path in path_list:
if os.path.isdir(path):
folders.append(path)
elif raise_errors:
raise PluginFatalError('Additional dirs contains erroneous path: {}'.format(path))
return folders
_initialized = {}
def init_plugin_manager(category_filter=None, info_ext=PLUGIN_INFO_EXT, builtins_pkg=PLUGIN_BUILTINS,
env_var=PLUGIN_ENV_VAR):
"""
Initialize the plugin manager and set some behaviour options
:param category_filter:
:param info_ext:
:param builtins_pkg:
:param env_var:
:return:
"""
global _initialized
# default category_filter is PLUGIN_CATEGORIES_FILTER (dict)
category_filter = PLUGIN_CATEGORIES_FILTER if category_filter is None else category_filter
logger.info('init plugin manager')
manager = PluginManagerSingleton.get()
manager.setCategoriesFilter(category_filter)
manager.setPluginInfoExtension(info_ext)
# save parameters used to initialize the module
_initialized = dict(category_filter=category_filter, info_ext=info_ext, builtins_pkg=builtins_pkg, env_var=env_var)
def get_plugin_manager():
"""
Get the plugin manager object (singleton)
"""
return PluginManagerSingleton.get()
_collected = False
def collect_plugins(load_builtins=True, load_env=True, additional_dirs=None, global_config=None, raise_errors=True):
"""
Collect plugins from folders in environment var and additional_dir param.
:param plugin_env_var: environment variable containing a list of paths (shell $PATH style)
:param additional_dirs: additional locations to search plugins in
:return:
"""
global _collected
if not _initialized:
raise PluginFatalError('You must invoke init_plugin_manager() before collect_plugins()!')
if _collected:
raise PluginFatalError('Plugins should be collected only once!')
try:
# load the plugins
global_config = {} if global_config is None else global_config
builtins = _builtins_paths(_initialized.get('builtins_pkg')) if load_builtins else []
paths_env = _env_dirs(_initialized.get('env_var')) if load_env else []
path_list = paths_env + _filter_additional_dirs(additional_dirs)
# not necessary and may cause module name clashes... remove?
# for entry in path_list:
# if entry not in sys.path:
# sys.path.append(entry) # so the plugins can relatively import their submodules
# check plugin dependencies declared in {plugin_dir}/requirements.txt are installed
for path in path_list:
miss_deps = _check_dependencies(path)
if miss_deps:
logger.error('Dependencies missing for plugin %s: %s', path, ','.join(miss_deps))
if raise_errors:
raise PluginFatalError('Dependencies missing for plugin {}: {}'.format(path, ','.join(miss_deps)))
manager = get_plugin_manager()
manager.setPluginPlaces(builtins + path_list)
# explore the provided locations and identify plugin candidates
manager.locatePlugins()
# save list of all plugin candidates: [(info file path, python file path, plugin info instance), ...]
candidates = manager.getPluginCandidates()
logger.debug('Recognized plugin candidates: %s', candidates)
# trigger the loading of all plugin python modules
manager.loadPlugins()
all_plugins = manager.getAllPlugins()
if len(all_plugins) != len(candidates):
plugin_paths = map(_path_source_to_plugin, [p.path for p in all_plugins])
dropped = [c for c in candidates if c[0] not in plugin_paths]
logger.error('These plugin candidates have errors: %s', dropped)
if raise_errors:
raise PluginFatalError('Plugin candidates have errors: {}'.format(dropped))
# configure and activate plugins
for plugin in all_plugins:
config_prefix = GLOBAL_CONFIG_PREFIX.format(plugin_name=plugin.name)
conf_global = {}
try:
conf_global = {str(c)[len(config_prefix):]: v for c, v in global_config.iteritems() if str(c).startswith(config_prefix)}
logger.debug('Plugin %s received global conf keys: %s', plugin.name, conf_global.keys())
except Exception:
logger.exception('Failed to parse global configuration. Reason: ')
if raise_errors:
raise
conf = {}
try:
if plugin.details.has_section('Configuration'):
conf = {c: v for c, v in plugin.details.items('Configuration')} # plugin.plugin_info.detail has the safeconfig object
logger.debug('Plugin %s received local conf keys: %s', plugin.name, conf.keys())
except Exception:
logger.exception('Failed to load local configuration from plugin: %s. Reason: ', plugin.name)
if raise_errors:
raise
# for security reasons our global config take precedence over the local config
conf.update(conf_global)
try:
plugin.plugin_object.configure(conf)
except Exception:
logger.exception('Failed configuration of plugin: %s. Reason: ', plugin.name)
if raise_errors:
raise
plugin.plugin_object.deactivate()
continue
plugin.plugin_object.activate()
_collected = True
except PluginFatalError:
raise
except Exception:
logger.exception('Unexpected error during plugin collection: ')
if raise_errors:
_, ev, tb = sys.exc_info()
raise PluginFatalError("Error while loading plugins. Reason: {}".format(ev)), None, tb
def get_plugins_of_category(category, active=True, raise_errors=True):
"""
Get plugins (plugin_info) of a given category
"""
try:
plugins = get_plugin_manager().getPluginsOfCategory(category)
except KeyError:
if raise_errors:
raise PluginRecoverableError('Category {} not known to the plugin system'.format(category))
return []
if plugins and isinstance(active, bool):
plugins = [p for p in plugins if p.is_activated == active]
return plugins
def get_plugin_objs_of_category(category, active=True, raise_errors=True):
"""
Get plugin objects of a given category
"""
return [p.plugin_object for p in get_plugins_of_category(category, active, raise_errors)]
def get_plugin_by_name(name, category, not_found_is_error=True):
"""
Get a plugin by name and category
"""
plugin = get_plugin_manager().getPluginByName(name, category)
if not plugin and not_found_is_error:
raise PluginRecoverableError('Plugin by name {} not found under category {}'.format(name, category))
return plugin
def get_plugin_obj_by_name(name, category, not_found_is_error=True):
"""
Get a plugin object by name and category
"""
plugin = get_plugin_by_name(name, category, not_found_is_error)
return None if plugin is None else plugin.plugin_object
def get_all_plugins():
"""
Get list of all loaded plugins
"""
return get_plugin_manager().getAllPlugins()
def get_all_plugin_names():
"""
Get list of names of all loaded plugins
"""
plugins = get_all_plugins()
if not plugins:
return []
return [p.name for p in plugins]
def get_all_categories():
"""
Return list of categories provided in the category_filter
"""
manager = get_plugin_manager()
return manager.getCategories()
def get_loaded_plugins_categories():
"""
Return list of categories that have one or more discovered plugins
"""
return list(set([p.category for p in get_all_plugins()]))
def _check_dependencies(path):
req_path = path + os.sep + 'requirements.txt'
if not os.path.isfile(req_path):
logger.debug('%s has no requirements.txt file' % path)
return None
missing_pkg = []
with open(req_path) as f:
for line in f:
stripped = line.strip()
if stripped and not stripped.startswith('#'):
try:
pkg_resources.get_distribution(stripped)
except Exception as _:
missing_pkg.append(stripped)
return missing_pkg
def _path_source_to_plugin(source_path):
source_no_py = source_path[:-3] if source_path.lower().endswith('.py') else source_path
plugin_path = source_no_py + '.' + _initialized['info_ext']
return plugin_path | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/plugin_manager.py | plugin_manager.py |
import tempfile
import subprocess
import os
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
class ExaplusFactory(IFunctionFactoryPlugin):
def __init__(self):
super(ExaplusFactory, self).__init__()
# fields from config
self._exacrm_cluster = None
self._exacrm_user = None
self._exacrm_pass = None
def configure(self, conf):
"""
Called after plugin is loaded to pass the [configuration] section in their plugin info file
:param conf: configuration dictionary
"""
self._exacrm_cluster = conf['exacrm_cluster']
self._exacrm_user = conf['exacrm_user']
self._exacrm_pass = conf['exacrm_pass']
def create(self, factory_ctx):
"""
Automatically called to create the check function's object
:param factory_ctx: (dict) names available for Function instantiation
:return: an object that implements a check function
"""
return propartial(ExaplusWrapper, cluster=self._exacrm_cluster, password=self._exacrm_pass,
user=self._exacrm_user)
class ExaplusWrapper(object):
def __init__(self, cluster, user='ZALANDO_NAGIOS', password='', schema=False):
self._err = None
self._out = None
self.user = user
self.__password = password
self.cluster = cluster
self.schema = schema
self.java_opts = ['-Djava.net.preferIPv4Stack=true', '-Djava.awt.headless=true', '-Xmx512m', '-Xms128m']
self.exaplus_opts = [
'-recoverConnection',
'OFF',
'-retry',
'0',
'-lang',
'EN',
'-q',
'-x',
'-Q',
'10',
'-pipe',
]
self.jar_file = '/server/exasol/exaplus/current/exaplus.jar'
def query(self, query):
fd, name = tempfile.mkstemp(suffix='.sql', text=True)
try:
fh = os.fdopen(fd, 'w')
fh.write('%s\n' % query)
fh.flush()
cmd = ['/usr/bin/java']
cmd.extend(self.java_opts)
cmd.extend(['-jar', self.jar_file])
cmd.extend(['-c', self.cluster])
cmd.extend(['-u', self.user])
cmd.extend(['-p', self.__password])
cmd.extend(self.exaplus_opts)
if self.schema:
cmd.extend(['-s', self.schema])
cmd.extend(['-f', name])
# print "EXAPLUS="+" ".join(cmd)
sub = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
d_out, d_err = sub.communicate()
self._out = d_out
self._err = d_err
finally:
os.unlink(name)
return self
def result(self):
return self._out.split('\n'), self._err.split('\n')
if __name__ == '__main__':
import sys
exaplus = ExaplusWrapper(sys.argv[1], sys.argv[2], sys.argv[3])
print exaplus.query('''select table_name, case when hours_between(systimestamp,last_export_success_time) < 24 then 'EXPORTED YESTERDAY (within 24 HOURS) - OK' else 'NOT EXPORTED within LAST 24 HOURS' end status, last_export_success_time LAST_EXPORT_TIME from STG.TARGET_LOADING_STATUS where table_name not in ('D_SHOP','F_CUSTOMER_SALES','F_PRODUCT_AVAILABILITY','F_UMS_CAMPAIGN_RESPONSE') order by 1 ;'''
).result() | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/exasol.py | exasol.py |
import psycopg2
import re
import sys
from zmon_worker_monitor.zmon_worker.errors import CheckError, InsufficientPermissionsError, DbError
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
from psycopg2.extras import NamedTupleCursor
DEFAULT_PORT = 5432
CONNECTION_RE = \
re.compile(r'''
^(?P<host>[^:/]+) # host - either IP o hostname
(:(?P<port>\d+))? # port - integer, optional
/(?P<dbname>\w+) # database name
$
'''
, re.X)
ABSOLUTE_MAX_RESULTS = 1000000
REQUIRED_GROUP = 'zalandos'
PERMISSIONS_STMT = \
'''
SELECT r.rolcanlogin AS can_login,
ARRAY(SELECT b.rolname
FROM pg_catalog.pg_auth_members m
JOIN pg_catalog.pg_roles b ON (m.roleid = b.oid)
WHERE m.member = r.oid) AS member_of
FROM pg_catalog.pg_roles r
WHERE r.rolname = %s;
'''
NON_SAFE_CHARS = re.compile(r'[^a-zA-Z_0-9-]')
class SqlFactory(IFunctionFactoryPlugin):
def __init__(self):
super(SqlFactory, self).__init__()
# fields from config
self._user = None
self._pass = None
def configure(self, conf):
"""
Called after plugin is loaded to pass the [configuration] section in their plugin info file
:param conf: configuration dictionary
"""
self._user = conf['user']
self._pass = conf['pass']
def create(self, factory_ctx):
"""
Automatically called to create the check function's object
:param factory_ctx: (dict) names available for Function instantiation
:return: an object that implements a check function
"""
return propartial(SqlWrapper,
shards=factory_ctx['shards'],
user=self._user,
password=self._pass,
timeout=factory_ctx['soft_time_limit'] * 1000,
check_id=factory_ctx['check_id'],
created_by=factory_ctx['req_created_by'],
__protected=['created_by', 'check_id'])
def make_safe(s):
'''
>>> make_safe('Bad bad \\' 123')
'Badbad123'
'''
if not s:
return ''
return NON_SAFE_CHARS.sub('', s)
class SqlWrapper(object):
'''Shard-aware SQL adapter
sql().execute('SELECT 1').result()
'''
def __init__(
self,
shards,
user='zmon',
password='',
timeout=60000,
shard=None,
created_by=None,
check_id=None,
):
'''
Parameters
----------
shards: dict
A dict of shard definitions where key is the shard's name and value is the host/database string.
user: str
password: str
timeout: int
Statement timeout in milliseconds.
shard: str
Optional shard name. If provided, the check will be run on only one shard matching given name.
created_by: str
Optional user name. If provided, the check will first make sure that the user has permissions to access the
requested database. It's optional because it's currently supported only in trial run.
check_id: int
The check definition ID in order to set PostgreSQL application name (easier tracking on server side).
'''
if not shards:
raise CheckError('SqlWrapper: No shards defined')
if shard and not shards.get(shard):
raise CheckError('SqlWrapper: Shard {} not found in shards definition'.format(shard))
self._cursors = []
self._stmt = None
permissions = {}
for shard_def in ([shards[shard]] if shard else shards.values()):
m = CONNECTION_RE.match(shard_def)
if not m:
raise CheckError('Invalid shard connection: {}'.format(shard_def))
connection_str = \
"host='{host}' port='{port}' dbname='{dbname}' user='{user}' password='{password}' connect_timeout=5 options='-c statement_timeout={timeout}' application_name='ZMON Check {check_id} (created by {created_by})' ".format(
host=m.group('host'),
port=int(m.group('port') or DEFAULT_PORT),
dbname=m.group('dbname'),
user=user,
password=password,
timeout=timeout,
check_id=check_id,
created_by=make_safe(created_by),
)
try:
conn = psycopg2.connect(connection_str)
conn.set_session(readonly=True, autocommit=True)
cursor = conn.cursor(cursor_factory=NamedTupleCursor)
self._cursors.append(cursor)
except Exception, e:
raise DbError(str(e), operation='Connect to {}'.format(shard_def)), None, sys.exc_info()[2]
try:
if created_by:
cursor.execute(PERMISSIONS_STMT, [created_by])
row = cursor.fetchone()
permissions[shard_def] = (row.can_login and REQUIRED_GROUP in row.member_of if row else False)
except Exception, e:
raise DbError(str(e), operation='Permission query'), None, sys.exc_info()[2]
for resource, permitted in permissions.iteritems():
if not permitted:
raise InsufficientPermissionsError(created_by, resource)
def execute(self, stmt):
self._stmt = stmt
return self
def result(self, agg=sum):
'''return single row result, will result primitive value if only one column is selected'''
result = {}
try:
for cur in self._cursors:
try:
cur.execute(self._stmt)
row = cur.fetchone()
if row:
for k, v in row._asdict().items():
result[k] = result.get(k, [])
result[k].append(v)
finally:
cur.close()
except Exception, e:
raise DbError(str(e), operation=self._stmt), None, sys.exc_info()[2]
for k, v in result.items():
try:
result[k] = agg(v)
except:
# just use list if aggregation function fails
# (e.g. if we try to sum strings)
result[k] = v
if len(result) == 1:
return result.values()[0]
else:
return result
def results(self, max_results=100, raise_if_limit_exceeded=True):
'''return many rows'''
results = []
max_results = min(max_results, ABSOLUTE_MAX_RESULTS)
try:
for cur in self._cursors:
try:
cur.execute(self._stmt)
if raise_if_limit_exceeded:
rows = cur.fetchmany(max_results + 1)
if len(rows) > max_results:
raise DbError('Too many results, result set was limited to {}. Try setting max_results to a higher value.'.format(max_results),
operation=self._stmt)
else:
rows = cur.fetchmany(max_results)
for row in rows:
results.append(row._asdict())
finally:
cur.close()
except Exception, e:
raise DbError(str(e), operation=self._stmt), None, sys.exc_info()[2]
return results
if __name__ == '__main__':
if len(sys.argv) == 4:
check = SqlWrapper([sys.argv[1] + '/' + sys.argv[2]])
print check.execute(sys.argv[3]).result()
elif len(sys.argv) > 1:
print 'sql.py <host> <dbname> <stmt>' | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/sql_postgresql.py | sql_postgresql.py |
import logging
from zmon_worker_monitor.zmon_worker.errors import CheckError
from functools import partial
from suds.client import Client
from zmon_worker_monitor.zmon_worker.common.time_ import parse_timedelta
from timeperiod import in_period, InvalidFormat
from zmon_worker_monitor.zmon_worker.common.utils import async_memory_cache
import sys
import json
import redis
import time
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
logger = logging.getLogger(__name__)
CHECK_REFRESH_TIME = 240
ALERT_REFRESH_TIME = 120
class ZmonFactory(IFunctionFactoryPlugin):
def __init__(self):
super(ZmonFactory, self).__init__()
def configure(self, conf):
"""
Called after plugin is loaded to pass the [configuration] section in their plugin info file
:param conf: configuration dictionary
"""
return
def create(self, factory_ctx):
"""
Automatically called to create the check function's object
:param factory_ctx: (dict) names available for Function instantiation
:return: an object that implements a check function
"""
return propartial(ZmonWrapper, factory_ctx['zmon_url'], factory_ctx['redis_host'], factory_ctx['redis_port'])
class ZmonWrapper(object):
ZMON_ALERTS_ENTITIES_PATTERN = 'zmon:alerts:*:entities'
def __init__(self, wsdl, host, port):
# TODO: ZMON Controller no longer provides a SOAP endpoint
try:
self.__ws_client = Client(url=wsdl)
self.__ws_client.set_options(cache=None)
except Exception:
raise CheckError('ZmonWrapper Error: failed to connect to zmon-controller')
self.__redis = redis.StrictRedis(host, port)
self.__checks = {}
self.__alerts = []
self.logger = logger
self.__checks = self.__load_check_definitions()
self.__alerts = self.__load_alert_definitions()
@async_memory_cache.cache_on_arguments(namespace='zmon-worker', expiration_time=ALERT_REFRESH_TIME)
def __load_alert_definitions(self):
try:
response = self.__ws_client.service.getAllActiveAlertDefinitions()
except Exception:
self.logger.exception('ZmonWrapper Error: failed to load alert definitions')
raise CheckError('ZmonWrapper Error: failed to load alert definitions'), None, sys.exc_info()[2]
else:
return [{
'id': a.id,
'team': a.team,
'responsible_team': a.responsibleTeam,
'check_id': a.checkDefinitionId,
'period': (a.period or '' if hasattr(a, 'period') else ''),
} for a in response[1]]
@async_memory_cache.cache_on_arguments(namespace='zmon-worker', expiration_time=CHECK_REFRESH_TIME)
def __load_check_definitions(self):
try:
response = self.__ws_client.service.getAllActiveCheckDefinitions()
except Exception:
self.logger.exception('ZmonWrapper Error: failed to load check definitions')
raise CheckError('ZmonWrapper Error: failed to load check definitions'), None, sys.exc_info()[2]
else:
return dict((c.id, {'interval': c.interval}) for c in response[1])
@staticmethod
def _is_entity_alert_stale(last_run, period):
'''
Checks whether check's last run is within given period.
>>> ZmonWrapper._is_entity_alert_stale(None, 60)
False
>>> ZmonWrapper._is_entity_alert_stale(time.time(), 10)
False
>>> ZmonWrapper._is_entity_alert_stale(time.time() - 20, 10)
True
'''
return (False if last_run is None else time.time() - last_run > period)
def __is_alert_stale(self, alert, evaluated_alerts, check_results, multiplier, offset):
a_id = alert['id'] # alert id
c_id = alert['check_id'] # check id
r_id = partial('{}:{}'.format, c_id) # helper function used in iterator to generate result id
try:
is_in_period = in_period(alert.get('period', ''))
except InvalidFormat:
self.logger.warn('Alert with id %s has malformed time period.', a_id)
is_in_period = True
if is_in_period:
return a_id not in evaluated_alerts or any(self._is_entity_alert_stale(check_results.get(r_id(entity)),
multiplier * self.__checks[c_id]['interval'] + offset)
for entity in evaluated_alerts[a_id])
else:
return False
def stale_active_alerts(self, multiplier=2, offset='5m'):
'''
Returns a list of alerts that weren't executed in a given period of time. The period is calculated using
multiplier and offset: check's interval * multiplier + offset.
Parameters
----------
multiplier: int
Multiplier for check's interval.
offset: str
Time offset, for details see parse_timedelta function in zmon-worker/src/function/time_.py.
Returns
-------
list
A list of stale active alerts.
'''
alert_entities = self.__redis.keys(self.ZMON_ALERTS_ENTITIES_PATTERN)
# Load evaluated alerts and their entities from redis.
p = self.__redis.pipeline()
for key in alert_entities:
p.hkeys(key)
entities = p.execute()
evaluated_alerts = dict((int(key.split(':')[2]), entities[i]) for (i, key) in enumerate(alert_entities))
# Load check results for previously loaded alerts and entities.
check_ids = []
for alert in self.__alerts:
if alert['id'] in evaluated_alerts:
for entity in evaluated_alerts[alert['id']]:
p.lindex('zmon:checks:{}:{}'.format(alert['check_id'], entity), 0)
check_ids.append('{}:{}'.format(alert['check_id'], entity))
results = p.execute()
check_results = dict((check_id, json.loads(results[i])['ts']) for (i, check_id) in enumerate(check_ids)
if results[i])
return [{'id': alert['id'], 'team': alert['team'], 'responsible_team': alert['responsible_team']} for alert in
self.__alerts if self.__is_alert_stale(alert, evaluated_alerts, check_results, multiplier,
parse_timedelta(offset).total_seconds())]
def check_entities_total(self):
'''
Returns total number of checked entities.
'''
alert_entities = self.__redis.keys(self.ZMON_ALERTS_ENTITIES_PATTERN)
p = self.__redis.pipeline()
for key in alert_entities:
p.hkeys(key)
entities = p.execute()
return sum(len(e) for e in entities) | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/zmon_.py | zmon_.py |
try:
from cmdb.client import Client as cmdb_client
except:
cmdb_client = None
from dogpile.cache import make_region
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
import json
import redis
import time
HOSTS_CACHE_EXPIRATION_TIME = 600 # 10 minutes
memory_cache = make_region().configure('dogpile.cache.memory', expiration_time=HOSTS_CACHE_EXPIRATION_TIME)
class JoblocksFactory(IFunctionFactoryPlugin):
def __init__(self):
super(JoblocksFactory, self).__init__()
# fields from configuration
self.cmdb_url = None
def configure(self, conf):
"""
Called after plugin is loaded to pass the [configuration] section in their plugin info file
:param conf: configuration dictionary
"""
self.cmdb_url = conf['cmdb_url']
def create(self, factory_ctx):
"""
Automatically called to create the check function's object
:param factory_ctx: (dict) names available for Function instantiation
:return: an object that implements a check function
"""
return propartial(JoblocksWrapper, cmdb_url=self.cmdb_url, project=factory_ctx['entity'].get('name'))
class JoblocksWrapper(object):
LOCKING_NODE_ROLE_ID = 118
ALLOCATED_STATUS_ID = 6000
DEFAULT_EXPECTED_DURATION = 60000 # [ms]
def __init__(self, cmdb_url, project=None, environment='LIVE'):
if cmdb_client:
self._cmdb = cmdb_client(cmdb_url)
self.pattern = 'job:lock:{}:{}:*'.format(project or '*', environment)
@memory_cache.cache_on_arguments(namespace='zmon-worker')
def _get_hosts(self, host_role_id, lifecycle_status_id):
return self._cmdb.get_hosts(host_role_id=host_role_id, lifecycle_status_id=lifecycle_status_id)
@staticmethod
def _get_expected_duration(redis_value, check_param):
'''
>>> JoblocksWrapper._get_expected_duration({}, None)
60000.0
>>> JoblocksWrapper._get_expected_duration({}, 10000)
10000.0
>>> JoblocksWrapper._get_expected_duration({'expectedMaximumDuration': 120000}, None)
120000.0
>>> JoblocksWrapper._get_expected_duration({'expectedMaximumDuration': 60000}, 90000)
90000.0
'''
return float((check_param if check_param else redis_value.get('expectedMaximumDuration',
JoblocksWrapper.DEFAULT_EXPECTED_DURATION)))
def results(self, expected_duration=None):
hosts = self._get_hosts(JoblocksWrapper.LOCKING_NODE_ROLE_ID, JoblocksWrapper.ALLOCATED_STATUS_ID)
host_connections = dict((host.hostname, redis.StrictRedis(host=host.hostname)) for host in hosts)
host_keys = dict((host, con.keys(self.pattern)) for (host, con) in host_connections.iteritems())
str_results = []
for host, keys in host_keys.iteritems():
p = host_connections[host].pipeline()
for key in keys:
p.get(key)
str_results.extend(p.execute())
results = []
for r in str_results:
try:
results.append(json.loads(r))
except ValueError:
pass
# In case flowId is None, we want to return empty string instead.
return dict((r['lockingComponent'], {
'host': r['host'],
'instance': r['instanceCode'],
'created': r['created'],
'expected_duration': JoblocksWrapper._get_expected_duration(r, expected_duration),
'flow_id': r.get('flowId') or '',
'expired': time.time() - time.mktime(time.strptime(r['created'], '%Y-%m-%dT%H:%M:%S'))
> JoblocksWrapper._get_expected_duration(r, expected_duration) / 1000,
}) for r in results)
if __name__ == '__main__':
import sys
if len(sys.argv) != 2:
print "usage: {} <cmdb_url>".format(sys.argv[0])
sys.exit(1)
res = JoblocksWrapper(cmdb_url=sys.argv[1], environment='LIVE').results(expected_duration=60000)
print res | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/joblocks.py | joblocks.py |
import json
import sys
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
from zmon_worker_monitor import plugin_manager
MILLI = 10 ** -3
NANO = 10 ** -9
THREAD_POOL_PORT_PREFIXES = {'http': 3, 'ajp': 2}
class ZomcatFactory(IFunctionFactoryPlugin):
def __init__(self):
super(ZomcatFactory, self).__init__()
# fields to store dependencies: plugin depends on 3 other plugins
self.http_factory = None
self.jmx_factory = None
self.counter_factory = None
def configure(self, conf):
"""
Called after plugin is loaded to pass the [configuration] section in their plugin info file
:param conf: configuration dictionary
"""
return
def create(self, factory_ctx):
"""
Automatically called to create the check function's object
:param factory_ctx: (dict) names available for Function instantiation
:return: an object that implements a check function
"""
# load plugins dependencies and store them locally for efficiency
if not self.http_factory:
self.http_factory = plugin_manager.get_plugin_obj_by_name('http', 'Function')
if not self.jmx_factory:
self.jmx_factory = plugin_manager.get_plugin_obj_by_name('jmx', 'Function')
if not self.counter_factory:
self.counter_factory = plugin_manager.get_plugin_obj_by_name('counter', 'Function')
return propartial(ZomcatWrapper,
host=factory_ctx['host'],
instance=factory_ctx['instance'],
http=self.http_factory.create(factory_ctx),
jmx=self.jmx_factory.create(factory_ctx),
counter=self.counter_factory.create(factory_ctx))
def memory_usage_percentage(data):
'''helper function to calculate percentage from "used" and "max"'''
return round(100. * data['used'] / data['max'], 2)
class ZomcatWrapper(object):
def __init__(self, host, instance, http, jmx, counter):
'''expects ready to use "partials" for http, jmx and counter'''
self.host = host
self.instance = instance
self._http = http
self._jmx = jmx
# initialize counter with Redis connection
self._counter = counter('')
@staticmethod
def get_jmx_port(instance):
return int('4' + instance)
def gc(self):
'''return garbage collector statistics: gc_percentage and gcs_per_sec'''
gc_count = 0
gc_time = 0
for _type in 'ConcurrentMarkSweep', 'ParNew':
try:
row = self._jmx().query('java.lang:type=GarbageCollector,name={}'.format(_type), 'CollectionCount',
'CollectionTime').results()
gc_count += row['CollectionCount']
gc_time += row['CollectionTime']
except:
pass
gc_count = round(self._counter.key('gcCount').per_second(gc_count), 2)
gc_time = self._counter.key('gcTime').per_second(gc_time * MILLI)
return {'gc_percentage': round(gc_time * 100, 2), 'gcs_per_sec': gc_count}
def requests(self):
'''return Tomcat request statistics such as requests/s and errors/s'''
request_count = 0
request_time = 0
http_errors = 0
for _type, _port_prefix in THREAD_POOL_PORT_PREFIXES.items():
try:
row = self._jmx().query('Catalina:type=GlobalRequestProcessor,name="{}-apr-{}{}"'.format(_type,
_port_prefix, self.instance), 'requestCount', 'processingTime', 'errorCount'
).results()
request_count += row['requestCount']
request_time += row['processingTime']
http_errors += row['errorCount']
except:
pass
requests = round(self._counter.key('requestCount').per_second(request_count), 2)
http_errors = round(self._counter.key('errorCount').per_second(http_errors), 2)
time_per_request = round(self._counter.key('requestTime').per_second(request_time) / max(requests, 1), 2)
return {'http_errors_per_sec': http_errors, 'requests_per_sec': requests, 'time_per_request': time_per_request}
def basic_stats(self):
'''return basic statistics such as memory, CPU and thread usage'''
jmx = self._jmx()
# {"NonHeapMemoryUsage":{"max":184549376,"init":24313856,"used":54467720,"committed":85266432},
# "HeapMemoryUsage":{"max":518979584,"init":134217728,"used":59485272,"committed":129761280}}
jmx.query('java.lang:type=Memory', 'HeapMemoryUsage', 'NonHeapMemoryUsage')
jmx.query('java.lang:type=Threading', 'ThreadCount')
jmx.query('java.lang:type=OperatingSystem', 'ProcessCpuTime')
data = jmx.results()
memory = data['java.lang:type=Memory']
threading = data['java.lang:type=Threading']
os = data['java.lang:type=OperatingSystem']
cpu = self._counter.key('cpuTime').per_second(os['ProcessCpuTime'] * NANO)
threads = threading['ThreadCount']
try:
heartbeat = self._http('/heartbeat.jsp', timeout=3).text().strip() == 'OK: Zalando JVM is running'
except:
heartbeat = None
try:
jobs = self._http('/jobs.monitor?view=json', timeout=3).json()['operationMode'] == 'NORMAL'
except:
jobs = None
return {
'cpu_percentage': round(cpu * 100, 2),
'heap_memory_percentage': memory_usage_percentage(memory['HeapMemoryUsage']),
'heartbeat_enabled': heartbeat,
'jobs_enabled': jobs,
'nonheap_memory_percentage': memory_usage_percentage(memory['NonHeapMemoryUsage']),
'threads': threads,
}
def health(self):
'''return complete Zomcat health statistics including memory, threads, CPU, requests and GC'''
data = {}
data.update(self.basic_stats())
data.update(self.gc())
data.update(self.requests())
return data
if __name__ == '__main__':
# init plugin manager and collect plugins, as done by Zmon when worker is starting
plugin_manager.init_plugin_manager()
plugin_manager.collect_plugins(load_builtins=True, load_env=True)
host = sys.argv[1]
instance = sys.argv[2]
factory_ctx = {
'base_url': 'http://{host}:3{instance}/'.format(host=host, instance=instance),
'host': host,
'port': ZomcatWrapper.get_jmx_port(instance),
'instance': instance,
'redis_host': 'localhost',
}
# http = partial(HttpWrapper, base_url='http://{host}:3{instance}/'.format(host=host, instance=instance))
http = plugin_manager.get_plugin_obj_by_name('http', 'Function').create(factory_ctx)
# jmx = partial(JmxWrapper, host=host, port=ZomcatWrapper.get_jmx_port(instance))
jmx = plugin_manager.get_plugin_obj_by_name('jmx', 'Function').create(factory_ctx)
# counter = partial(CounterWrapper, redis_host='localhost')
counter = plugin_manager.get_plugin_obj_by_name('counter', 'Function').create(factory_ctx)
zomcat = ZomcatWrapper(host, instance, http=http, jmx=jmx, counter=counter)
print json.dumps(zomcat.health(), indent=4, sort_keys=True) | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/zomcat.py | zomcat.py |
from zmon_worker_monitor.zmon_worker.errors import CheckError
#from http import HttpWrapper # FIXME: watch out for this!!!
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
from zmon_worker_monitor import plugin_manager
class EventlogFactory(IFunctionFactoryPlugin):
def __init__(self):
super(EventlogFactory, self).__init__()
# fields from configuration
self.eventlog_url = None
# fields from dependencies: plugin depends 1 other plugin
self.http_factory = None
def configure(self, conf):
"""
Called after plugin is loaded to pass the [configuration] section in their plugin info file
:param conf: configuration dictionary
"""
self.eventlog_url = conf['eventlog_url']
def create(self, factory_ctx):
"""
Automatically called to create the check function's object
:param factory_ctx: (dict) names available for Function instantiation
:return: an object that implements a check function
"""
# load plugins dependencies and store them locally for efficiency
if not self.http_factory:
self.http_factory = plugin_manager.get_plugin_obj_by_name('http', 'Function')
return propartial(EventLogWrapper,
http_wrapper=self.http_factory.create(factory_ctx),
url=self.eventlog_url)
class EventLogWrapper(object):
'''Convenience wrapper to access EventLog counts'''
def __init__(self, http_wrapper, url):
self.__http = http_wrapper
self.url = url.rstrip('/') + '/'
def __request(self, path, params):
return self.__http(self.url + path, params=params).json()
def count(self, event_type_ids, time_from, time_to=None, group_by=None, **kwargs):
'''Return number of events for given type IDs in given time frame
returns a single number (integer) if only one type ID is given
returns a dict (typeId as hex=>count) if more than one type ID is given
returns a dict (fieldValue => count) if one type ID is given and a field name with "group_by"
>>> EventLogWrapper(object, 'https://eventlog.example.com/').count('a', time_from='-1h')
Traceback (most recent call last):
...
CheckError: EventLog type ID must be a integer
>>> EventLogWrapper(object, 'https://eventlog.example.com/').count(123, time_from='-1h')
Traceback (most recent call last):
...
CheckError: EventLog type ID is out of range
'''
if isinstance(event_type_ids, (int, long)):
event_type_ids = [event_type_ids]
for type_id in event_type_ids:
if not isinstance(type_id, (int, long)):
raise CheckError('EventLog type ID must be a integer')
if type_id < 0x1001 or type_id > 0xfffff:
raise CheckError('EventLog type ID is out of range')
params = kwargs
params['event_type_ids'] = ','.join(['{:x}'.format(v) for v in event_type_ids])
params['time_from'] = time_from
params['time_to'] = time_to
params['group_by'] = group_by
result = self.__request('count', params)
if len(event_type_ids) == 1 and not group_by:
return result.get(params['event_type_ids'], 0)
else:
return result
if __name__ == '__main__':
import sys
import logging
logging.basicConfig(level=logging.DEBUG)
# init plugin manager and collect plugins, as done by Zmon when worker is starting
plugin_manager.init_plugin_manager()
plugin_manager.collect_plugins(load_builtins=True, load_env=True)
eventlog_url = sys.argv[1]
factory_ctx = {}
http = plugin_manager.get_plugin_obj_by_name('http', 'Function').create(factory_ctx)
#eventlog = EventLogWrapper()
eventlog = EventLogWrapper(http_wrapper=http, url=eventlog_url)
print eventlog.count(0x96001, time_from='-1m')
print eventlog.count([0x96001, 0x63005], time_from='-1m')
print eventlog.count(0x96001, time_from='-1m', group_by='appDomainId') | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/eventlog.py | eventlog.py |
import logging
import requests
import sys
import urllib
import urlparse
import json
from prometheus_client.parser import text_string_to_metric_families
from collections import defaultdict
from zmon_worker_monitor.zmon_worker.errors import HttpError
from requests.adapters import HTTPAdapter
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
import tokens
# will use OAUTH2_ACCESS_TOKEN_URL environment variable by default
# will try to read application credentials from CREDENTIALS_DIR
tokens.configure()
tokens.manage('uid', ['uid'])
tokens.start()
logger = logging.getLogger('zmon-worker.http-function')
class HttpFactory(IFunctionFactoryPlugin):
def __init__(self):
super(HttpFactory, self).__init__()
def configure(self, conf):
"""
Called after plugin is loaded to pass the [configuration] section in their plugin info file
:param conf: configuration dictionary
"""
return
def create(self, factory_ctx):
"""
Automatically called to create the check function's object
:param factory_ctx: (dict) names available for Function instantiation
:return: an object that implements a check function
"""
return propartial(HttpWrapper, base_url=factory_ctx.get('entity_url'))
def absolute_http_url(url):
'''
>>> absolute_http_url('')
False
>>> absolute_http_url('bla:8080/blub')
False
>>> absolute_http_url('https://www.zalando.de')
True
'''
return url.startswith('http://') or url.startswith('https://')
class HttpWrapper(object):
def __init__(
self,
url,
params=None,
base_url=None,
timeout=10,
max_retries=0,
verify=True,
oauth2=False,
headers=None,
):
self.url = (base_url + url if not absolute_http_url(url) else url)
self.clean_url = None
self.params = params
self.timeout = timeout
self.max_retries = max_retries
self.verify = verify
self.headers = headers or {}
self.oauth2 = oauth2
self.__r = None
def __request(self, raise_error=True, post_data = None):
if self.__r is not None:
return self.__r
if self.max_retries:
s = requests.Session()
s.mount('', HTTPAdapter(max_retries=self.max_retries))
else:
s = requests
base_url = self.url
basic_auth = None
url_parsed = urlparse.urlsplit(base_url)
if url_parsed and url_parsed.username and url_parsed.password:
base_url = base_url.replace("{0}:{1}@".format(urllib.quote(url_parsed.username), urllib.quote(url_parsed.password)), "")
base_url = base_url.replace("{0}:{1}@".format(url_parsed.username, url_parsed.password), "")
basic_auth = requests.auth.HTTPBasicAuth(url_parsed.username, url_parsed.password)
self.clean_url = base_url
if self.oauth2:
self.headers.update({'Authorization':'Bearer {}'.format(tokens.get('uid'))})
try:
if post_data is None:
self.__r = s.get(base_url, params=self.params, timeout=self.timeout, verify=self.verify,
headers=self.headers, auth = basic_auth)
else:
self.__r = s.post(base_url, params=self.params, timeout=self.timeout, verify=self.verify,
headers=self.headers, auth = basic_auth, data=json.dumps(post_data))
except requests.Timeout, e:
raise HttpError('timeout', self.clean_url), None, sys.exc_info()[2]
except requests.ConnectionError, e:
raise HttpError('connection failed', self.clean_url), None, sys.exc_info()[2]
except Exception, e:
raise HttpError(str(e), self.clean_url), None, sys.exc_info()[2]
if raise_error:
try:
self.__r.raise_for_status()
except requests.HTTPError, e:
raise HttpError(str(e), self.clean_url), None, sys.exc_info()[2]
return self.__r
def json(self, raise_error=True):
r = self.__request(raise_error=raise_error)
try:
return r.json()
except Exception, e:
raise HttpError(str(e), self.url), None, sys.exc_info()[2]
def jolokia(self, read_requests, raise_error=True):
def set_read_type(x):
x['type'] = 'READ'
# hack quick verify
if (not self.url.endswith('jolokia/')) or ('?' in self.url) or ('&' in self.url):
raise HttpError("URL needs to end in jolokia/ and not contain ? and &", self.url)
map(set_read_type, read_requests)
r = self.__request(post_data=read_requests, raise_error=raise_error)
try:
return r.json()
except Exception, e:
raise HttpError(str(e), self.url), None, sys.exc_info()[2]
def actuator_metrics(self, prefix = 'zmon.response.', raise_error = True):
"""
/metric responds with keys like: zmon.response.<status>.<method>.<end-point>
Response map is ep->method->status->metric
"""
j = self.json(raise_error=raise_error)
r={}
# for clojure projects we use the dropwizard servlet, there the json looks slightly different
if "timers" in j:
metric_map = {'p99':'99th','p75':'75th','mean':'median','m1_rate':'mRate','99%':'99th','75%':'75th','1m.rate':'mRate'}
j = j["timers"]
j["zmon.response.200.GET.metrics"]={"mRate": 0.12345}
start_index = len(prefix.split('.')) - 1
for (k,v) in j.iteritems():
if k.startswith(prefix):
ks = k.split('.')
ks = ks[start_index:]
status = ks[0]
method = ks[1]
ep = '.'.join(ks[2:])
if not ep in r:
r[ep]={}
if not method in r[ep]:
r[ep][method]={}
if not status in r[ep][method]:
r[ep][method][status]={}
for (mn, mv) in v.iteritems():
if mn in ['count','p99','p75','m1_rate','min','max','mean','75%','99%','1m.rate','median']:
if mn in metric_map:
mn = metric_map[mn]
r[ep][method][status][mn]=mv
return r
j["zmon.response.200.GET.metrics.oneMinuteRate"]=0.12345
for (k,v) in j.iteritems():
if k.startswith(prefix):
ks = k.split('.')
if ks[-2]=='snapshot':
ep = '.'.join(ks[4:-2])
else:
ep = '.'.join(ks[4:-1])
if not ep in r:
r[ep] = {}
# zmon.response. 200 . GET . EP .
if ks[3] not in r[ep]:
r[ep][ks[3]] = {}
if ks[2] not in r[ep][ks[3]]:
r[ep][ks[3]][ks[2]] = {}
if not (ks[-2] == 'snapshot'):
if ks[-1] == 'count':
r[ep][ks[3]][ks[2]]['count']=v
if ks[-1] == 'oneMinuteRate':
r[ep][ks[3]][ks[2]]['mRate']=v
else:
if ks[-1] in ['75thPercentile','99thPercentile','min','max','median']:
r[ep][ks[3]][ks[2]][ks[-1].replace("Percentile", "")] = v
return r
def text(self, raise_error=True):
r = self.__request(raise_error=raise_error)
return r.text
def prometheus(self):
t = self.__request().text
samples_by_name = defaultdict(list)
for l in text_string_to_metric_families(t):
for s in l.samples:
samples_by_name[s[0]].append((s[1],s[2]))
return samples_by_name
def headers(self, raise_error=True):
return self.__request(raise_error=raise_error).headers
def cookies(self, raise_error=True):
return self.__request(raise_error=raise_error).cookies
def content_size(self, raise_error=True):
return len(self.__request(raise_error=raise_error).content)
def time(self, raise_error=True):
return self.__request(raise_error=raise_error).elapsed.total_seconds()
def code(self):
return self.__request(raise_error=False).status_code
if __name__ == '__main__':
http = HttpWrapper(sys.argv[1], max_retries=3)
print http.text() | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/http.py | http.py |
import sys
import ldap
try:
import ldapapi
except:
ldapapi = None
import logging
import time
from zmon_worker_monitor.zmon_worker.errors import CheckError
from ldap.dn import explode_dn
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
from zmon_worker_monitor import plugin_manager
STATISTICS_OPERATIONS_TO_MONITOR = frozenset([
'bind',
'unbind',
'search',
'modify',
'add',
'delete',
'extended',
])
STATISTICS_GAUGE_KEYS = frozenset([
'threads_active',
'threads_max',
'connections_current',
'statistics_entries',
'waiters_read',
'waiters_write',
'connections_max_file_descriptors',
])
# rename some keys to make the names more friendly
STATISTICS_FRIENDLY_KEY_NAMES = {'statistics_entries': 'entries',
'connections_max_file_descriptors': 'max_file_descriptors'}
class LdapFactory(IFunctionFactoryPlugin):
def __init__(self):
super(LdapFactory, self).__init__()
# fields from config
self._ldapuser = None
self._ldappass = None
# fields to store dependencies: plugin depends on 1 other plugins
self.counter_factory = None
def configure(self, conf):
"""
Called after plugin is loaded to pass the [configuration] section in their plugin info file
:param conf: configuration dictionary
"""
self._ldapuser = conf['user']
self._ldappass = conf['pass']
def create(self, factory_ctx):
"""
Automatically called to create the check function's object
:param factory_ctx: (dict) names available for Function instantiation
:return: an object that implements a check function
"""
if not self.counter_factory:
self.counter_factory = plugin_manager.get_plugin_obj_by_name('counter', 'Function')
return propartial(LdapWrapper, user=self._ldapuser, password=self._ldappass, host=factory_ctx['host'],
counter=self.counter_factory.create(factory_ctx))
class UnsupportedMethodException(Exception):
pass
class DuplicateBindException(Exception):
pass
class LdapWrapper(object):
def __init__(
self,
host=None,
tls=True,
krb5=False,
user='uid=nagios,ou=robots,ou=users,dc=example,dc=com',
password='',
timeout=60,
logger=None,
counter=None,
):
'''expects ready to use "partial" for counter (CounterWrapper)'''
self.logger = logger or logging.getLogger()
self._counter = counter('')
self.use_tls = tls
self.use_krb5 = krb5
self.user_base_dn = ','.join(explode_dn(user)[1:])
self.user_filter = '(' + explode_dn(user)[0] + ')'
self.user_attrib = ['dn']
# password auth
self.bind_dn = user
self.__password = password
self.session = None
self.host = host
if self.host and len(self.host.split('.')) <= 1:
# FIXME
self.host += '.zalando'
def _connect(self, ldapserver):
if self.session:
raise CheckError('LDAP Error: duplicate bind exception.')
self.logger.debug('connect to %s', ldapserver)
uri = ldapserver
if not uri.startswith("ldap://") and not uri.startswith("ldaps://"):
uri = 'ldap://{0}'.format(ldapserver)
try:
if self.use_krb5 and self.use_tls:
self.logger.debug('sasl bind')
self.session = ldapapi.Session(uri, tls=True)
elif self.use_tls:
self.logger.debug('simple bind')
self.session = ldapapi.Session(uri, self.bind_dn, self.__password, tls=True)
elif uri.startswith("ldaps://"):
self.logger.debug('LDAPS + simple bind')
self.session = ldapapi.Session(uri, self.bind_dn, self.__password, tls=False)
else:
raise CheckError('LDAP Error: unsupported method exception.')
except CheckError:
raise
except Exception, e:
raise CheckError('Error connecting to LDAP: {}'.format(e)), None, sys.exc_info()[2]
def _search(self, base, fltr, attrs, scope=ldap.SCOPE_SUBTREE):
return self.session.search(base, fltr, attrs, scope)
def _disconnect(self):
self.logger.debug('disconnect')
try:
self.session.disconnect()
except Exception, e:
raise CheckError('Error disconnecting to LDAP: {}'.format(e)), None, sys.exc_info()[2]
self.session = None
def _sync_state(self, ldapserver):
base = 'dc=example,dc=com'
fltr = '(objectclass=*)'
attr = ['contextCSN']
self._connect(ldapserver)
result = self._search(base, fltr, attr, scope=ldap.SCOPE_BASE)
self._disconnect()
return result[0][1]['contextCSN']
def _get_rid_to_url(self, ldapserver):
'''Returns a dict for this query:
% ldapsearch -b cn=config '(cn=config)' -H ldap://myserver olcServerID
'''
rid2url = {}
url2rid = {}
base = 'cn=config'
fltr = '(cn=config)'
attr = ['olcServerID']
self._connect(ldapserver)
res = self.session.conn.search_ext_s(base, ldap.SCOPE_BASE, fltr, attr)
self._disconnect()
for rid_url in res[0][1]['olcServerID']:
rid, url = rid_url.split()
rid = '%03d' % int(rid)
rid2url[rid] = url
url2rid[url] = rid
return rid2url, url2rid
def _get_timestamp_rid(self, csn):
'''csn: 20140227093429.363252Z#000000#004#000000'''
ts, _, rid, _ = csn.split('#')
ts = ts.split('.')[0]
# ts = datetime.datetime.strptime(ts, "%Y%m%d%H%M%S")
ts = int(ts)
return rid, ts
def sync(self):
'''Example:
checkldap().sync() => [{'newest': 20140516151002, 'elapsed': 0.14442706108093262, 'ok': True, 'diff': 0, 'server': 'myserv'}, {'newest': 20140516151002, 'elapsed': 0.19423580169677734, 'ok': True, 'diff': 0, 'server': 'myserver'}, {'newest': 20140516151002, 'elapsed': 0.2617530822753906, 'ok': True, 'diff': 0, 'server': 'z-auth123.example'}, {'newest': 20140516151002, 'elapsed': 0.15635299682617188, 'ok': True, 'diff': 0, 'server': 'myserver'}, {'newest': 20140516151002, 'elapsed': 0.20283913612365723, 'ok': True, 'diff': 0, 'server': 'myserver'}]
'''
try:
rid2url, url2rid = self._get_rid_to_url(self.host)
ldapservers = map(lambda url: url[7:], url2rid.keys())
return self._sync(ldapservers)
except CheckError:
raise
except Exception, e:
raise CheckError('{}'.format(e)), None, sys.exc_info()[2]
def _sync(self, ldapservers):
'''Returns a list of dict, where 'diff' is the difference to the 'newest' of the full list, 'newest' is the newest timestamp for the given 'server', 'ok' means LDAP state for current 'server' and 'elapsed' the runtime of that ldap request.
Example dict:
{'diff': 0,
'elapsed': 0.2969970703125,
'newest': 20140228135148,
'ok': True,
'server': 'myserver'}
'''
if not ldapservers:
return
results = []
for ldapserver in ldapservers:
try:
start = time.time()
csn_list = self._sync_state(ldapserver)
rid2ts = {}
rid_ts = map(lambda csn: self._get_timestamp_rid(csn), csn_list)
newest = rid_ts[0][1]
for rid, ts in rid_ts:
rid2ts[rid] = ts
if ts > newest:
newest = ts
elapsed = time.time() - start
results.append({
'server': ldapserver,
'ok': True,
'newest': newest,
'elapsed': elapsed,
})
except ldap.LOCAL_ERROR:
bind_type = 'simple bind'
if self.use_krb5:
bind_type = 'sasl bind'
msg = 'Could not connect to {} via {}'.format(ldapserver, bind_type)
self.logger.exception(msg)
raise CheckError(msg)
except ldap.CONFIDENTIALITY_REQUIRED:
results.append({'ok': False, 'server': ldapserver})
newest = 0
for result in results:
if result['ok']:
if result['newest'] > newest:
newest = result['newest']
for result in results:
if result['ok']:
result['diff'] = newest - result['newest']
return results
def auth(self):
try:
start = time.time()
self._connect(self.host)
connect_elapsed = time.time() - start
self._search(self.user_base_dn, self.user_filter, self.user_attrib)
all_elapsed = time.time() - start
search_elapsed = all_elapsed - connect_elapsed
self._disconnect()
return {
'ok': True,
'connect_time': connect_elapsed,
'search_time': search_elapsed,
'elapsed': all_elapsed,
}
except ldap.LOCAL_ERROR:
bind_type = 'simple bind'
if self.use_krb5:
bind_type = 'sasl bind'
msg = 'Could not connect to {} via {}'.format(self.host, bind_type)
self.logger.exception(msg)
raise CheckError(msg)
except ldap.CONFIDENTIALITY_REQUIRED:
return {'ok': False}
except Exception, e:
raise CheckError('Error authenticating to LDAP: {}'.format(e)), None, sys.exc_info()[2]
@staticmethod
def _split_monitor_dn(dn):
'''
>>> LdapWrapper._split_monitor_dn('cn=Max File Descriptors,cn=Connections,cn=Monitor')
('connections', 'max_file_descriptors')
'''
parts = dn.replace(' ', '_').split(',')
return (parts[1])[3:].lower(), (parts[0])[3:].lower()
def statistics_raw(self):
'''collect statistics from OpenLDAP "Monitor" DB as a dict
ldapsearch -b cn=Connections,cn=Monitor -H ldap://myserver '(monitorCounter=*)' '+'
Example result::
{
"connections_current": "51",
"connections_max_file_descriptors": "65536",
"connections_total": "26291",
"operations_add_completed": "0",
"operations_add_initiated": "0",
"operations_bind_completed": "25423",
"operations_bind_initiated": "25423",
"operations_delete_completed": "0",
"operations_delete_initiated": "0",
"operations_extended_completed": "293",
"operations_extended_initiated": "293",
"operations_modify_completed": "91",
"operations_modify_initiated": "91",
"operations_search_completed": "22865",
"operations_search_initiated": "22866",
"operations_unbind_completed": "25233",
"operations_unbind_initiated": "25233",
"statistics_bytes": "122581936",
"statistics_entries": "64039",
"statistics_pdu": "112707",
"statistics_referrals": "0",
"waiters_read": "51",
"waiters_write": "0"
}
'''
try:
self._connect(self.host)
data = {}
# we need to use the internal "conn" attribute as the default _search is using paging which does not work for the "cn=Monitor" tree!
result = self.session.conn.search_s('cn=Monitor', ldap.SCOPE_SUBTREE, '(objectClass=monitorCounterObject)',
['monitorCounter'])
for dn, attr in result:
category, counter = self._split_monitor_dn(dn)
data['{}_{}'.format(category, counter)] = int(attr['monitorCounter'][0])
result = self.session.conn.search_s('cn=Threads,cn=Monitor', ldap.SCOPE_SUBTREE,
'(&(objectClass=monitoredObject)(monitoredInfo=*))', ['monitoredInfo'])
for dn, attr in result:
category, key = self._split_monitor_dn(dn)
if key in ('active', 'max'):
data['{}_{}'.format(category, key)] = int(attr['monitoredInfo'][0])
result = self.session.conn.search_s('cn=Operations,cn=Monitor', ldap.SCOPE_SUBTREE,
'(objectClass=monitorOperation)', ['monitorOpInitiated',
'monitorOpCompleted'])
for dn, attr in result:
category, op = self._split_monitor_dn(dn)
if op in STATISTICS_OPERATIONS_TO_MONITOR:
data['{}_{}_initiated'.format(category, op)] = int(attr['monitorOpInitiated'][0])
data['{}_{}_completed'.format(category, op)] = int(attr['monitorOpCompleted'][0])
self._disconnect()
except CheckError:
raise
except Exception, e:
raise CheckError('{}'.format(e)), None, sys.exc_info()[2]
return data
def statistics(self):
'''uses raw statistics and computes counter values (i.e. e.g. operations per second)
Example result::
{
"connections_current": 74,
"connections_per_sec": 24.1,
"entries": 353540,
"max_file_descriptors": 65536,
"operations_add_per_sec": 0.0,
"operations_bind_per_sec": 26.4,
"operations_delete_per_sec": 0.0,
"operations_extended_per_sec": 1.15,
"operations_modify_per_sec": 0.0,
"operations_search_per_sec": 20.66,
"operations_unbind_per_sec": 24.1,
"threads_active": 2,
"threads_max": 16,
"waiters_read": 73,
"waiters_write": 0
}
'''
_data = self.statistics_raw()
data = {}
for key, val in _data.items():
if key in STATISTICS_GAUGE_KEYS:
data[STATISTICS_FRIENDLY_KEY_NAMES.get(key, key)] = val
elif key == 'connections_total':
data['connections_per_sec'] = round(self._counter.key(key).per_second(val), 2)
elif key.startswith('operations_') and key.endswith('_initiated'):
data[key.replace('_initiated', '_per_sec')] = round(self._counter.key(key).per_second(val), 2)
# gc_count = round(self._counter.key('gcCount').per_second(gc_count), 2)
return data | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/checkldap.py | checkldap.py |
# wrapper for kairosdb to access history data about checks
import logging
import requests
from zmon_worker_monitor.builtins.plugins.distance_to_history import DistanceWrapper
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
logger = logging.getLogger(__name__)
class HistoryFactory(IFunctionFactoryPlugin):
def __init__(self):
super(HistoryFactory, self).__init__()
# fields from configuration
self.kairosdb_host = None
self.kairosdb_port = None
self.kairosdb_history_enabled = None
def configure(self, conf):
"""
Called after plugin is loaded to pass the [configuration] section in their plugin info file
:param conf: configuration dictionary
"""
self.kairosdb_host = conf.get('kairosdb_host')
self.kairosdb_port = conf.get('kairosdb_port')
self.kairosdb_history_enabled = True if conf.get('kairosdb_history_enabled') in ('true', 'True', '1') else False
def create(self, factory_ctx):
"""
Automatically called to create the check function's object
:param factory_ctx: (dict) names available for Function instantiation
:return: an object that implements a check function
"""
return propartial(HistoryWrapper,
kairosdb_host=self.kairosdb_host,
kairosdb_port=self.kairosdb_port,
history_enabled=self.kairosdb_history_enabled,
check_id=factory_ctx['check_id'],
entities=factory_ctx['entity_id_for_kairos'])
def get_request_json(check_id, entities, time_from, time_to, aggregator='avg', sampling_size_in_seconds=300):
j = \
"""
{
"metrics": [
{
"tags": {
"entity": [
%s
]
},
"name": "zmon.check.%s",
"group_by": [
{
"name": "tag",
"tags": [
"key"
]
}
],
"aggregators": [
{
"name": "%s",
"align_sampling": true,
"sampling": {
"value": "%s",
"unit": "seconds"
}
}
]
}
],
"cache_time": 0,
"start_relative": {
"value": "%s",
"unit": "seconds"
},
"end_relative": {
"value": "%s",
"unit": "seconds"
}
}
"""
r = j % (
','.join(map(lambda x: '"' + x + '"', entities)),
check_id,
aggregator,
sampling_size_in_seconds,
time_from,
time_to,
)
return r
ONE_WEEK = 7 * 24 * 60 * 60
ONE_WEEK_AND_5MIN = ONE_WEEK + 5 * 60
class HistoryWrapper(object):
def __init__(self, kairosdb_host, kairosdb_port, history_enabled, check_id, entities):
self.__kairosdb_host = kairosdb_host if kairosdb_host is not None else 'cassandra01'
self.__kairosdb_port = kairosdb_port if kairosdb_port is not None else '37629'
self.__enabled = bool(history_enabled)
self.url = 'http://%s:%s/api/v1/datapoints/query' % (self.__kairosdb_host, self.__kairosdb_port)
self.check_id = check_id
if type(entities) == list:
self.entities = entities
else:
self.entities = [entities]
def result(self, time_from=ONE_WEEK_AND_5MIN, time_to=ONE_WEEK):
if not self.__enabled:
raise Exception("History() function disabled for now")
#self.logger.info("history query %s %s %s", self.check_id, time_from, time_to)
return requests.post(self.url, get_request_json(self.check_id, self.entities, int(time_from),
int(time_to))).json()
def get_one(self, time_from=ONE_WEEK_AND_5MIN, time_to=ONE_WEEK):
if not self.__enabled:
raise Exception("History() function disabled for now")
#self.logger.info("history get one %s %s %s", self.check_id, time_from, time_to)
return requests.post(self.url, get_request_json(self.check_id, self.entities, int(time_from),
int(time_to))).json()['queries'][0]['results'][0]['values']
def get_aggregated(self, key, aggregator, time_from=ONE_WEEK_AND_5MIN, time_to=ONE_WEEK):
if not self.__enabled:
raise Exception("History() function disabled for now")
# read the list of results
query_result = requests.post(self.url, get_request_json(self.check_id, self.entities, int(time_from),
int(time_to), aggregator, int(time_from - time_to))).json()['queries'][0]['results'
]
# filter for the key we are interested in
filtered_for_key = filter(lambda x: x['tags'].get('key', [''])[0] == key, query_result)
if not filtered_for_key:
return_value = []
else:
return_value = [filtered_for_key[0]['values'][0][1]]
# since we have a sample size of 'all in the time range', return only the value, not the timestamp.
return return_value
def get_avg(self, key, time_from=ONE_WEEK_AND_5MIN, time_to=ONE_WEEK):
if not self.__enabled:
raise Exception("History() function disabled for now")
#self.logger.info("history get avg %s %s %s", self.check_id, time_from, time_to)
return self.get_aggregated(key, 'avg', time_from, time_to)
def get_std_dev(self, key, time_from=ONE_WEEK_AND_5MIN, time_to=ONE_WEEK):
if not self.__enabled:
raise Exception("History() function disabled for now")
#self.logger.info("history get std %s %s %s", self.check_id, time_from, time_to)
return self.get_aggregated(key, 'dev', time_from, time_to)
def distance(self, weeks=4, snap_to_bin=True, bin_size='1h', dict_extractor_path=''):
if not self.__enabled:
raise Exception("History() function disabled for now")
#self.logger.info("history distance %s %s ", self.check_id, weeks, bin_size)
return DistanceWrapper(history_wrapper=self, weeks=weeks, bin_size=bin_size, snap_to_bin=snap_to_bin,
dict_extractor_path=dict_extractor_path)
if __name__ == '__main__':
import logging
logging.basicConfig(level=logging.DEBUG)
zhistory = HistoryWrapper(None, None, None, 17, ['GLOBAL'])
r = zhistory.result()
logging.info(r)
r = zhistory.get_one()
logging.info(r)
r = zhistory.get_aggregated('', 'avg')
logging.info(r) | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/history.py | history.py |
import sys
import os
from zmon_worker_monitor.zmon_worker.errors import DbError
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
# default port Oracle Net Listener port
DEFAULT_PORT = 1521
MAX_RESULTS = 100
class SqlOracleFactory(IFunctionFactoryPlugin):
def __init__(self):
super(SqlOracleFactory, self).__init__()
# fields from config
self._user = None
self._pass = None
def configure(self, conf):
"""
Called after plugin is loaded to pass the [configuration] section in their plugin info file
:param conf: configuration dictionary
"""
self._user = conf['user']
self._pass = conf['pass']
def create(self, factory_ctx):
"""
Automatically called to create the check function's object
:param factory_ctx: (dict) names available for Function instantiation
:return: an object that implements a check function
"""
return propartial(SqlOracleWrapper, factory_ctx['host'], factory_ctx['port'], factory_ctx['entity'].get('sid'),
user=self._user, password=self._pass)
def _check_oracle_env():
if 'ORACLE_HOME' not in os.environ or 'LD_LIBRARY_PATH' not in os.environ or os.environ['ORACLE_HOME'] \
not in os.environ['LD_LIBRARY_PATH'] or not os.path.isdir(os.environ['ORACLE_HOME']):
raise Exception('Environmet variables ORACLE_HOME and LD_LIBRARY_PATH are not correctly set')
def _import_db_driver():
try:
_check_oracle_env()
_cx_Oracle = __import__('cx_Oracle', globals(), locals(), [], -1)
except Exception:
# do we want to take some action here?
raise
return _cx_Oracle
class SqlOracleWrapper(object):
'''Oracle SQL adapter
sql().execute('SELECT 1').result()
'''
def __init__(self, host, port, sid, user='nagios', password='', enabled=True):
self._stmt = None
self._dsn_tns = None
self._enabled = enabled
self.__cx_Oracle = None
self.__conn = None
self.__cursor = None
if self._enabled:
self.__cx_Oracle = _import_db_driver()
port = (int(port) if port and str(port).isdigit() else DEFAULT_PORT)
try:
self._dsn_tns = self.__cx_Oracle.makedsn(host, port, sid)
self.__conn = self.__cx_Oracle.connect(user, password, self._dsn_tns)
self.__cursor = self.__conn.cursor()
except Exception, e:
raise DbError(str(e), operation='Connect to dsn={}'.format(self._dsn_tns)), None, sys.exc_info()[2]
def execute(self, stmt):
self._stmt = stmt
return self
def result(self, agg=sum):
'''return single row result, will result primitive value if only one column is selected'''
result = {}
try:
if self._enabled and self.__cx_Oracle:
cur = self.__cursor
try:
cur.execute(self._stmt)
desc = [d[0] for d in cur.description] # Careful: col names come out all uppercase
row = cur.fetchone()
if row:
result = dict(zip(desc, row))
finally:
cur.close()
except Exception, e:
raise DbError(str(e), operation=self._stmt), None, sys.exc_info()[2]
if len(result) == 1:
return result.values()[0]
else:
return result
def results(self):
'''return many rows'''
results = []
try:
if self._enabled and self.__cx_Oracle:
cur = self.__cursor
try:
cur.execute(self._stmt)
desc = [d[0] for d in cur.description] # Careful: col names come out all uppercase
rows = cur.fetchmany(MAX_RESULTS)
for row in rows:
row = dict(zip(desc, row))
results.append(row)
finally:
cur.close()
except Exception, e:
raise DbError(str(e), operation=self._stmt), None, sys.exc_info()[2]
return results
if __name__ == '__main__':
default_sql_stmt = "SELECT 'OK' from dual"
if len(sys.argv) in (6, 7):
check = SqlOracleWrapper(sys.argv[1], sys.argv[2], sys.argv[3], user=sys.argv[4], password=sys.argv[5])
if len(sys.argv) == 7:
sql_stmt = sys.argv[6]
else:
print 'executing default statement:', default_sql_stmt
sql_stmt = default_sql_stmt
# print '>>> one result:\n', check.execute(sql_stmt).result()
print '>>> many results:\n', check.execute(sql_stmt).results()
else:
print '{} <host> <port> <sid> [sql_stmt]'.format(sys.argv[0]) | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/sql_oracle.py | sql_oracle.py |
import json
import requests
import logging
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
logger = logging.getLogger('zmon-worker.scalyr-function')
class ScalyrWrapperFactory(IFunctionFactoryPlugin):
def __init__(self):
super(ScalyrWrapperFactory, self).__init__()
def configure(self, conf):
self.read_key = conf.get('read.key', '')
return
def create(self, factory_ctx):
"""
Automatically called to create the check function's object
:param factory_ctx: (dict) names available for Function instantiation
:return: an object that implements a check function
"""
return propartial(ScalyrWrapper, read_key=self.read_key)
class ScalyrWrapper(object):
def __init__(self, read_key):
self.numeric_url = 'https://www.scalyr.com/api/numericQuery'
self.timeseries_url = 'https://www.scalyr.com/api/timeseriesQuery'
self.facet_url = 'https://www.scalyr.com/api/facetQuery'
self.read_key = read_key
def count(self, query, minutes=5):
val = {
'token': self.read_key,
'queryType': 'numeric',
'filter': query,
'function': 'count',
'startTime': str(minutes)+'m',
'priority': 'low',
'buckets': 1
}
r = requests.post(self.numeric_url, data=json.dumps(val), headers={"Content-Type": "application/json"})
j = r.json()
if 'values' in j:
return j['values'][0]
else:
return j
def function(self, function, query, minutes=5):
val = {
'token': self.read_key,
'queryType': 'numeric',
'filter': query,
'function': function,
'startTime': str(minutes)+'m',
'priority': 'low',
'buckets': 1
}
r = requests.post(self.numeric_url, data=json.dumps(val), headers={"Content-Type": "application/json"})
j = r.json()
if 'values' in j:
return j['values'][0]
else:
return j
def facets(self, filter, field, max_count=5, minutes=30, prio="low"):
val = {
'token': self.read_key,
'queryType': 'facet',
'filter': filter,
'field': field,
'maxCount': max_count,
"startTime": str(minutes)+"m",
"priority": prio
}
r = requests.post(self.facet_url, data=json.dumps(val), headers={"Content-Type": "application/json"})
j = r.json()
return j
def timeseries(self, filter, function="count", minutes=30, buckets=1, prio="low"):
val = {
'token': self.read_key,
'queries': [
{
"filter": filter,
"function": function,
"startTime": str(minutes)+"m",
"buckets": buckets,
"priority": prio
}
]
}
r = requests.post(self.timeseries_url, data=json.dumps(val), headers={"Content-Type": "application/json"})
j = r.json()
if j['status'] == 'success':
if len(j['results'][0]['values'])==1:
return j['results'][0]['values'][0]
return map(lambda x: x * minutes / buckets, j['results'][0]['values'])
return j
if __name__ == '__main__':
import os
s = ScalyrWrapper(read_key=os.getenv('SCALYR_READ_KEY'))
print s.count(query="$application_id='zmon-scheduler'") | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/scalyr.py | scalyr.py |
import numpy
import datetime
from zmon_worker_monitor.zmon_worker.common.time_ import parse_timedelta
# from tasks.check import flatten
# originally, I wanted to load this function defintion from the tasks module, but I did not
# succeed in doing so. My python knowledge is limited, so maybe you can tell me how I can achieve this?
def flatten(structure, key='', path='', flattened=None):
path = str(path)
key = str(key)
if flattened is None:
flattened = {}
if type(structure) not in (dict, list):
flattened[((path + '.' if path else '')) + key] = structure
elif isinstance(structure, list):
pass
else:
# for i, item in enumerate(structure):
# flatten(item, '%d' % i, '.'.join(filter(None, [path, key])), flattened)
for new_key, value in structure.items():
flatten(value, new_key, '.'.join(filter(None, [path, key])), flattened)
return flattened
class DistanceWrapper(object):
def __init__(self, history_wrapper, weeks=4, snap_to_bin=True, bin_size='1h', dict_extractor_path=''):
self.history_wrapper = history_wrapper
self.weeks = weeks
self.snap_to_bin = snap_to_bin
self.bin_size = parse_timedelta(bin_size)
self.dict_extractor_path = dict_extractor_path
def calculate_bin_time_range(self):
'''
Calculates the time ranges we need to look for using the settings configured for this class.
Returns a list of dicts with the time ranges.
'''
now = datetime.datetime.now().replace(microsecond=0)
if self.snap_to_bin:
day_begin = now.replace(hour=0, minute=0, second=0, microsecond=0)
# the number of bins (of size bin_size) that passed since the beginning of the day
bins_this_day_until_now = int((now - day_begin).total_seconds() / self.bin_size.total_seconds())
bin_begin = day_begin + bins_this_day_until_now * self.bin_size
bin_end = day_begin + (bins_this_day_until_now + 1) * self.bin_size
else:
bin_begin = now - self.bin_size
bin_end = now
timestamps = []
for week in range(1, self.weeks + 1):
time_from = abs((bin_begin - week * datetime.timedelta(days=7) - now).total_seconds())
time_to = abs((bin_end - week * datetime.timedelta(days=7) - now).total_seconds())
timestamps.append({'time_from': time_from, 'time_to': time_to})
return timestamps
def extract_value(self, value):
'''
Extracts the value that will be used for comparisons. For dicts, we need an extractor. The extractor may not
be empty if the value is a dict. The extractor is of the form 'a.b.c' for a dict with the structure
{'a':{'b':{'c':5}}} to extract the value 5.
'''
if isinstance(value, dict):
if self.dict_extractor_path == '':
raise Exception('Extractor may not be empty for dicts as value. You need to tell which part of the dict I should use.'
)
# throws when the key is unavailable; this is what we want
value = flatten(value)[self.dict_extractor_path]
return value
def bin_mean(self):
'''
Calculates the mean of the history values. Applies the extractor and returns a scalar value.
'''
time_ranges = self.calculate_bin_time_range()
averages = []
for time_range in time_ranges:
averages.extend(self.history_wrapper.get_avg(self.dict_extractor_path, time_range['time_from'],
time_range['time_to']))
if not averages:
raise Exception('No history data available in bin_mean call.')
return numpy.average(averages)
def bin_standard_deviation(self):
'''
Calculates the standard deviation of the history values. Applies the extractor and returns a scalar value.
'''
time_ranges = self.calculate_bin_time_range()
deviations = []
for time_range in time_ranges:
deviations.extend(self.history_wrapper.get_std_dev(self.dict_extractor_path, time_range['time_from'],
time_range['time_to']))
if not deviations:
raise Exception('No history data available in bin_standard_deviation call.')
# you can't simply average standard deviations.
# see https://en.wikipedia.org/wiki/Variance#Basic_properties for details, keep in mind that
# the different times are uncorrelated. We assume that the sample sizes for the different weeks
# are equal (since we do not get exact sample sizes for a specific key from the kairosdb)
return numpy.sqrt(numpy.sum(map(lambda x: x * x, deviations)))
def absolute(self, value):
'''
Calculates the absolute distance of the actual value from the history value bins
as selected through the constructor parameters weeks, bin_size and snap_to_bin.
Applies the extractor and returns a scalar value.
'''
return self.extract_value(value) - self.bin_mean()
def sigma(self, value):
'''
Calculates the relative distance of the actual value from the history value bins,
normalized by the standard deviation. A sigma distance of 1.0 means that the actual value
is as far away from the mean as the standard deviation is. The sigma distance can be negative, in this
case you are below the mean with your value. If you need absolute values, you can use
abs(sigma(value)). Applies the extractor and returns a scalar value.
'''
abs_value = self.absolute(value)
std_dev = self.bin_standard_deviation()
if std_dev == 0:
return numpy.Infinity * numpy.sign(abs_value) if abs_value != 0 else numpy.float64(0)
return abs_value / std_dev
if __name__ == '__main__':
import logging
logging.basicConfig(level=logging.DEBUG)
logging.info('flattened dict: %s', flatten({'a': {'b': {'c': 5}}}))
class HistoryWrapper(object):
def __init__(self, check_id, entities=[]):
self.check_id = check_id
self.entities = entities
@staticmethod
def get_avg(key, time_from, time_to):
return [7]
@staticmethod
def get_std_dev(key, time_from, time_to):
return [2]
now = datetime.datetime.now()
before = now.replace(minute=0, second=0, microsecond=0)
distance = DistanceWrapper(history_wrapper=HistoryWrapper(check_id=588), snap_to_bin=False, weeks=3, bin_size='5m')
logging.info('Mean of history values: %f', distance.bin_mean())
logging.info('Absolute distance: %f', distance.absolute(15))
logging.info('Sigma distance: %f', distance.sigma(15)) | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/distance_to_history.py | distance_to_history.py |
import sys
import json
import logging
import re
import shlex
import subprocess32
from functools import partial, wraps
from zmon_worker_monitor.zmon_worker.errors import CheckError, NagiosError
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
logger = logging.getLogger(__name__)
# only return 95% of diskspace because of http://unix.stackexchange.com/questions/7950/reserved-space-for-root-on-a-filesystem-why
USABLE_DISKSPACE_FACTOR = 0.95
class NagiosFactory(IFunctionFactoryPlugin):
def __init__(self):
super(NagiosFactory, self).__init__()
# fields from config
self._exarpc_user = None
self._exarpc_pass = None
self._loungemysql_user = None
self._loungemysql_pass = None
self._hetcrawler_proxy_user = None
self._hetcrawler_proxy_pass = None
def configure(self, conf):
"""
Called after plugin is loaded to pass the [configuration] section in their plugin info file
:param conf: configuration dictionary
"""
self._exarpc_user = conf['exarpc_user']
self._exarpc_pass = conf['exarpc_pass']
self._loungemysql_user = conf['loungemysql_user']
self._loungemysql_pass = conf['loungemysql_pass']
self._hetcrawler_proxy_user = conf['hetcrawler_proxy_user']
self._hetcrawler_proxy_pass = conf['hetcrawler_proxy_pass']
def create(self, factory_ctx):
"""
Automatically called to create the check function's object
:param factory_ctx: (dict) names available for Function instantiation
:return: an object that implements a check function
"""
return propartial(NagiosWrapper,
factory_ctx['host'],
exasol_user=self._exarpc_user,
exasol_password=self._exarpc_pass,
lounge_mysql_user=self._loungemysql_user,
lounge_mysql_password=self._loungemysql_pass,
hetcrawler_proxy_user=self._hetcrawler_proxy_user,
hetcrawler_proxy_pass=self._hetcrawler_proxy_pass)
def error_wrapped(parser):
@wraps(parser)
def wrapper(*args, **kwargs):
try:
result = parser(*args, **kwargs)
except Exception:
raise NagiosError(args[0])
else:
return result
return wrapper
def fix_sub32_exc(e):
'''Quick and dirty way to deal with subprocess32 bugs. See PF-4190'''
if isinstance(e, subprocess32.TimeoutExpired):
for field in ['output', 'timeout', 'cmd']:
if not hasattr(e, field):
setattr(e, field, '--')
if isinstance(e, subprocess32.CalledProcessError):
for field in ['returncode', 'output', 'cmd']:
if not hasattr(e, field):
setattr(e, field, '--')
return e
class NagiosWrapper(object):
def __init__(self, host, exasol_user='nagios', exasol_password='', lounge_mysql_user='nagios',
lounge_mysql_password='', hetcrawler_proxy_user='', hetcrawler_proxy_pass=''):
self.host = host
self.__nrpe_config = { # example to check non-default memcached:
# nagios().nrpe('check_memcachestatus', port=11212)
# example to check non-default logwatch:
# requires NRPE: command[check_all_disks]=/usr/lib/nagios/plugins/check_disk -w "$ARG1$" -c "$ARG2$" -u "$ARG3$"
'check_diff_reverse': {'args': '-a /proc/meminfo CommitLimit Committed_AS kB 1048576 524288',
'parser': self._to_dict_commitdiff},
'check_disk': {'args': '-a 15% 7% /', 'parser': self._parse_memory},
'check_all_disks': {'args': '-a 15% 7% MB', 'parser': self._parse_disks},
'check_fiege-avis-file': {'args': '', 'parser': self._to_dict_from_text},
'check_findfiles': {'args': '-a 20,20,20 20,20,20 {directory} {epoch} found',
'parser': partial(self._to_dict, func=int),
'parameters': {'directory': '', 'epoch': 1}},
'check_findfiles_names': {'args': '-a 20,20,20 20,20,20 {directory} {epoch} found {name}',
'parser': partial(self._to_dict, func=int),
'parameters': {'directory': '', 'epoch': 1,
'name': ''}},
'check_findfiles_names_exclude': {'args': '-a 20,20,20 20,20,20 {directory} {epoch} found {name}',
'parser': partial(self._to_dict, func=int),
'parameters': {'directory': '', 'epoch': 1,
'name': ''}},
'check_hpacucli_py': {'args': '', 'parser': json.loads},
'check_hpacucli': {'args': '', 'parser': self._to_dict_hpraid},
'check_hpasm_dl380p_gen8_fix': {'args': '-a 14:60 15:60', 'parser': self._to_dict_hpasm},
'check_hpasm_fix_power_supply': {'args': '-a 14:60 15:60', 'parser': self._to_dict_hpasm},
'check_hpasm_gen8': {'args': '-a 14:60 15:60', 'parser': self._to_dict_hpasm},
'check_inodes': {'args': '', 'parser': json.loads},
'check_iostat': {'args': '-a 32000,30000 64000,40000 {disk}', 'parser': self._to_dict_iostat,
'parameters': {'disk': 'sda'}},
'check_list_timeout': {
'args': '-a "ls {path}" {timeout}',
'parameters': {'path': '/data/production/', 'timeout': 10},
'parser': self._to_dict,
'pre_run_hook': self._check_path_chars,
},
'check_load': {'args': '-a 15,14,12 20,17,15', 'parser': self._to_dict},
'check_mailq_postfix': {'args': '-a 10 5000', 'parser': partial(self._to_dict, func=int)},
'check_postfix_queue.sh': {'parser': partial(self._to_dict, func=int)},
'check_memcachestatus': {'args': '-a 9000000,550,10000,100,6000,5000,20481024,20481024 99000000,1000,12000,200,8000,7000,40961024,40961024 127.0.0.1 {port}',
'parser': self._to_dict, 'parameters': {'port': 11211}},
'check_ntp_time': {'args': '-a 1 2 10 {ntp_server}', 'parser': self._to_dict},
'check_openmanage': {'args': '', 'parser': self._to_dict_hpasm},
'check_subdomain_redirect': {'args': '', 'parser': self._to_dict_from_text},
'check_icmp': {'args': '-a {targethost} {num_of_packets} {timeout}', 'parser': self._to_dict,
'parameters': {'targethost': 'default', 'num_of_packets': 5, 'timeout': 10}},
'check_tcp': {'args': '-a {targethost} {port} {timeout}', 'parser': self._to_dict,
'parameters': {'targethost': 'default', 'port': 22, 'timeout': 10}},
'check_tcp_str': {'args': '-a {targethost} {port} {timeout} {expected}', 'parser': self._to_dict,
'parameters': {
'targethost': 'default',
'port': 22,
'timeout': 10,
'expected': 'SSH-2.0-OpenSSH',
}},
'check_ssl': {'args': '-a {targethost} {port} {timeout}', 'parser': self._to_dict,
'parameters': {'targethost': 'default', 'port': 443, 'timeout': 10}},
'check_statistics.pl': {'args': '', 'parser': self._to_dict},
'check_oracle': {'args': '{user_args}', 'parser': self._to_dict, 'parameters': {'user_args': ''}},
'check_dbus': {'args': '', 'parser': self._to_dict_win_text,},
'check_flocked_file': {'args': '-a {lockfile}', 'parser': self._to_dict_from_text},
'check_apachestatus_uri': {'args': '-a 16000,10000,48 32000,20000,64 {url}', 'parser': self._to_dict,
'parameters': {'url': 'http://127.0.0.1/server-status?auto'}},
'check_command_procs': {'args': '-a 250 500 {process}', 'parser': self._to_dict_procs,
'parameters': {'process': 'httpd'}},
'check_http_expect_port_header': {'args': '-a 2 8 60 {ip} {url} {redirect} {size} {expect} {port} {hostname}',
'parser': self._to_dict, 'parameters': {
'ip': 'localhost',
'url': '/',
'redirect': 'warning',
'size': '9000:90000',
'expect': '200',
'port': '88',
'hostname': 'www.example.com',
}},
'check_mysql_processes': {'args': '-a 30 60 {host} {port} {user} {password}',
'parser': self._to_dict_mysql_procs, 'parameters': {
'host': 'localhost',
'port': '/var/lib/mysql/mysql.sock',
'user': lounge_mysql_user,
'password': lounge_mysql_password,
}},
'check_mysqlperformance': {'args': '-a 10000,1500,5000,500,750,100,100,1,5000,30,60,500,10,30 15000,3000,10000,750,1000,250,250,5,7500,60,300,1000,20,60 {host} {port} Questions,Com_select,Qcache_hits,Com_update,Com_insert,Com_delete,Com_replace,Aborted_clients,Com_change_db,Created_tmp_disk_tables,Created_tmp_tables,Qcache_not_cached,Table_locks_waited,Select_scan {user} {password}',
'parser': self._to_dict, 'parameters': {
'host': 'localhost',
'port': '/var/lib/mysql/mysql.sock',
'user': lounge_mysql_user,
'password': lounge_mysql_password,
}},
'check_mysql_slave': {'args': '-a 3 60 {host} {port} {database} {user} {password}',
'parser': self._to_dict_mysql_slave, 'parameters': {
'host': 'localhost',
'port': '/var/lib/mysql/mysql.sock',
'database': 'zlr_live_global',
'user': lounge_mysql_user,
'password': lounge_mysql_password,
}},
'check_stunnel_target': {
'args': '-a {target} {user} {password}',
'parser': self._to_dict,
'parameters': {
'target': 'www.example.com',
'user': hetcrawler_proxy_user,
'password': hetcrawler_proxy_pass,
},
},
'check_lounge_queries': {'args': '', 'parser': self._to_dict_lounge_queries},
'check_newsletter': {'args': '-p {port}', 'parser': self._to_dict_newsletter,
'parameters': {'port': '5666'}},
'check_nfs_mounts': {'args': '', 'parser': self._to_dict_list},
'check_kdc': {'args': '', 'parser': json.loads},
'check_kadmin': {'args': '', 'parser': json.loads},
'check_ssl_cert': {'args': '-a 60 30 {host_ip} {domain_name}', 'parser': partial(self._to_dict, func=int),
'parameters': {'host_ip': '127.0.0.1', 'domain_name': 'www.example.com'}},
}
self.__local_config = {
'check_subdomain_redirect.py': {'args': '', 'parser': self._to_dict_from_text},
'check_ping': {'args': '-H {} -w 5000,100% -c 5000,100% -p 1'.format(self.host), 'parser': self._to_dict},
'check_snmp_mem_used-cached.pl': {'args': '-H {} -w 100,100,100 -c 100,100,100 -C public -f'.format(self.host),
'parser': self._to_dict},
'check_icmp': {'args': '-H {} -n {{num_of_packets}} -t {{timeout}}'.format(self.host),
'parser': self._to_dict, 'parameters': {'num_of_packets': 5, 'timeout': 10}},
'check_tcp': {'args': '-H {} -p {{port}} -t {{timeout}}'.format(self.host), 'parser': self._to_dict,
'parameters': {'port': 22, 'timeout': 10}},
'check_tcp_str': {'args': '-H {} -p {{port}} -t {{timeout}} -e {{expected}}'.format(self.host),
'parser': self._to_dict, 'parameters': {'port': 22, 'timeout': 10,
'expected': 'SSH-2.0-OpenSSH'}},
'check_ssl': {'args': '-H {} -p {{port}} -t {{timeout}} -S'.format(self.host), 'parser': self._to_dict,
'parameters': {'port': 443, 'timeout': 10}},
'check_dns': {'args': '-H {host} -s {dns_server} -t {timeout}', 'parser': self._to_dict,
'parameters': {'timeout': 5}},
'check_snmp_process.pl': {'args': '-H {} -C {{community}} -F -n {{name}} -c {{critical}} -w {{warn}} -o {{octets}} {{extra}}'.format(self.host),
'parser': self._to_dict, 'parameters': {
'timeout': 5,
'octets': 2400,
'warn': 1,
'critical': 1,
'community': 'public',
'extra': '-r -2',
}},
# check_xmlrpc.rb: BI checks for PF-3558
# possible user_args:
# Exasol: backup state -> '-check-backup' (default)
# Exasol: DB-Status -> '--rpc getDatabaseState --ok'
# Exasol: Node status -> '--check-node-states -w 0 -c 1'
# Exasol: Verbindungs-Status -> '--rpc getDatabaseConnectionState --ok yes'
'check_xmlrpc.rb': {'args': '--url http://{user}:{password}@{targethost}/cluster1/db_exa_db1 {user_args}',
'parser': self._to_dict_newsletter, 'parameters': {
'targethost': '10.229.12.212',
'user': exasol_user,
'password': exasol_password,
'user_args': '-check-backup',
}},
'check_ssl_cert': {'args': '-w 60 -c 30 -H {host_ip} -n {domain_name} -r /etc/ssl/certs --altnames', 'parser': partial(self._to_dict, func=int),
'parameters': {'host_ip': '127.0.0.1', 'domain_name': 'www.example.com'}},
'check-ldap-sync.pl': {'args': '', 'parser': json.loads},
}
self.__win_config = {
'CheckCounter': {'args': '-a "Counter:ProcUsedMem=\\Process({process})\\Working Set" ShowAll MaxWarn=1073741824 MaxCrit=1073741824',
'parser': partial(self._to_dict_win, func=int), 'parameters': {'process': 'eo_server'}},
'CheckCPU': {'args': '-a warn=100 crit=100 time=1 warn=100 crit=100 time=5 warn=100 crit=100 time=10',
'parser': partial(self._to_dict_win, func=int)},
'CheckDriveSize': {'args': '-a CheckAll ShowAll perf-unit=M', 'parser': self._to_dict_win},
'CheckEventLog': {'args': '-a file="{log}" MaxWarn=1 MaxCrit=1 "filter={query}" truncate=800 unique "syntax=%source% (%count%)"',
'parser': partial(self._to_dict_win, func=int), 'parameters': {'log': 'application',
'query': 'generated gt -7d AND type=\'error\''}},
'CheckFiles': {'args': '-a "path={path}" "pattern={pattern}" "filter={query}" MaxCrit=1',
'parser': partial(self._to_dict_win, func=int),
'parameters': {'path': 'C:\\Import\\Exchange2Clearing', 'pattern': '*.*',
'query': 'creation lt -1h'}},
'CheckLogFile': {'args': '-a file="{logfile}" column-split="{seperator}" "filter={query}"',
'parser': self._to_dict_win_log,
'parameters': {'logfile': 'c:\Temp\log\maxflow_portal.log', 'seperator': ' ',
'query': 'column4 = \'ERROR\' OR column4 = \'FATAL\''}},
'CheckMEM': {'args': '-a MaxWarn=15G MaxCrit=15G ShowAll perf-unit=M type=physical type=page type=virtual',
'parser': self._to_dict_win},
'CheckProcState': {'args': '-a ShowAll {process}', 'parser': self._to_dict_win_text,
'parameters': {'process': 'check_mk_agent.exe'}},
'CheckServiceState': {'args': '-a ShowAll {service}', 'parser': self._to_dict_win_text,
'parameters': {'service': 'ENAIO_server'}},
'CheckUpTime': {'args': '-a MinWarn=1000d MinCrit=1000d', 'parser': partial(self._to_dict_win, func=int)},
}
def nrpe(self, check, timeout=60, **kwargs):
config = self.__nrpe_config[check]
parameters = {}
parameters.update(config.get('parameters', {}))
parameters.update(kwargs)
pre_run_hook_ok = config.get('pre_run_hook', self._check_ok)
if not pre_run_hook_ok(config.get('parameters', {})):
raise CheckError('Pre run hook does not accept your parameters')
cmd_args = config['args'].format(**parameters)
cmd = shlex.split('/usr/lib/nagios/plugins/check_nrpe -u -H {h} -t {t} -c {c} {a}'.format(h=self.host,
t=timeout, c=check, a=cmd_args))
try:
output = subprocess32.check_output(cmd, shell=False, timeout=timeout)
except subprocess32.CalledProcessError, e:
e = fix_sub32_exc(e)
if e.returncode < 3:
output = str(e.output)
else:
output = str(e.output)
return output
except subprocess32.TimeoutExpired, e:
e = fix_sub32_exc(e)
raise NagiosError(str(e)), None, sys.exc_info()[2]
logger.debug('output for cmd (%s): %s', cmd, output)
return self.__nrpe_config[check]['parser'](output)
def local(self, check, timeout=60, **kwargs):
config = self.__local_config[check]
parameters = {}
parameters.update(config.get('parameters', {}))
parameters.update(kwargs)
pre_run_hook_ok = config.get('pre_run_hook', self._check_ok)
if not pre_run_hook_ok(config.get('parameters', {})):
raise CheckError('Pre run hook does not accept your parameters')
cmd_args = config['args'].format(**parameters)
cmd = shlex.split('/usr/lib/nagios/plugins/{c} {a}'.format(c=check, a=cmd_args))
try:
output = subprocess32.check_output(cmd, shell=False, timeout=timeout)
except subprocess32.CalledProcessError, e:
e = fix_sub32_exc(e)
if e.returncode < 3:
output = str(e.output)
else:
output = str(e.output)
return output
except subprocess32.TimeoutExpired, e:
e = fix_sub32_exc(e)
raise NagiosError(str(e)), None, sys.exc_info()[2]
logger.debug('output for cmd (%s): %s', cmd, output)
return self.__local_config[check]['parser'](output)
def win(self, check, timeout=60, **kwargs):
config = self.__win_config[check]
parameters = {}
parameters.update(config.get('parameters', {}))
parameters.update(kwargs)
pre_run_hook_ok = config.get('pre_run_hook', self._check_ok)
if not pre_run_hook_ok(config.get('parameters', {})):
raise CheckError('Pre run hook does not accept your parameters')
cmd_args = config['args'].format(**parameters)
cmd = shlex.split('/usr/lib/nagios/plugins/check_nrpe -u -H {h} -t {t} -c {c} {a}'.format(h=self.host,
t=timeout, c=check, a=cmd_args))
try:
output = subprocess32.check_output(cmd, shell=False, timeout=timeout)
except subprocess32.CalledProcessError, e:
e = fix_sub32_exc(e)
if e.returncode < 3:
output = str(e.output)
else:
output = str(e.output)
return output
except subprocess32.TimeoutExpired, e:
e = fix_sub32_exc(e)
raise NagiosError(str(e)), None, sys.exc_info()[2]
logger.debug('output for cmd (%s): %s', cmd, output)
return self.__win_config[check]['parser'](output)
@staticmethod
def _check_ok(config):
'''Returns always True (ok) as result.'''
return True
@staticmethod
def _check_path_chars(config):
return re.match("^[a-zA-Z0-9\/_\-]+$", config['path'])
@staticmethod
@error_wrapped
def _to_dict(output, func=float):
return dict((a.split('=')[0], func(re.sub(r'.*?(-?[0-9]*\.[0-9]+|-?[0-9]+).*', r'\1', a.split('=')[1].split(';')[0]))) for a in
output.split('|')[-1].split())
@staticmethod
@error_wrapped
def _to_dict_list(output):
return dict((a, 1) for a in output.split('|')[-1].split())
@staticmethod
@error_wrapped
def _to_dict_olderfiles(output):
'''try to parse this output:
OK - 0 files older as 600 min -- 0 files older as 540 min -- total 762 files -- older:
>>> import json; json.dumps(NagiosWrapper._to_dict_olderfiles('OK - 0 files older as 600 min -- 112 files older as 60 min -- total 831 files -- older:'), sort_keys=True)
'{"files older than time01": 112, "files older than time02": 0, "total files": 831}'
'''
return {'files older than time01': int(output.split(' -- ')[1].split()[0]), 'files older than time02': int(output.split(' -- ')[0].split()[2]), 'total files': int(output.split(' -- ')[2].split()[1])}
@staticmethod
@error_wrapped
def _to_dict_win(output, func=float):
'''try to parse this output:
OK: physical memory: 4.8G, page file: 5.92G, virtual memory: 254M|'physical memory %'=29%;6;6 'physical memory'=5028644K;15728640;15728640;0;16776760 'page file %'=18%;53;53 'page file'=6206652K;15728640;15728640;0;33472700 'virtual memory %'=0%;99;99 'virtual memory'=259704K;15728640;15728640;0;8589934464
'''
return dict((a.split('=')[0], func(re.sub('[^0-9.]', '', a.split('=')[1].split(';')[0]))) for a in
shlex.split(output.split('|')[-1]))
@staticmethod
@error_wrapped
def _to_dict_win_text(output):
'''try to parse this output:
OK: ENAIO_server: started
'''
po = {'status': output.split(':')[0], 'message': ' '.join(output.split(' ')[1:]).strip(' \n').split('|')[0]}
if not po['status'] or not po['message']:
raise NagiosError('Unable to parse {}'.format(output))
return po
@staticmethod
@error_wrapped
def _to_dict_win_log(output):
'''try to parse this output:
c:\Temp\log\maxflow_portal.log2014.04.29: 1 (2014-04-29 15:44:00,741 [5] WARN BeckIT.MPO.... )
'''
if 'Nothing matched' in output:
return {'count': 0}
else:
return {'count': int(output.split(' ')[1].strip(' '))}
@staticmethod
@error_wrapped
def _to_dict_commitdiff(output):
'''
try to parse this output:
CheckDiff OK - CommitLimit-Committed_AS: 24801200 | 24801200;1048576;524288
'''
return {(output.split(' ')[-4])[:-1]: int(output.split(' ')[-3])}
@staticmethod
@error_wrapped
def _to_dict_logwatch(output):
'''
try to parse this output:
WARNING - 0 new of 109 Lines on /access.log|newlines=0;100;5000;0;
or
OK - 0 new of 109 Lines on /access.log|newlines=0;1000;5000;0;
'''
return {'last': int(output.split(' ')[2]), 'total': int(output.split(' ')[5])}
@staticmethod
@error_wrapped
def _to_dict_from_text(output):
'''
try to parse this output:
Status ERROR : Avis-File for Fiege is missing
or
Status OK : file is ...
'''
return {'status': output.split(' ')[1].strip('\n'), 'message': ' '.join(output.split(' ')[3:]).strip('\n')}
@staticmethod
@error_wrapped
def _to_dict_procs(output):
'''
try to parse this output:
PROCS OK: 33 processes with command name 'httpd'
'''
return {'procs': int(output.split(' ')[2])}
@staticmethod
@error_wrapped
def _to_dict_mysql_procs(output):
'''
try to parse this output:
1 threads running. 0 seconds avg
'''
return {'threads': int(output.split(' ')[0]), 'avg': int(output.split(' ')[3])}
@staticmethod
@error_wrapped
def _to_dict_mysql_slave(output):
'''try to parse this output:
Uptime: 38127526 Threads: 2 Questions: 42076974272 Slow queries: 1081545 Opens: 913119 Flush tables: 889 Open tables: 438 Queries per second avg: 1103.585 Slave IO: Yes Slave SQL: Yes Seconds Behind Master: 0
'''
po = dict(re.findall('([a-z][a-z0-9 ]+): ([a-z0-9.()]+)', output, re.IGNORECASE))
for k, v in po.items():
if not re.match('[a-z()]', v, re.IGNORECASE):
po[k] = float(v)
return po
@staticmethod
@error_wrapped
def _to_dict_lounge_queries(output):
'''try to parse this output:
QUERY OK: 'SELECT COUNT(*) FROM global_orders WHERE ( billing_address LIKE '%Rollesbroich%' OR shipping_address LIKE '%Rollesbroich%' OR email LIKE '%Rollesbroich%' OR billing_address LIKE '%Süddeutsche TV%' OR shipping_address LIKE '%Süddeutsche TV%' OR email='[email protected]' ) AND order_date >= DATE_SUB(CURDATE(),INTERVAL 1 DAY);' returned 0.000000
'''
return {'status': ' '.join(output.split()[:2]).strip(':'), 'query': ' '.join(output.split()[2:-2]),
'result': float(output.split()[-1])}
@staticmethod
@error_wrapped
def _to_dict_iostat(output):
'''
try to parse this output:
OK - IOread 0.00 kB/s, IOwrite 214.80 kB/s on sda with 31.10 tps |ioread=0.00;32000;64000;0;iowrite=214.80;30000;40000;0;
'''
return {'ioread': float(output.split(' ')[3]), 'iowrite': float(output.split(' ')[6]),
'tps': float(output.split(' ')[13])}
@staticmethod
@error_wrapped
def _to_dict_hpraid(output):
'''
try to parse this output:
logicaldrive 1 (68.3 GB, RAID 1, OK) -- physicaldrive 1I:1:1 (port 1I:box 1:bay 1, SAS, 146 GB, OK) -- physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SAS, 72 GB, OK) -- logicaldrive 2 (279.4 GB, RAID 1, OK) -- physicaldrive 1I:1:3 (port 1I:box 1:bay 3, SAS, 300 GB, OK) -- physicaldrive 1I:1:4 (port 1I:box 1:bay 4, SAS, 300 GB, OK) -- logicaldrive 3 (279.4 GB, RAID 1, OK) -- physicaldrive 2I:1:5 (port 2I:box 1:bay 5, SAS, 300 GB, OK) -- physicaldrive 2I:1:6 (port 2I:box 1:bay 6, SAS, 300 GB, OK) --
'''
return dict((b.split(' ')[0] + '_' + b.split(' ')[1], b.split(',')[-1].strip(' )')) for b in [a.strip(' --\n')
for a in output.split(' -- ')])
@staticmethod
@error_wrapped
def _to_dict_newsletter(output):
'''
try to parse this output:
OK: Not in timeframe (02:25:00 - 09:00:00)
or
CRITICAL: NL not processed for appdomain 17, Not processed for appdomain 18
'''
return {'status': output.split(': ')[0], 'messages': output.split(': ')[-1].strip('\n').split(',')}
@staticmethod
@error_wrapped
def _to_dict_hpasm(output):
'''
try to parse this output:
OK - System: 'proliant dl360 g6', S/N: 'CZJ947016M', ROM: 'P64 05/05/2011', hardware working fine, da: 3 logical drives, 6 physical drives cpu_0=ok cpu_1=ok ps_2=ok fan_1=46% fan_2=46% fan_3=46% fan_4=46% temp_1=21 temp_2=40 temp_3=40 temp_4=35 temp_5=34 temp_6=37 temp_7=32 temp_8=36 temp_9=32 temp_10=36 temp_11=32 temp_12=33 temp_13=48 temp_14=29 temp_15=32 temp_16=30 temp_17=29 temp_18=39 temp_19=37 temp_20=38 temp_21=45 temp_22=42 temp_23=39 temp_24=48 temp_25=35 temp_26=46 temp_27=35 temp_28=71 | fan_1=46%;0;0 fan_2=46%;0;0 fan_3=46%;0;0 fan_4=46%;0;0 'temp_1_ambient'=21;42;42 'temp_2_cpu#1'=40;82;82 'temp_3_cpu#2'=40;82;82 'temp_4_memory_bd'=35;87;87 'temp_5_memory_bd'=34;78;78 'temp_6_memory_bd'=37;87;87 'temp_7_memory_bd'=32;78;78 'temp_8_memory_bd'=36;87;87 'temp_9_memory_bd'=32;78;78 'temp_10_memory_bd'=36;87;87 'temp_11_memory_bd'=32;78;78 'temp_12_power_supply_bay'=33;59;59 'temp_13_power_supply_bay'=48;73;73 'temp_14_memory_bd'=29;60;60 'temp_15_processor_zone'=32;60;60 'temp_16_processor_zone'=3
or
OK - ignoring 16 dimms with status 'n/a' , System: 'proliant dl360p gen8', S/N: 'CZJ2340R6C', ROM: 'P71 08/20/2012', hardware working fine, da: 1 logical drives, 4 physical drives
'''
return {'status': output.split(' - ')[0], 'message': output.split(' - ')[-1].strip('\n')}
@staticmethod
@error_wrapped
def _parse_memory(output):
result = dict((a.split('=')[0], a.split('=')[1].split(';')[0]) for a in output.split('|')[-1].split())
conv = {
't': 1000000000,
'tb': 1000000000,
'tib': 1073741824,
'g': 1000000,
'gb': 1000000,
'gib': 1048576,
'm': 1000,
'mb': 1000,
'mib': 1024,
'k': 1,
'kb': 1,
'kib': 1.024,
}
p = re.compile(r'^(\d+(?:\.\d+)?)(?:\s+)?(\w+)?$', re.I)
for k in result:
parts = p.findall(result[k])
if len(parts):
v, u = parts[0]
result[k] = (float(v) * conv[u.lower()] if u and u.lower() in conv else float(v))
return result
@staticmethod
@error_wrapped
def _parse_disks(output):
'''try to parse output of /usr/lib/nagios/plugins/check_disk -w 10% -c 5% -u MB
>>> import json; json.dumps(NagiosWrapper._parse_disks('DISK OK - free space: / 80879 MB (69% inode=99%); /dev 64452 MB (99% inode=99%); /selinux 0 MB (100% inode=99%); | /=35303MB;110160;116280;0;122401 /dev=0MB;58006;61229;0;64452 /selinux=0MB;0;0;0;0'), sort_keys=True)
'{"/": {"total_mb": 116280, "used_mb": 35303}, "/dev": {"total_mb": 61229, "used_mb": 0}}'
'''
r = re.compile('[^0-9.]')
performance_data = output.split('|')[-1]
result = dict((m[0], {'used_mb': int(r.sub('', f[0])), 'total_mb': int(int(f[4]) * USABLE_DISKSPACE_FACTOR)})
for (m, f) in [[s.split(';') for s in a.split('=')] for a in performance_data.split()]
if int(f[4]) != 0)
return result
if __name__ == '__main__':
if len(sys.argv) == 3:
checkname = sys.argv[2]
check = NagiosWrapper(sys.argv[1])
print json.dumps(check.nrpe(checkname), indent=4)
elif len(sys.argv) == 4:
checkname = sys.argv[2]
query = sys.argv[3]
check = NagiosWrapper(sys.argv[1])
print json.dumps(check.win(checkname, query=query), indent=4)
elif len(sys.argv) == 5:
checkname = sys.argv[2]
path = sys.argv[3]
query = sys.argv[4]
check = NagiosWrapper(sys.argv[1])
print json.dumps(check.win(checkname, path=path, query=query), indent=4)
elif len(sys.argv) == 6:
checkname = sys.argv[2]
directory = sys.argv[3]
epoch = sys.argv[4]
name = sys.argv[5]
check = NagiosWrapper(sys.argv[1])
print json.dumps(check.nrpe(checkname, directory=directory, epoch=epoch, name=name), indent=4) | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/nagios.py | nagios.py |
from zmon_worker_monitor.zmon_worker.errors import JmxQueryError
import json
import requests
import time
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
class JmxFactory(IFunctionFactoryPlugin):
def __init__(self):
super(JmxFactory, self).__init__()
self._jmxquery_host = None
self._jmxquery_port = None
def configure(self, conf):
"""
Called after plugin is loaded to pass the [configuration] section in their plugin info file
:param conf: configuration dictionary
"""
self._jmxquery_host = conf['jmxquery.host']
self._jmxquery_port = conf['jmxquery.port']
def create(self, factory_ctx):
"""
Automatically called to create the check function's object
:param factory_ctx: (dict) names available for Function instantiation
:return: an object that implements a check function
"""
return propartial(JmxWrapper,
jmxqueryhost=self._jmxquery_host,
jmxqueryport=self._jmxquery_port,
host=factory_ctx['host'],
port=factory_ctx['jmx_port'])
class JmxWrapper(object):
def __init__(self, jmxqueryhost, jmxqueryport, host, port, timeout=5):
#jmxquery running where?
self.jmxquery_host = jmxqueryhost
self.jmxquery_port = jmxqueryport
self.host = host
self.port = port
self.timeout = timeout
self._queries = []
@staticmethod
def _transform_results(data):
'''Transform JSON returned from JMX Query to a reasonable dict
>>> JmxWrapper._transform_results({'results':[{'beanName':'mybean','attributes':{'HeapMemoryUsage':1}}]})
{'HeapMemoryUsage': 1}
>>> JmxWrapper._transform_results({'results':[{'beanName':'a','attributes':{'x':1}}, {'beanName': 'b', 'attributes': {'y': 2}}]})
{'a': {'x': 1}, 'b': {'y': 2}}
>>> JmxWrapper._transform_results({'results':[{'beanName':'a','attributes':{'x':{'compositeType': {}, 'contents': {'y':7}}}}]})
{'x': {'y': 7}}
'''
results = data['results']
d = {}
for result in results:
attr = result['attributes']
for key, val in attr.items():
if 'password' in key.lower():
attr[key] = ''
continue
if isinstance(val, dict) and 'compositeType' in val and 'contents' in val:
# special unpacking of JMX CompositeType objects (e.g. "HeapMemoryUsage")
# we do not want all the CompositeType meta information => just return the actual values
attr[key] = val['contents']
d[result['beanName']] = attr
if len(d) == 1:
# strip the top-level "bean name" keys
return d.values()[0]
else:
return d
def query(self, bean, *attributes):
self._queries.append((bean, attributes))
return self
def _jmxquery_queries(self):
for bean, attributes in self._queries:
query = bean
if attributes:
query += '@' + ','.join(attributes)
yield query
def results(self):
if not self._queries:
raise ValueError('No query to execute')
try:
r = requests.get('http://{}:{}'.format(self.jmxquery_host, self.jmxquery_port), params={'host': self.host, 'port': self.port,
'query': self._jmxquery_queries()}, timeout=2)
if r.status_code == 500:
raise Exception('-do-one-try-')
except:
time.sleep(1)
r = requests.get('http://{}:{}'.format(self.jmxquery_host, self.jmxquery_port), params={'host': self.host, 'port': self.port,
'query': self._jmxquery_queries()}, timeout=2)
output = r.text
try:
data = json.loads(output)
except:
raise JmxQueryError(output)
return self._transform_results(data)
if __name__ == '__main__':
# example call:
# JAVA_HOME=/opt/jdk1.7.0_21/ python jmx.py restsn03 49600 jmxremote.password java.lang:type=Memory HeapMemoryUsage
import sys
jmx = JmxWrapper(*sys.argv[1:4])
print jmx.query(*sys.argv[4:]).results() | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/jmx.py | jmx.py |
import boto3
import collections
import datetime
import fnmatch
import json
import sys
import logging
import requests
import sys
logging.getLogger('botocore').setLevel(logging.WARN)
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
class CloudwatchWrapperFactory(IFunctionFactoryPlugin):
def __init__(self):
super(CloudwatchWrapperFactory, self).__init__()
def configure(self, conf):
return
def create(self, factory_ctx):
"""
Automatically called to create the check function's object
:param factory_ctx: (dict) names available for Function instantiation
:return: an object that implements a check function
"""
return propartial(CloudwatchWrapper, region=factory_ctx.get('entity').get('region', None))
def get_region():
r = requests.get('http://169.254.169.254/latest/dynamic/instance-identity/document', timeout=3)
return r.json()['region']
def matches(dimensions, filters):
for key, pattern in filters.items():
if not fnmatch.fnmatch(''.join(dimensions.get(key, '')), pattern):
return False
return True
class CloudwatchWrapper(object):
def __init__(self, region=None):
if not region:
region = get_region()
self.client = boto3.client('cloudwatch', region_name=region)
def query(self, dimensions, metric_name, statistics='Sum', namespace=None, unit=None, period=60, minutes=5):
filter_dimension_keys = set()
filter_dimension_pattern = {}
for key, val in list(dimensions.items()):
if val == 'NOT_SET':
filter_dimension_keys.add(key)
del dimensions[key]
if val and '*' in val:
filter_dimension_pattern[key] = val
del dimensions[key]
dimension_kvpairs = [{'Name': k, 'Value': v} for k, v in dimensions.items()]
args = {'Dimensions': dimension_kvpairs, 'MetricName': metric_name}
if namespace:
args['Namespace'] = namespace
metrics = self.client.list_metrics(**args)
metrics = metrics['Metrics']
end = datetime.datetime.utcnow()
start = end - datetime.timedelta(minutes=minutes)
data = collections.defaultdict(int)
data['dimensions'] = collections.defaultdict(int)
for metric in metrics:
metric_dimensions = {d['Name']: d['Value'] for d in metric['Dimensions']}
if set(metric_dimensions.keys()) & filter_dimension_keys:
continue
if filter_dimension_pattern and not matches(metric_dimensions, filter_dimension_pattern):
continue
response = self.client.get_metric_statistics(Namespace=metric['Namespace'], MetricName=metric['MetricName'], Dimensions=metric['Dimensions'],
StartTime=start, EndTime=end, Period=period, Statistics=[statistics])
data_points = response['Datapoints']
if data_points:
for [dim_name, dim_val] in metric_dimensions.items():
if not dim_name in data['dimensions']:
data['dimensions'][dim_name] = collections.defaultdict(int)
data['dimensions'][dim_name][dim_val] += data_points[-1][statistics]
data[metric['MetricName']] += data_points[-1][statistics]
return data
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
cloudwatch = CloudwatchWrapper(sys.argv[1])
print "ELB result (eu-west-1 only):"
elb_data = cloudwatch.query({'AvailabilityZone': 'NOT_SET', 'LoadBalancerName': 'pierone-*'}, 'Latency', 'Average')
print(json.dumps(elb_data))
print "Billing result (us-east-1 only):"
billing_data = cloudwatch.query({'Currency': 'USD'}, 'EstimatedCharges', 'Maximum', 'AWS/Billing', None, 3600, 60*4)
print(json.dumps(billing_data)) | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/cloudwatch.py | cloudwatch.py |
from collections import Iterable
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
from zmon_worker_monitor import plugin_manager
class ExceptionsFactory(IFunctionFactoryPlugin):
def __init__(self):
super(ExceptionsFactory, self).__init__()
# fields from dependencies: plugin depends 1 other plugin
self.http_factory = None
def configure(self, conf):
"""
Called after plugin is loaded to pass the [configuration] section in their plugin info file
:param conf: configuration dictionary
"""
return
def create(self, factory_ctx):
"""
Automatically called to create the check function's object
:param factory_ctx: (dict) names available for Function instantiation
:return: an object that implements a check function
"""
entity = factory_ctx['entity']
project = entity['name'] if entity['type'] == 'project' else None
# load plugins dependencies and store them locally for efficiency
if not self.http_factory:
self.http_factory = plugin_manager.get_plugin_obj_by_name('http', 'Function')
return propartial(ExceptionsWrapper,
http_wrapper=self.http_factory.create(factory_ctx),
host=factory_ctx['host'],
instance=factory_ctx['instance'],
project=project)
class ExceptionsWrapper(object):
def __init__(self, http_wrapper, host=None, instance=None, project=None):
self.__http = http_wrapper
self.url = 'https://exceptions.example.com/'
self.host = host
self.instance = instance
self.project = project
def __request(self, path, **params):
return self.__http(path, base_url=self.url, params=params).json()
def count(
self,
host=None,
instance=None,
project=None,
source_class=None,
method_name=None,
exception_class=None,
time_from='-24h',
time_to=None,
level='ERROR',
q=None,
):
return self.__request(
'count',
host=maybe_comma_join(host or self.host),
instance=maybe_comma_join(instance or self.instance),
project=maybe_comma_join(project or self.project),
source_class=maybe_comma_join(source_class),
method_name=maybe_comma_join(method_name),
exception_class=maybe_comma_join(exception_class),
time_from=time_from,
time_to=time_to,
level=maybe_comma_join(level),
q=q,
)['count']
def maybe_comma_join(s):
"""
If `s` is iterable (but not a string), returns a comma-separated Unicode string of the elements of `s`.
Otherwise, returns `s`
>>> maybe_comma_join(['a', 'b', 'c'])
u'a,b,c'
>>> maybe_comma_join([1, 2, 3])
u'1,2,3'
>>> maybe_comma_join([u'\u03B1', u'\u03B2', u'\u03B3'])
u'\u03b1,\u03b2,\u03b3'
>>> maybe_comma_join([])
''
>>> maybe_comma_join('abc')
'abc'
>>> maybe_comma_join(u'\u03B1\u03B2\u03B3')
u'\u03b1\u03b2\u03b3'
>>> maybe_comma_join('')
''
>>> maybe_comma_join(123)
123
"""
if isinstance(s, Iterable) and not isinstance(s, basestring):
return ','.join(unicode(e) for e in s)
else:
return s | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/exceptions_.py | exceptions_.py |
from itertools import groupby
from operator import itemgetter
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
from zmon_worker_monitor import plugin_manager
class JobsFactory(IFunctionFactoryPlugin):
def __init__(self):
super(JobsFactory, self).__init__()
# fields from dependencies: plugin depends 1 other plugin
self.http_factory = None
def configure(self, conf):
"""
Called after plugin is loaded to pass the [configuration] section in their plugin info file
:param conf: configuration dictionary
"""
return
def create(self, factory_ctx):
"""
Automatically called to create the check function's object
:param factory_ctx: (dict) names available for Function instantiation
:return: an object that implements a check function
"""
# load plugins dependencies and store them locally for efficiency
if not self.http_factory:
self.http_factory = plugin_manager.get_plugin_obj_by_name('http', 'Function')
return propartial(JobsWrapper,
http_wrapper=self.http_factory.create(factory_ctx),
project=factory_ctx['entity'].get('name'))
class JobsWrapper(object):
def __init__(self, http_wrapper, environment, project, **kwargs):
self.url = 'https://deployctl.example.com/jobs/history.json/{}/{}'.format(environment, project)
self.__http = http_wrapper
self.http_wrapper_params = kwargs
self.name = itemgetter('name')
def __request(self):
return self.__http(self.url, **self.http_wrapper_params).json()
def lastruns(self):
start_time = itemgetter('start_seconds_ago')
return dict((job, min(runs, key=start_time)) for (job, runs) in groupby(sorted(self.__request(),
key=self.name), key=self.name))
def history(self):
return dict((job, list(runs)) for (job, runs) in groupby(sorted(self.__request(), key=self.name),
key=self.name)) | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/jobs.py | jobs.py |
import sys
import logging
from zmon_worker_monitor.zmon_worker.errors import DbError
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
logger = logging.getLogger(__name__)
# requires:
# sudo apt-get install freetds-dev
# sudo pip install pymssql
# default port
DEFAULT_PORT = 1433
MAX_RESULTS = 100
class MsSqlFactory(IFunctionFactoryPlugin):
def __init__(self):
super(MsSqlFactory, self).__init__()
# fields from config
self._user = None
self._pass = None
def configure(self, conf):
"""
Called after plugin is loaded to pass the [configuration] section in their plugin info file
:param conf: configuration dictionary
"""
self._user = conf['user']
self._pass = conf['pass']
def create(self, factory_ctx):
"""
Automatically called to create the check function's object
:param factory_ctx: (dict) names available for Function instantiation
:return: an object that implements a check function
"""
return propartial(MsSqlWrapper, factory_ctx['host'], factory_ctx['port'], factory_ctx['database'],
user=self._user, password=self._pass, timeout=factory_ctx['soft_time_limit'])
def _import_db_driver():
try:
_cx_MsSql = __import__('pymssql', globals(), locals(), [], -1)
except Exception, e:
logger.exception('Import of module pymssql failed')
raise
return _cx_MsSql
class MsSqlWrapper(object):
# Note: Timeout must be in seconds
def __init__(self, host, port, database, user='robot_zmon', password='', enabled=True, timeout=60):
self.__stmt = None
self.__enabled = enabled
if self.__enabled:
self.__cx_MsSql = _import_db_driver()
port = (int(port) if port and str(port).isdigit() else DEFAULT_PORT)
try:
self.__conn = self.__cx_MsSql.connect('{}:{}'.format(host, port), user, password, database, timeout,
as_dict=True)
self.__cursor = self.__conn.cursor()
except Exception, e:
raise DbError(str(e), operation='Connect to {}:{}'.format(host, port)), None, sys.exc_info()[2]
def execute(self, stmt):
self.__stmt = stmt
return self
def result(self):
# return single row result, will result primitive value if only one column is selected
result = {}
try:
if self.__enabled and self.__cx_MsSql:
cur = self.__cursor
try:
cur.execute(self.__stmt)
row = cur.fetchone()
if row:
result = row
finally:
cur.close()
except Exception, e:
raise DbError(str(e), operation=self.__stmt), None, sys.exc_info()[2]
if len(result) == 1:
return result.values()[0]
else:
return result
def results(self):
# return many rows
results = []
try:
if self.__enabled and self.__cx_MsSql:
cur = self.__cursor
try:
cur.execute(self.__stmt)
rows = cur.fetchmany(MAX_RESULTS)
for row in rows:
results.append(row)
finally:
cur.close()
except Exception, e:
raise DbError(str(e), operation=self.__stmt), None, sys.exc_info()[2]
return results
if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG)
default_sql_stmt = "SELECT 'ONE ROW' AS COLUMN_NAME"
if len(sys.argv) in (6, 7):
check = MsSqlWrapper(sys.argv[1], sys.argv[2], sys.argv[3], user=sys.argv[4], password=sys.argv[5])
if len(sys.argv) == 7:
sql_stmt = sys.argv[6]
else:
print 'executing default statement:', default_sql_stmt
sql_stmt = default_sql_stmt
print '>>> one result:\n', check.execute(sql_stmt).result()
# print '>>> many results:\n', check.execute(sql_stmt).results()
else:
print '{} <host> <port> <database> [sql_stmt]'.format(sys.argv[0]) | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/sql_mssql.py | sql_mssql.py |
from zmon_worker_monitor.zmon_worker.errors import SnmpError
from pysnmp.entity.rfc3413.oneliner import cmdgen
from pysnmp.proto.rfc1902 import Integer, OctetString, Counter32, Counter64
import re
import subprocess32
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
class SnmpFactory(IFunctionFactoryPlugin):
def __init__(self):
super(SnmpFactory, self).__init__()
def configure(self, conf):
"""
Called after plugin is loaded to pass the [configuration] section in their plugin info file
:param conf: configuration dictionary
"""
return
def create(self, factory_ctx):
"""
Automatically called to create the check function's object
:param factory_ctx: (dict) names available for Function instantiation
:return: an object that implements a check function
"""
return propartial(SnmpWrapper, host=factory_ctx['host'])
class SnmpWrapper(object):
def __init__(self, host, community='public', version='v2c', timeout=5):
if re.match(r'^[0-9]+$', str(timeout)):
self.timeout = timeout
if re.match(r'^[\w\-.]+$', host):
self.host = host
self.generator = cmdgen.CommandGenerator()
self.transport = cmdgen.UdpTransportTarget((host, 161), timeout=timeout)
if version == 'v2c':
# self.comm_data = cmdgen.CommunityData('server', community, 1) # 1 means version SNMP v2c
self.comm_data = cmdgen.CommunityData(community)
def memory(self):
'''return {'free': 3, ..}
# 3 UCD-SNMP-MIB::memTotalSwap.0 = INTEGER: 4194300 kB
# 4 UCD-SNMP-MIB::memAvailSwap.0 = INTEGER: 4194300 kB
# 5 UCD-SNMP-MIB::memTotalReal.0 = INTEGER: 32816032 kB
# 6 UCD-SNMP-MIB::memAvailReal.0 = INTEGER: 9392600 kB
# 11 UCD-SNMP-MIB::memTotalFree.0 = INTEGER: 13586900 kB
# 12 UCD-SNMP-MIB::memMinimumSwap.0 = INTEGER: 16000 kB
# 13 UCD-SNMP-MIB::memShared.0 = INTEGER: 0 kB
# 14 UCD-SNMP-MIB::memBuffer.0 = INTEGER: 299992 kB
# 15 UCD-SNMP-MIB::memCached.0 = INTEGER: 6115656 kB
'''
result = {}
oids = {
'swap_total': '1.3.6.1.4.1.2021.4.3.0',
'swap_free': '1.3.6.1.4.1.2021.4.4.0',
'ram_total': '1.3.6.1.4.1.2021.4.5.0',
'ram_free': '1.3.6.1.4.1.2021.4.6.0',
'ram_total_free': '1.3.6.1.4.1.2021.4.11.0',
'swap_min': '1.3.6.1.4.1.2021.4.12.0',
'ram_shared': '1.3.6.1.4.1.2021.4.13.0',
'ram_buffer': '1.3.6.1.4.1.2021.4.14.0',
'ram_cache': '1.3.6.1.4.1.2021.4.15.0',
}
for k, oid in oids.items():
val = self._get_cmd(oid)
result[k] = self.parse(Integer, int, val)
return result
def load(self):
'''
Return CPU Load Averages
Example result: {"load1":0.95,"load5":0.69,"load15":0.72}
'''
result = {}
oids = {'load1': '1.3.6.1.4.1.2021.10.1.3.1', 'load5': '1.3.6.1.4.1.2021.10.1.3.2',
'load15': '1.3.6.1.4.1.2021.10.1.3.3'}
for k, oid in oids.items():
val = self._get_cmd(oid)
result[k] = self.parse(OctetString, lambda x: float(str(x)), val)
return result
def cpu(self):
'''
Returns CPU Percentage
Example result: {"cpu_system":0,"cpu_user":19,"cpu_idle":79}
'''
result = {}
oids = {'cpu_idle': '1.3.6.1.4.1.2021.11.11.0', 'cpu_user': '1.3.6.1.4.1.2021.11.9.0',
'cpu_system': '1.3.6.1.4.1.2021.11.10.0'}
for k, oid in oids.items():
val = self._get_cmd(oid)
result[k] = self.parse(Integer, int, val)
return result
def cpu_raw(self):
result = {}
oids = {
'raw_cpu_user': '1.3.6.1.4.1.2021.11.50.0',
'raw_cpu_system': '.1.3.6.1.4.1.2021.11.52.0',
'raw_cpu_nice': '.1.3.6.1.4.1.2021.11.51.0',
'raw_cpu_idle': '.1.3.6.1.4.1.2021.11.53.0',
}
for k, oid in oids.items():
val = self._get_cmd(oid)
result[k] = self.parse(Counter32, int, val)
return result
def df(self):
'''
Return disk usage information
Example result: {"/data/postgres-wal-nfs-itr":{"percentage_space_used":0,"used_space":160,"total_size":524288000,"device":"zala0-1-stp-02:/vol/zal_pgwal","available_space":524287840,"percentage_inodes_used":0}}
'''
# disk_table = '.1.3.6.1.4.1.2021.9'
# base = '1.3.6.1.4.1.2021.13.15.1.1'
base = '1.3.6.1.4.1.2021.9.1'
base_idx = base + '.1.'
base_name = base + '.2.'
results = {}
idx2name = {}
result_all = self._get_walk(base)
for oid in sorted(result_all.keys()):
if base_idx in oid:
val = str(result_all[oid])
idx2name[val] = None
elif base_name in oid:
idx = oid.split('.')[-1]
val = result_all[oid]
idx2name[idx] = val
for oid in sorted(result_all.keys()):
if oid in base_idx or oid in base_name:
continue
idx = oid.split('.')[-1]
name = str(idx2name[idx])
if 'loop' in name or 'ram' in name:
continue
results[name] = results.get(name, {})
tname = oid
kind = oid.split('.')[-2]
if kind == '3':
tname = 'device'
elif kind == '6':
tname = 'total_size' # kBytes
elif kind == '7':
tname = 'available_space' # kBytes
elif kind == '8':
tname = 'used_space' # kBytes
elif kind == '9':
tname = 'percentage_space_used'
elif kind == '10':
tname = 'percentage_inodes_used'
elif kind == '11':
tname = 'total_size' # Gauge32
elif kind == '13':
tname = 'available_space' # Gauge32
elif kind == '15':
tname = 'used_space' # Gauge32
else:
continue
results[name][tname] = result_all[oid]
return results
def logmatch(self):
# logmatch_table = '.1.3.6.1.4.1.2021.16'
base = '1.3.6.1.4.1.2021.16.2.1'
base_idx = base + '.1.'
base_name = base + '.2.'
results = {}
idx2name = {}
result_all = self._get_walk(base)
for oid in sorted(result_all.keys()):
if base_idx in oid:
val = str(result_all[oid])
idx2name[val] = None
elif base_name in oid:
idx = oid.split('.')[-1]
val = result_all[oid]
idx2name[idx] = val
for oid in sorted(result_all.keys()):
if oid in base_idx or oid in base_name:
continue
idx = oid.split('.')[-1]
name = str(idx2name[idx])
results[name] = results.get(name, {})
tname = oid
kind = oid.split('.')[-2]
if kind == '3':
tname = 'file' # file name
elif kind == '4':
tname = 'regex' # regex string
elif kind == '5':
tname = 'global_count' # counter32
elif kind == '7':
tname = 'current_count' # counter32 since last logrotation
elif kind == '9':
tname = 'last_count' # counter32 since last read
else:
continue
results[name][tname] = result_all[oid]
return results
def interfaces(self):
# IF-MIB::interfaces_table = '1.3.6.1.2.1.2.'
# IF-MIB::ifMIB_table = '1.3.6.1.2.1.31'
base = '1.3.6.1.2.1.2.2.1'
base_idx = base + '.1.'
base_name = base + '.2.'
results = {}
idx2name = {}
result_all = self._get_walk(base)
for oid in sorted(result_all.keys()):
if base_idx in oid:
val = str(result_all[oid])
idx2name[val] = None
elif base_name in oid:
idx = oid.split('.')[-1]
val = result_all[oid]
idx2name[idx] = val
for oid in sorted(result_all.keys()):
if oid in base_idx or oid in base_name:
continue
idx = oid.split('.')[-1]
name = str(idx2name[idx])
results[name] = results.get(name, {})
tname = oid
kind = oid.split('.')[-2]
if kind == '7':
tname = 'opStatus' # operational status
elif kind == '8':
tname = 'adStatus' # administratal status
elif kind == '13':
tname = 'in_discards' # counter32
elif kind == '14':
tname = 'in_error' # counter32
elif kind == '19':
tname = 'out_discards' # counter32
elif kind == '20':
tname = 'out_error' # counter32
else:
continue
results[name][tname] = result_all[oid]
# IF-MIB::ifMIB_table = '1.3.6.1.2.1.31'
base = '1.3.6.1.2.1.31.1.1.1'
base_idx = '1.3.6.1.2.1.2.2.1.1.'
base_name = base + '.1.'
# results = {}
idx2name = {}
result_all = self._get_walk(base)
for oid in sorted(result_all.keys()):
if base_idx in oid:
val = str(result_all[oid])
idx2name[val] = None
elif base_name in oid:
idx = oid.split('.')[-1]
val = result_all[oid]
idx2name[idx] = val
for oid in sorted(result_all.keys()):
if oid in base_idx or oid in base_name:
continue
idx = oid.split('.')[-1]
name = str(idx2name[idx])
results[name] = results.get(name, {})
tname = oid
kind = oid.split('.')[-2]
if kind == '6':
tname = 'in_octets' # counter64
elif kind == '10':
tname = 'out_octets' # counter64
elif kind == '15':
tname = 'speed' # gauge32
else:
continue
results[name][tname] = result_all[oid]
return results
def postgres_backup(self):
# val = self._get_mib('public', 'NET-SNMP-EXTEND-MIB', 'check_postgres_backup')
# res = self.parse(OctetString, str, val)
# Workaround for a too large check response from the script(too large udp packets are blocked by the fw, so we use tcp)
cmd = \
'/usr/bin/snmpget -v2c -c public -t {timeout} tcp:{host} \'NET-SNMP-EXTEND-MIB::nsExtendOutputFull."check_postgres_backup"\''.format(timeout=self.timeout,
host=self.host)
try:
output = subprocess32.check_output(cmd, shell=True, timeout=self.timeout, stderr=subprocess32.STDOUT)
except subprocess32.CalledProcessError, e:
database_backup_size, warnings, check_duration = {}, [str(e.output)], 0
else:
res = output.partition(': ')[2]
s = res.split('|')
warning = s[0]
perfdata = s[-1]
database_backup_size = {}
check_duration = 0
for pd in perfdata.split(' '):
k, _, v = pd.partition('=')
v = v.split(';')[0]
if k == 'time':
check_duration = v
else:
database_backup_size[k] = v
warnings = warning.split(';')
return {'database_backup_size': database_backup_size, 'warnings': warnings, 'check_duration': check_duration}
def disk_pgxlog(self):
result = {}
output = str(self._get_mib('public', 'NET-SNMP-EXTEND-MIB', 'disk_pgxlog'))
output = [i for i in re.split('\s{1,}|\t|\n', output) if i.isdigit() or i.startswith('/')]
output = [output[i:i + 7] for i in range(0, len(output), 7)]
output = [[
i[1],
int(int(i[0]) / 1024),
i[2],
int(i[3]),
int(i[4]),
int(i[5]),
i[6],
] for i in output]
for i in output:
name = str(i[0])
result[name] = {}
for index in range(len(i)):
val = i[index]
if val == i[1]:
tname = 'du_dir'
elif val == i[2]:
tname = 'filesystem'
elif val == i[3]:
tname = 'totalspace'
elif val == i[4]:
tname = 'used_space'
elif val == i[5]:
tname = 'available_space'
elif val == i[6]:
tname = 'mounted_on'
else:
continue
result[name][tname] = i[index]
return result
def conntrackstats(self):
output = str(self._get_mib('public', 'NET-SNMP-EXTEND-MIB', 'conntrackstats'))
return dict((a.split('=')[0].strip(), int(a.split('=')[1])) for a in output.split('|'))
#
# snmp functions
#
def get_list(self, prefix='get', convert=int, *oids):
h = {}
for idx, oid in enumerate(oids):
k = '{0}{1}'.format(prefix, idx)
h[k] = self.get(oid, k, convert)
return h
def get(self, oid, name, convert):
'''Example:
get('1.3.6.1.4.1.2021.4.6.0', 'foo', int) -> {'foo': 42}
'''
val = self._get_cmd(oid)
result = convert(val)
return {name: result}
def _get_mib(self, community, prefix, extend, mib_result='nsExtendOutputFull', path=None):
'''Parameter: mib_result can be 'nsExtendOutputFull', 'nsExtendResult', ..
Example:
_get_mib("public", "NET-SNMP-EXTEND-MIB", "check_postgres_backup")
is the same like:
% snmpget -v2c -c public z-storage02 'NET-SNMP-EXTEND-MIB::nsExtendOutputFull."check_postgres_backup"'
'''
mib = None
if path:
mib = cmdgen.MibVariable(prefix, mib_result, extend).addMibSource(path)
else:
mib = cmdgen.MibVariable(prefix, mib_result, extend)
real_fun = getattr(self.generator, 'getCmd') # SNMPGET
res = errorIndication, errorStatus, errorIndex, varBinds = real_fun(self.comm_data, self.transport, mib)
if not errorIndication is None or errorStatus is True:
msg = 'Error: %s %s %s %s' % res
raise SnmpError(msg)
else:
_, val = varBinds[0]
return val
def _get_mib_bulkwalk(self, community, prefix, table, path=None):
'''
% snmpbulkwalk -v2c -c public myhost123 TCP-MIB::tcpConnTable
'''
mib = None
if path:
mib = cmdgen.MibVariable(prefix, table).addMibSource(path)
else:
mib = cmdgen.MibVariable(prefix, table)
real_fun = getattr(self.generator, 'bulkCmd') # SNMPBULKWALK
res = errorIndication, errorStatus, errorIndex, varBinds = real_fun(self.comm_data, self.transport, 0, 50, mib,
max_rows=100, ignore_non_increasing_oid=True)
if not errorIndication is None or errorStatus is True:
msg = 'Error: %s %s %s %s' % res
raise SnmpError(msg)
else:
res = {}
for items in varBinds:
oid = str(items[0][0])
val = items[0][1]
if isinstance(val, Counter64) or isinstance(val, Counter32) or isinstance(val, Integer):
res[oid] = int(val)
else:
res[oid] = str(val)
return res
def _get_walk(self, oid):
'''Returns a dictionary of oid -> value'''
real_fun = getattr(self.generator, 'nextCmd') # SNMPWALK
res = errorIndication, errorStatus, errorIndex, varBinds = real_fun(self.comm_data, self.transport, oid)
if not errorIndication is None or errorStatus is True:
msg = 'Error: %s %s %s %s' % res
raise SnmpError(msg)
else:
res = {}
for items in varBinds:
oid = str(items[0][0])
val = items[0][1]
if isinstance(val, Counter64) or isinstance(val, Counter32) or isinstance(val, Integer):
res[oid] = int(val)
else:
res[oid] = str(val)
return res
def _get_cmd(self, oid):
real_fun = getattr(self.generator, 'getCmd') # SNMPGET
res = errorIndication, errorStatus, errorIndex, varBinds = real_fun(self.comm_data, self.transport, oid)
if not errorIndication is None or errorStatus is True:
msg = 'Error: %s %s %s %s' % res
raise SnmpError(msg)
else:
_, val = varBinds[0]
return val
# Convert SNMP data to python data
def parse(self, clazz, convert, val):
'''Example: self.parse(Integer, int, Integer(11040956))'''
if not val:
return None
if isinstance(val, clazz):
return convert(val)
raise SnmpError('Could not convert [{}] with {} into {}'.format(val, convert, clazz)) | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/snmp.py | snmp.py |
import logging
import requests
import json
import sys
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
logger = logging.getLogger('zmon-worker.kairosdb-function')
class KairosdbFactory(IFunctionFactoryPlugin):
def __init__(self):
super(KairosdbFactory, self).__init__()
def configure(self, conf):
"""
Called after plugin is loaded to pass the [configuration] section in their plugin info file
:param conf: configuration dictionary
"""
return
def create(self, factory_ctx):
"""
Automatically called to create the check function's object
:param factory_ctx: (dict) names available for Function instantiation
:return: an object that implements a check function
"""
return propartial(KairosdbWrapper, url=factory_ctx.get('entity_url'))
class KairosdbWrapper(object):
def __init__(self, url):
self.url = url
def query(self, name, group_by = [], tags = None, start = -5, end = 0, time_unit='seconds', aggregators = None):
url = self.url + '/api/v1/datapoints/query'
q = {
"start_relative": {
"value": start,
"unit": time_unit
},
"metrics": [{
"name": name,
}]
}
if aggregators is not None:
q["metrics"][0]["aggregators"] = aggregators
if tags is not None:
q["metrics"][0]["tags"] = tags
try:
response = requests.post(url, json=q)
if response.status_code == requests.codes.ok:
return response.json()["queries"][0]
else:
raise Exception("KairosDB Query failed: " + json.dumps(q))
except requests.Timeout, e:
raise HttpError('timeout', self.url), None, sys.exc_info()[2]
except requests.ConnectionError, e:
raise HttpError('connection failed', self.url), None, sys.exc_info()[2]
def tagnames(self):
return []
def tagnames(self):
return []
def metric_tags(self):
return {} | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/kairosdb.py | kairosdb.py |
import redis
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
from zmon_worker_monitor import plugin_manager
STATISTIC_GAUGE_KEYS = frozenset([
'blocked_clients',
'connected_clients',
'connected_slaves',
'instantaneous_ops_per_sec',
'used_memory',
'used_memory_rss',
])
STATISTIC_COUNTER_KEYS = frozenset([
'evicted_keys',
'expired_keys',
'keyspace_hits',
'keyspace_misses',
'total_commands_processed',
'total_connections_received',
])
class RedisFactory(IFunctionFactoryPlugin):
def __init__(self):
super(RedisFactory, self).__init__()
# fields to store dependencies: plugin depends on 1 other plugin
self.counter_factory = None
def configure(self, conf):
"""
Called after plugin is loaded to pass the [configuration] section in their plugin info file
:param conf: configuration dictionary
"""
return
def create(self, factory_ctx):
"""
Automatically called to create the check function's object
:param factory_ctx: (dict) names available for Function instantiation
:return: an object that implements a check function
"""
# load plugins dependencies and store them locally for efficiency
if not self.counter_factory:
self.counter_factory = plugin_manager.get_plugin_obj_by_name('counter', 'Function')
return propartial(RedisWrapper, counter=self.counter_factory.create(factory_ctx), host=factory_ctx['host'])
class RedisWrapper(object):
'''Class to allow only readonly access to underlying redis connection'''
def __init__(self, counter, host, port=6379, db=0, socket_connect_timeout=1):
self._counter = counter('')
self.__con = redis.StrictRedis(host, port, db, socket_connect_timeout=socket_connect_timeout)
def llen(self, key):
return self.__con.llen(key)
def lrange(self, key, start, stop):
return self.__con.lrange(key, start, stop)
def get(self, key):
return self.__con.get(key)
def hget(self, key, field):
return self.__con.hget(key, field)
def hgetall(self, key):
return self.__con.hgetall(key)
def statistics(self):
'''
Return general Redis statistics such as operations/s
Example result::
{
"blocked_clients": 2,
"commands_processed_per_sec": 15946.48,
"connected_clients": 162,
"connected_slaves": 0,
"connections_received_per_sec": 0.5,
"dbsize": 27351,
"evicted_keys_per_sec": 0.0,
"expired_keys_per_sec": 0.0,
"instantaneous_ops_per_sec": 29626,
"keyspace_hits_per_sec": 1195.43,
"keyspace_misses_per_sec": 1237.99,
"used_memory": 50781216,
"used_memory_rss": 63475712
}
'''
data = self.__con.info()
stats = {}
for key in STATISTIC_GAUGE_KEYS:
stats[key] = data.get(key)
for key in STATISTIC_COUNTER_KEYS:
stats['{}_per_sec'.format(key).replace('total_', '')] = \
round(self._counter.key(key).per_second(data.get(key, 0)), 2)
stats['dbsize'] = self.__con.dbsize()
return stats
if __name__ == '__main__':
import sys
import json
# init plugin manager and collect plugins, as done by Zmon when worker is starting
plugin_manager.init_plugin_manager()
plugin_manager.collect_plugins(load_builtins=True, load_env=True)
factory_ctx = {
'redis_host': 'localhost',
}
counter = plugin_manager.get_plugin_obj_by_name('counter', 'Function').create(factory_ctx)
wrapper = RedisWrapper(counter, sys.argv[1])
print json.dumps(wrapper.statistics(), indent=4, sort_keys=True) | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/redis_wrapper.py | redis_wrapper.py |
import json
import redis
import time
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
# round to microseconds
ROUND_SECONDS_DIGITS = 6
class CounterFactory(IFunctionFactoryPlugin):
def __init__(self):
super(CounterFactory, self).__init__()
def configure(self, conf):
"""
Called after plugin is loaded to pass the [configuration] section in their plugin info file
:param conf: configuration dictionary
"""
return
def create(self, factory_ctx):
"""
Automatically called to create the check function's object
:param factory_ctx: (dict) names available for Function instantiation
:return: an object that implements a check function
"""
return propartial(CounterWrapper, key_prefix='{}:{}:'.format(factory_ctx['check_id'], factory_ctx['entity_id']),
redis_host=factory_ctx['redis_host'], redis_port=factory_ctx['redis_port'])
class CounterWrapper(object):
'''Measure increasing counts (per second) by saving the last value in Redis'''
def __init__(self, key, redis_host, redis_port=6379, key_prefix=''):
self.__con = redis.StrictRedis(redis_host, redis_port)
self.key_prefix = key_prefix
self.key(key)
def key(self, key):
'''expose key setter to allow reusing redis connection (CounterWrapper instance)'''
self.__key = 'zmon:counters:{}{}'.format(self.key_prefix, key)
# return self to allow method chaining
return self
def per_second(self, value):
'''return increment rate of counter value (per second)'''
olddata = self.__con.get(self.__key)
result = 0
now = time.time()
if olddata:
olddata = json.loads(olddata)
time_diff = now - olddata['ts']
value_diff = value - olddata['value']
# do not allow negative values (important for JMX counters which will reset after restart/deploy)
result = max(value_diff / time_diff, 0)
newdata = {'value': value, 'ts': round(now, ROUND_SECONDS_DIGITS)}
self.__con.set(self.__key, json.dumps(newdata))
return result
def per_minute(self, value):
'''convenience method: returns per_second(..) / 60'''
return self.per_second(value) / 60.0
if __name__ == '__main__':
counter = CounterWrapper('test', 'localhost', 6379)
print counter.per_second(1)
time.sleep(2)
print counter.per_second(101)
time.sleep(1)
print counter.per_second(111)
time.sleep(1)
print counter.per_minute(211) | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/counter.py | counter.py |
import sys
import re
from zmon_worker_monitor.zmon_worker.errors import DbError
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
DEFAULT_PORT = 3306
MAX_RESULTS = 100
CONNECTION_RE = \
re.compile(r'''
^(?P<host>[^:/]+) # host - either IP o hostname
(:(?P<port>\d+))? # port - integer, optional
/(?P<dbname>\w+) # database name
$
'''
, re.X)
class MySqlFactory(IFunctionFactoryPlugin):
def __init__(self):
super(MySqlFactory, self).__init__()
# fields from config
self._user = None
self._pass = None
def configure(self, conf):
"""
Called after plugin is loaded to pass the [configuration] section in their plugin info file
:param conf: configuration dictionary
"""
self._user = conf['user']
self._pass = conf['pass']
def create(self, factory_ctx):
"""
Automatically called to create the check function's object
:param factory_ctx: (dict) names available for Function instantiation
:return: an object that implements a check function
"""
return propartial(MySqlWrapper, shards=factory_ctx['shards'], user=self._user, password=self._pass,
timeout=factory_ctx['soft_time_limit'] * 1000)
def _import_db_driver():
module_alternatives = 'MySQLdb', 'pymysql'
for module in module_alternatives:
try:
return __import__(module, globals(), locals(), [], -1)
except Exception, e:
if module == module_alternatives[-1]:
raise
else:
# print is well supported by celery, this will end up as a log entry
print 'Warning: Import of module {} failed: {}'.format(module, e)
class MySqlWrapper(object):
'''Shard-aware SQL adapter
sql().execute('SELECT 1').result()
'''
def __init__(self, shards, user='nagios', password='', timeout=60000, shard=None):
'''
Parameters
----------
shards: dict
A dict of shard definitions where key is the shard's name and value is the host/database string.
user: str
password: str
timeout: int
Statement timeout in milliseconds.
shard: str
Optional shard name. If provided, the check will be run on only one shard matching given name.
'''
if not shards:
raise ValueError('SqlWrapper: No shards defined')
if shard and not shards.get(shard):
raise ValueError('SqlWrapper: Shard {} not found in shards definition'.format(shard))
self._cursors = []
self._stmt = None
mdb = _import_db_driver()
for shard_def in ([shards[shard]] if shard else shards.values()):
m = CONNECTION_RE.match(shard_def)
if not m:
raise ValueError('Invalid shard connection: {}'.format(shard_def))
try:
conn = mdb.connect(host=m.group('host'), user=user, passwd=password, db=m.group('dbname'),
port=(int(m.group('port')) if int(m.group('port')) > 0 else DEFAULT_PORT),
connect_timeout=timeout)
except Exception, e:
raise DbError(str(e), operation='Connect to {}'.format(shard_def)), None, sys.exc_info()[2]
# TODO: Find a way to enforce readonly=True as it is done in postgres Wrapper
# TODO: Do we need to set charset="utf8" and use_unicode=True in connection?
conn.autocommit(True)
self._cursors.append(conn.cursor(mdb.cursors.DictCursor))
def execute(self, stmt):
self._stmt = stmt
return self
def result(self, agg=sum):
'''return single row result, will result primitive value if only one column is selected'''
result = {}
try:
for cur in self._cursors:
try:
cur.execute(self._stmt)
row = cur.fetchone()
if row:
for k, v in row.items():
result[k] = result.get(k, [])
result[k].append(v)
finally:
cur.close()
except Exception, e:
raise DbError(str(e), operation=self._stmt), None, sys.exc_info()[2]
for k, v in result.items():
try:
result[k] = agg(v)
except:
# just use list if aggregation function fails
# (e.g. if we try to sum strings)
result[k] = v
if len(result) == 1:
return result.values()[0]
else:
return result
def results(self):
'''return many rows'''
results = []
try:
for cur in self._cursors:
try:
cur.execute(self._stmt)
rows = cur.fetchmany(MAX_RESULTS)
for row in rows:
results.append(dict(row))
finally:
cur.close()
except Exception, e:
raise DbError(str(e), operation=self._stmt), None, sys.exc_info()[2]
return results
if __name__ == '__main__':
default_dbname = 'mysql'
default_sql_stmt = 'SELECT VERSION()' # SELECT Host,User FROM user
if len(sys.argv) in (6, 7):
if len(sys.argv) == 7:
shards = {'test': sys.argv[1] + ':' + sys.argv[2] + '/' + sys.argv[3]}
sql_stmt = sys.argv[6]
else:
print 'executing default statement:', default_sql_stmt
shards = {'test': sys.argv[1] + ':' + sys.argv[2] + '/' + default_dbname}
sql_stmt = default_sql_stmt
check = MySqlWrapper(shards, user=sys.argv[4], password=sys.argv[5])
# print '>>> many results:\n', check.execute(sql_stmt).results()
print '>>> one result:\n', check.execute(sql_stmt).result()
else:
print '{} <host> <port> <dbname> <user> <password> [sql_stmt]'.format(sys.argv[0]) | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/builtins/plugins/sql_mysql.py | sql_mysql.py |
import requests
from notification import BaseNotification
import zmon_worker_monitor.eventloghttp as eventlog
import logging
logger = logging.getLogger(__name__)
SMS_PROVIDER_URL = 'https://gateway.smstrade.de'
SMS_SENDER = 'zmon2'
SMS_API_KEY = ''
SMS_ROUTE = 'gold'
SMS_MAXLENGTH = 2048
#logger = get_task_logger('zmon-worker')
class SmsException(Exception):
pass
class Sms(BaseNotification):
@classmethod
def send(cls, alert, *args, **kwargs):
provider_url = cls._config.get('notifications.sms.provider_url', SMS_PROVIDER_URL)
phone_numbers = BaseNotification.resolve_group(args, phone=True)
repeat = kwargs.get('repeat', 0)
maxlen = cls._config.get('notifications.sms.maxlength', SMS_MAXLENGTH)
message = cls._get_subject(alert, custom_message=kwargs.get('message'))[:maxlen]
request_params = {
'to': '',
'key': cls._config['notifications.sms.apikey'],
'from': cls._config.get('notifications.sms.sender', SMS_SENDER),
'route': cls._config.get('notifications.sms.route', SMS_ROUTE),
'message': message,
'cost': 1,
'message_id': 1,
}
alert_id = alert.get('alert_def', {}).get('id', 0)
entity = alert.get('entity', {}).get('id', 0)
try:
if cls._config.get('notifications.sms.on', True):
for phone in phone_numbers:
request_params['to'] = phone
r = requests.get(provider_url, params=request_params, verify=False)
url_secured = r.url.replace(request_params['key'], '*' * len(request_params['key']))
logger.info('SMS sent: request to %s --> status: %s, response headers: %s, response body: %s',
url_secured, r.status_code, r.headers, r.text)
r.raise_for_status()
eventlog.log(cls._EVENTS['SMS_SENT'].id, alertId=alert_id, entity=entity, phoneNumber=phone,
httpStatus=r.status_code)
except Exception:
logger.exception('Failed to send sms for alert %s with id %s to: %s', alert['name'], alert['id'],
list(phone_numbers))
finally:
return repeat
if __name__ == '__main__':
Sms.update_config({
'notifications.sms.on': True,
'notifications.sms.apikey': '--secret--',
'notifications.sms.sender': 'zmon2',
'notifications.sms.route': 'gold',
})
test_recipients = ['1stlevel']
fake_alert = {
'is_alert': True,
'alert_def': {'name': 'Test'},
'entity': {'id': 'hostxy'},
'captures': {},
}
Sms.send(fake_alert, *test_recipients, **{'message': 'My customized zmon2 alert message'})
Sms.send(fake_alert, *test_recipients) | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/zmon_worker/notifications/sms.py | sms.py |
import jinja2
import os
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from notification import BaseNotification
import logging
logger = logging.getLogger(__name__)
thisdir = os.path.join(os.path.dirname(__file__))
template_dir = os.path.join(thisdir, '../templates/mail')
jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader(template_dir))
class Mail(BaseNotification):
@classmethod
def send(cls, alert, *args, **kwargs):
sender = cls._config.get('notifications.mail.sender')
subject = cls._get_subject(alert, custom_message=kwargs.get('subject'))
html = kwargs.get('html', False)
cc = kwargs.get('cc', [])
hide_recipients = kwargs.get('hide_recipients', True)
repeat = kwargs.get('repeat', 0)
expanded_alert_name = cls._get_expanded_alert_name(alert)
try:
tmpl = jinja_env.get_template('alert.txt')
body_plain = tmpl.render(expanded_alert_name=expanded_alert_name, **alert)
except Exception:
logger.exception('Error parsing email template for alert %s with id %s', alert['name'], alert['id'])
else:
if html:
msg = MIMEMultipart('alternative')
tmpl = jinja_env.get_template('alert.html')
body_html = tmpl.render(expanded_alert_name=expanded_alert_name, **alert)
part1 = MIMEText(body_plain.encode('utf-8'), 'plain', 'utf-8')
part2 = MIMEText(body_html.encode('utf-8'), 'html', 'utf-8')
msg.attach(part1)
msg.attach(part2)
else:
msg = MIMEText(body_plain.encode('utf-8'), 'plain', 'utf-8')
msg['Subject'] = subject
msg['From'] = 'ZMON 2 <{}>'.format(sender)
args = BaseNotification.resolve_group(args)
if hide_recipients:
msg['To'] = 'Undisclosed Recipients <{}>'.format(sender)
msg['Bcc'] = ', '.join(args)
else:
msg['To'] = ', '.join(args)
msg['Cc'] = ', '.join(cc)
mail_host = cls._config.get('notifications.mail.host', 'localhost')
mail_port = cls._config.get('notifications.mail.port', '25')
logger.info("Relaying via %s %s", mail_host, mail_port)
if cls._config.get('notifications.mail.on', True):
try:
if mail_host != 'localhost':
s = smtplib.SMTP_SSL(mail_host, mail_port)
else:
s = smtplib.SMTP(mail_host, mail_port)
except Exception:
logger.exception('Error connecting to SMTP server %s for alert %s with id %s',
mail_host, alert['name'], alert['id'])
else:
try:
mail_user = cls._config.get('notifications.mail.user', None)
if mail_user is not None:
s.login(mail_user, cls._config.get('notifications.mail.password'))
s.sendmail(sender, list(args) + cc, msg.as_string())
except SMTPAuthenticationError:
logger.exception('Error sending email for alert %s with id %s: authentication failed for %s', alert['name'], alert['id'], mail_user)
except Exception:
logger.exception('Error sending email for alert %s with id %s', alert['name'], alert['id'])
finally:
s.quit()
finally:
return repeat
if __name__ == '__main__':
import sys
Mail.send({'entity': {'id': 'test'}, 'value': 5}, *sys.argv[1:]) | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/zmon_worker/notifications/mail.py | mail.py |
import datetime
import logging
class BaseNotification(object):
_config = {}
_EVENTS = None
@classmethod
def update_config(cls, new_config):
cls._config.update(new_config)
@classmethod
def register_eventlog_events(cls, events):
cls._EVENTS = events
@classmethod
def set_redis_con(cls, r):
cls.__redis_conn = r
@classmethod
def _get_subject(cls, alert, custom_message=None):
"""
>>> BaseNotification._get_subject({'is_alert': True, 'changed': True, 'alert_def':{'name': 'Test'}, 'entity':{'id':'hostxy'}, 'captures': {}})
'NEW ALERT: Test on hostxy'
>>> BaseNotification._get_subject({'is_alert': True, 'changed': False, 'alert_def':{'name': 'Test'}, 'entity':{'id':'hostxy'}, 'captures': {}, 'duration': datetime.timedelta(seconds=30)})
'ALERT ONGOING: Test on hostxy for 0:00:30'
"""
if alert['changed']:
event = ('NEW ALERT' if alert and alert.get('is_alert') else 'ALERT ENDED')
else:
event = 'ALERT ONGOING'
name = cls._get_expanded_alert_name(alert, custom_message)
if not custom_message:
return ('{}: {} on {} for {}'.format(event, name, alert['entity']['id'], str(alert['duration'
])[:7]) if alert.get('duration') else '{}: {} on {}'.format(event, name, alert['entity']['id']))
else:
return '{}: {}'.format(event, name)
@classmethod
def _get_expanded_alert_name(cls, alert, custom_message=None):
name = (alert['alert_def']['name'] if not custom_message else custom_message)
try:
replacements = {'entities': alert['entity']['id']}
replacements.update(alert['captures'])
return name.format(**replacements)
except KeyError, e:
return name # This is fairly normal. Just use the unformatted name.
except Exception, e:
return "<<< Unformattable name '{name}': {message} >>>".format(name=name, message=e)
@classmethod
def send(cls, alert, *args, **kwargs):
raise NotImplementedError('Method meant to be overriden by subclass')
@classmethod
def resolve_group(cls, targets, phone=False):
new_targets = []
for target in targets:
prefix = target[0:target.find(':')+1]
if not prefix in ['group:', 'active:']:
new_targets.append(target)
continue
group_id = target[target.find(':')+1:]
key = 'zmon:group:'+group_id + (':members' if prefix == 'group:' else ':active')
team = cls.__redis_conn.smembers(key)
if not team:
logging.warn("no members found for group: %s", target)
continue
if not phone:
new_targets.extend(team)
else:
for m in team:
phone_numbers = cls.__redis_conn.smembers('zmon:member:'+m+':phone')
new_targets.extend(phone_numbers)
logging.info("Redirect notifications: from %s to %s", targets, new_targets)
return new_targets | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/zmon_worker/notifications/notification.py | notification.py |
import logging
from zmon_worker_monitor.zmon_worker.errors import CheckError
from functools import partial
from suds.client import Client
from zmon_worker_monitor.zmon_worker.common.time_ import parse_timedelta
from timeperiod import in_period, InvalidFormat
from zmon_worker_monitor.zmon_worker.common.utils import async_memory_cache
import sys
import json
import redis
import time
logger = logging.getLogger(__name__)
CHECK_REFRESH_TIME = 240
ALERT_REFRESH_TIME = 120
class ZmonWrapper(object):
ZMON_ALERTS_ENTITIES_PATTERN = 'zmon:alerts:*:entities'
def __init__(self, wsdl, host, port):
try:
self.__ws_client = Client(url=wsdl)
self.__ws_client.set_options(cache=None)
except Exception:
raise CheckError('ZmonWrapper Error: failed to connect to zmon-controller')
self.__redis = redis.StrictRedis(host, port)
self.__checks = {}
self.__alerts = []
self.logger = logger
self.__checks = self.__load_check_definitions()
self.__alerts = self.__load_alert_definitions()
@async_memory_cache.cache_on_arguments(namespace='zmon-worker', expiration_time=ALERT_REFRESH_TIME)
def __load_alert_definitions(self):
try:
response = self.__ws_client.service.getAllActiveAlertDefinitions()
except Exception:
self.logger.exception('ZmonWrapper Error: failed to load alert definitions')
raise CheckError('ZmonWrapper Error: failed to load alert definitions'), None, sys.exc_info()[2]
else:
return [{
'id': a.id,
'team': a.team,
'responsible_team': a.responsibleTeam,
'check_id': a.checkDefinitionId,
'period': (a.period or '' if hasattr(a, 'period') else ''),
} for a in response[1]]
@async_memory_cache.cache_on_arguments(namespace='zmon-worker', expiration_time=CHECK_REFRESH_TIME)
def __load_check_definitions(self):
try:
response = self.__ws_client.service.getAllActiveCheckDefinitions()
except Exception:
self.logger.exception('ZmonWrapper Error: failed to load check definitions')
raise CheckError('ZmonWrapper Error: failed to load check definitions'), None, sys.exc_info()[2]
else:
return dict((c.id, {'interval': c.interval}) for c in response[1])
@staticmethod
def _is_entity_alert_stale(last_run, period):
'''
Checks whether check's last run is within given period.
>>> ZmonWrapper._is_entity_alert_stale(None, 60)
False
>>> ZmonWrapper._is_entity_alert_stale(time.time(), 10)
False
>>> ZmonWrapper._is_entity_alert_stale(time.time() - 20, 10)
True
'''
return (False if last_run is None else time.time() - last_run > period)
def __is_alert_stale(self, alert, evaluated_alerts, check_results, multiplier, offset):
a_id = alert['id'] # alert id
c_id = alert['check_id'] # check id
r_id = partial('{}:{}'.format, c_id) # helper function used in iterator to generate result id
try:
is_in_period = in_period(alert.get('period', ''))
except InvalidFormat:
self.logger.warn('Alert with id %s has malformed time period.', a_id)
is_in_period = True
if is_in_period:
return a_id not in evaluated_alerts or any(self._is_entity_alert_stale(check_results.get(r_id(entity)),
multiplier * self.__checks[c_id]['interval'] + offset)
for entity in evaluated_alerts[a_id])
else:
return False
def stale_active_alerts(self, multiplier=2, offset='5m'):
'''
Returns a list of alerts that weren't executed in a given period of time. The period is calculated using
multiplier and offset: check's interval * multiplier + offset.
Parameters
----------
multiplier: int
Multiplier for check's interval.
offset: str
Time offset, for details see parse_timedelta function in zmon-worker/src/function/time_.py.
Returns
-------
list
A list of stale active alerts.
'''
alert_entities = self.__redis.keys(self.ZMON_ALERTS_ENTITIES_PATTERN)
# Load evaluated alerts and their entities from redis.
p = self.__redis.pipeline()
for key in alert_entities:
p.hkeys(key)
entities = p.execute()
evaluated_alerts = dict((int(key.split(':')[2]), entities[i]) for (i, key) in enumerate(alert_entities))
# Load check results for previously loaded alerts and entities.
check_ids = []
for alert in self.__alerts:
if alert['id'] in evaluated_alerts:
for entity in evaluated_alerts[alert['id']]:
p.lindex('zmon:checks:{}:{}'.format(alert['check_id'], entity), 0)
check_ids.append('{}:{}'.format(alert['check_id'], entity))
results = p.execute()
check_results = dict((check_id, json.loads(results[i])['ts']) for (i, check_id) in enumerate(check_ids)
if results[i])
return [{'id': alert['id'], 'team': alert['team'], 'responsible_team': alert['responsible_team']} for alert in
self.__alerts if self.__is_alert_stale(alert, evaluated_alerts, check_results, multiplier,
parse_timedelta(offset).total_seconds())]
def check_entities_total(self):
'''
Returns total number of checked entities.
'''
alert_entities = self.__redis.keys(self.ZMON_ALERTS_ENTITIES_PATTERN)
p = self.__redis.pipeline()
for key in alert_entities:
p.hkeys(key)
entities = p.execute()
return sum(len(e) for e in entities) | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/zmon_worker/functions/zmon.py | zmon.py |
import psycopg2
import re
import sys
from zmon_worker_monitor.zmon_worker.errors import CheckError, InsufficientPermissionsError, DbError
from psycopg2.extras import NamedTupleCursor
DEFAULT_PORT = 5432
CONNECTION_RE = \
re.compile(r'''
^(?P<host>[^:/]+) # host - either IP o hostname
(:(?P<port>\d+))? # port - integer, optional
/(?P<dbname>\w+) # database name
$
'''
, re.X)
ABSOLUTE_MAX_RESULTS = 1000000
REQUIRED_GROUP = 'zalandos'
PERMISSIONS_STMT = \
'''
SELECT r.rolcanlogin AS can_login,
ARRAY(SELECT b.rolname
FROM pg_catalog.pg_auth_members m
JOIN pg_catalog.pg_roles b ON (m.roleid = b.oid)
WHERE m.member = r.oid) AS member_of
FROM pg_catalog.pg_roles r
WHERE r.rolname = %s;
'''
NON_SAFE_CHARS = re.compile(r'[^a-zA-Z_0-9-]')
def make_safe(s):
'''
>>> make_safe('Bad bad \\' 123')
'Badbad123'
'''
if not s:
return ''
return NON_SAFE_CHARS.sub('', s)
class SqlWrapper(object):
'''Shard-aware SQL adapter
sql().execute('SELECT 1').result()
'''
def __init__(
self,
shards,
user='nagios',
password='',
timeout=60000,
shard=None,
created_by=None,
check_id=None,
):
'''
Parameters
----------
shards: dict
A dict of shard definitions where key is the shard's name and value is the host/database string.
user: str
password: str
timeout: int
Statement timeout in milliseconds.
shard: str
Optional shard name. If provided, the check will be run on only one shard matching given name.
created_by: str
Optional user name. If provided, the check will first make sure that the user has permissions to access the
requested database. It's optional because it's currently supported only in trial run.
check_id: int
The check definition ID in order to set PostgreSQL application name (easier tracking on server side).
'''
if not shards:
raise CheckError('SqlWrapper: No shards defined')
if shard and not shards.get(shard):
raise CheckError('SqlWrapper: Shard {} not found in shards definition'.format(shard))
self._cursors = []
self._stmt = None
permissions = {}
for shard_def in ([shards[shard]] if shard else shards.values()):
m = CONNECTION_RE.match(shard_def)
if not m:
raise CheckError('Invalid shard connection: {}'.format(shard_def))
connection_str = \
"host='{host}' port='{port}' dbname='{dbname}' user='{user}' password='{password}' connect_timeout=5 options='-c statement_timeout={timeout}' application_name='ZMON Check {check_id} (created by {created_by})' ".format(
host=m.group('host'),
port=int(m.group('port') or DEFAULT_PORT),
dbname=m.group('dbname'),
user=user,
password=password,
timeout=timeout,
check_id=check_id,
created_by=make_safe(created_by),
)
try:
conn = psycopg2.connect(connection_str)
conn.set_session(readonly=True, autocommit=True)
cursor = conn.cursor(cursor_factory=NamedTupleCursor)
self._cursors.append(cursor)
except Exception, e:
raise DbError(str(e), operation='Connect to {}'.format(shard_def)), None, sys.exc_info()[2]
try:
if created_by:
cursor.execute(PERMISSIONS_STMT, [created_by])
row = cursor.fetchone()
permissions[shard_def] = (row.can_login and REQUIRED_GROUP in row.member_of if row else False)
except Exception, e:
raise DbError(str(e), operation='Permission query'), None, sys.exc_info()[2]
for resource, permitted in permissions.iteritems():
if not permitted:
raise InsufficientPermissionsError(created_by, resource)
def execute(self, stmt):
self._stmt = stmt
return self
def result(self, agg=sum):
'''return single row result, will result primitive value if only one column is selected'''
result = {}
try:
for cur in self._cursors:
try:
cur.execute(self._stmt)
row = cur.fetchone()
if row:
for k, v in row._asdict().items():
result[k] = result.get(k, [])
result[k].append(v)
finally:
cur.close()
except Exception, e:
raise DbError(str(e), operation=self._stmt), None, sys.exc_info()[2]
for k, v in result.items():
try:
result[k] = agg(v)
except:
# just use list if aggregation function fails
# (e.g. if we try to sum strings)
result[k] = v
if len(result) == 1:
return result.values()[0]
else:
return result
def results(self, max_results=100, raise_if_limit_exceeded=True):
'''return many rows'''
results = []
max_results = min(max_results, ABSOLUTE_MAX_RESULTS)
try:
for cur in self._cursors:
try:
cur.execute(self._stmt)
if raise_if_limit_exceeded:
rows = cur.fetchmany(max_results + 1)
if len(rows) > max_results:
raise DbError('Too many results, result set was limited to {}. Try setting max_results to a higher value.'.format(max_results),
operation=self._stmt)
else:
rows = cur.fetchmany(max_results)
for row in rows:
results.append(row._asdict())
finally:
cur.close()
except Exception, e:
raise DbError(str(e), operation=self._stmt), None, sys.exc_info()[2]
return results
if __name__ == '__main__':
if len(sys.argv) == 4:
check = SqlWrapper([sys.argv[1] + '/' + sys.argv[2]])
print check.execute(sys.argv[3]).result()
elif len(sys.argv) > 1:
print 'sql.py <host> <dbname> <stmt>' | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/zmon_worker/functions/sql.py | sql.py |
try:
from scmmanager import StashApi
except:
StashApi = None
import os
import yaml
import logging
from yaml.scanner import ScannerError
class StashAccessor(object):
def __init__(self, logger=None):
self._logger = (logger if logger else _get_null_logger())
if StashApi:
self.stash = StashApi()
else:
self.stash = None
def set_logger(self, logger):
self._logger = logger
def get_stash_check_definitions(self, *repo_urls):
'''
Downloads the check definitions found under the given stash repositories.
Returns a list of dict corresponding to the check definitions
'''
check_definitions = []
if self.stash:
for repo_url in repo_urls:
self._logger.info("Scanning Stash url: %s", repo_url)
try:
repo, check_path = self.stash.get_repo_from_scm_url(repo_url)
except Exception:
self._logger.exception('Bad configured stash repo: %s. Exception follows: ', repo_url)
else:
try:
files = [f for f in self.stash.get_files(repo, check_path) if f.endswith('.yaml')]
if not files:
self._logger.warn('No check definitions found in secure repo: %s', repo_url)
for check_file in files:
self._logger.info("Reading file: %s", check_file)
file_path = os.path.join(check_path, check_file)
fd = self.stash.get_content(repo, file_path)
try:
check_definitions.append(yaml.safe_load(fd))
except ScannerError as e:
self._logger.exception("Could not parse file %s/%s", check_path, check_file, e )
except Exception:
self._logger.exception('Unexpected error when fetching info from stash: ')
if repo_urls and not check_definitions: # StashApi returns empty results on failure
self._logger.error('Stash error: Check definition download finished with empty results')
raise Exception('Check definition download finished with empty results')
return check_definitions
def get_stash_commands(self, *repo_urls):
'''
Returns a list of str corresponding to commands found in check_definitions under the given stash repositories
'''
return set(cf['command'] for cf in self.get_stash_check_definitions(*repo_urls) if 'command' in cf)
class NullHandler(logging.Handler):
def emit(self, record):
pass
_null_logger = None
def _get_null_logger():
global _null_logger
if not _null_logger:
handler = NullHandler()
_null_logger = logging.getLogger('NullLogger')
_null_logger.addHandler(handler)
return _null_logger | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/zmon_worker/tasks/stashacc.py | stashacc.py |
import ast
from inspect import isclass
import __future__
from collections import Callable, Counter
import socket
from zmon_worker_monitor.zmon_worker.encoder import JsonDataEncoder
from stashacc import StashAccessor
from zmon_worker_monitor.zmon_worker.common.utils import async_memory_cache, with_retries
from zmon_worker_monitor.zmon_worker.errors import *
import zmon_worker_monitor.eventloghttp as eventlog
import functools
import itertools
import json
import logging
import random
from zmon_worker_monitor.redis_context_manager import RedisConnHandler
import time
import re
import requests
import sys
import setproctitle
from datetime import timedelta, datetime
import urllib
import pytz
import threading
import Queue
from collections import defaultdict
from bisect import bisect_left
from zmon_worker_monitor.zmon_worker.common.time_ import parse_timedelta
from zmon_worker_monitor.zmon_worker.notifications.hipchat import NotifyHipchat
from zmon_worker_monitor.zmon_worker.notifications.slack import NotifySlack
from zmon_worker_monitor.zmon_worker.notifications.mail import Mail
from zmon_worker_monitor.zmon_worker.notifications.sms import Sms
from zmon_worker_monitor.zmon_worker.notifications.hubot import Hubot
from zmon_worker_monitor.zmon_worker.notifications.notification import BaseNotification
from operator import itemgetter
from timeperiod import in_period, InvalidFormat
import functional
from zmon_worker_monitor.zmon_worker.common import mathfun
from zmon_worker_monitor import plugin_manager
logger = logging.getLogger(__name__)
# interval in seconds for sending metrics to graphite
METRICS_INTERVAL = 15
STASH_CACHE_EXPIRATION_TIME = 3600
DEFAULT_CHECK_RESULTS_HISTORY_LENGTH = 20
TRIAL_RUN_RESULT_EXPIRY_TIME = 300
# we allow specifying condition expressions without using the "value" variable
# the following pattern is used to check if "value" has to be prepended to the condition
SIMPLE_CONDITION_PATTERN = re.compile(r'^[<>!=\[]|i[ns] ')
GRAPHITE_REPLACE_KEYCHARS = re.compile(r'[./\s]')
# round to microseconds
ROUND_SECONDS_DIGITS = 6
JMX_CONFIG_FILE = 'jmxremote.password'
KAIROS_ID_FORBIDDEN_RE = re.compile(r'[^a-zA-Z0-9\-_\.]')
HOST_GROUP_PREFIX = re.compile(r'^([a-z]+)')
INSTANCE_PORT_SUFFIX = re.compile(r':([0-9]+)$')
EVENTS = {
'ALERT_STARTED': eventlog.Event(0x34001, ['checkId', 'alertId', 'value']),
'ALERT_ENDED': eventlog.Event(0x34002, ['checkId', 'alertId', 'value']),
'ALERT_ENTITY_STARTED': eventlog.Event(0x34003, ['checkId', 'alertId', 'value', 'entity']),
'ALERT_ENTITY_ENDED': eventlog.Event(0x34004, ['checkId', 'alertId', 'value', 'entity']),
'DOWNTIME_STARTED': eventlog.Event(0x34005, [
'alertId',
'entity',
'startTime',
'endTime',
'userName',
'comment',
]),
'DOWNTIME_ENDED': eventlog.Event(0x34006, [
'alertId',
'entity',
'startTime',
'endTime',
'userName',
'comment',
]),
'SMS_SENT': eventlog.Event(0x34007, ['alertId', 'entity', 'phoneNumber', 'httpStatus']),
'ACCESS_DENIED': eventlog.Event(0x34008, ['userName', 'entity']),
}
eventlog.register_all(EVENTS)
Sms.register_eventlog_events(EVENTS)
get_value = itemgetter('value')
class ProtectedPartial(object):
'''
Provides functools.partial functionality with one additional feature: if keyword arguments contain '__protected'
key with list of arguments as value, the appropriate values will not be overwritten when calling the partial. This
way we can prevent user from overwriting internal zmon parameters in check command. The protected key uses double
underscore to prevent overwriting it, we reject all commands containing double underscores.
'''
def __init__(self, func, *args, **kwargs):
self.__func = func
self.__partial_args = args
self.__partial_kwargs = kwargs
self.__protected = frozenset(kwargs.get('__protected', []))
self.__partial_kwargs.pop('__protected', None)
def __call__(self, *args, **kwargs):
new_kwargs = self.__partial_kwargs.copy()
new_kwargs.update((k, v) for (k, v) in kwargs.iteritems() if k not in self.__protected)
return self.__func(*self.__partial_args + args, **new_kwargs)
def propartial(func, *args, **kwargs):
'''
>>> propartial(int, base=2)('100')
4
>>> propartial(int, base=2)('100', base=16)
256
>>> propartial(int, base=2, __protected=['base'])('100', base=16)
4
'''
return ProtectedPartial(func, *args, **kwargs)
normalize_kairos_id = propartial(KAIROS_ID_FORBIDDEN_RE.sub, '_')
orig_process_title = None
def setp(check_id, entity, msg):
global orig_process_title
if not orig_process_title:
try:
orig_process_title = setproctitle.getproctitle().split(' ')[2].split(':')[0].split('.')[0]
except:
orig_process_title = 'p34XX'
setproctitle.setproctitle('zmon-worker.{} check {} on {} {} {}'.format(orig_process_title, check_id, entity, msg,
datetime.now().strftime('%H:%M:%S.%f')))
def flatten(structure, key='', path='', flattened=None):
path = str(path)
key = str(key)
if flattened is None:
flattened = {}
if type(structure) not in (dict, list):
flattened[((path + '.' if path else '')) + key] = structure
elif isinstance(structure, list):
pass
else:
for new_key, value in structure.items():
flatten(value, new_key, '.'.join(filter(None, [path, key])), flattened)
return flattened
def timed(f):
'''Decorator to "time" a function execution. Wraps the function's result in a new dict.
>>> timed(lambda: 1)()['value']
1
'''
def wrapper(*args, **kwargs):
start = time.time()
res = f(*args, **kwargs)
delta = time.time() - start
# round and use short keys as we will serialize the whole stuff as JSON
return {'value': res, 'ts': round(start, ROUND_SECONDS_DIGITS), 'td': round(delta, ROUND_SECONDS_DIGITS)}
return wrapper
def _get_entity_url(entity):
'''
>>> _get_entity_url({})
>>> _get_entity_url({'url': 'fesn01:39820'})
'http://fesn01:39820'
>>> _get_entity_url({'host': 'fesn01'})
'http://fesn01'
'''
if 'url' in entity:
if entity['url'].startswith('http://') or entity['url'].startswith('https://'):
return entity['url']
return 'http://' + entity['url']
if 'host' in entity:
return 'http://' + entity['host']
return None
def _get_jmx_port(entity):
'''
>>> _get_jmx_port({'instance': '9620'})
49620
'''
if 'instance' in entity:
return int('4' + entity['instance'])
return None
def _get_shards(entity):
'''
>>> _get_shards({'shards': {'shard1': 'host1/db1'}})
{'shard1': 'host1/db1'}
>>> _get_shards({'service_name': 'db'})
{'db': 'db/postgres'}
>>> _get_shards({'service_name': 'db', 'port': 1234})
{'db': 'db:1234/postgres'}
>>> _get_shards({'service_name': 'db:1234', 'port': 1234})
{'db:1234': 'db:1234/postgres'}
>>> _get_shards({'service_name': 'db:1234'})
{'db:1234': 'db:1234/postgres'}
>>> _get_shards({'service_name': 'db-1234', 'port': 1234})
{'db-1234': 'db-1234:1234/postgres'}
>>> _get_shards({'project': 'shop'})
'''
if 'shards' in entity:
return entity['shards']
if 'service_name' in entity:
return {entity['service_name']: ('{service_name}:{port}/postgres'.format(**entity) if 'port' in entity
and not entity['service_name'].endswith(':{}'.format(entity['port'
])) else '{}/postgres'.format(entity['service_name']))}
return None
def entity_values(con, check_id, alert_id,count=1):
return map(get_value, entity_results(con, check_id, alert_id, count))
def entity_results(con, check_id, alert_id, count=1):
all_entities = con.hkeys('zmon:alerts:{}:entities'.format(alert_id))
all_results = []
for entity_id in all_entities:
results = get_results(con, check_id, entity_id, count)
all_results.extend(results)
return all_results
def capture(value=None, captures=None, **kwargs):
'''
>>> capture(1, {})
1
>>> captures={}; capture(1, captures); captures
1
{'capture_1': 1}
>>> captures={'capture_1': 1}; capture(2, captures); sorted(captures.items())
2
[('capture_1', 1), ('capture_2', 2)]
>>> captures={}; capture(captures=captures, mykey=1); captures
1
{'mykey': 1}
>>> p = functools.partial(capture, captures={}); p(1); p(a=1)
1
1
'''
if kwargs:
if len(kwargs) > 1:
raise ValueError('Only one named capture supported')
key, value = kwargs.items()[0]
else:
i = 1
while True:
key = 'capture_{}'.format(i)
if key not in captures:
break
i += 1
captures[key] = value
return value
def _parse_alert_parameter_value(data):
'''
>>> _parse_alert_parameter_value({'value': 10})
10
>>> _parse_alert_parameter_value({'value': '2014-07-03T22:00:00.000Z', 'comment': "desc", "type": "date"})
datetime.date(2014, 7, 3)
'''
allowed_types = {
'int': int,
'float': float,
'str': str,
'bool': bool,
'datetime': lambda json_date: datetime.strptime(json_date, '%Y-%m-%dT%H:%M:%S.%fZ'),
'date': lambda json_date: datetime.strptime(json_date, '%Y-%m-%dT%H:%M:%S.%fZ').date(),
}
value = data['value']
type_name = data.get('type')
if type_name:
try:
value = allowed_types[type_name](value)
except Exception:
raise Exception('Attempted wrong type cast <{}> in alert parameters'.format(type_name))
return value
def _inject_alert_parameters(alert_parameters, ctx):
'''
Inject alert parameters into the execution context dict (ctx)
'''
params_name = 'params'
params = {}
if alert_parameters:
for apname, apdata in alert_parameters.items():
if apname in ctx:
raise Exception('Parameter name: %s clashes in context', apname)
value = _parse_alert_parameter_value(apdata)
params[apname] = value
ctx[apname] = value # inject parameter into context
# inject the whole parameters map so that user can iterate over them in the alert condition
if params_name not in ctx:
ctx[params_name] = params
def alert_series(f, n, con, check_id, entity_id):
""" evaluate given function on the last n check results and return true if the "alert" function f returns true for all values"""
vs = get_results(con, check_id, entity_id, n)
active_count = 0
exception_count = 0
for v in vs:
# counting exceptions thrown during eval as alert being active for that interval
try:
v = v["value"]
r = 1 if f(v) else 0
x =0
except:
r = 1
x = 1
active_count += r
exception_count += x
if exception_count == n:
raise Exception("All alert evaluations failed!")
# activating alert if not enough value found (this should only affect starting period)
return n == active_count or len(vs)<n
def build_condition_context(con, check_id, alert_id, entity, captures, alert_parameters):
'''
>>> plugin_manager.collect_plugins(); 'timeseries_median' in build_condition_context(None, 1, 1, {'id': '1'}, {}, {})
True
>>> 'timeseries_percentile' in build_condition_context(None, 1, 1, {'id': '1'}, {}, {})
True
'''
history_factory = plugin_manager.get_plugin_obj_by_name('history', 'Function')
ctx = build_default_context()
ctx['capture'] = functools.partial(capture, captures=captures)
ctx['entity_results'] = functools.partial(entity_results, con=con, check_id=check_id, alert_id=alert_id)
ctx['entity_values'] = functools.partial(entity_values, con=con, check_id=check_id, alert_id=alert_id)
ctx['entity'] = dict(entity)
ctx['history'] = history_factory.create({ 'check_id': check_id, 'entity_id_for_kairos': normalize_kairos_id(entity['id']) })
ctx['value_series'] = functools.partial(get_results_user, con=con, check_id=check_id, entity_id=entity['id'])
ctx['alert_series'] = functools.partial(alert_series, con=con, check_id=check_id, entity_id=entity['id'])
_inject_alert_parameters(alert_parameters, ctx)
for f in (
mathfun.avg,
mathfun.delta,
mathfun.median,
mathfun.percentile,
mathfun.first,
mathfun._min,
mathfun._max,
sum,
):
name = f.__name__
if name.startswith('_'):
name = name[1:]
ctx['timeseries_' + name] = functools.partial(_apply_aggregate_function_for_time, con=con, func=f, check_id=check_id,
entity_id=entity['id'], captures=captures)
return ctx
def _time_slice(time_spec, results):
'''
>>> _time_slice('1s', [])
[]
>>> _time_slice('1s', [{'ts': 0, 'value': 0}, {'ts': 1, 'value': 10}])
[{'ts': 0, 'value': 0}, {'ts': 1, 'value': 10}]
>>> _time_slice('2s', [{'ts': 123.6, 'value': 10}, {'ts': 123, 'value': 0}, {'ts': 121, 'value': -10}])
[{'ts': 123, 'value': 0}, {'ts': 123.6, 'value': 10}]
'''
if len(results) < 2:
# not enough values to calculate anything
return results
get_ts = itemgetter('ts')
results.sort(key=get_ts)
keys = map(get_ts, results)
td = parse_timedelta(time_spec)
last = results[-1]
needle = last['ts'] - td.total_seconds()
idx = bisect_left(keys, needle)
if idx == len(results):
# timerange exceeds range of results
return results
return results[idx:]
def _get_results_for_time(con, check_id, entity_id, time_spec):
results = get_results(con, check_id, entity_id, DEFAULT_CHECK_RESULTS_HISTORY_LENGTH)
return _time_slice(time_spec, results)
def _apply_aggregate_function_for_time(
time_spec,
con,
func,
check_id,
entity_id,
captures,
key=functional.id,
**args
):
results = _get_results_for_time(con, check_id, entity_id, time_spec)
ret = mathfun.apply_aggregate_function(results, func, key=functional.compose(key, get_value), **args)
# put function result in our capture dict for debugging
# e.g. captures["delta(5m)"] = 13.5
captures['{}({})'.format(func.__name__, time_spec)] = ret
return ret
def _build_notify_context(alert):
return {
'send_mail': functools.partial(Mail.send, alert),
'send_email': functools.partial(Mail.send, alert),
'send_sms': functools.partial(Sms.send, alert),
'notify_hubot': functools.partial(Hubot.notify, alert),
'send_hipchat': functools.partial(NotifyHipchat.send, alert),
'send_slack': functools.partial(NotifySlack.send, alert)
}
def _prepare_condition(condition):
'''function to prepend "value" to condition if necessary
>>> _prepare_condition('>0')
'value >0'
>>> _prepare_condition('["a"]>0')
'value ["a"]>0'
>>> _prepare_condition('in (1, 2, 3)')
'value in (1, 2, 3)'
>>> _prepare_condition('value>0')
'value>0'
>>> _prepare_condition('a in (1, 2, 3)')
'a in (1, 2, 3)'
'''
if SIMPLE_CONDITION_PATTERN.match(condition):
# short condition format, e.g. ">=3"
return 'value {}'.format(condition)
else:
# condition is more complex, e.g. "value > 3 and value < 10"
return condition
class PeriodicBufferedAction(object):
def __init__(self, action, action_name=None, retries=5, t_wait=10, t_random_fraction=0.5):
self._stop = True
self.action = action
self.action_name = action_name if action_name else (action.func_name if hasattr(action, 'func_name') else
(action.__name__ if hasattr(action, '__name__') else None))
self.retries = retries
self.t_wait = t_wait
self.t_rand_fraction = t_random_fraction
self._queue = Queue.Queue()
self._thread = threading.Thread(target=self._loop)
self._thread.daemon = True
def start(self):
self._stop = False
self._thread.start()
def stop(self):
self._stop = True
def is_active(self):
return not self._stop
def get_time_randomized(self):
return self.t_wait * (1 + random.uniform(-self.t_rand_fraction, self.t_rand_fraction))
def enqueue(self, data, count=0):
elem = {
'data': data,
'count': count,
# 'time': time.time()
}
try:
self._queue.put_nowait(elem)
except Queue.Full:
logger.exception('Fatal Error: is worker out of memory? Details: ')
def _collect_from_queue(self):
elem_list = []
empty = False
while not empty and not self._stop:
try:
elem_list.append(self._queue.get_nowait())
except Queue.Empty:
empty = True
return elem_list
def _loop(self):
t_last = time.time()
t_wait_last = self.get_time_randomized()
while not self._stop:
if time.time() - t_last >= t_wait_last:
elem_list = self._collect_from_queue()
try:
if elem_list:
self.action([e['data'] for e in elem_list])
except Exception as e:
logger.error('Error executing action %s: %s', self.action_name, e)
for elem in elem_list:
if elem['count'] < self.retries:
self.enqueue(elem['data'], count=elem['count']+1)
else:
logger.error('Error: Maximum retries reached for action %s. Dropping data: %s ',
self.action_name, elem['data'])
finally:
t_last = time.time()
t_wait_last = self.get_time_randomized()
else:
time.sleep(0.2) # so loop is responsive to stop commands
def _log_event(event_name, alert, result, entity=None):
params = {'checkId': alert['check_id'], 'alertId': alert['id'], 'value': result['value']}
if entity:
params['entity'] = entity
eventlog.log(EVENTS[event_name].id, **params)
def _convert_captures(worker_name, alert_id, entity_id, timestamp, captures):
'''
>>> _convert_captures('p0.h', 1, 'e1', 1, {'c0': 'error'})
[]
>>> _convert_captures('p0.h', 1, 'e1', 1, {'c1': '23.4'})
[('p0_h.alerts.1.e1.captures.c1', 23.4, 1)]
>>> _convert_captures('p0.h', 1, 'e1', 1, {'c2': 12})
[('p0_h.alerts.1.e1.captures.c2', 12.0, 1)]
>>> _convert_captures('p0.h', 1, 'e1', 1, {'c3': {'c31': '42'}})
[('p0_h.alerts.1.e1.captures.c3.c31', 42.0, 1)]
>>> _convert_captures('p0.h', 1, 'e1', 1, {'c4': {'c41': 'error'}})
[]
>>> _convert_captures('p0.h', 1, 'e .1/2', 1, {'c 1/2': '23.4'})
[('p0_h.alerts.1.e__1_2.captures.c_1_2', 23.4, 1)]
>>> _convert_captures('p0.h', 1, 'e1', 1, {'c3': {'c 3.1/': '42'}})
[('p0_h.alerts.1.e1.captures.c3.c_3_1_', 42.0, 1)]
'''
result = []
key = '{worker_name}.alerts.{alert_id}.{entity_id}.captures.{capture}'
safe_worker_name = GRAPHITE_REPLACE_KEYCHARS.sub('_', worker_name)
safe_entity_id = GRAPHITE_REPLACE_KEYCHARS.sub('_', entity_id)
for capture, value in captures.iteritems():
safe_capture = GRAPHITE_REPLACE_KEYCHARS.sub('_', capture)
if isinstance(value, dict):
for inner_capture, inner_value in value.iteritems():
try:
v = float(inner_value)
except (ValueError, TypeError):
continue
safe_inner_capture = GRAPHITE_REPLACE_KEYCHARS.sub('_', inner_capture)
result.append(('{}.{}'.format(key.format(worker_name=safe_worker_name, alert_id=alert_id,
entity_id=safe_entity_id, capture=safe_capture), safe_inner_capture), v, timestamp))
else:
try:
v = float(value)
except (ValueError, TypeError):
continue
result.append((key.format(worker_name=safe_worker_name, alert_id=alert_id, entity_id=safe_entity_id,
capture=safe_capture), v, timestamp))
return result
def evaluate_condition(val, condition, **ctx):
'''
>>> evaluate_condition(0, '>0')
False
>>> evaluate_condition(1, '>0')
True
>>> evaluate_condition(1, 'delta("5m")<-10', delta=lambda x:1)
False
>>> evaluate_condition({'a': 1}, '["a"]>10')
False
'''
return safe_eval(_prepare_condition(condition), eval_source='<alert-condition>', value=val, **ctx)
class InvalidEvalExpression(Exception):
pass
class MalformedCheckResult(Exception):
def __init__(self, msg):
Exception.__init__(self, msg)
class Try(Callable):
def __init__(self, try_call, except_call, exc_cls=Exception):
self.try_call = try_call
self.except_call = except_call
self.exc_cls = exc_cls
def __call__(self, *args):
try:
return self.try_call()
except self.exc_cls, e:
return self.except_call(e)
def get_results_user(count=1, con=None, check_id=None, entity_id=None):
return map(lambda x: x["value"], get_results(con, check_id, entity_id, count))
def get_results(con, check_id, entity_id, count=1):
r = map(json.loads, con.lrange('zmon:checks:{}:{}'.format(check_id, entity_id), 0, count - 1))
for x in r:
x.update({"entity_id": entity_id})
return r
def avg(sequence):
'''
>>> avg([])
0
>>> avg([1, 2, 3])
2.0
>>> avg([2, 3])
2.5
'''
l = len(sequence) * 1.0
return (sum(sequence) / l if l else 0)
def empty(v):
'''
>>> empty([])
True
>>> empty([1])
False
'''
return not bool(v)
def build_default_context():
return {
'abs': abs,
'all': all,
'any': any,
'avg': avg,
'basestring': basestring,
'bin': bin,
'bool': bool,
'chain': itertools.chain,
'chr': chr,
'Counter': Counter,
'dict': dict,
'divmod': divmod,
'Exception': Exception,
'empty': empty,
'enumerate': enumerate,
'False': False,
'filter': filter,
'float': float,
'groupby': itertools.groupby,
'hex': hex,
'int': int,
'isinstance': isinstance,
'json': json.loads,
'len': len,
'list': list,
'long': long,
'map': map,
'max': max,
'min': min,
'normalvariate': random.normalvariate,
'oct': oct,
'ord': ord,
'pow': pow,
'range': range,
'reduce': functools.reduce,
'reversed': reversed,
'round': round,
'set': set,
'sorted': sorted,
'str': str,
'sum': sum,
'timestamp': time.time,
'True': True,
'Try': Try,
'tuple': tuple,
'unichr': unichr,
'unicode': unicode,
'xrange': xrange,
'zip': zip,
}
def check_ast_node_is_safe(node):
'''
Check that the ast node does not contain any system attribute calls
as well as exec call (not to construct the system attribute names with strings).
eval() function calls should not be a problem, as it is hopefuly not exposed
in the globals and __builtins__
>>> node = ast.parse('def __call__(): return 1')
>>> node == check_ast_node_is_safe(node)
True
>>> check_ast_node_is_safe(ast.parse('def m(): return ().__class__'))
Traceback (most recent call last):
...
InvalidEvalExpression: alert definition should not try to access hidden attributes (for example '__class__')
>>> check_ast_node_is_safe(ast.parse('def horror(g): exec "exploit = ().__" + "class" + "__" in g'))
Traceback (most recent call last):
...
InvalidEvalExpression: alert definition should not try to execute arbitrary code
'''
for n in ast.walk(node):
if isinstance(n, ast.Attribute):
if n.attr.startswith('__'):
raise InvalidEvalExpression("alert definition should not try to access hidden attributes (for example '__class__')"
)
elif isinstance(n, ast.Exec):
raise InvalidEvalExpression('alert definition should not try to execute arbitrary code')
return node
def safe_eval(expr, eval_source='<string>', **kwargs):
'''
Safely execute expr.
For now expr can be only one python expression, a function definition
or a callable class definition.
If the expression is returning a callable object (like lambda function
or Try() object) it will be called and a result of the call will be returned.
If a result of calling of the defined function or class are returning a callable object
it will not be called.
As access to the hidden attributes is protected by check_ast_node_is_safe() method
we should not have any problem with valnarabilites defined here:
Link: http://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html
TODO: implement compile object cache
>>> safe_eval('value > 0', value=1)
True
>>> safe_eval('def m(): return value', value=10)
10
>>> safe_eval('def m(param): return value', value=10)
Traceback (most recent call last):
...
TypeError: m() takes exactly 1 argument (0 given)
>>> safe_eval('lambda: value', value=10)
10
>>> result = safe_eval('def m(): print value', value=10)
Traceback (most recent call last):
...
SyntaxError: invalid syntax
>>> result = safe_eval('print value', value=10)
Traceback (most recent call last):
...
SyntaxError: invalid syntax
>>> safe_eval('def m(): return lambda: value', value=10) #doctest: +ELLIPSIS
<function <lambda> at ...>
>>> safe_eval('error = value', value=10)
Traceback (most recent call last):
...
InvalidEvalExpression: alert definition can contain a python expression, a function call or a callable class definition
>>> safe_eval('def m(): return value.__class__', value=10)
Traceback (most recent call last):
...
InvalidEvalExpression: alert definition should not try to access hidden attributes (for example '__class__')
>>> safe_eval("""
... class CallableClass(object):
...
... def get_value(self):
... return value
...
... def __call__(self):
... return self.get_value()
... """, value=10)
10
>>> safe_eval("""
... class NotCallableClass(object):
...
... def get_value(self):
... return value
...
... def call(self): # this is not a callable class
... return self.get_value()
... """, value=10)
Traceback (most recent call last):
...
InvalidEvalExpression: alert definition should contain a callable class definition (missing __call__ method?)
>>> safe_eval("""
... def firstfunc():
... return value
...
... value > 0
...
... """, value=10)
Traceback (most recent call last):
...
InvalidEvalExpression: alert definition should contain only one python expression, a function call or a callable class definition
'''
g = {'__builtins__': {}, 'object': object, '__name__': __name__}
# __builtins__ should be masked away to disable builtin functions
# object is needed if the NewStyle class is being created
# __name__ is needed to be able to complie a class
g.update(kwargs)
node = compile(expr, eval_source, 'exec', ast.PyCF_ONLY_AST | __future__.CO_FUTURE_PRINT_FUNCTION)
node = check_ast_node_is_safe(node)
body = node.body
if body and len(body) == 1:
x = body[0]
if isinstance(x, ast.FunctionDef) or isinstance(x, ast.ClassDef):
cc = compile(node, eval_source, 'exec') # can be nicely cached
v = {}
exec (cc, g, v)
if len(v) == 1:
c = v.itervalues().next()
if isclass(c):
# we need a class instance and not the class itself
c = c()
if callable(c):
return c() # if a function will return another callable, we will not call it
else:
raise InvalidEvalExpression('alert definition should contain a callable class definition (missing __call__ method?)'
)
else:
raise InvalidEvalExpression('alert definition should contain only one function or one callable class definition'
)
elif isinstance(x, ast.Expr):
cc = compile(expr, eval_source, 'eval', __future__.CO_FUTURE_PRINT_FUNCTION) # can be nicely cached
r = eval(cc, g)
if callable(r):
# Try() returns callable that should be executed
return r()
else:
return r
else:
raise InvalidEvalExpression('alert definition can contain a python expression, a function call or a callable class definition'
)
else:
raise InvalidEvalExpression('alert definition should contain only one python expression, a function call or a callable class definition'
)
class NotaZmonTask(object):
abstract = True
_host = 'localhost'
_port = 6379
_secure_queue = 'zmon:queue:secure'
_db = 0
_con = None
_graphite = None
_counter = Counter()
_captures_local = []
_last_metrics_sent = 0
_last_captures_sent = 0
_logger = None
_logfile = None
_loglevel = logging.DEBUG
_zmon_url = None
_worker_name = None
_queues = None
_stash = None
_stash_cmds = None
_safe_repositories = []
_is_secure_worker = True
_timezone = None
_account = None
_team = None
_dataservice_url = None
_dataservice_poster = None
_plugin_category = 'Function'
_plugins = []
_function_factories = {}
_zmon_actuator_checkid = None
@classmethod
def configure(cls, config):
try:
#configure RedisConnHandler
RedisConnHandler.configure(**config)
except KeyError:
logger.exception('Error creating connection: ')
raise
#cls._loglevel = (logging.getLevelName(config['loglevel']) if 'loglevel' in config else logging.INFO)
cls._logfile = config.get('logfile')
cls._soap_config = {k: v for k, v in config.items() if k.startswith('soap.service')}
cls._zmon_url = config.get('zmon.url')
cls._queues = config.get('zmon.queues', {}).get('local')
cls._safe_repositories = sorted(config.get('safe_repositories', []))
cls._zmon_actuator_checkid = config.get('zmon.actuator.checkid', None)
cls._logger = cls.get_configured_logger()
cls.perload_stash_commands()
cls._is_secure_worker = config.get('worker.is_secure')
cls._timezone = pytz.timezone('Europe/Berlin')
cls._account = config.get('account')
cls._team = config.get('team')
cls._dataservice_url = config.get('dataservice.url')
if cls._dataservice_url:
# start action loop for sending reports to dataservice
cls._logger.info("Enabling data service: {}".format(cls._dataservice_url))
cls._dataservice_poster = PeriodicBufferedAction(cls.send_to_dataservice, retries=10, t_wait=5)
cls._dataservice_poster.start()
cls._plugins = plugin_manager.get_plugins_of_category(cls._plugin_category)
# store function factories from plugins in a dict by name
cls._function_factories = {p.name: p.plugin_object for p in cls._plugins}
def __init__(self):
self.task_context = None
self._cmds_first_accessed = False
@classmethod
def is_secure_worker(cls):
return cls._is_secure_worker
@classmethod
def perload_stash_commands(cls):
cls._stash = StashAccessor(cls.get_configured_logger())
if cls.is_secure_worker():
try:
cls._stash_cmds = cls._stash.get_stash_commands(*cls._safe_repositories)
cls._logger.info('Loaded %d commands from stash secure repos', len(cls._stash_cmds))
except Exception:
cls._logger.exception('Error loading stash commands: ')
@async_memory_cache.cache_on_arguments(namespace='zmon-worker', expiration_time=STASH_CACHE_EXPIRATION_TIME)
@with_retries(max_retries=3, delay=10)
def load_stash_commands(self, repositories):
if not self._cmds_first_accessed:
# ugly but needed to stop celery from refreshing the cache when task process is forked
self._cmds_first_accessed = True
return self._stash_cmds
else:
return self._stash.get_stash_commands(*repositories)
@classmethod
def get_configured_logger(cls):
if not cls._logger:
cls._logger = logger
return cls._logger
@property
def con(self):
self._con = RedisConnHandler.get_instance().get_conn()
BaseNotification.set_redis_con(self._con)
return self._con
@property
def logger(self):
return self.get_configured_logger()
@property
def worker_name(self):
if not self._worker_name:
self._worker_name = 'p{}.{}'.format('local', socket.gethostname())
return self._worker_name
def get_redis_host(self):
return RedisConnHandler.get_instance().get_parsed_redis().hostname
def get_redis_port(self):
return RedisConnHandler.get_instance().get_parsed_redis().port
def send_metrics(self):
now = time.time()
if now > self._last_metrics_sent + METRICS_INTERVAL:
p = self.con.pipeline()
p.sadd('zmon:metrics', self.worker_name)
for key, val in self._counter.items():
p.incrby('zmon:metrics:{}:{}'.format(self.worker_name, key), val)
p.set('zmon:metrics:{}:ts'.format(self.worker_name), now)
p.execute()
self._counter.clear()
self._last_metrics_sent = now
self.logger.info('Send metrics, end storing metrics in redis count: %s, duration: %.3fs', len(self._counter), time.time() - now)
@classmethod
def send_to_dataservice(cls, check_results, timeout=10, method='PUT'):
http_req = {'PUT': requests.put, 'POST': requests.post, 'GET': requests.get}
headers = {'content-type': 'application/json'}
team = cls._team if cls._team is not None else ''
account = cls._account if cls._account is not None else ''
try:
# group check_results by check_id
results_by_id = defaultdict(list)
for cr in check_results:
results_by_id[cr['check_id']].append(cr)
# make separate posts per check_id
for check_id, results in results_by_id.items():
url = '{url}/{account}/{check_id}/'.format(url=cls._dataservice_url.rstrip('/'),
account=urllib.quote(account), check_id=check_id)
worker_result = {
'team': team,
'account': account,
'results': results,
}
r = http_req[method](url, data=json.dumps(worker_result), timeout=timeout, headers=headers)
if r.status_code != requests.codes.ok:
raise Exception('http request to {} got status_code={}'.format(url, r.status_code))
except Exception:
logger.exception('Error in dataservice post: ')
raise
def check_and_notify(self, req, alerts, task_context=None):
self.task_context = task_context
start_time = time.time()
# soft_time_limit = req['interval']
check_id = req['check_id']
entity_id = req['entity']['id']
try:
val = self.check(req)
#TODO: need to support soft and hard time limits soon
# except SoftTimeLimitExceeded, e:
# self.logger.info('Check request with id %s on entity %s exceeded soft time limit', check_id,
# entity_id)
# # PF-3685 It might happen that this exception was raised after sending a command to redis, but before receiving
# # a response. In this case, the connection object is "dirty" and when the same connection gets taken out of the
# # pool and reused, it'll throw an exception in redis client.
# self.con.connection_pool.disconnect()
# notify(check_and_notify, {'ts': start_time, 'td': soft_time_limit, 'value': str(e)}, req, alerts,
# force_alert=True)
except CheckError, e:
# self.logger.warn('Check failed for request with id %s on entity %s. Output: %s', check_id, entity_id, str(e))
self.notify({'ts': start_time, 'td': time.time() - start_time, 'value': str(e), 'worker': self.worker_name, 'exc': 1}, req, alerts,
force_alert=True)
except SecurityError, e:
self.logger.exception('Security exception in request with id %s on entity %s', check_id, entity_id)
self.notify({'ts': start_time, 'td': time.time() - start_time, 'value': str(e), 'worker': self.worker_name, 'exc': 1}, req, alerts,
force_alert=True)
except Exception, e:
# self.logger.exception('Check request with id %s on entity %s threw an exception', check_id, entity_id)
# PF-3685 Disconnect on unknown exceptions: we don't know what actually happened, it might be that redis
# connection is dirty. CheckError exception is "safe", it's thrown by the worker whenever the check returns a
# different response than expected, the user doesn't have access to the checked entity or there's an error in
# check's parameters.
self.con.connection_pool.disconnect()
self.notify({'ts': start_time, 'td': time.time() - start_time, 'value': str(e), 'worker': self.worker_name, 'exc': 1}, req, alerts,
force_alert=True)
else:
self.notify(val, req, alerts)
def trial_run(self, req, alerts, task_context=None):
self.task_context = task_context
start_time = time.time()
# soft_time_limit = req['interval']
entity_id = req['entity']['id']
try:
val = self.check_for_trial_run(req)
#TODO: need to support soft and hard time limits soon
# except SoftTimeLimitExceeded, e:
# trial_run.logger.info('Trial run on entity %s exceeded soft time limit', entity_id)
# trial_run.con.connection_pool.disconnect()
# notify_for_trial_run(trial_run, {'ts': start_time, 'td': soft_time_limit, 'value': str(e)}, req, alerts,
# force_alert=True)
except InsufficientPermissionsError, e:
self.logger.info('Access denied for user %s to run check on %s', req['created_by'], entity_id)
eventlog.log(EVENTS['ACCESS_DENIED'].id, userName=req['created_by'], entity=entity_id)
self.notify_for_trial_run({'ts': start_time, 'td': time.time() - start_time, 'value': str(e)}, req,
alerts, force_alert=True)
except CheckError, e:
self.logger.warn('Trial run on entity %s failed. Output: %s', entity_id, str(e))
self.notify_for_trial_run({'ts': start_time, 'td': time.time() - start_time, 'value': str(e)}, req,
alerts, force_alert=True)
except Exception, e:
self.logger.exception('Trial run on entity %s threw an exception', entity_id)
self.con.connection_pool.disconnect()
self.notify_for_trial_run({'ts': start_time, 'td': time.time() - start_time, 'value': str(e)}, req,
alerts, force_alert=True)
else:
self.notify_for_trial_run(val, req, alerts)
def cleanup(self, *args, **kwargs):
self.task_context = kwargs.get('task_context')
p = self.con.pipeline()
p.smembers('zmon:checks')
p.smembers('zmon:alerts')
check_ids, alert_ids = p.execute()
for check_id in kwargs.get('disabled_checks', {}):
self._cleanup_check(p, check_id)
for alert_id in kwargs.get('disabled_alerts', {}):
self._cleanup_alert(p, alert_id)
for check_id in check_ids:
if check_id in kwargs.get('check_entities', {}):
redis_entities = self.con.smembers('zmon:checks:{}'.format(check_id))
check_entities = set(kwargs['check_entities'][check_id])
# If it happens that we remove all entities for given check, we should remove all the things.
if not check_entities:
p.srem('zmon:checks', check_id)
p.delete('zmon:checks:{}'.format(check_id))
for entity in redis_entities:
p.delete('zmon:checks:{}:{}'.format(check_id, entity))
else:
self._cleanup_common(p, 'checks', check_id, redis_entities - check_entities)
else:
self._cleanup_check(p, check_id)
for alert_id in alert_ids:
if alert_id in kwargs.get('alert_entities', {}):
# Entities that are in the alert state.
redis_entities = self.con.smembers('zmon:alerts:{}'.format(alert_id))
alert_entities = set(kwargs['alert_entities'][alert_id])
# If it happens that we remove all entities for given alert, we should remove all the things.
if not alert_entities:
p.srem('zmon:alerts', alert_id)
p.delete('zmon:alerts:{}'.format(alert_id))
p.delete('zmon:alerts:{}:entities'.format(alert_id))
for entity in redis_entities:
p.delete('zmon:alerts:{}:{}'.format(alert_id, entity))
p.delete('zmon:notifications:{}:{}'.format(alert_id, entity))
else:
self._cleanup_common(p, 'alerts', alert_id, redis_entities - alert_entities)
# All entities matching given alert definition.
all_entities = set(self.con.hkeys('zmon:alerts:{}:entities'.format(alert_id)))
for entity in all_entities - alert_entities:
self.logger.info('Removing entity %s from hash %s', entity,
'zmon:alerts:{}:entities'.format(alert_id))
p.hdel('zmon:alerts:{}:entities'.format(alert_id), entity)
p.delete('zmon:notifications:{}:{}'.format(alert_id, entity))
else:
self._cleanup_alert(p, alert_id)
p.execute()
def _cleanup_check(self, pipeline, check_id):
self.logger.info('Removing check with id %s from zmon:checks set', check_id)
pipeline.srem('zmon:checks', check_id)
for entity_id in self.con.smembers('zmon:checks:{}'.format(check_id)):
self.logger.info('Removing key %s', 'zmon:checks:{}:{}'.format(check_id, entity_id))
pipeline.delete('zmon:checks:{}:{}'.format(check_id, entity_id))
self.logger.info('Removing key %s', 'zmon:checks:{}'.format(check_id))
pipeline.delete('zmon:checks:{}'.format(check_id))
def _cleanup_alert(self, pipeline, alert_id):
self.logger.info('Removing alert with id %s from zmon:alerts set', alert_id)
pipeline.srem('zmon:alerts', alert_id)
for entity_id in self.con.smembers('zmon:alerts:{}'.format(alert_id)):
self.logger.info('Removing key %s', 'zmon:alerts:{}:{}'.format(alert_id, entity_id))
pipeline.delete('zmon:alerts:{}:{}'.format(alert_id, entity_id))
pipeline.delete('zmon:notifications:{}:{}'.format(alert_id, entity_id))
self.logger.info('Removing key %s', 'zmon:alerts:{}'.format(alert_id))
pipeline.delete('zmon:alerts:{}'.format(alert_id))
self.logger.info('Removing key %s', 'zmon:alert:{}:entities'.format(alert_id))
pipeline.delete('zmon:alerts:{}:entities'.format(alert_id))
def _cleanup_common(self, pipeline, entry_type, entry_id, entities):
'''
Removes entities from redis matching given type and id.
Parameters
----------
entry_type: str
Type of entry to remove: 'checks' or 'alerts'.
entry_id: int
Id of entry to remove.
entities: set
A set of entities to remove (difference between entities from scheduler and ones present in redis).
'''
for entity in entities:
self.logger.info('Removing entity %s from set %s', entity, 'zmon:{}:{}'.format(entry_type, entry_id))
pipeline.srem('zmon:{}:{}'.format(entry_type, entry_id), entity)
self.logger.info('Removing key %s', 'zmon:{}:{}:{}'.format(entry_type, entry_id, entity))
pipeline.delete('zmon:{}:{}:{}'.format(entry_type, entry_id, entity))
def _store_check_result(self, req, result):
self.con.sadd('zmon:checks', req['check_id'])
self.con.sadd('zmon:checks:{}'.format(req['check_id']), req['entity']['id'])
key = 'zmon:checks:{}:{}'.format(req['check_id'], req['entity']['id'])
value = json.dumps(result, cls=JsonDataEncoder)
self.con.lpush(key, value)
self.con.ltrim(key, 0, DEFAULT_CHECK_RESULTS_HISTORY_LENGTH - 1)
def check(self, req):
self.logger.debug(req)
# schedule_time = req['schedule_time']
start = time.time()
try:
setp(req['check_id'], req['entity']['id'], 'start')
res = self._get_check_result(req)
setp(req['check_id'], req['entity']['id'], 'done')
except Exception, e:
# PF-3778 Always store check results and re-raise exception which will be handled in 'check_and_notify'.
self._store_check_result(req, {'td': round(time.time() - start, ROUND_SECONDS_DIGITS), 'ts': round(start,
ROUND_SECONDS_DIGITS), 'value': str(e), 'worker': self.worker_name, 'exc': 1})
raise
finally:
# Store duration in milliseconds as redis only supports integers for counters.
# 'check.{}.count'.format(req['check_id']): 1,
# 'check.{}.duration'.format(req['check_id']): int(round(1000.0 * (time.time() - start))),
# 'check.{}.latency'.format(req['check_id']): int(round(1000.0 * (start - schedule_time))),
self._counter.update({
'check.count': 1
})
self.send_metrics()
setp(req['check_id'], req['entity']['id'], 'store')
self._store_check_result(req, res)
setp(req['check_id'], req['entity']['id'], 'stored')
return res
def check_for_trial_run(self, req):
# fake check ID as it is used by check context
req['check_id'] = 'trial_run'
return self._get_check_result(req)
@timed
def _get_check_result_internal(self, req):
self._enforce_security(req)
cmd = req['command']
ctx = self._build_check_context(req)
try:
result = safe_eval(cmd, eval_source='<check-command>', **ctx)
return result() if isinstance(result, Callable) else result
except (SyntaxError, InvalidEvalExpression), e:
raise CheckError(str(e))
def _get_check_result(self, req):
r = self._get_check_result_internal(req)
r['worker'] = self.worker_name
return r
def _enforce_security(self, req):
'''
Check tasks from the secure queue to asert the command to run is specified in stash check definition
Side effect: modifies req to address unique security concerns
Raises SecurityError on check failure
'''
if self.is_secure_worker() or self.task_context['delivery_info'].get('routing_key') == 'secure':
try:
stash_commands = self.load_stash_commands(self._safe_repositories)
except Exception, e:
traceback = sys.exc_info()[2]
raise SecurityError('Unexpected Internal error: {}'.format(e)), None, traceback
if req['command'] not in stash_commands:
raise SecurityError('Security violation: Non-authorized command received in secure environment')
# transformations of entities: hostname "pp-whatever" needs to become "whatever.pp"
prefix = 'pp-'
if 'host' in req['entity'] and str(req['entity']['host']).startswith(prefix):
self.logger.warn('secure req[entity] before pp- transformations: %s', req['entity'])
real_host = req['entity']['host']
#secure_host = '{}.pp'.format(req['entity']['host'][3:])
secure_host = '{}.{}'.format(req['entity']['host'][len(prefix):], prefix[:-1])
# relplace all real host values occurrences with secure_host
req['entity'].update({k: v.replace(real_host, secure_host) for k, v in req['entity'].items() if
isinstance(v, basestring) and real_host in v and k != 'id'})
self.logger.warn('secure req[entity] after pp- transformations: %s', req['entity'])
def _build_check_context(self, req):
'''Build context for check command with all necessary functions'''
entity = req['entity']
# function creation context: passed to function factories create() method
factory_ctx = {
'entity': entity,
'entity_url': _get_entity_url(entity),
'check_id': req['check_id'],
'entity_id': entity['id'],
'host': entity.get('host'),
'port': entity.get('port'),
'instance': entity.get('instance'),
'external_ip': entity.get('external_ip'),
'load_balancer_status': entity.get('load_balancer_status'),
'data_center_code': entity.get('data_center_code'),
'database': entity.get('database'),
'jmx_port': _get_jmx_port(entity),
'shards': _get_shards(entity),
'soft_time_limit': req['interval'],
'redis_host': self.get_redis_host(),
'redis_port': self.get_redis_port(),
'zmon_url': NotaZmonTask._zmon_url,
'entity_id_for_kairos': normalize_kairos_id(entity['id']),
'req_created_by': req.get('created_by'),
}
# check execution context
ctx = build_default_context()
ctx['entity'] = entity
# populate check context with functions from plugins' function factories
for func_name, func_factory in self._function_factories.items():
if func_name not in ctx:
ctx[func_name] = func_factory.create(factory_ctx)
return ctx
def evaluate_alert(self, alert_def, req, result):
'''Check if the result triggers an alert
The function will save the global alert state to the following redis keys:
* zmon:alerts:<ALERT-DEF-ID>:entities hash of entity IDs -> captures
* zmon:alerts set of active alert definition IDs
* zmon:alerts:<ALERT-DEF-ID> set of entity IDs in alert
* zmon:alerts:<ALERT-DEF-ID>:<ENTITY-ID> JSON with alert evaluation result for given alert definition and entity
'''
# captures is our map of "debug" information, e.g. to see values calculated in our condition
captures = {}
alert_id = alert_def['id']
check_id = alert_def['check_id']
alert_parameters = alert_def.get('parameters')
try:
result = evaluate_condition(result['value'], alert_def['condition'], **build_condition_context(self.con,
check_id, alert_id, req['entity'], captures, alert_parameters))
except Exception, e:
captures['exception'] = str(e)
result = True
try:
is_alert = bool((result() if isinstance(result, Callable) else result))
except Exception, e:
captures['exception'] = str(e)
is_alert = True
# add parameters to captures so they can be substituted in alert title
if alert_parameters:
pure_captures = captures.copy()
try:
captures = {k: p['value'] for k, p in alert_parameters.items()}
except Exception, e:
self.logger.exception('Error when capturing parameters: ')
captures.update(pure_captures)
return is_alert, captures
def send_notification(self, notification, context):
ctx = _build_notify_context(context)
try:
repeat = safe_eval(notification, eval_source='<check-command>' , **ctx)
except Exception, e:
# TODO Define what should happen if sending emails or sms fails.
self.logger.exception(e)
else:
if repeat:
self.con.hset('zmon:notifications:{}:{}'.format(context['alert_def']['id'], context['entity']['id']),
notification, time.time() + repeat)
def notify(self, val, req, alerts, force_alert=False):
'''
Process check result and evaluate all alerts. Returns list of active alert IDs
Parameters
----------
val: dict
Check result, see check function
req: dict
Check request dict
alerts: list
A list of alert definitions matching the checked entity
force_alert: bool
An optional flag whether to skip alert evalution and force "in alert" state. Used when check request exceeds
time limit or throws other exception, this way unexpected conditions are always treated as alerts.
Returns
-------
list
A list of alert definitions matching given entity.
'''
ts_serialize = lambda ts: datetime.fromtimestamp(ts, tz=self._timezone).isoformat(' ') if ts else None
result = []
entity_id = req['entity']['id']
start = time.time()
check_result = {
'time': ts_serialize(val.get('ts')) if isinstance(val, dict) else None,
'run_time': val.get('td') if isinstance(val, dict) else None, # TODO: should be float or is it milliseconds?
'check_id': req['check_id'],
'entity_id': req['entity']['id'],
'check_result': val,
'exception': True if isinstance(val, dict) and val.get('exc') else False,
'alerts': {},
}
try:
setp(req['check_id'], entity_id, 'notify loop')
for alert in alerts:
alert_id = alert['id']
alert_entities_key = 'zmon:alerts:{}'.format(alert_id)
alerts_key = 'zmon:alerts:{}:{}'.format(alert_id, entity_id)
notifications_key = 'zmon:notifications:{}:{}'.format(alert_id, entity_id)
is_alert, captures = ((True, {}) if force_alert else self.evaluate_alert(alert, req, val))
func = getattr(self.con, ('sadd' if is_alert else 'srem'))
changed = bool(func(alert_entities_key, entity_id))
if is_alert:
# bubble up: also update global set of alerts
alert_changed = func('zmon:alerts', alert_id)
if alert_changed:
_log_event('ALERT_STARTED', alert, val)
else:
entities_in_alert = self.con.smembers(alert_entities_key)
if not entities_in_alert:
# no entity has alert => remove from global set
alert_changed = func('zmon:alerts', alert_id)
if alert_changed:
_log_event('ALERT_ENDED', alert, val)
# PF-3318 If an alert has malformed time period, we should evaluate it anyway and continue with
# the remaining alert definitions.
try:
is_in_period = in_period(alert.get('period', ''))
except InvalidFormat, e:
self.logger.warn('Alert with id %s has malformed time period.', alert_id)
captures['exception'] = '; \n'.join(filter(None, [captures.get('exception'), str(e)]))
is_in_period = True
if changed and is_in_period and is_alert:
# notify on entity-level
_log_event(('ALERT_ENTITY_STARTED'), alert, val, entity_id)
elif changed and not is_alert:
_log_event(('ALERT_ENTITY_ENDED'), alert, val, entity_id)
# Always store captures for given alert-entity pair, this is also used a list of all entities matching
# given alert id. Captures are stored here because this way we can easily link them with check results
# (see PF-3146).
self.con.hset('zmon:alerts:{}:entities'.format(alert_id), entity_id, json.dumps(captures,
cls=JsonDataEncoder))
# prepare report - alert part
check_result['alerts'][alert_id] = {
'alert_id': alert_id,
'captures': captures,
'downtimes': [],
'exception': True if isinstance(captures, dict) and 'exception' in captures else False,
'active': is_alert,
'changed': changed,
'in_period': is_in_period,
'start_time': None,
# '_alert_stored': None,
# '_notifications_stored': None,
}
# get last alert data stored in redis if any
alert_stored = None
try:
stored_raw = self.con.get(alerts_key)
alert_stored = json.loads(stored_raw) if stored_raw else None
except (ValueError, TypeError):
self.logger.warn('My messy Error parsing JSON alert result for key: %s', alerts_key)
if False:
# get notification data stored in redis if any
notifications_stored = None
try:
stored_raw = self.con.get(notifications_key)
notifications_stored = json.loads(stored_raw) if stored_raw else None
except (ValueError, TypeError):
self.logger.warn('My requete-messy Error parsing JSON alert result for key: %s', notifications_key)
downtimes = None
if is_in_period:
self._counter.update({'alerts.{}.count'.format(alert_id): 1,
'alerts.{}.evaluation_duration'.format(alert_id): int(round(1000.0 * (time.time()
- start)))})
# Always evaluate downtimes, so that we don't miss downtime_ended event in case the downtime ends when
# the alert is no longer active.
downtimes = self._evaluate_downtimes(alert_id, entity_id)
start_time = time.time()
# Store or remove the check value that triggered the alert
if is_alert:
result.append(alert_id)
start_time = alert_stored['start_time'] if alert_stored and not changed else time.time()
# create or refresh stored alert
alert_stored = dict(captures=captures, downtimes=downtimes, start_time=start_time, **val)
self.con.set(alerts_key, json.dumps(alert_stored, cls=JsonDataEncoder))
else:
self.con.delete(alerts_key)
self.con.delete(notifications_key)
start = time.time()
notification_context = {
'alert_def': alert,
'entity': req['entity'],
'value': val,
'captures': captures,
'worker': self.worker_name,
'is_alert': is_alert,
'changed': changed,
'duration': timedelta(seconds=(time.time() - start_time if is_alert and not changed else 0)),
}
#do not send notifications for downtimed alerts
if not downtimes:
if changed:
for notification in alert['notifications']:
self.send_notification(notification, notification_context)
else:
previous_times = self.con.hgetall(notifications_key)
for notification in alert['notifications']:
if notification in previous_times and time.time() > float(previous_times[notification]):
self.send_notification(notification, notification_context)
self._counter.update({'alerts.{}.notification_duration'.format(alert_id): int(round(1000.0
* (time.time() - start)))})
setp(req['check_id'], entity_id, 'notify loop - send metrics')
self.send_metrics()
setp(req['check_id'], entity_id, 'notify loop end')
else:
self.logger.debug('Alert %s is not in time period: %s', alert_id, alert['period'])
if is_alert:
entities_in_alert = self.con.smembers('zmon:alerts:{}'.format(alert_id))
p = self.con.pipeline()
p.srem('zmon:alerts:{}'.format(alert_id), entity_id)
p.delete('zmon:alerts:{}:{}'.format(alert_id, entity_id))
p.delete(notifications_key)
if len(entities_in_alert) == 1:
p.srem('zmon:alerts', alert_id)
p.execute()
self.logger.info('Removed alert with id %s on entity %s from active alerts due to time period: %s',
alert_id, entity_id, alert.get('period', ''))
# add to alert report regardless alert up/down/out of period
# report['results']['alerts'][alert_id]['_alert_stored'] = alert_stored
# report['results']['alerts'][alert_id]['_notifications_stored'] = notifications_stored
check_result['alerts'][alert_id]['start_time'] = ts_serialize(alert_stored['start_time']) if alert_stored else None
check_result['alerts'][alert_id]['start_time_ts'] = alert_stored['start_time'] if alert_stored else None
check_result['alerts'][alert_id]['downtimes'] = downtimes
setp(req['check_id'], entity_id, 'return notified')
# enqueue report to be sent via http request
if self._dataservice_poster:
#'entity_id': req['entity']['id'],
check_result["entity"] = {"id": req['entity']['id']}
for k in ["application_id","application_version","stack_name","stack_version","team","account_alias"]:
if k in req["entity"]:
check_result["entity"][k] = req["entity"][k]
self._dataservice_poster.enqueue(check_result)
return result
#TODO: except SoftTimeLimitExceeded:
except Exception:
# Notifications should not exceed the time limit.
self.logger.exception('Notification for check %s reached soft time limit', req['check_name'])
self.con.connection_pool.disconnect()
return None
def post_trial_run(self, id, entity, result):
if self._dataservice_url is not None:
val = {
'id': id,
'entity-id': entity,
'result': result
}
try:
requests.put(self._dataservice_url+"trial-run/", data=json.dumps(val, cls=JsonDataEncoder), headers={"Content-Type":"application/json"})
except Exception as ex:
self.logger.exception(ex)
def notify_for_trial_run(self, val, req, alerts, force_alert=False):
"""Like notify(), but for trial runs!"""
try:
# There must be exactly one alert in alerts.
alert, = alerts
redis_key = 'zmon:trial_run:{uuid}:results'.format(uuid=(alert['id'])[3:])
is_alert, captures = ((True, {}) if force_alert else self.evaluate_alert(alert, req, val))
try:
is_in_period = in_period(alert.get('period', ''))
except InvalidFormat, e:
self.logger.warn('Alert with id %s has malformed time period.', alert['id'])
captures['exception'] = '; \n'.join(filter(None, [captures.get('exception'), str(e)]))
is_in_period = True
try:
result = {
'entity': req['entity'],
'value': val,
'captures': captures,
'is_alert': is_alert,
'in_period': is_in_period,
}
result_json = json.dumps(result, cls=JsonDataEncoder)
except TypeError, e:
result = {
'entity': req['entity'],
'value': str(e),
'captures': {},
'is_alert': is_alert,
'in_period': is_in_period,
}
result_json = json.dumps(result, cls=JsonDataEncoder)
self.con.hset(redis_key, req['entity']['id'], result_json)
self.con.expire(redis_key, TRIAL_RUN_RESULT_EXPIRY_TIME)
self.post_trial_run(alert['id'][3:], req['entity'], result)
return ([alert['id']] if is_alert and is_in_period else [])
#TODO: except SoftTimeLimitExceeded:
except Exception:
self.con.connection_pool.disconnect()
return None
def _store_captures_locally(self, alert_id, entity_id, timestamp, captures):
metrics = _convert_captures(self.worker_name, alert_id, entity_id, timestamp, captures)
if metrics:
self._captures_local.extend(metrics)
def _evaluate_downtimes(self, alert_id, entity_id):
result = []
p = self.con.pipeline()
p.smembers('zmon:downtimes:{}'.format(alert_id))
p.hgetall('zmon:downtimes:{}:{}'.format(alert_id, entity_id))
redis_entities, redis_downtimes = p.execute()
try:
downtimes = dict((k, json.loads(v)) for (k, v) in redis_downtimes.iteritems())
except ValueError, e:
self.logger.exception(e)
else:
now = time.time()
for uuid, d in downtimes.iteritems():
# PF-3604 First check if downtime is active, otherwise check if it's expired, else: it's a future downtime.
if now > d['start_time'] and now < d['end_time']:
d['id'] = uuid
result.append(d)
func = 'sadd'
elif now >= d['end_time']:
func = 'srem'
else:
continue
# Check whether the downtime changed state: active -> inactive or inactive -> active.
changed = getattr(self.con, func)('zmon:active_downtimes', '{}:{}:{}'.format(alert_id, entity_id, uuid))
if changed:
eventlog.log(EVENTS[('DOWNTIME_ENDED' if func == 'srem' else 'DOWNTIME_STARTED')].id, **{
'alertId': alert_id,
'entity': entity_id,
'startTime': d['start_time'],
'endTime': d['end_time'],
'userName': d['created_by'],
'comment': d['comment'],
})
# If downtime is over, we can remove its definition from redis.
if func == 'srem':
if len(downtimes) == 1:
p.delete('zmon:downtimes:{}:{}'.format(alert_id, entity_id))
if len(redis_entities) == 1:
p.delete('zmon:downtimes:{}'.format(alert_id))
p.srem('zmon:downtimes', alert_id)
else:
p.srem('zmon:downtimes:{}'.format(alert_id), entity_id)
else:
p.hdel('zmon:downtimes:{}:{}'.format(alert_id, entity_id), uuid)
p.execute()
return result | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/zmon_worker/tasks/notacelery_task.py | notacelery_task.py |
from datetime import timedelta, datetime
import re
TIME_UNITS = {
's': 'seconds',
'm': 'minutes',
'h': 'hours',
'd': 'days',
}
TIME_FORMATS = ['%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M', '%Y-%m-%d']
TIMEZONE_OFFSET = re.compile(r'([+-])([0-9][0-9])(?::?([0-9][0-9]))?$')
def parse_timedelta(s):
'''
>>> parse_timedelta('bla')
>>> parse_timedelta('1s').total_seconds()
1.0
>>> parse_timedelta('-2s').total_seconds()
-2.0
>>> parse_timedelta('2m').total_seconds()
120.0
>>> parse_timedelta('1h').total_seconds()
3600.0
'''
if s.startswith('-'):
s = s[1:]
factor = -1
else:
factor = 1
try:
v = int(s[:-1])
u = s[-1]
except:
return None
arg = TIME_UNITS.get(u)
if arg:
return factor * timedelta(**{arg: v})
return None
def parse_datetime(s):
'''
>>> parse_datetime('foobar')
>>> parse_datetime('1983-10-12T23:30').isoformat(' ')
'1983-10-12 23:30:00'
>>> parse_datetime('1983-10-12 23:30:12').isoformat(' ')
'1983-10-12 23:30:12'
>>> parse_datetime('2014-05-05 17:40:44.100313').isoformat(' ')
'2014-05-05 17:40:44.100313'
>>> parse_datetime('2014-05-05 17:40:44.100313+01:00').isoformat(' ')
'2014-05-05 16:40:44.100313'
'''
s = s.replace('T', ' ')
# calculate timezone data from date string, we'll parse it ourselves ('%z' is not supported on all platforms for strptime)
match = TIMEZONE_OFFSET.search(s)
if match:
signum = int(match.group(1) + '1')
hours = signum * int(match.group(2))
minutes = signum * int(match.group(3))
timezone_timedelta = timedelta(hours=hours, minutes=minutes)
else:
timezone_timedelta = timedelta()
# remove timezone data from input string, if any.
s = TIMEZONE_OFFSET.sub('', s)
for fmt in TIME_FORMATS:
try:
return datetime.strptime(s, fmt) - timezone_timedelta
except:
pass
return None | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/zmon_worker/common/time_.py | time_.py |
from functools import partial
import functional
import math
def _percentile(N, percent, key=functional.id):
"""
Find the percentile of a list of values.
@parameter N - is a list of values. Note N MUST BE already sorted.
@parameter percent - a float value from 0.0 to 1.0.
@parameter key - optional key function to compute value from each element of N.
@return - the percentile of the values
>>> percentile([0,1], 0.5)
0.5
>>> percentile([0,1,2], 0.9)
1.8
>>> percentile([], 0.9) is None
True
"""
if not N:
return None
k = (len(N) - 1) * percent
f = math.floor(k)
c = math.ceil(k)
if f == c:
return key(N[int(k)])
d0 = key(N[int(f)]) * (c - k)
d1 = key(N[int(c)]) * (k - f)
return d0 + d1
# median is 50th percentile.
_median = partial(_percentile, percent=0.5)
def median(results):
return _median(sorted(results))
def percentile(results, percent):
return _percentile(sorted(results), percent)
def apply_aggregate_function(results, func, key=functional.id, **args):
'''
>>> apply_aggregate_function([1,2,3], sum)
6
>>> apply_aggregate_function([{'a': 0}, {'a': 2}], _percentile, key=lambda x:x['a'], percent=0.9)
1.8
'''
return func(map(key, results), **args)
def delta(results):
'''
>>> delta([])
0
>>> delta([0, 10])
10
>>> delta([10, 0])
-10
'''
if not results:
# no results => zero delta
return 0
return results[-1] - results[0]
def avg(results):
'''
>>> avg([]) is None
True
>>> avg([0, 1])
0.5
'''
if not results:
return None
return sum(results) * 1.0 / len(results)
def first(results):
'''
>>> first([1, 2])
1
>>> first([]) is None
True
'''
return (results[0] if results else None)
def _min(results):
'''
>>> _min([2, 1, 3, 2])
1
>>> _min([]) is None
True
'''
return (min(results) if results else None)
def _max(results):
'''
>>> _max([2, 1, 3, 2])
3
>>> _max([]) is None
True
'''
return (max(results) if results else None) | zmon-worker | /zmon-worker-0.1.tar.gz/zmon-worker-0.1/zmon_worker_monitor/zmon_worker/common/mathfun.py | mathfun.py |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.