Back to index

texmacs  1.0.7.15
Public Member Functions | Public Attributes
scheme_language_rep Struct Reference

#include <impl_language.hpp>

Inheritance diagram for scheme_language_rep:
Inheritance graph
[legend]
Collaboration diagram for scheme_language_rep:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 scheme_language_rep (string name)
text_property advance (tree t, int &pos)
array< int > get_hyphens (string s)
void hyphenate (string s, int after, string &left, string &right)
string get_color (tree t, int start, int end)
virtual string get_group (string s)
virtual array< stringget_members (string s)
virtual void highlight (tree t)

Public Attributes

hashmap< string, stringcolored
string lan_name
int hl_lan
string res_name

Detailed Description

Definition at line 32 of file impl_language.hpp.


Constructor & Destructor Documentation

Definition at line 16 of file scheme_language.cpp.

                                                    :
  language_rep (name), colored ("")
{
  eval ("(use-modules (utils misc tm-keywords))");
  list<string> l= as_list_string (eval ("(map symbol->string highlight-any)"));
  while (!is_nil (l)) {
    colored (l->item)= "#309090";
    l= l->next;
  }
}

Here is the call graph for this function:


Member Function Documentation

text_property scheme_language_rep::advance ( tree  t,
int &  pos 
) [virtual]

Implements language_rep.

Definition at line 28 of file scheme_language.cpp.

                                              {
  string s= t->label;
  if (pos==N(s)) return &tp_normal_rep;
  switch (s[pos]) {
  case ' ':
    pos++;
    return &tp_space_rep;
  case '(':
  case ')':
    pos++;
    return &tp_normal_rep;
  }
  while ((pos<N(s)) && (s[pos]!=' ') && (s[pos]!='(') && (s[pos]!=')')) pos++;
  if (pos < N(s) && pos >= 2 && (s[pos] == '(' || s[pos] == ')'))
    if (s[pos-2] == '#' && s[pos-1] == '\\') pos++;
  return &tp_normal_rep;
}

Here is the call graph for this function:

string scheme_language_rep::get_color ( tree  t,
int  start,
int  end 
) [virtual]

Reimplemented from language_rep.

Definition at line 68 of file scheme_language.cpp.

                                                          {
  static string none= "";
  if (start >= end) return none;
  string s= t->label;
  for (int i= max (0, start-1000); i <= start; i++)
    switch (s[i]) {
    case ';': return "brown";
    case '\042':
      i++;
      while (i <= start && s[i] != '\042')
       if (s[i] == '\\' && i < start) i += 2;
       else i++;
      if (i >= start) return "dark grey";
      break;
    }
  if (is_numeric (s[start]) || s[start] == '\042' || s[start] == '#')
    return "dark grey";
  if (s[start] == ':') return "dark magenta";
  string r= s (start, end);
  if (!colored->contains (r)) {
    colored (r)= "";
    if (as_bool (call ("defined?", symbol_object (tm_decode (r)))))
      colored (r)= "#204080";
  }
  return colored[r];
}

Here is the call graph for this function:

string language_rep::get_group ( string  s) [virtual, inherited]

Reimplemented in math_language_rep.

Definition at line 150 of file language.cpp.

                                 {
  (void) s;
  return "default";
}

Implements language_rep.

Definition at line 47 of file scheme_language.cpp.

                                          {
  int i;
  array<int> penalty (N(s)+1);
  penalty[0]= HYPH_INVALID;
  for (i=1; i<N(s); i++)
    if (s[i-1] == '-' && is_alpha (s[i]))
      penalty[i]= HYPH_STD;
    else penalty[i]= HYPH_INVALID;
  penalty[i]= HYPH_INVALID;
  return penalty;
}

Here is the call graph for this function:

array< string > language_rep::get_members ( string  s) [virtual, inherited]

Reimplemented in math_language_rep.

Definition at line 156 of file language.cpp.

                                   {
  (void) s;
  return array<string> ();
}
void language_rep::highlight ( tree  t) [virtual, inherited]

Definition at line 162 of file language.cpp.

                               {
  if (hl_lan != 0 && !has_highlight (t, hl_lan))
    packrat_highlight (res_name, "Main", t);
}

Here is the call graph for this function:

void scheme_language_rep::hyphenate ( string  s,
int  after,
string left,
string right 
) [virtual]

Implements language_rep.

Definition at line 60 of file scheme_language.cpp.

{ 
  left = s(0, after);
  right= s(after, N(s));
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 33 of file impl_language.hpp.

int language_rep::hl_lan [inherited]

Definition at line 113 of file language.hpp.

Definition at line 112 of file language.hpp.

string rep< language >::res_name [inherited]

Definition at line 17 of file resource.hpp.


The documentation for this struct was generated from the following files: