diff options
Diffstat (limited to 'fluid/widgets/Style_Parser.cxx')
| -rw-r--r-- | fluid/widgets/Style_Parser.cxx | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/fluid/widgets/Style_Parser.cxx b/fluid/widgets/Style_Parser.cxx index 9929cc01a..9188e565e 100644 --- a/fluid/widgets/Style_Parser.cxx +++ b/fluid/widgets/Style_Parser.cxx @@ -22,9 +22,6 @@ #include <ctype.h> #include <stdlib.h> // bsearch() -using namespace fld; -using namespace fld::widget; - // Sorted list of C/C++ keywords... static const char * const code_keywords[] = { "and", @@ -133,7 +130,7 @@ static void* search_types(char *find) { // Applies the current style, advances to next text + style char. // Returns 0 if hit end of buffer, 1 otherwise. // -int Style_Parser::parse_over_char(int handle_crlf) { +int fld::widget::Style_Parser::parse_over_char(int handle_crlf) { char c = *tbuff; // End of line? @@ -160,7 +157,7 @@ int Style_Parser::parse_over_char(int handle_crlf) { // Parse over white space using current style // Returns 0 if hit end of buffer, 1 otherwise. // -int Style_Parser::parse_over_white() { +int fld::widget::Style_Parser::parse_over_white() { while ( len > 0 && strchr(" \t", *tbuff)) { if ( !parse_over_char() ) return 0; } return 1; @@ -169,7 +166,7 @@ int Style_Parser::parse_over_white() { // Parse over non-white alphabetic text // Returns 0 if hit end of buffer, 1 otherwise. // -int Style_Parser::parse_over_alpha() { +int fld::widget::Style_Parser::parse_over_alpha() { while ( len > 0 && isalpha(*tbuff) ) { if ( !parse_over_char() ) return 0; } return 1; @@ -178,7 +175,7 @@ int Style_Parser::parse_over_alpha() { // Parse to end of line in specified style. // Returns 0 if hit end of buffer, 1 otherwise. // -int Style_Parser::parse_to_eol(char s) { +int fld::widget::Style_Parser::parse_to_eol(char s) { char save = style; style = s; while ( *tbuff != '\n' ) @@ -190,7 +187,7 @@ int Style_Parser::parse_to_eol(char s) { // Parse a block comment until end of comment or buffer. // Returns 0 if hit end of buffer, 1 otherwise. // -int Style_Parser::parse_block_comment() { +int fld::widget::Style_Parser::parse_block_comment() { char save = style; style = 'C'; // block comment style while ( len > 0 ) { @@ -206,10 +203,11 @@ int Style_Parser::parse_block_comment() { } // Copy keyword from tbuff -> keyword[] buffer -void Style_Parser::buffer_keyword() { +void fld::widget::Style_Parser::buffer_keyword() { char *key = keyword; char *kend = key + sizeof(keyword) - 1; // end of buffer - for ( const char *s=tbuff; + const char *s; + for (s =tbuff; (islower(*s) || *s=='_') && (key < kend); *key++ = *s++ ) { } *key = 0; // terminate @@ -218,7 +216,7 @@ void Style_Parser::buffer_keyword() { // Parse over specified 'key'word in specified style 's'. // Returns 0 if hit end of buffer, 1 otherwise. // -int Style_Parser::parse_over_key(const char *key, char s) { +int fld::widget::Style_Parser::parse_over_key(const char *key, char s) { char save = style; style = s; // Parse over the keyword while applying style to sbuff @@ -232,7 +230,7 @@ int Style_Parser::parse_over_key(const char *key, char s) { // Parse over angle brackets <..> in specified style. // Returns 0 if hit end of buffer, 1 otherwise. // -int Style_Parser::parse_over_angles(char s) { +int fld::widget::Style_Parser::parse_over_angles(char s) { if ( *tbuff != '<' ) return 1; // not <..>, early exit char save = style; style = s; @@ -248,7 +246,7 @@ int Style_Parser::parse_over_angles(char s) { // spi.keyword[] will contain parsed word. // Returns 0 if hit end of buffer, 1 otherwise. // -int Style_Parser::parse_keyword() { +int fld::widget::Style_Parser::parse_keyword() { // Parse into 'keyword' buffer buffer_keyword(); char *key = keyword; @@ -265,7 +263,7 @@ int Style_Parser::parse_keyword() { // Style parse a quoted string, either "" or ''. // Returns 0 if hit end of buffer, 1 otherwise. // -int Style_Parser::parse_quoted_string(char quote_char, // e.g. '"' or '\'' +int fld::widget::Style_Parser::parse_quoted_string(char quote_char, // e.g. '"' or '\'' char in_style) { // style for quoted text style = in_style; // start string style if ( !parse_over_char() ) return 0; // parse over opening quote @@ -292,7 +290,7 @@ int Style_Parser::parse_quoted_string(char quote_char, // e.g. '"' or '\'' // Style parse a directive (#include, #define..) // Returns 0 if hit end of buffer, 1 otherwise. // -int Style_Parser::parse_directive() { +int fld::widget::Style_Parser::parse_directive() { style = 'E'; // start directive style if ( !parse_over_char() ) return 0; // Parse over '#' if ( !parse_over_white() ) return 0; // Parse over any whitespace after '#' @@ -306,7 +304,7 @@ int Style_Parser::parse_directive() { // Style parse a line comment to end of line. // Returns 0 if hit end of buffer, 1 otherwise. // -int Style_Parser::parse_line_comment() { +int fld::widget::Style_Parser::parse_line_comment() { return parse_to_eol('B'); } @@ -315,7 +313,7 @@ int Style_Parser::parse_line_comment() { // a continuation of a line, such as in a multiline #directive. // Returns 0 if hit end of buffer, 1 otherwise. // -int Style_Parser::parse_escape() { +int fld::widget::Style_Parser::parse_escape() { const char no_crlf = 0; if ( !parse_over_char(no_crlf) ) return 0; // backslash if ( !parse_over_char(no_crlf) ) return 0; // char escaped @@ -325,7 +323,7 @@ int Style_Parser::parse_escape() { // Parse all other non-specific characters // Returns 0 if hit end of buffer, 1 otherwise. // -int Style_Parser::parse_all_else() { +int fld::widget::Style_Parser::parse_all_else() { last = isalnum(*tbuff) || *tbuff == '_' || *tbuff == '.'; return parse_over_char(); } |
