Commit c12b7184 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Fixed issue with copy/paste of NEXTSTATE without children;

Fixed issue with syntax check of STATE and NEXTSTATE
parent 90ee507e
......@@ -65,7 +65,7 @@ def copy(selection):
def copy_branch(top_level_item):
''' Copy branches (recursively) '''
res_terminators = []
pr_text = '\n'.join(Pr.generate(top_level_item,
pr_text = '\n'.join(Pr.generate(top_level_item, cpy=True,
nextstate=False, recursive=True))
item_ast, terminators = top_level_item.get_ast(pr_text)
LOG.debug('COPY ' + str(item_ast))
......
......@@ -247,11 +247,12 @@ def _label(symbol, recursive=True, **kwargs):
@generate.register(sdlSymbols.State)
def _state(symbol, recursive=True, nextstate=True, composite=False, **kwargs):
def _state(symbol, recursive=True, nextstate=True, composite=False, cpy=False,
**kwargs):
''' State/Nextstate symbol or branch if recursive is set '''
if nextstate:
if nextstate and symbol.hasParent:
result = common('NEXTSTATE', symbol)
elif not composite and symbol.hasParent \
elif not composite and symbol.hasParent and not cpy \
and not [each for each in symbol.childSymbols()
if not isinstance(each, genericSymbols.Comment)]:
# If nextstate has no child, don't generate anything
......
......@@ -694,6 +694,13 @@ class State(VerticalSymbol):
ast, _, _, _, terminators = self.parser.parseSingleElement('state',
pr_text)
return ast, terminators
def check_syntax(self, pr_text):
''' Redefinition of the check syntax function for the state '''
name = self.common_name if self.hasParent else 'state'
_, err, _, _, _ = \
self.parser.parseSingleElement(name, pr_text)
return err
class Process(HorizontalSymbol):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment