Sunday, July 17, 2005

Experiments with syntax highlighting

I have been posting code for a while now, I want to try and post good looking code - which is syntax highlighted.

Here is the first attempt


/*
* Simple program to parse regular expressions
* (C) Balbir Singh
* Permission to copy the program if and only if the (C) is
* maintained.
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <bitset>
#include <iostream>
#include <queue>
using namespace std;

static bool status = true;

#ifdef DEBUG
#define debug(x...) {\
printf("%s:%d ", __FUNCTION__, __LINE__); \
printf(x); \
}
#else
#define debug(x...)
#endif

#define pcr debug("current token is %c\n", s[idx]);
#define perr {\
fprintf(stderr, "%s:%d parse error at token is %c\n", \
__PRETTY_FUNCTION__, __LINE__, s[idx-1]); \
status = false; \
};

Post a Comment