2 /* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002
3 Free Software Foundation, Inc.
4 Written by James Clark (jjc@jclark.com)
6 This file is part of groff.
8 groff is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
13 groff is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License along
19 with groff; see the file COPYING. If not, write to the Free Software
20 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
36 TOKEN_CHAR, // a normal printing character
38 TOKEN_EMPTY, // this is the initial value
41 TOKEN_HYPHEN_INDICATOR,
42 TOKEN_INTERRUPT, // \c
43 TOKEN_ITALIC_CORRECTION, // \/
46 TOKEN_MARK_INPUT, // \k -- `nm' is the name of the register
47 TOKEN_NEWLINE, // newline
53 TOKEN_SPACE, // ` ' -- ordinary space
54 TOKEN_SPECIAL, // a special character -- \' \` \- \(xx \[xxx]
55 TOKEN_SPREAD, // \p -- break and spread output line
56 TOKEN_STRETCHABLE_SPACE, // \~
57 TOKEN_UNSTRETCHABLE_SPACE, // `\ '
59 TOKEN_TRANSPARENT, // \!
60 TOKEN_TRANSPARENT_DUMMY, // \)
61 TOKEN_ZERO_WIDTH_BREAK, // \:
62 TOKEN_EOF // end of file
68 void operator=(const token &);
73 int nspaces(); // 1 if space, 2 if double space, 0 otherwise
74 int space(); // is the current token a space?
75 int stretchable_space(); // is the current token a stretchable space?
76 int unstretchable_space(); // is the current token an unstretchable space?
77 int white_space(); // is the current token space or tab?
78 int special(); // is the current token a special character?
79 int newline(); // is the current token a newline?
80 int tab(); // is the current token a tab?
83 int delimiter(int warn = 0); // is it suitable for use as a delimiter?
85 int transparent_dummy();
90 int hyphen_indicator();
91 int zero_width_break();
92 int operator==(const token &); // need this for delimiters, and for conditions
93 int operator!=(const token &); // ditto
95 charinfo *get_char(int required = 0);
96 int add_to_node_list(node **);
100 const char *description();
102 friend void process_input_stack();
105 extern token tok; // the current token
107 extern symbol get_name(int required = 0);
108 extern symbol get_long_name(int required = 0);
109 extern charinfo *get_optional_char();
110 extern char *read_string();
111 extern void check_missing_character();
112 extern void skip_line();
113 extern void handle_initial_title();
116 extern void read_title_parts(node **part, hunits *part_width);
118 extern int get_number_rigidly(units *result, unsigned char si);
120 extern int get_number(units *result, unsigned char si);
121 extern int get_integer(int *result);
123 extern int get_number(units *result, unsigned char si, units prev_value);
124 extern int get_integer(int *result, int prev_value);
126 void interpolate_number_reg(symbol, int);
128 const char *asciify(int c);
130 inline int token::newline()
132 return type == TOKEN_NEWLINE;
135 inline int token::space()
137 return type == TOKEN_SPACE;
140 inline int token::stretchable_space()
142 return type == TOKEN_STRETCHABLE_SPACE;
145 inline int token::unstretchable_space()
147 return type == TOKEN_UNSTRETCHABLE_SPACE;
150 inline int token::special()
152 return type == TOKEN_SPECIAL;
155 inline int token::nspaces()
157 if (type == TOKEN_SPACE)
163 inline int token::white_space()
165 return type == TOKEN_SPACE || type == TOKEN_TAB;
168 inline int token::transparent()
170 return type == TOKEN_TRANSPARENT;
173 inline int token::page_ejector()
175 return type == TOKEN_PAGE_EJECTOR;
178 inline unsigned char token::ch()
180 return type == TOKEN_CHAR ? c : 0;
183 inline int token::eof()
185 return type == TOKEN_EOF;
188 inline int token::dummy()
190 return type == TOKEN_DUMMY;
193 inline int token::transparent_dummy()
195 return type == TOKEN_TRANSPARENT_DUMMY;
198 inline int token::left_brace()
200 return type == TOKEN_LEFT_BRACE;
203 inline int token::right_brace()
205 return type == TOKEN_RIGHT_BRACE;
208 inline int token::tab()
210 return type == TOKEN_TAB;
213 inline int token::leader()
215 return type == TOKEN_LEADER;
218 inline int token::backspace()
220 return type == TOKEN_BACKSPACE;
223 inline int token::hyphen_indicator()
225 return type == TOKEN_HYPHEN_INDICATOR;
228 inline int token::zero_width_break()
230 return type == TOKEN_ZERO_WIDTH_BREAK;