summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-03-31 04:25:38 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-03-31 04:25:38 +0200
commita0cc8fcb087845096462b8f5790bdbc261d3f2a8 (patch)
tree083ec8b3b517ec9214644a87d7ecb7bbc08143b2 /src
parent8b707351c72edb799195ea8c8423f34c72c5c46b (diff)
downloadsolar-a0cc8fcb087845096462b8f5790bdbc261d3f2a8.tar
solar-a0cc8fcb087845096462b8f5790bdbc261d3f2a8.zip
parser: rename token_t and value_t to parser_token_t and parser_value_t
Diffstat (limited to 'src')
-rw-r--r--src/lex.cpp18
-rw-r--r--src/lex.hpp24
-rw-r--r--src/parser.cpp2
-rw-r--r--src/parser.hpp8
-rw-r--r--src/solar.cpp2
5 files changed, 27 insertions, 27 deletions
diff --git a/src/lex.cpp b/src/lex.cpp
index 0587689..a4c64c4 100644
--- a/src/lex.cpp
+++ b/src/lex.cpp
@@ -97,12 +97,12 @@ void lex_t::consume(bool consume_needspace) {
needspace = consume_needspace;
}
-int lex_t::io_error(value_t *value) {
+int lex_t::io_error(parser_value_t *value) {
value->error = "I/O error";
return -1;
}
-int lex_t::syntax_error(value_t *value) {
+int lex_t::syntax_error(parser_value_t *value) {
if (std::ferror(file))
return io_error(value);
@@ -110,7 +110,7 @@ int lex_t::syntax_error(value_t *value) {
return -1;
}
-int lex_t::consume_comment(value_t *value) {
+int lex_t::consume_comment(parser_value_t *value) {
char prev = 0;
while (next(true)) {
@@ -131,7 +131,7 @@ int lex_t::consume_comment(value_t *value) {
}
/*
-int lex_t::unterminated_string(value_t *value) {
+int lex_t::unterminated_string(parser_value_t *value) {
if (ferror(file))
return io_error(value);
@@ -139,7 +139,7 @@ int lex_t::unterminated_string(value_t *value) {
return -1;
}
-int lex_t::lex_string(value_t *value) {
+int lex_t::lex_string(parser_value_t *value) {
char *buf = NULL;
size_t len = 1024;
size_t pos = 0;
@@ -189,7 +189,7 @@ int lex_t::lex_string(value_t *value) {
return TOK_STRING;
}*/
-int lex_t::lex_number(value_t *value) {
+int lex_t::lex_number(parser_value_t *value) {
if (needspace)
return syntax_error(value);
@@ -219,7 +219,7 @@ int lex_t::lex_number(value_t *value) {
return TOK_UINT;
}
-int lex_t::lex_keyword(value_t *value) {
+int lex_t::lex_keyword(parser_value_t *value) {
if (needspace)
return syntax_error(value);
@@ -243,7 +243,7 @@ int lex_t::lex_keyword(value_t *value) {
return ret->token;
}
-int lex_t::lex_symbol(value_t *value, bool terminal) {
+int lex_t::lex_symbol(parser_value_t *value, bool terminal) {
if (needspace)
return syntax_error(value);
@@ -275,7 +275,7 @@ int lex_t::lex_symbol(value_t *value, bool terminal) {
return terminal ? TOK_TERM : TOK_NONTERM;
}
-int lex_t::lex(value_t *value) {
+int lex_t::lex(parser_value_t *value) {
int token;
while (end > start) {
diff --git a/src/lex.hpp b/src/lex.hpp
index 8898d0b..ea8621b 100644
--- a/src/lex.hpp
+++ b/src/lex.hpp
@@ -62,17 +62,17 @@ private:
bool next(bool move);
void consume(bool needspace);
- int io_error(value_t *value);
- int syntax_error(value_t *value);
- int consume_comment(value_t *value);
- //int unterminated_string(value_t *value);
-
- int lex_string(value_t *value);
- int lex_address(value_t *value);
- int lex_float(value_t *value);
- int lex_number(value_t *value);
- int lex_keyword(value_t *value);
- int lex_symbol(value_t *value, bool terminal);
+ int io_error(parser_value_t *value);
+ int syntax_error(parser_value_t *value);
+ int consume_comment(parser_value_t *value);
+ //int unterminated_string(parser_value_t *value);
+
+ int lex_string(parser_value_t *value);
+ int lex_address(parser_value_t *value);
+ int lex_float(parser_value_t *value);
+ int lex_number(parser_value_t *value);
+ int lex_keyword(parser_value_t *value);
+ int lex_symbol(parser_value_t *value, bool terminal);
char current() {
return buffer[start + tok_len];
@@ -92,7 +92,7 @@ public:
fclose(file);
}
- int lex(value_t *value);
+ int lex(parser_value_t *value);
const location_t & get_location() const {
return loc;
diff --git a/src/parser.cpp b/src/parser.cpp
index c931ca6..d21a196 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -49,7 +49,7 @@ parser_t * parser_alloc(void) {
return parser;
}
-int parser_push(parser_t *parser, int token, const value_t *value, parser_state_t *state) {
+int parser_push(parser_t *parser, int token, const parser_value_t *value, parser_state_t *state) {
switch (parser->state) {
case STATE_INIT:
switch (token) {
diff --git a/src/parser.hpp b/src/parser.hpp
index 0cd6b38..6d21796 100644
--- a/src/parser.hpp
+++ b/src/parser.hpp
@@ -33,7 +33,7 @@
namespace solar {
-enum token_t {
+enum parser_token_t {
TOK_TERM = 1,
TOK_NONTERM,
TOK_BLOCK,
@@ -41,18 +41,18 @@ enum token_t {
TOK_UINT,
};
-typedef struct value {
+typedef struct parser_value {
char *str;
uint64_t number;
const char *error;
-} value_t;
+} parser_value_t;
typedef struct parser parser_t;
parser_t * parser_alloc(void);
-int parser_push(parser_t *parser, int token, const value_t *value, parser_state_t *state);
+int parser_push(parser_t *parser, int token, const parser_value_t *value, parser_state_t *state);
void parser_free(parser_t *parser);
}
diff --git a/src/solar.cpp b/src/solar.cpp
index 975ea22..e0fbba0 100644
--- a/src/solar.cpp
+++ b/src/solar.cpp
@@ -48,7 +48,7 @@ bool read_grammar(const char *filename, parser_state_t *state) {
do {
int token;
- value_t value;
+ parser_value_t value;
token = lexer->lex(&value);
if (token < 0) {