2 * Copyright (c) 2014 Steffen (Daode) Nurpmeso <sdaoden@users.sf.net>.
4 * Copyright (C) 1989 - 1992, 2000 - 2002, 2004
5 * Free Software Foundation, Inc.
6 * Written by James Clark (jjc@jclark.com)
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, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
26 #include "troff-config.h"
34 friend void process_input_stack();
44 TOKEN_CHAR
, // a normal printing character
46 TOKEN_EMPTY
, // this is the initial value
49 TOKEN_HYPHEN_INDICATOR
,
50 TOKEN_INTERRUPT
, // \c
51 TOKEN_ITALIC_CORRECTION
, // \/
54 TOKEN_MARK_INPUT
, // \k -- `nm' is the name of the register
55 TOKEN_NEWLINE
, // newline
61 TOKEN_SPACE
, // ` ' -- ordinary space
62 TOKEN_SPECIAL
, // a special character -- \' \` \- \(xx \[xxx]
63 TOKEN_SPREAD
, // \p -- break and spread output line
64 TOKEN_STRETCHABLE_SPACE
, // \~
65 TOKEN_UNSTRETCHABLE_SPACE
, // `\ '
67 TOKEN_TRANSPARENT
, // \!
68 TOKEN_TRANSPARENT_DUMMY
, // \)
69 TOKEN_ZERO_WIDTH_BREAK
, // \:
70 TOKEN_EOF
// end of file
77 void operator=(const token
&);
82 int nspaces(); // 1 if space, 2 if double space, 0 otherwise
83 int space(); // is the current token a space?
84 int stretchable_space(); // is the current token a stretchable space?
85 int unstretchable_space(); // is the current token an unstretchable space?
86 int white_space(); // is the current token space or tab?
87 int special(); // is the current token a special character?
88 int newline(); // is the current token a newline?
89 int tab(); // is the current token a tab?
92 int delimiter(int warn
= 0); // is it suitable for use as a delimiter?
94 int transparent_dummy();
99 int hyphen_indicator();
100 int zero_width_break();
101 int operator==(const token
&); // need this for delimiters, and for conditions
102 int operator!=(const token
&); // ditto
104 charinfo
*get_char(int required
= 0);
105 int add_to_node_list(node
**);
109 const char *description();
112 extern token tok
; // the current token
114 extern symbol
get_name(int required
= 0);
115 extern symbol
get_long_name(int required
= 0);
116 extern charinfo
*get_optional_char();
117 extern char *read_string();
118 extern void check_missing_character();
119 extern void skip_line();
120 extern void handle_initial_title();
129 extern void do_define_character(char_mode
, const char * = 0);
132 extern void read_title_parts(node
**part
, hunits
*part_width
);
134 extern int get_number_rigidly(units
*result
, unsigned char si
);
136 extern int get_number(units
*result
, unsigned char si
);
137 extern int get_integer(int *result
);
139 extern int get_number(units
*result
, unsigned char si
, units prev_value
);
140 extern int get_integer(int *result
, int prev_value
);
142 void interpolate_number_reg(symbol
, int);
144 const char *asciify(int c
);
146 inline int token::newline()
148 return type
== TOKEN_NEWLINE
;
151 inline int token::space()
153 return type
== TOKEN_SPACE
;
156 inline int token::stretchable_space()
158 return type
== TOKEN_STRETCHABLE_SPACE
;
161 inline int token::unstretchable_space()
163 return type
== TOKEN_UNSTRETCHABLE_SPACE
;
166 inline int token::special()
168 return type
== TOKEN_SPECIAL
;
171 inline int token::nspaces()
173 if (type
== TOKEN_SPACE
)
179 inline int token::white_space()
181 return type
== TOKEN_SPACE
|| type
== TOKEN_TAB
;
184 inline int token::transparent()
186 return type
== TOKEN_TRANSPARENT
;
189 inline int token::page_ejector()
191 return type
== TOKEN_PAGE_EJECTOR
;
194 inline unsigned char token::ch()
196 return type
== TOKEN_CHAR
? c
: 0;
199 inline int token::eof()
201 return type
== TOKEN_EOF
;
204 inline int token::dummy()
206 return type
== TOKEN_DUMMY
;
209 inline int token::transparent_dummy()
211 return type
== TOKEN_TRANSPARENT_DUMMY
;
214 inline int token::left_brace()
216 return type
== TOKEN_LEFT_BRACE
;
219 inline int token::right_brace()
221 return type
== TOKEN_RIGHT_BRACE
;
224 inline int token::tab()
226 return type
== TOKEN_TAB
;
229 inline int token::leader()
231 return type
== TOKEN_LEADER
;
234 inline int token::backspace()
236 return type
== TOKEN_BACKSPACE
;
239 inline int token::hyphen_indicator()
241 return type
== TOKEN_HYPHEN_INDICATOR
;
244 inline int token::zero_width_break()
246 return type
== TOKEN_ZERO_WIDTH_BREAK
;