Back to index

texmacs  1.0.7.15
Public Member Functions | Public Attributes
text_language_rep Struct Reference
Inheritance diagram for text_language_rep:
Inheritance graph
[legend]
Collaboration diagram for text_language_rep:
Collaboration graph
[legend]

List of all members.

Public Member Functions

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

Public Attributes

hashmap< string, stringpatterns
hashmap< string, stringhyphenations
string lan_name
int hl_lan
string res_name

Detailed Description

Definition at line 29 of file text_language.cpp.


Constructor & Destructor Documentation

text_language_rep::text_language_rep ( string  lan_name,
string  hyph_name 
)

Definition at line 39 of file text_language.cpp.

                                                                      :
  language_rep (lan_name), patterns ("?"), hyphenations ("?") {
    load_hyphen_tables (hyph_name, patterns, hyphenations); }

Here is the call graph for this function:


Member Function Documentation

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

Implements language_rep.

Definition at line 44 of file text_language.cpp.

                                            {
  string s= t->label;
  if (pos == N(s)) return &tp_normal_rep;

  if (s[pos]==' ') {
    pos++;
    // while ((pos<N(s)) && (s[pos]==' ')) pos++;
    if ((pos == N(s)) || (!is_punctuation (s[pos])))
      return &tp_space_rep;
    return &tp_blank_rep;
  }
  
  if (is_punctuation (s[pos])) {
    while ((pos<N(s)) && is_punctuation (s[pos])) pos++;
    if ((pos==N(s)) || (s[pos]!=' ')) return &tp_normal_rep;
    switch (s[pos-1]) {
    case ',': case ':': case ';': case '`': case '\'':
      return &tp_space_rep;
    case '.': case '!': case '?':
      return &tp_period_rep;
    }
    return &tp_space_rep;
  }

  if (s[pos]=='-') {
    pos++;
    while ((pos<N(s)) && (s[pos]=='-')) pos++;
    return &tp_hyph_rep;
  }

  if (is_iso_alpha (s[pos])) {
    while ((pos<N(s)) && is_iso_alpha (s[pos])) pos++;
    return &tp_normal_rep;
  }

  if (is_numeric (s[pos])) { // can not be a '.'
    while ((pos<N(s)) && is_numeric (s[pos])) pos++;
    while (s[pos-1]=='.') pos--;
    return &tp_normal_rep;
  }

  if (s[pos]=='<') {
    while ((pos<N(s)) && (s[pos]!='>')) pos++;
    if (pos<N(s)) pos++;
    return &tp_normal_rep;
  }

  pos++;
  return &tp_normal_rep;
}

Here is the call graph for this function:

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

Reimplemented in cpp_language_rep, mathemagix_language_rep, scheme_language_rep, and verb_language_rep.

Definition at line 168 of file language.cpp.

                                                   {
  (void) t; (void) start; (void) end;
  return "";
}
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";
}
array< int > text_language_rep::get_hyphens ( string  s) [virtual]

Implements language_rep.

Definition at line 96 of file text_language.cpp.

Here is the caller 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 text_language_rep::hyphenate ( string  s,
int  after,
string left,
string right 
) [virtual]

Implements language_rep.

Definition at line 101 of file text_language.cpp.

{
  array<int> penalty= get_hyphens (s);
  std_hyphenate (s, after, left, right, penalty[after]);
}

Here is the call graph for this function:


Member Data Documentation

int language_rep::hl_lan [inherited]

Definition at line 113 of file language.hpp.

Definition at line 31 of file text_language.cpp.

Definition at line 112 of file language.hpp.

Definition at line 30 of file text_language.cpp.

string rep< language >::res_name [inherited]

Definition at line 17 of file resource.hpp.


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