2 keyword.cc -- keywords and identifiers
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
)
20 table_
.push_back (*tab
++);
22 vector_sort (table_
, tab_less
);
26 Keyword_table::lookup (char const *s
) const
30 vsize idx
= binary_search (table_
, e
, tab_less
);
32 return table_
[idx
].tokcode_
;