2 /* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
3 Written by James Clark (jjc@jclark.com)
5 This file is part of groff.
7 groff is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 groff is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License along
18 with groff; see the file COPYING. If not, write to the Free Software
19 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
35 TOKEN_CHAR, // a normal printing character
37 TOKEN_EMPTY, // this is the initial value
40 TOKEN_HYPHEN_INDICATOR,
41 TOKEN_INTERRUPT, // \c
42 TOKEN_ITALIC_CORRECTION, // \/
45 TOKEN_MARK_INPUT, // \k -- `nm' is the name of the register
46 TOKEN_NEWLINE, // newline
52 TOKEN_SPACE, // ` ' -- ordinary space
53 TOKEN_SPECIAL, // a special character -- \' \` \- \(xx
54 TOKEN_SPREAD, // \p -- break and spread output line
56 TOKEN_TRANSPARENT, // \!
57 TOKEN_EOF // end of file
63 void operator=(const token &);
68 int nspaces(); // 1 if space, 2 if double space, 0 otherwise
69 int space(); // is it a space or double space?
70 int white_space(); // is the current token space or tab?
71 int newline(); // is the current token a newline?
72 int tab(); // is the current token a tab?
75 int delimiter(int warn = 0); // is it suitable for use as a delimiter?
81 int hyphen_indicator();
82 int operator==(const token &); // need this for delimiters, and for conditions
83 int operator!=(const token &); // ditto
85 charinfo *get_char(int required = 0);
86 int add_to_node_list(node **);
90 const char *description();
92 friend void process_input_stack();
95 extern token tok; // the current token
97 extern symbol get_name(int required = 0);
98 extern symbol get_long_name(int required = 0);
99 extern charinfo *get_optional_char();
100 extern void check_missing_character();
101 extern void skip_line();
102 extern void handle_initial_title();
105 extern void read_title_parts(node **part, hunits *part_width);
107 extern int get_number(units *result, unsigned char si);
108 extern int get_integer(int *result);
110 extern int get_number(units *result, unsigned char si, units prev_value);
111 extern int get_integer(int *result, int prev_value);
113 void interpolate_number_reg(symbol, int);
115 const char *asciify(int c);
117 inline int token::newline()
119 return type == TOKEN_NEWLINE;
122 inline int token::space()
124 return type == TOKEN_SPACE;
127 inline int token::nspaces()
129 if (type == TOKEN_SPACE)
135 inline int token::white_space()
137 return type == TOKEN_SPACE || type == TOKEN_TAB;
140 inline int token::transparent()
142 return type == TOKEN_TRANSPARENT;
145 inline int token::page_ejector()
147 return type == TOKEN_PAGE_EJECTOR;
150 inline unsigned char token::ch()
152 return type == TOKEN_CHAR ? c : 0;
155 inline int token::eof()
157 return type == TOKEN_EOF;
160 inline int token::dummy()
162 return type == TOKEN_DUMMY;
165 inline int token::left_brace()
167 return type == TOKEN_LEFT_BRACE;
170 inline int token::right_brace()
172 return type == TOKEN_RIGHT_BRACE;
175 inline int token::tab()
177 return type == TOKEN_TAB;
180 inline int token::leader()
182 return type == TOKEN_LEADER;
185 inline int token::backspace()
187 return type == TOKEN_BACKSPACE;
190 inline int token::hyphen_indicator()
192 return type == TOKEN_HYPHEN_INDICATOR;