Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ReKeywordsChangedError,
NameAssignedError,
MissingStartError,
UnusedElementError) # nopep8
from examples import JsonGrammar # nopep8
class _TestGrammar1(Grammar):
k_test = Keyword('test')
k_ignore_case = Keyword('ignore_case', ign_case=True)
START = Sequence(k_test, k_ignore_case)
class _TestGrammar2(Grammar):
k_ni = Keyword('ni')
s_seq = Sequence('(', THIS, ')')
START = Prio(
k_ni,
s_seq,
Sequence(THIS, Keyword('and'), THIS),
Sequence(THIS, Keyword('or'), THIS))
class _TestGrammar3(Grammar):
s_tic_tac = Sequence(Keyword('tic'), Keyword('tac'))
s_tic_tac_toe = Sequence(Keyword('tic'), Keyword('tac'), Keyword('toe'))
START = Sequence(
Choice(s_tic_tac, s_tic_tac_toe),
Choice(s_tic_tac, s_tic_tac_toe, most_greedy=False))
from examples import JsonGrammar # nopep8
class _TestGrammar1(Grammar):
k_test = Keyword('test')
k_ignore_case = Keyword('ignore_case', ign_case=True)
START = Sequence(k_test, k_ignore_case)
class _TestGrammar2(Grammar):
k_ni = Keyword('ni')
s_seq = Sequence('(', THIS, ')')
START = Prio(
k_ni,
s_seq,
Sequence(THIS, Keyword('and'), THIS),
Sequence(THIS, Keyword('or'), THIS))
class _TestGrammar3(Grammar):
s_tic_tac = Sequence(Keyword('tic'), Keyword('tac'))
s_tic_tac_toe = Sequence(Keyword('tic'), Keyword('tac'), Keyword('toe'))
START = Sequence(
Choice(s_tic_tac, s_tic_tac_toe),
Choice(s_tic_tac, s_tic_tac_toe, most_greedy=False))
class _TestGrammar4(Grammar):
START = Ref()
ni_item = Choice(Keyword('ni'), START)
START = Sequence('[', List(ni_item), ']')
k_alter,
most_greedy=False)
_boolean = Choice(k_true, k_false, most_greedy=False)
log_keywords = Choice(
k_debug,
k_info,
k_warning,
k_error,
k_critical,
most_greedy=False)
int_expr = Prio(
r_integer,
Sequence('(', THIS, ')'),
Sequence(THIS, Tokens('+ - * % /'), THIS))
string = Choice(r_singleq_str, r_doubleq_str, most_greedy=False)
time_expr = Prio(
r_time_str,
k_now,
string,
r_integer,
Sequence('(', THIS, ')'),
Sequence(THIS, Tokens('+ - * % /'), THIS))
series_columns = List(Choice(
k_name,
k_type,
k_length,
k_address,
k_buffer_path,
k_dbpath,
k_ip_support,
k_libuv,
k_name,
k_uuid,
k_version,
k_status,
k_reindex_progress,
k_sync_progress,
k_tee_pipe_name,
most_greedy=False), str_operator, string),
Sequence(k_online, bool_operator, _boolean),
Sequence(k_log_level, int_operator, log_keywords),
Sequence('(', THIS, ')'),
Sequence(THIS, k_and, THIS),
Sequence(THIS, k_or, THIS)))
# where shard
where_shard = Sequence(k_where, Prio(
Sequence(
Choice(k_sid, k_pool, k_size, most_greedy=False),
int_operator,
int_expr),
Sequence(Choice(k_server, k_status), str_operator, string),
Sequence(
Choice(k_start, k_end, most_greedy=False),
int_operator,
time_expr),
Sequence(
k_type,