Back to index

texmacs  1.0.7.15
Functions | Variables
edit_complete.cpp File Reference
#include "edit_interface.hpp"
#include "hashset.hpp"
#include "analyze.hpp"
#include "connect.hpp"

Go to the source code of this file.

Functions

static void find_completions (drd_info drd, tree t, hashset< string > &h, string prefix="")
static array< stringfind_completions (drd_info drd, tree t, string prefix="")
static tree put_cursor (tree t, path p)

Variables

static string cursor_symbol ("[tmcursor]")

Function Documentation

static void find_completions ( drd_info  drd,
tree  t,
hashset< string > &  h,
string  prefix = "" 
) [static]

Definition at line 22 of file edit_complete.cpp.

{
  if (is_atomic (t)) {
    string s= t->label;
    int i= 0, n= N(s);
    while (i<n) {
      if (is_iso_alpha (s[i])) {
       int start= i;
       while ((i<n) && (is_iso_alpha (s[i]))) i++;
       string r= s (start, i);
       if (starts (r, prefix) && (r != prefix))
         h->insert (r (N(prefix), N(r)));
      }
      else skip_symbol (s, i);
    }
  }
  else {
    int i, n= N(t);
    for (i=0; i<n; i++)
      if (drd->is_accessible_child (t, i))
       find_completions (drd, t[i], h, prefix);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static array<string> find_completions ( drd_info  drd,
tree  t,
string  prefix = "" 
) [static]

Definition at line 48 of file edit_complete.cpp.

                                                           {
  hashset<string> h;
  find_completions (drd, t, h, prefix);
  return as_completions (h);
}

Here is the call graph for this function:

static tree put_cursor ( tree  t,
path  p 
) [static]

Definition at line 161 of file edit_complete.cpp.

                            {
  if (is_atomic (t)) {
    string s= t->label;
    return s (0, p->item) * cursor_symbol * s (p->item, N(s));
  }
  else {
    if (p == path (0)) return tree (CONCAT, cursor_symbol, t);
    else if (p == path (1)) return tree (CONCAT, t, cursor_symbol);
    else {
      int i, n= N(t);
      tree u (t, n);
      for (i=0; i<n; i++)
       if (i == p->item) u[i]= put_cursor (t[i], p->next);
       else u[i]= t[i];
      return u;
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

string cursor_symbol("[tmcursor]") [static]