void
 __expect_in_target (E const& elm, Literal oper)
 {
     if (end_of_target())
         throw error::State(_Fmt("Unable to %s element %s from target as demanded; "
                                 "no (further) elements in target sequence") % oper % elm
                            , LUMIERA_ERROR_DIFF_CONFLICT);
     if (*pos_ != elm)
         throw error::State(_Fmt("Unable to %s element %s from target as demanded; "
                                 "found element %s on current target position instead")
                            % oper % elm % *pos_
                            , LUMIERA_ERROR_DIFF_CONFLICT);
 }
Esempio n. 2
0
 void
 TreeDiffMutatorBinding::__failMismatch (Literal oper, GenNode const& spec)
 {
   throw error::State(_Fmt("Unable to %s element %s. Current shape of target "
                           "data does not match expectations") % oper % spec
                     , LUMIERA_ERROR_DIFF_CONFLICT);
 }
Esempio n. 3
0
 void
 TreeDiffMutatorBinding::__fail_not_found (GenNode const& elm)
 {
   throw error::State(_Fmt("Premature end of sequence; unable to locate "
                           "element %s in the remainder of the target.") % elm
                     , LUMIERA_ERROR_DIFF_CONFLICT);
 }
Esempio n. 4
0
 const Asset::Ident
 createIdent (Query<STRU> const& query)
   {
     // does the query somehow specify the desired name-ID?
     string nameID = query.extractID (genericIdSymbol);
     if (isnil (nameID))
       nameID = query.extractID (StructTraits<STRU>::idSymbol());
     if (isnil (nameID))
       {
          // no name-ID contained in the query...
         //  so we'll create a new one
         static int i=0;
         nameID = _Fmt("%s.%d")
                      % StructTraits<STRU>::namePrefix()
                      % (++i);
       }
     ENSURE (!isnil (nameID));
     
     // does the query actually demand the Nth instance/element?
     string seqID = query.extractID (seqNrPredicate);
     if (!isnil (seqID) && 1 < uNum(seqID))
       nameID += "."+seqID;
     
     Category cat (STRUCT, StructTraits<STRU>::catFolder());
     return Asset::Ident (nameID, cat );
   }
Esempio n. 5
0
 void
 TreeDiffMutatorBinding::__expect_further_elements (GenNode const& elm)
 {
   if (not treeMutator_->hasSrc())
     throw error::State(_Fmt("Premature end of target sequence, still expecting element %s; "
                             "unable to apply diff further.") % elm
                       , LUMIERA_ERROR_DIFF_CONFLICT);
 }
Esempio n. 6
0
 void
 TreeDiffMutatorBinding::__expect_valid_parent_scope (GenNode::ID const& idi)
 {
   if (0 == scopeManger_->depth())
     throw error::Fatal(_Fmt("Diff application floundered after leaving scope %s; "
                             "unbalanced nested scopes, diff attempts to pop root.") % idi.getSym()
                       , LUMIERA_ERROR_DIFF_CONFLICT);
 }
 void
 __expect_found (E const& elm, Iter const& targetPos)
 {
     if (targetPos == orig_.end())
         throw error::State(_Fmt("Premature end of sequence; unable to locate "
                                 "element %s in the remainder of the target.") % elm
                            , LUMIERA_ERROR_DIFF_CONFLICT);
 }
 void
 __expect_further_elements (E const& elm)
 {
     if (end_of_target())
         throw error::State(_Fmt("Premature end of target sequence, still expecting element %s; "
                                 "unable to apply diff further.") % elm
                            , LUMIERA_ERROR_DIFF_CONFLICT);
 }
Esempio n. 9
0
 void
 TreeDiffMutatorBinding::__expect_end_of_scope (GenNode::ID const& idi)
 {
   if (not treeMutator_->completeScope())
     throw error::State(_Fmt("Diff application floundered in nested scope %s; "
                             "unexpected extra elements found when diff "
                             "should have settled everything.") % idi.getSym()
                       , LUMIERA_ERROR_DIFF_CONFLICT);
 }
Esempio n. 10
0
 /** supplement a syntactic representation (as generic query in predicate form).
  *  Building this representation is done on demand for performance reasons;
  *  typically a ScopeQuery is issued immediately into a known sub scope
  *  of the Session/Model and resolved by the PlacementIndex
  * @todo we need a readable and sensible representation as generic query ///////////////////TICKET #901
  */
 lib::QueryText
 buildSyntacticRepresentation()  const
   {
     using util::_Fmt;
     TODO ("valid syntactic representation of scope queries");
     return lib::QueryText (_Fmt ("scope(X, %08X), scopeRelation(X, %d)")
                                 % hash_value(searchScope())        ////////TODO how to represent a placement in queries
                                 % uint(searchDirection()));        ////////TODO how to translate that in textual terms
   }
Esempio n. 11
0
 CommandQueue&
 feed (Command&& cmd)
   {
     if (not cmd.canExec())
       throw error::Logic(_Fmt("Reject '%s'. Not suitably prepared for invocation: %s")
                              % cmd.getID() % cmd
                         , LERR_(UNBOUND_ARGUMENTS));
     
     lib::IterQueue<Command>::feed (move(cmd));
     return *this;
   }