parrotcode: Setting up input and reading input | |
Contents | Language Implementations | M4 |
input.imc - Setting up input and reading input
Copyright: 2004 Bernhard Schmalhofer. All Rights Reserved. CVS Info: $Id$ History: Ported from GNU m4 1.4 References: http://www.gnu.org/software/m4/m4.html
Initialise the input stack and various regexes.
'input_stack' contains files, strings and macro definitions 'word_regex' recognizes TOKEN_WORD. 'string_regex' recognizes TOKEN_STRING 'simple_regex' recognizes TOKEN_SIMPLE 'comment_regex' recognizes comments, returned as TOKEN_SIMPLE
TODO: recognize nested quoted strings
Stores a filename on a stack TODO: open these files and complain when they don't or pass filehandles
Parse and return a single token from the input stream. A token can either be TOKEN_EOF, if the input_stack is empty; it can be TOKEN_STRING for a quoted string; TOKEN_WORD for something that is a potential macro name; and TOKEN_SIMPLE for any single character that is not a part of any of the previous types. | Next_token () return the token type and the token data.
Uses regular expressions for finding tokens.
|