X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fparse.h;h=abd5bb2d7ef718c41ba9c1a72f6e05b639ed9e83;hb=78a8680cd7379cc0d75af810dabe62c7a6c4a8b2;hp=1b72667d0597c3ac11efb8d9f5b7b250d433182d;hpb=87fbee961fcf302ed92cbc2681375a3bea9ce713;p=chaz%2Fopenbox diff --git a/openbox/parse.h b/openbox/parse.h index 1b72667d..abd5bb2d 100644 --- a/openbox/parse.h +++ b/openbox/parse.h @@ -2,24 +2,30 @@ #define __parse_h #include -#include "y.tab.h" +#ifndef NO_TAB_H +#include "parse.tab.h" +#endif typedef enum { - TOKEN_REAL, - TOKEN_INTEGER, - TOKEN_STRING, - TOKEN_IDENTIFIER, - TOKEN_BOOL, - TOKEN_LBRACKET = '(', - TOKEN_RBRACKET = ')', + TOKEN_REAL = REAL, + TOKEN_INTEGER = INTEGER, + TOKEN_STRING = STRING, + TOKEN_IDENTIFIER = IDENTIFIER, + TOKEN_BOOL = BOOLEAN, + TOKEN_LIST, TOKEN_LBRACE = '{', TOKEN_RBRACE = '}', - TOKEN_EQUALS = '=', TOKEN_COMMA = ',', TOKEN_NEWLINE = '\n' } ParseTokenType; -typedef void (*ParseFunc)(ParseTokenType type, union ParseToken token); +typedef struct { + ParseTokenType type; + union ParseTokenData data; +} ParseToken; + +typedef void (*ParseFunc)(ParseToken *token); +typedef void (*AssignParseFunc)(char *name, ParseToken *value); void parse_startup(); void parse_shutdown(); @@ -29,11 +35,11 @@ void parse_shutdown(); */ void parse_rc(); -void parse_reg_section(char *section, ParseFunc func); +void parse_reg_section(char *section, ParseFunc func, AssignParseFunc afunc); /* Free a parsed token's allocated memory */ -void parse_free_token(ParseTokenType type, union ParseToken token); +void parse_free_token(ParseToken *token); /* Display an error message while parsing. found in parse.yacc */