Пример #1
0
static tree
parse_comment (string s, int& i) {
  string comment= parse_delimited (s, i, "(*", "*)", false);
  if (is_star_rule (comment, 0))
    return compound ("hrule");
  return compound ("coq-comment", from_verbatim (comment, false));
}
Пример #2
0
TEST(ReferenceDataTest, HandlesUpdateChangedWithoutChanges)
{
    {
        TestReferenceData    data(gmx::test::erefdataUpdateAll);
        TestReferenceChecker checker(data.rootChecker());
        checker.checkInteger(1, "int");
        checker.checkString("Test", "string");
        TestReferenceChecker compound(checker.checkCompound("Compound", "Compound"));
        compound.checkInteger(2, "int");
    }
    {
        TestReferenceData    data(gmx::test::erefdataUpdateChanged);
        TestReferenceChecker checker(data.rootChecker());
        checker.checkInteger(1, "int");
        checker.checkString("Test", "string");
        TestReferenceChecker compound(checker.checkCompound("Compound", "Compound"));
        compound.checkInteger(2, "int");
    }
    {
        TestReferenceData    data(gmx::test::erefdataCompare);
        TestReferenceChecker checker(data.rootChecker());
        checker.checkInteger(1, "int");
        checker.checkString("Test", "string");
        TestReferenceChecker compound(checker.checkCompound("Compound", "Compound"));
        compound.checkInteger(2, "int");
    }
}
Пример #3
0
void MemberAccessOperator::doPrint(PrintContext &context) const {
    bool braces = compound()->is<UnaryOperator>() ||
                  compound()->is<BinaryOperator>() ||
                  compound()->is<Typecast>();

    if (braces) {
        context.out() << "(";
    }
    compound_->print(context);
    if (braces) {
        context.out() << ")";
    }

    switch (accessKind()) {
        case ARROW:
            context.out() << "->";
            break;
        case DOT:
            context.out() << '.';
            break;
        default:
            unreachable();
            break;
    }
    
    context.out() << member_->identifier();
}
Пример #4
0
static void
make_entry (tree& D, tree t) {
  // cout << "Make entry " << t << "\n";
  int i, j, n= N(t);
  for (i=0; i<n; i++)
    if (is_func (t[i], TUPLE, 1)) {
      bool flag= true;
      for (j=0; j<n; j++)
	if (is_func (t[j], TUPLE, 2) && (t[i][0] == t[j][0]))
	  flag= false;
      if (flag) D << t[i][0];
    }

  for (i=0; i<n; i++)
    if (is_func (t[i], TUPLE, 2) && is_tuple (t[i][1], "range", 2)) {
      bool flag= true;
      for (j=i+1; j<n; j++)
	if (is_func (t[j], TUPLE, 2) && is_tuple (t[j][1], "range", 2))
	  if ((t[i][0] == t[j][0]) && (t[i][1][1] == t[j][1][1])) {
	    t[i][1]= tree (CONCAT, t[i][1][2], "--", t[j][1][2]);
	    t[j]= "";
	    flag= false;
	    break;
	  }
      if (flag) t[i][1]= tree (CONCAT, t[i][1][2], "--?");
    }

  hashmap<tree,tree> h ("");
  for (i=0; i<n; i++)
    if (is_func (t[i], TUPLE, 2)) {
      tree l= t[i][0], r= t[i][1];
      if (!h->contains (l)) h (l)= r;
      else {
	tree rr= h[l];
	if (rr == "") rr= r;
	else if (r != "") {
	  if (!is_concat (rr)) rr= tree (CONCAT, rr);
	  rr << ", " << r;
	}
	h (l)= rr;
      }
    }

  for (i=0; i<n; i++)
    if (is_func (t[i], TUPLE, 2)) {
      tree l= t[i][0];
      if (h->contains (l)) {
	int k= N(l);
	tree e= compound ("index-" * as_string (k), copy (l[k-1]), h[l]);
	if (h[l] == "")
	  e= compound ("index-" * as_string (k) * "*", copy (l[k-1]));
	D << e;
	h->reset (l);
      }
    }
}
Пример #5
0
void
edit_select_rep::selection_paste (string key) {
  tree t; string s;
  (void) ::get_selection (key, t, s, selection_import);
  if (inside_active_graphics ()) {
    if (is_tuple (t, "texmacs", 3))
      call ("graphics-paste", t[1]);
    return;
  }
  if (is_tuple (t, "extern", 1)) {
    string mode= get_env_string (MODE);
    string lan = get_env_string (MODE_LANGUAGE (mode));
    if ((selection_import == "latex") && (mode == "prog")) mode= "verbatim";
    if ((selection_import == "latex") && (mode == "math")) mode= "latex-math";
    if ((selection_import == "html") && (mode == "prog")) mode= "verbatim";
    string fm= selection_import * "-snippet";
    tree doc= generic_to_tree (selection_decode(lan, as_string(t[1])), fm);
    if (is_func (doc, DOCUMENT, 1)) doc= doc[0]; // temporary fix
    insert_tree (doc);
  }
  if (is_tuple (t, "texmacs", 3)) {
    string mode= get_env_string (MODE);
    string lan = get_env_string (MODE_LANGUAGE (mode));
    if (is_compound (t[1], "text", 1) && mode == "text")
      t= tuple ("texmacs", t[1][0], "text", lan);
    if (is_compound (t[1], "math", 1) && mode == "math")
      t= tuple ("texmacs", t[1][0], "math", lan);
    if (mode == "math" && t[2] == "text")
      set_message ("Error: invalid paste of text into a formula", "paste");
    else if (mode == "prog" && t[2] == "math") {
      tree in= tuple (lan, t[1]);
      tree r= stree_to_tree (call ("plugin-math-input", tree_to_stree (in)));
      insert_tree (r);
    }
    else {
      if ((t[2] != mode) && (t[2] != "src") && (mode != "src") &&
	  ((t[2] == "math") || (mode == "math"))) {
        if (t[2] == "math")
          insert_tree (compound ("math", ""), path (0, 0));
        else if (t[2] == "text")
          insert_tree (compound ("text", ""), path (0, 0));
        else
          insert_tree (tree (WITH, copy (MODE), copy (t[2]), ""), path (2, 0));
      }
      if (is_func (t[1], TFORMAT) || is_func (t[1], TABLE)) {
	int row, col;
	path fp= search_format (row, col);
	if (is_nil (fp)) insert_tree (compound (copy (TABULAR), t[1]));
	else table_write_subtable (fp, row, col, t[1]);
      }
      else insert_tree (t[1]);
    }
  }
}
Пример #6
0
tree
texmacs_invarianted (tree t, tree p, int c, string src,
                     hashmap<tree,tree> corr,
                     hashmap<tree,tree> pred,
                     hashmap<tree,tree> succ) {
  if (corr->contains (t)) {
    tree oids= corr[t], ids (TUPLE);
    for (int i=0; i<N(oids); i++) {
      int b, e;
      if (get_range (oids[i], b, e, src)) ids << oids[i];
    }
    if (N(ids) >= 1) {
      tree id= texmacs_best_match (ids, p, c, corr, pred, succ);
      if (id != tree (UNINIT)) return compound ("ilx", id);
    }
  }
  if (is_atomic (t)) return t;
  else {
    int i, n= N(t);
    tree r (t, n);
    for (i=0; i<n; i++)
      r[i]= texmacs_invarianted (t[i], t, i, src, corr, pred, succ);
    return r;
  }
}
Пример #7
0
tree
tree_translate (tree t, string from, string to) {
  //cout << "Translating " << t << " from " << from << " into " << to << "\n";
  if (is_atomic (t))
    return translate (t->label, from, to);
  else if (is_compound (t, "replace")) {
    if (!is_atomic (t[0])) {
        //cout << "tree_translate() ERROR: first child should be a string\n";
      return t;
    }
    t[0]->label= translate_as_is (t[0]->label, from, to);
    return translate_replace (t, from, to);
  }
  else if (is_compound (t, "verbatim", 1))
    return t[0];
  else if (is_compound (t, "localize", 1))
    return tree_translate (t[0], "english", out_lan);
  else if (is_compound (t, "render-key", 1))
    return compound ("render-key", tree_translate (t[0], from, to));
  else {
    tree r (t, N(t));
    for (int i=0; i<N(t); i++)
      if (!the_drd->is_accessible_child (t, i)) r[i]= t[i];
      else r[i]= tree_translate (t[i], from, to);
    return r;
  }
}
Пример #8
0
void SyntaxAnalyzer::statement() {
	if (currentToken.lexeme() == "{") {
		cout << "<Statement> -> <Compound>" << endl;
		compound();
	}
	else if (currentToken.type() == "identifier") {
		cout << "<Statement> -> <Assign>" << endl;
		assign();
	}
	else if (currentToken.lexeme() == "if") {
		cout << "<Statement> -> <If>" << endl;
		ifProcedure();
	}
	else if (currentToken.lexeme() == "return") {
		cout << "<Statement> -> <Return>" << endl;
		returnProcedure();
	}
	else if (currentToken.lexeme() == "write") {
		cout << "<Statement> -> <Write>" << endl;
		write();
	}
	else if (currentToken.lexeme() == "read") {
		cout << "<Statement> -> <Write>" << endl;
		read();
	}
	else if (currentToken.lexeme() == "while") {
		cout << "<Statement> -> <While>" << endl;
		whileProcedure();
	}
	else { errorMessage("}\", <Identifer>, \"if\", \"return\", \"write\", \"read\", or \"while"); }
}
Пример #9
0
 void checkReference(gmx::test::TestReferenceChecker *checker, const char *id,
                     bool checkDotCoordinates)
 {
     gmx::test::TestReferenceChecker compound(
             checker->checkCompound("SASA", id));
     compound.checkReal(area_, "Area");
     if (volume_ > 0.0)
     {
         compound.checkReal(volume_, "Volume");
     }
     if (atomArea_ != NULL)
     {
         compound.checkSequenceArray(index_.size(), atomArea_, "AtomArea");
     }
     if (dots_ != NULL)
     {
         if (checkDotCoordinates)
         {
             // The algorithm may produce the dots in different order in
             // single and double precision due to some internal
             // sorting...
             std::qsort(dots_, dotCount_, sizeof(rvec), &dotComparer);
             compound.checkSequenceArray(3*dotCount_, dots_, "Dots");
         }
         else
         {
             compound.checkInteger(dotCount_, "DotCount");
         }
     }
 }
Пример #10
0
static tree
parse_item (string s, int &i, int item_indent) {
  int text_indent= item_indent, n= N(s);
  while (i<n && is_blank (s[i])) i++;
  if (is_new_item (s, i)) {
    text_indent++;
    while (s[i] == '-') i++;
  }
  while (i<n && is_spacing (s[i])) {
    if (s[i] == ' ')
      text_indent++;
    i++;
  }
  tree r (CONCAT);
  r << compound ("item");
  string line= "";
  string tmp= parse_line (s, i, text_indent);
  if (tmp != "")
    line << tmp;
  while (can_parse_line (s, i, text_indent)) {
    tmp= parse_line (s, i, text_indent);
    if (tmp != "")
      line << "\n" <<  tmp;
  }
  r << coqdoc_to_tree (line);
  return r;
}
Пример #11
0
static tree
format_proof (tree t) {
  tree r= compound ("coq-proof", "", "dark grey");
  if (!is_document (t) || N(t) == 0)
    r << "" << "";
  else if (N(t) > 0 && is_begin_proof (t[0])) {
    r << t[0];
    if (N(t) > 1)
      r << t(1,N(t));
    else
      r << "";
  }
  else if (N(t) > 1 && is_compound (t[0], "coq-indent", 1)
                    && is_begin_proof (t[1])) {
    r << t[1];
    if (N(t) > 2) {
      tree tmp= tree (DOCUMENT, t[0]);
      tmp << A(t(2,N(t)));
      r << tmp;
    }
    else
      r << "";
  }
  else
    r << "Proof." << t;
  return r;
}
Пример #12
0
pager_rep::pager_rep (path ip2, edit_env env2, array<page_item> l2):
  ip (ip2), env (env2), style (UNINIT), l (l2)
{
  style (PAGE_THE_PAGE)   = tree (MACRO, compound ("page-nr"));
  style (PAGE_ODD_HEADER) = env->read (PAGE_ODD_HEADER);
  style (PAGE_ODD_FOOTER) = env->read (PAGE_ODD_FOOTER);
  style (PAGE_EVEN_HEADER)= env->read (PAGE_EVEN_HEADER);
  style (PAGE_EVEN_FOOTER)= env->read (PAGE_EVEN_FOOTER);
  style (PAGE_THIS_HEADER)= "";
  style (PAGE_THIS_FOOTER)= "";

  int nr_cols= env->get_int (PAR_COLUMNS);
  paper= (env->get_string (PAGE_MEDIUM) == "paper");
  string pbr= env->get_string (PAGE_BREAKING);
  quality= (pbr == "sloppy"? 0: (pbr == "medium"? 1: 2));
  env->get_page_pars (text_width, text_height, width, height,
		      odd, even, top, bot);
  may_extend= env->get_length (PAGE_EXTEND);
  may_shrink= env->get_length (PAGE_SHRINK);
  head_sep  = env->get_length (PAGE_HEAD_SEP);
  foot_sep  = env->get_length (PAGE_FOOT_SEP);
  col_sep   = env->get_length (PAR_COLUMNS_SEP);
  fn_sep    = env->get_vspace (PAR_FNOTE_SEP);
  fnote_sep = env->get_vspace (PAGE_FNOTE_SEP) + (2*env->fn->sep);
  fnote_bl  = env->get_length (PAGE_FNOTE_BARLEN);
  float_sep = env->get_vspace (PAGE_FLOAT_SEP);
  mnote_sep = env->get_length (PAGE_MNOTE_SEP);
  show_hf   = env->get_bool (PAGE_SHOW_HF) && paper;
  if (nr_cols > 1) text_width = (text_width+col_sep+1) * nr_cols - col_sep;

  page_offset= 0;
  cur_top= 0;
}
Пример #13
0
void
edit_interface_rep::key_press (string gkey) {
  string zero= "a"; zero[0]= '\0';
  string key= replace (gkey, "<#0>", zero);
  if (pre_edit_mark != 0) {
    ASSERT (sh_mark == 0, "invalid shortcut during pre-edit");
    mark_cancel (pre_edit_mark);
    pre_edit_s= "";
    pre_edit_mark= 0;
  }
  if (starts (key, "pre-edit:") ) {
    interrupt_shortcut ();
    string s= key (9, N(key));
    if (s == "") return;
    int i, n= N(s), pos= N(s);
    for (i=0; i<n; i++)
      if (s[i] == ':' && is_int (s (0, i))) {
        int k= as_int (s (0, i));
        s= s (i+1, n);
        pos= 0;
        for (int j=0; j<k && pos<N(s); j++)
          tm_char_forwards (s, pos);
        break;
      }
    pre_edit_s= s;
    pre_edit_mark= new_marker ();
    mark_start (pre_edit_mark);
    archive_state ();
    insert_tree (compound ("pre-edit", s), path (0, pos));
    return;
  }
  
  string new_sh= N(sh_s)==0? key: sh_s * " " * key;
  if (try_shortcut (new_sh)) return;
  if (new_sh != key) {
    interrupt_shortcut ();
    if (try_shortcut (key)) return;
  }
  
  string rew= sv->kbd_post_rewrite (key);
  if (N(rew) == 1) {
    int i ((unsigned char) rew[0]);
    if ((i >= 32 && i <= 127) || (i >= 128 && i <= 255) || (i == 25))
      if (!inside_active_graphics ()) {
        archive_state ();
        call ("kbd-insert", rew);
      }
    interrupt_shortcut ();
  }
  else if (contains_unicode_char (rew)) {
    archive_state ();
    call ("kbd-insert", key);
    interrupt_shortcut ();    
  }
  else if (DEBUG_KEYBOARD)
    debug_keyboard
      << "unrecognized key " << key << ". "
      << "Undefined shortcut or key missing in the encoding files.\n";
}
Пример #14
0
static tree
parse_list (string s, int &i) {
  int item_indent= get_list_depth (s, i);
  tree r (DOCUMENT);
  while (can_parse_item (s, i, item_indent))
    r << parse_item (s, i, item_indent);
  return compound ("itemize", r);
}
Пример #15
0
static tree
parse_vernac_command (string s, bool wrap= false) {
  tree r (CONCAT);
  array<string> a= split_command (s);
  if (N(a) == 1)
    return compound ("coq-command", "", "dark grey",
                     parse_subcommand (a[0], wrap));
  else if (N(a) > 0) {
    for (int i=0; i<N(a)-1; i++)
      r << compound ("coq-command", "", "dark grey",
                     ensure_inline (parse_subcommand (a[i], wrap)))
        << " ";
    r << compound ("coq-command", "", "dark grey",
                   ensure_inline (parse_subcommand (a[N(a)-1], wrap)));
  }
  return r;
}
long long compound(double rate,int serv,int time,long long pr)
{
    long long net=0;
    if (time==0)
    return pr;
    else
    return (compound(rate,serv,time-1,pr-serv+(int)(pr*rate)));

}
Пример #17
0
void
link_announce (observer obs, modification mod) {
  //cout << "Link event " << mod << "\n";
  for (list<string> ids= pointer_resolve [obs];
       !is_nil (ids); ids= ids->next)
    for (list<tree> lns= get_links (compound ("id", ids->item));
	 !is_nil (lns); lns= lns->next)
      link_announce (lns->item, ids->item, mod);
}
Пример #18
0
void write()
{
    Abc::OArchive archive(
            Alembic::AbcCoreHDF5::WriteArchive(), "HasAMaterial.abc" );
    
    Abc::OObject root(archive, Abc::kTop);
    
    
    //BEGIN Manually create and test schemas and compounds {
    Abc::OObject obj(root, "an_object");
    
    Mat::OMaterialSchema mat(Mat::OMaterialSchema(obj.getProperties(), ".byanyothername"));
    mat.setShader("prman", "surface", "ambocc");
    
    {
        Abc::OCompoundProperty compound(obj.getProperties(), "butnotbythisone");
        Abc::OStringProperty sprop(compound, "value");
        sprop.set("hello");
    }
    
    {
        //add a .material but not created with the schema
        Abc::OCompoundProperty compound(obj.getProperties(), ".material");
        Abc::OStringProperty sprop(compound, "value");
        sprop.set("world");
    }
    
    //END Manually create and test schemas and compounds }
    
    //BEGIN Test assignment and has-a mechanisms {
    {
        Abc::OObject anotherObj(root, "another_object");
        Mat::addMaterialAssignment(anotherObj, "/some/material");
        
        Mat::OMaterialSchema mat = Mat::addMaterial(anotherObj);
        
        mat.setShader("prman", "surface", "carpet");
    }
    //END Test assignment and has-a mechanisms }
    
    
    
}
Пример #19
0
int statement (INTPTR_T func)
{
	if ((ch () == 0) & feof (input))
		return (0);
	lastst = 0;
	if (func)
	{
		if (match ("{")) {
			compound (YES);
			return (lastst);
		} else
			error ("function requires compound statement");
	}
	if (match ("{"))
		compound (NO);
	else
		stst ();
	return (lastst);
}
Пример #20
0
	wns::ldk::CompoundPtr
	SelectiveRepeatFSMTest::createIFrame(int number)
	{
		wns::ldk::CompoundPtr compound(fun->createCompound());
		SelectiveRepeatCommand* command = arq->activateCommand(compound->getCommandPool());

		command->peer.type = SelectiveRepeatCommand::I;
		command->peer.NS = number;
		return compound;
	} // createIFrame
Пример #21
0
    void
    NoneTest::forwarding()
    {
        CompoundPtr compound(getFUN()->createCompound());

        CPPUNIT_ASSERT(compoundsSent() == 0);

        getUpperStub()->sendData(compound);
        CPPUNIT_ASSERT(compoundsSent() == 1);
        CPPUNIT_ASSERT(getLowerStub()->sent[0] == compound);
    } // forwarding
Пример #22
0
	wns::ldk::CompoundPtr
	SelectiveRepeatFSMTest::createACKFrame(wns::ldk::CompoundPtr receivedCompound)
	{
		SelectiveRepeatCommand* receivedPCI = arq->getCommand(receivedCompound->getCommandPool());
		wns::ldk::CompoundPtr compound(fun->createCompound());
		SelectiveRepeatCommand* command = arq->activateCommand(compound->getCommandPool());

		command->peer.type = SelectiveRepeatCommand::ACK;
		command->peer.NS = receivedPCI->peer.NS;
		return compound;
	} // createACKFrame
Пример #23
0
void
bridge_argument_rep::my_typeset (int desired_status) {
  string name;
  tree   value;
  path   valip= decorate_right (ip);

  tree r= st[0];
  if (is_compound (r)) value= tree (ERROR, "arg");
  else {
    name = r->label;
    if ((!is_nil (env->macro_arg)) && env->macro_arg->item->contains (r->label)) {
      value= env->macro_arg->item [name];
      if (!is_func (value, BACKUP)) {
	path new_valip= env->macro_src->item [name];
	if (is_accessible (new_valip)) valip= new_valip;
      }
    }
    else value= compound ("src-unknown", name);
  }

  path prefix;
  if (N(st) > 1) {
    int i, n= N(st);
    for (i=1; i<n; i++) {
      tree r= env->exec (st[i]);
      if (!is_int (r)) {
        prefix= path ();
        value= tree (ERROR, "arg " * name);
        valip= decorate_right (ip);
        break;
      }
      int nr= as_int (r);
      if ((!is_compound (value)) || (nr<0) || (nr>=N(value))) {
        prefix= path ();
        value= tree (ERROR, "arg " * name);
        valip= decorate_right (ip);
        break;
      }
      value = value[nr];
      valip = descend (valip, nr);
      prefix= prefix * nr;
    }
  }
  initialize (name, prefix, attach_here (value, valip));

  ttt->insert_marker (body->st, ip);
  list<hashmap<string,tree> > old_var= env->macro_arg;
  list<hashmap<string,path> > old_src= env->macro_src;
  if (!is_nil (env->macro_arg)) env->macro_arg= env->macro_arg->next;
  if (!is_nil (env->macro_src)) env->macro_src= env->macro_src->next;
  body->typeset (desired_status);
  env->macro_arg= old_var;
  env->macro_src= old_src;
}
Пример #24
0
/*
 *	non-declaration statement
 */
void stst (void )
{
	if (amatch ("if", 2)) {
		doif ();
		lastst = STIF;
	} else if (amatch ("while", 5)) {
		dowhile ();
		lastst = STWHILE;
	} else if (amatch ("switch", 6)) {
		doswitch ();
		lastst = STSWITCH;
	} else if (amatch ("do", 2)) {
		dodo ();
		ns ();
		lastst = STDO;
	} else if (amatch ("for", 3)) {
		dofor ();
		lastst = STFOR;
	} else if (amatch ("return", 6)) {
		doreturn ();
		ns ();
		lastst = STRETURN;
	} else if (amatch ("break", 5)) {
		dobreak ();
		ns ();
		lastst = STBREAK;
	} else if (amatch ("continue", 8)) {
		docont ();
		ns ();
		lastst = STCONT;
	} else if (match (";"))
		;
	else if (amatch ("case", 4)) {
		docase ();
		lastst = statement (NO);
	} else if (amatch ("default", 7)) {
		dodefault ();
		lastst = statement (NO);
	} else if (match ("#asm")) {
		doasm ();
		lastst = STASM;
	} else if (match ("{"))
		compound (NO);
	else {
		expression (YES);
/*		if (match (":")) {
			dolabel ();
			lastst = statement (NO);
		} else {
*/			ns ();
			lastst = STEXP;
/*		}
*/	}
}
Пример #25
0
void
edit_process_rep::generate_glossary (string gly) {
  system_wait ("Generating glossary, ", "please wait");
  if (DEBUG_AUTO)
    debug_automatic << "Generating glossary [" << gly << "]\n";
  tree G= copy (buf->data->aux[gly]);
  if (buf->prj != NULL) G= copy (buf->prj->data->aux[gly]);
  if (N(G)>0) {
    int i, n= N(G);
    tree D (DOCUMENT);
    for (i=0; i<n; i++)
      if (is_func (G[i], TUPLE, 1)) D << G[i][0];
      else if (is_func (G[i], TUPLE, 3) && (G[i][0] == "normal")) {
        tree content= G[i][1];
        if (is_document (content) && N(content) == 1) content= content[0];;
	tree L= compound ("glossary-1", content, G[i][2]);
	D << L;
      }
      else if (is_func (G[i], TUPLE, 4) && (G[i][0] == "normal")) {
        tree content= G[i][1];
        if (is_document (content) && N(content) == 1) content= content[0];;
	tree L= compound ("glossary-2", content, G[i][2], G[i][3]);
	D << L;
      }
      else if (is_func (G[i], TUPLE, 3) && (G[i][0] == "dup")) {
	int j;
	for (j=0; j<N(D); j++)
	  if ((is_compound (D[j], "glossary-1") ||
	       is_compound (D[j], "glossary-2")) &&
	      (D[j][1] == G[i][1]))
	    {
	      tree C= D[j][N(D[j])-1];
	      if (!is_concat (C)) C= tree (CONCAT, C);
	      C << ", ";
	      C << G[i][2];
	      D[j][N(D[j])-1]= C;
	    }
      }
    insert_tree (remove_labels (D));
  }
}
Пример #26
0
static tree
parse_enunciation (string s) {
  int i= 0, n= N(s);
  string kind= parse_command_name (s, i);
  while (i<n && is_blank (s[i])) i++;
  string name= parse_identifier (s, i);
  while (i<n && is_blank (s[i])) i++;
  tree body= parse_subcommand (s (i, n));
  tree r= compound ("coq-enunciation", "", "dark grey");
  r << kind << name << body;
  return r;
}
Пример #27
0
tree
edit_env_rep::rewrite_inactive_var_active (
  tree t, tree var, bool block, bool flush)
{
  (void) block;
  tree r= tree (WITH, MODE, copy (env [MODE]), subvar (var, 0));
  if (flush &&
      (src_compact != COMPACT_ALL) &&
      (is_multi_paragraph (t[0]) || (src_compact == COMPACT_NONE)))
    r= tree (SURROUND, "", compound ("right-flush"), r);
  return tree (MARK, var, r);
}
Пример #28
0
static array<tree>
parse_vernac_proof (string s) {
  array<tree> r;
  array<string> a= split_command (s);
  if (N(a) == 0) return r;
  r << compound ("coq-command", "", "dark grey", parse_subcommand (a[0]));
  if (N(a) > 1) {
    string pf= recompose (range (a, 1, N(a)), " ");
    r << parse_vernac_command (pf);
  }
  return r;
}
Пример #29
0
tree
enrich_embedded_document (tree body, tree style) {
    tree orig= body;
    if (is_func (body, WITH)) body= body[N(body)-1];
    if (!is_func (body, DOCUMENT)) body= tree (DOCUMENT, body);
    hashmap<string,tree> initial (UNINIT);
    initial (PAGE_MEDIUM)= "automatic";
    initial (PAGE_SCREEN_LEFT)= "4px";
    initial (PAGE_SCREEN_RIGHT)= "4px";
    initial (PAGE_SCREEN_TOP)= "2px";
    initial (PAGE_SCREEN_BOT)= "2px";
    if (is_func (orig, WITH))
        for (int i=0; i+2<N(orig); i+=2)
            if (is_atomic (orig[i]))
                initial (orig[i]->label)= orig[i+1];
    tree doc (DOCUMENT);
    doc << compound ("TeXmacs", TEXMACS_VERSION);
    doc << style; //compound ("style", style);
    doc << compound ("body", body);
    doc << compound ("initial", make_collection (initial));
    return doc;
}
Пример #30
0
		void testIncoming()
		{
			CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), upper->received.size());
			CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), inner1->received.size());
			CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), inner2->received.size());

			CompoundPtr compound(fuNet->createCompound());
			lower->onData(compound);

			CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), upper->received.size());
			CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), inner1->received.size());
			CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), inner2->received.size());
		}