Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
clex.h
Package: parse.tar.Z [view]
Upload User: hbdengju
Upload Date: 2007-01-06
Package Size: 11k
Code Size: 2k
Category:
Compiler program
Development Platform:
C/C++
- #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] = ''; 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