Skip to content

Commit

Permalink
Updated EBNF creation scripts for bel_spec refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
wshayes committed Jan 20, 2018
1 parent 492fdc2 commit b8d7784
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions bel/lang/versions/bel_v2_0_0.ebnf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
##############
# BEL VERSION: 2.0.0
# EBNF CREATION TIMESTAMP: December 29, 2017 - 10:50:19PM
# EBNF CREATION TIMESTAMP: January 19, 2018 - 07:20:38PM
#########################
# GRAMMAR DEFINITIONS #
Expand All @@ -22,7 +22,7 @@ enclosed_statement = function_open bel_statement:bel_statement function_close ;
function = function:funcs function_open function_args:f_args function_close ;
funcs =
'cellSurfaceExpression' | 'compositeAbundance' | 'biologicalProcess' | 'microRNAAbundance' | 'complexAbundance' | 'proteinAbundance' | 'cellSecretion' | 'geneAbundance' | 'translocation' | 'rnaAbundance' | 'degradation' | 'abundance' | 'composite' | 'pathology' | 'activity' | 'reaction' | 'complex' | 'surf' | 'list' | 'list' | 'path' | 'tloc' | 'act' | 'sec' | 'deg' | 'rxn' | 'bp' | 'a' | 'g' | 'm' | 'p' | 'r' ;
'cellSurfaceExpression' | 'compositeAbundance' | 'biologicalProcess' | 'microRNAAbundance' | 'complexAbundance' | 'proteinAbundance' | 'cellSecretion' | 'geneAbundance' | 'translocation' | 'rnaAbundance' | 'degradation' | 'abundance' | 'composite' | 'pathology' | 'activity' | 'reaction' | 'complex' | 'list' | 'list' | 'path' | 'surf' | 'tloc' | 'act' | 'deg' | 'rxn' | 'sec' | 'bp' | 'a' | 'g' | 'm' | 'p' | 'r' ;
f_args = ','.{(function | modifier_function | namespace_arg | string_arg)}* ;
Expand Down
8 changes: 4 additions & 4 deletions bel/lang/versions/parser_v2_0_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,24 +171,24 @@ def _funcs_(self): # noqa
self._token('reaction')
with self._option():
self._token('complex')
with self._option():
self._token('surf')
with self._option():
self._token('list')
with self._option():
self._token('list')
with self._option():
self._token('path')
with self._option():
self._token('surf')
with self._option():
self._token('tloc')
with self._option():
self._token('act')
with self._option():
self._token('sec')
with self._option():
self._token('deg')
with self._option():
self._token('rxn')
with self._option():
self._token('sec')
with self._option():
self._token('bp')
with self._option():
Expand Down
8 changes: 5 additions & 3 deletions bin/yaml_to_ebnf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ def render_ebnf(tmpl_fn, bel_version, created_time, bel_spec):
template = env.get_template(tmpl_basename) # get the template

# replace template placeholders with appropriate variables
ebnf = template.render(functions=sorted(specs['function_list'], key=len, reverse=True),
m_functions=sorted(specs['modifier_list'], key=len, reverse=True),
relations=sorted(specs['relation_list'], key=len, reverse=True),
functions_list = sorted(specs['functions']['primary']['list_short'] + specs['functions']['primary']['list_long'])
modifiers_list = sorted(specs['functions']['modifier']['list_short'] + specs['functions']['modifier']['list_long'])
ebnf = template.render(functions=sorted(functions_list, key=len, reverse=True),
m_functions=sorted(modifiers_list, key=len, reverse=True),
relations=sorted(specs['relations']['list'], key=len, reverse=True),
bel_version=bel_version,
bel_major_version=bel_major_version,
created_time=created_time)
Expand Down

0 comments on commit b8d7784

Please sign in to comment.