glob [ #include #include main() { int diff; char aString[] = "a b c \t a bollocks"; char result[100]; testParser(&diff, aString, strlen(aString), result, 55); printf("Got a result of: '%s'\n", result); getchar(); } int globalVar = 4; ] parse testParser [in[char* in1, int in2] anyindex n anychar a,b,c anychar[ ] X,Y,Z top [ printf("Executing the top-block\n"); ] onfail [ printf("Executing the onfail-block\n"); ] onmismatch [ printf("\t-\tExecuting the onmismatch-block\n"); printf("\t-\tThe next input to parse is '%c%c%c%c'\n", now[0], now[1], now[2], now[3]); ] every ws[] [ printf("Executed the every-block\n"); ] tween " " [ ] -> else [ printf("The function got %d as the input 'in2'\n", in2); ] doItAgain-> "a" cond[ globalVar==4 ] [ printf("Found the letter 'a'\n"); ] a a[ a=='b' ] [ printf("Found the letter '%c'\n", a); ] X X[ X[n]=='c' ] [ printf("Found the letters '%s'\n", X); ]>doItAgain -> noevery (ws[] "d") [ printf("Found the letter 'a'\n"); strcpy(in1, "d"); return true; ] notween (ws[] "b" "o" "l" "l" "o" "c" "k" "s" ) [ printf("Found 'bollocks'\n"); strcpy(in1, "bollocks"); return true; ] "" cond[ globalVar==4 ] [ printf("The globalVar is 4\n"); ]>doItAgain ] glob [ // a glob block can appear anywhere a parse function can ] parse ws [ anychar[] Wo anyindex an -> Wo Wo[ Wo[an]==' ' || Wo[an]=='\t' || Wo[an]=='\n' ] [ printf("\t'ws' found whitespace: '%s'\n", Wo); return true; ] ]