Svg with woff fonts: document as new feature in changes.
[lilypond/patrick.git] / lily / keyword.cc
blobb5f7947ada203e31550ee041a557f37f439b115c
1 /*
2 keyword.cc -- keywords and identifiers
3 */
5 #include "keyword.hh"
7 #include <cstring>
8 #include <cstdlib>
9 using namespace std;
11 /* for qsort */
12 bool tab_less (Keyword_ent const &p1, Keyword_ent const &p2)
14 return strcmp (p1.name_, p2.name_) < 0;
17 Keyword_table::Keyword_table (Keyword_ent *tab)
19 while (tab->name_)
20 table_.push_back (*tab++);
22 vector_sort (table_, tab_less);
25 vsize
26 Keyword_table::lookup (char const *s) const
28 Keyword_ent e;
29 e.name_ = s;
30 vsize idx = binary_search (table_, e, tab_less);
31 if (idx != VPOS)
32 return table_[idx].tokcode_;
33 return VPOS;