|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T c
Length: 1555 (0x613)
Types: TextFile
Names: »clex.h«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
└─⟦this⟧ »EUUGD11/euug-87hel/sec1/clex/clex.h«
#ifndef INCLUDED_CLEX
#define INCLUDED_CLEX 1
#ifndef INCLUDED_STDIO
#include <stdio.h>
#endif
enum Boolean { FALSE, TRUE };
#include "clex_sym.h"
class Clex
{
friend class Cparse;
enum Clex_mode
{ CL_NONE=0, CL_COMMENT=1, CL_QUOTE=2, CL_POUND=4, CL_BRACK=8 };
protected:
short look; // a one-char lookahead
FILE* fp;
Boolean block_brack; // if TRUE, treat contents of "[]" as a string
long line_num; // line number in original source file
char filename[256]; // name of original source file
short bufsiz; // number of chars currently in buf
char buf[256];
void eat_one() { look = short(getc(fp)); }
void put_in_buf(char c) { if (bufsiz < sizeof(buf)-1) buf[bufsiz++] = c; }
void buf_one() { put_in_buf(look); eat_one(); }
Clex_sym terminate(Clex_sym s) { buf[bufsiz] = '\0'; return s; }
Clex_sym eat_return(Clex_sym);
Clex_sym num(char);
Clex_sym ident(char);
Clex_sym lbrack(Clex_mode);
Clex_sym quote(char, Clex_sym, Clex_mode);
void block_comment(Clex_mode);
void line_comment();
void eoln(Clex_mode);
virtual Boolean pound(Clex_mode, char*, short len);
public:
Clex_sym next();
const char* str() { return buf; }
short strlen() { return bufsiz; }
long line_no() { return line_num; }
const char* fname() { return filename; }
const char* debug(Clex_sym);
Clex(FILE*, Boolean block_brack);
};
#endif