original_docstring: 
          Parse the scenario source model.
          Use StoryFiller for parts that are stories.
          
docstring: Parse the scenario source model.
  Use StoryFiller for parts that are stories.
docstring_tokens: Parse the scenario source model . Use StoryFiller for parts that are stories .
code: def fillModel(self):
          """
          Parse the scenario source model.
          Use StoryFiller for parts that are stories.
          """
  
          def define_descriptor(ast_descriptor):
              name=ast_descriptor.name
              tb=astTextBlockToTextBlock(
                  container=self.model,
                  astTextBlock=ast_descriptor.textBlock)
              if name in self.scenarioModel.descriptorNamed:
                  ASTNodeSourceIssue(
                      code=icode('DESCRIPTOR_TWICE'),
                      astNode=ast_descriptor,
                      level=Levels.Error,
                      message=(
                          'Descriptor "%s" already defined.'
                          ' Ignored.' % (
                              name)))
              else:
                  d=Descriptor(name, tb)
                  self.scenarioModel.descriptorNamed[name]=d
  
          def define_actor_instance(ast_actori_decl):
              actori_name=ast_actori_decl.actorInstanceName
              actor_name=ast_actori_decl.actorName
              if actor_name not in self.usecaseModel.actorNamed:
                  ASTNodeSourceIssue(
                      code=icode('ACTOR_NOT_FOUND'),
                      astNode=ast_actori_decl,
                      level=Levels.Error,
                      message=(
                          'Actor "%s" does not exist.'
                          ' "%s" ignored.' % (
                              actor_name,
                              actori_name
                          )))
              else:
                  actor=self.usecaseModel.actorNamed[actor_name]
                  #TODO:3 scenarios: check actor not already defined
                  ActorInstance(
                      model=self.scenarioModel,
                      name=actori_name,
                      actor=actor,
                      astNode=ast_actori_decl
                  )
  
          #TODO:2 scenarios: validate the existence of Actor
          #TODO:2 scenarios: validate the existence of Verb
  
          def define_usecase_node(parent, astStep):
              ain=astStep.actorInstanceName
              #TODO:2 check that actor has to right to perform uc
              if ain not in self.scenarioModel.actorInstanceNamed:
                  ASTNodeSourceIssue(
                      code=icode('ACTOR_INSTANCE_NOT_FOUND'),
                      astNode=astStep,
                      level=Levels.Fatal,
                      message=(
                          'Actor instance "%s" does not exist.' % (
                              ain
                          )))
              actor_instance=(
                  self.scenarioModel.actorInstanceNamed[ain])
              un=astStep.usecaseName
              if un not in self.usecaseModel.system.usecaseNamed:
                  ASTNodeSourceIssue(
                      code=icode('USECASE_NOT_FOUND'),
                      astNode=astStep,
                      level=Levels.Fatal,
                      message=(
                          'Usecase "%s" does not exist.' % (
                              un
                          )))
              usecase=self.usecaseModel.system.usecaseNamed[un]
              step = UsecaseInstanceStep(
                  parent=parent,
                  actorInstance=actor_instance,
                  usecase=usecase,
                  astNode=astStep
              )
              return step
  
          def define_actor_part(ast_actor_part):
              # ap = ast_actor_part.actorPart
              # if ap is not None:
                  for actori_decl in ast_actor_part.actorInstanceDeclarations:
                      define_actor_instance(actori_decl)
  
          def define_context(ast_context):
              name='' if ast_context.name is None else ast_context.name
              context_filler = StoryFiller(
                  model=self.scenarioModel,
                  storyKind='context',
                  ensureCheckAfter=False,
                  infoIfCheckAdded=True,
                  allowDefinition=True,
                  allowAction=False,
                  allowVerb=False,
                  allowedIncludeKinds=[],
                  getStoryId=self.getStoryId,
                  astStory=ast_context.story)
              story=context_filler.story()
              c=self.scenarioModel.context(name)
              if c is not None:
                  ASTNodeSourceIssue(
                      code=icode('CONTEXT_TWICE'),
                      astNode=ast_context,
                      level=Levels.Error,
                      message='Context "%s" already defined.'
                              ' Previous definition ignored.' % name)
              context=\
                  Context(
                      model=self.scenarioModel,
                      name=name,
                      story=story,
                      storyEvaluation=None, # filled in resolve
                      astNode=ast_context)
              story.storyContainer=context
              self.scenarioModel.containerCollection.add(
                  kind='context',
                  name=name,
                  container=context)
  
          def define_fragment(ast_fragment):
              # NOTE:  While the keyword "story" is used externaly,
              # in the metamodel the term used is "fragment"
              # (Fragment inherits from Story). In the
              # concrete syntax the keyword "story" looks better.
              name=ast_fragment.name
              context_filler = StoryFiller(
                  model=self.scenarioModel,
                  storyKind='story', # "stories": see above
                  ensureCheckAfter=False,
                  infoIfCheckAdded=True,
                  allowDefinition=False,
                  allowAction=True,
                  allowVerb=True,
                  allowedIncludeKinds=[],
                  getStoryId=self.getStoryId,
                  astStory=ast_fragment.story)
              story=context_filler.story()
              c=self.scenarioModel.fragment(name)
              if c is not None:
                  ASTNodeSourceIssue(
                      code=icode('FRAGMENT_TWICE'),
                      astNode=ast_fragment,
                      level=Levels.Error,
                      # 'Story" instead of 'fragment': see above
                      message='Story "%s" already defined.'
                              ' Previous definition ignored.'
                              % name)
              fragment=\
                  Fragment(
                      model=self.scenarioModel,
                      name=name,
                      story=story,
                      storyEvaluation=None,  # filled in resolve
                      astNode=ast_fragment)
              story.storyContainer = fragment
  
              self.scenarioModel.containerCollection.add(
                  kind='fragment',
                  name=name,
                  container=fragment)
  
          def define_scenario(ast_scenario):
              name='' if ast_scenario.name is None else ast_scenario.name
              scenario_filler = StoryFiller(
                  model=self.scenarioModel,
                  storyKind='scenario',
                  ensureCheckAfter=True,
                  infoIfCheckAdded=True,
                  allowDefinition=False,
                  allowAction=True,
                  allowVerb=True,
                  allowedIncludeKinds=[
                      'objectModel',
                      'context',
                      'fragment'],
                  getStoryId=self.getStoryId,
                  astStory=ast_scenario.story)
              story=scenario_filler.story()
              s=self.scenarioModel.scenario(name)
              if s is not None:
                  ASTNodeSourceIssue(
                      code=icode('SCENARIO_TWICE'),
                      astNode=ast_scenario,
                      level=Levels.Error,
                      message='Scenario "%s" already defined.'
                              ' Previous definition ignored.' % name)
              scenario=\
                  Scenario(
                      model=self.scenarioModel,
                      name=name,
                      story=story,
                      storyEvaluation=None,  # filled in resolve
                      astNode=ast_scenario)
              story.storyContainer = scenario
  
              self.scenarioModel.containerCollection.add(
                  kind='scenario',
                  name=name,
                  container=scenario)
  
  
          ast_root=self.ast.model
  
          #  Initialized
          # with the object model if there is one. Otherwise nothing
          # is added, so that no object model container will be found later.
          # The parser should later
          # add contexts, fragments and scenarios.
          if self.objectModel is not None:
              container=ObjectModelStoryContainer(
                  scenarioModel=self.scenarioModel,
                  objectModel = self.objectModel)
              self.scenarioModel.containerCollection.add(
                  kind='objectModel',
                  name='',
                  container=container
              )
  
          #---- descriptors -----------------------------------
          for descriptor in ast_root.descriptors:
              define_descriptor(descriptor)
  
          for declaration in ast_root.declarations:
              type_=declaration.__class__.__name__
              if type_=='ActorInstancePart':
                  define_actor_part(declaration)
              elif type_=='Context':
                  define_context(declaration)
              elif type_=='Fragment':
                  define_fragment(declaration)
              elif type_=='Scenario':
                  define_scenario(declaration)
              else:
                  raise UnexpectedCase( #raise:OK
                      'AST type not expected: %s' % type_)
code_tokens: def fillModel ( self ) : def define_descriptor ( ast_descriptor ) : name = ast_descriptor . name tb = astTextBlockToTextBlock ( container = self . model , astTextBlock = ast_descriptor . textBlock ) if name in self . scenarioModel . descriptorNamed : ASTNodeSourceIssue ( code = icode ( 'DESCRIPTOR_TWICE' ) , astNode = ast_descriptor , level = Levels . Error , message = ( 'Descriptor "%s" already defined.' ' Ignored.' % ( name ) ) ) else : d = Descriptor ( name , tb ) self . scenarioModel . descriptorNamed [ name ] = d def define_actor_instance ( ast_actori_decl ) : actori_name = ast_actori_decl . actorInstanceName actor_name = ast_actori_decl . actorName if actor_name not in self . usecaseModel . actorNamed : ASTNodeSourceIssue ( code = icode ( 'ACTOR_NOT_FOUND' ) , astNode = ast_actori_decl , level = Levels . Error , message = ( 'Actor "%s" does not exist.' ' "%s" ignored.' % ( actor_name , actori_name ) ) ) else : actor = self . usecaseModel . actorNamed [ actor_name ] ActorInstance ( model = self . scenarioModel , name = actori_name , actor = actor , astNode = ast_actori_decl ) def define_usecase_node ( parent , astStep ) : ain = astStep . actorInstanceName if ain not in self . scenarioModel . actorInstanceNamed : ASTNodeSourceIssue ( code = icode ( 'ACTOR_INSTANCE_NOT_FOUND' ) , astNode = astStep , level = Levels . Fatal , message = ( 'Actor instance "%s" does not exist.' % ( ain ) ) ) actor_instance = ( self . scenarioModel . actorInstanceNamed [ ain ] ) un = astStep . usecaseName if un not in self . usecaseModel . system . usecaseNamed : ASTNodeSourceIssue ( code = icode ( 'USECASE_NOT_FOUND' ) , astNode = astStep , level = Levels . Fatal , message = ( 'Usecase "%s" does not exist.' % ( un ) ) ) usecase = self . usecaseModel . system . usecaseNamed [ un ] step = UsecaseInstanceStep ( parent = parent , actorInstance = actor_instance , usecase = usecase , astNode = astStep ) return step def define_actor_part ( ast_actor_part ) : for actori_decl in ast_actor_part . actorInstanceDeclarations : define_actor_instance ( actori_decl ) def define_context ( ast_context ) : name = '' if ast_context . name is None else ast_context . name context_filler = StoryFiller ( model = self . scenarioModel , storyKind = 'context' , ensureCheckAfter = False , infoIfCheckAdded = True , allowDefinition = True , allowAction = False , allowVerb = False , allowedIncludeKinds = [ ] , getStoryId = self . getStoryId , astStory = ast_context . story ) story = context_filler . story ( ) c = self . scenarioModel . context ( name ) if c is not None : ASTNodeSourceIssue ( code = icode ( 'CONTEXT_TWICE' ) , astNode = ast_context , level = Levels . Error , message = 'Context "%s" already defined.' ' Previous definition ignored.' % name ) context = Context ( model = self . scenarioModel , name = name , story = story , storyEvaluation = None , astNode = ast_context ) story . storyContainer = context self . scenarioModel . containerCollection . add ( kind = 'context' , name = name , container = context ) def define_fragment ( ast_fragment ) : name = ast_fragment . name context_filler = StoryFiller ( model = self . scenarioModel , storyKind = 'story' , ensureCheckAfter = False , infoIfCheckAdded = True , allowDefinition = False , allowAction = True , allowVerb = True , allowedIncludeKinds = [ ] , getStoryId = self . getStoryId , astStory = ast_fragment . story ) story = context_filler . story ( ) c = self . scenarioModel . fragment ( name ) if c is not None : ASTNodeSourceIssue ( code = icode ( 'FRAGMENT_TWICE' ) , astNode = ast_fragment , level = Levels . Error , message = 'Story "%s" already defined.' ' Previous definition ignored.' % name ) fragment = Fragment ( model = self . scenarioModel , name = name , story = story , storyEvaluation = None , astNode = ast_fragment ) story . storyContainer = fragment self . scenarioModel . containerCollection . add ( kind = 'fragment' , name = name , container = fragment ) def define_scenario ( ast_scenario ) : name = '' if ast_scenario . name is None else ast_scenario . name scenario_filler = StoryFiller ( model = self . scenarioModel , storyKind = 'scenario' , ensureCheckAfter = True , infoIfCheckAdded = True , allowDefinition = False , allowAction = True , allowVerb = True , allowedIncludeKinds = [ 'objectModel' , 'context' , 'fragment' ] , getStoryId = self . getStoryId , astStory = ast_scenario . story ) story = scenario_filler . story ( ) s = self . scenarioModel . scenario ( name ) if s is not None : ASTNodeSourceIssue ( code = icode ( 'SCENARIO_TWICE' ) , astNode = ast_scenario , level = Levels . Error , message = 'Scenario "%s" already defined.' ' Previous definition ignored.' % name ) scenario = Scenario ( model = self . scenarioModel , name = name , story = story , storyEvaluation = None , astNode = ast_scenario ) story . storyContainer = scenario self . scenarioModel . containerCollection . add ( kind = 'scenario' , name = name , container = scenario ) ast_root = self . ast . model if self . objectModel is not None : container = ObjectModelStoryContainer ( scenarioModel = self . scenarioModel , objectModel = self . objectModel ) self . scenarioModel . containerCollection . add ( kind = 'objectModel' , name = '' , container = container ) for descriptor in ast_root . descriptors : define_descriptor ( descriptor ) for declaration in ast_root . declarations : type_ = declaration . __class__ . __name__ if type_ == 'ActorInstancePart' : define_actor_part ( declaration ) elif type_ == 'Context' : define_context ( declaration ) elif type_ == 'Fragment' : define_fragment ( declaration ) elif type_ == 'Scenario' : define_scenario ( declaration ) else : raise UnexpectedCase ( 'AST type not expected: %s' % type_ )
short_docstring: Parse the scenario source model.
short_docstring_tokens: Parse the scenario source model .
comment: """
          Parse the scenario source model.
          Use StoryFiller for parts that are stories.
          """$SEP$#TODO:3 scenarios: check actor not already defined$SEP$#TODO:2 scenarios: validate the existence of Actor$SEP$#TODO:2 scenarios: validate the existence of Verb$SEP$#TODO:2 check that actor has to right to perform uc$SEP$# ap = ast_actor_part.actorPart$SEP$# if ap is not None:$SEP$# filled in resolve$SEP$# NOTE:  While the keyword "story" is used externaly,$SEP$# in the metamodel the term used is "fragment"$SEP$# (Fragment inherits from Story). In the$SEP$# concrete syntax the keyword "story" looks better.$SEP$# "stories": see above$SEP$# 'Story" instead of 'fragment': see above$SEP$# filled in resolve$SEP$# filled in resolve$SEP$#  Initialized$SEP$# with the object model if there is one. Otherwise nothing$SEP$# is added, so that no object model container will be found later.$SEP$# The parser should later$SEP$# add contexts, fragments and scenarios.$SEP$#---- descriptors -----------------------------------$SEP$#raise:OK