diff options
-rw-r--r-- | doc/searching.doc | 6 | ||||
-rw-r--r-- | src/constexp.l | 3 | ||||
-rw-r--r-- | src/constexp.y | 6 | ||||
-rw-r--r-- | src/cppvalue.cpp | 10 | ||||
-rw-r--r-- | src/cppvalue.h | 1 | ||||
-rw-r--r-- | src/qcstring.h | 2 |
6 files changed, 26 insertions, 2 deletions
diff --git a/doc/searching.doc b/doc/searching.doc index 880c3f4..1bdb12d 100644 --- a/doc/searching.doc +++ b/doc/searching.doc @@ -43,8 +43,12 @@ has its own advantages and disadvantages: searching, i.e. the search results are presented and adapted as you type. This method also has its drawbacks: it is limited to searching for symbols - only. It does not provide full text search capabilities, and it does not + only. It does not provide full text search capabilities and it does not scale well to very large projects (then searching becomes very slow). + Furthermore the searching is done from the beginning of the indexed items, so + when having the available items `A_STRING`, `AA_STRING` and `STRING` and + typing in the search box `A` it will find `A_STRING` and `AA_STRING`, but when + typing e.g. `STR` it will only find `STRING` and not `A_STRING`. <h2>2. Server side searching</h2> If you plan to put the HTML documentation on a web server, and that diff --git a/src/constexp.l b/src/constexp.l index a26d517..889626c 100644 --- a/src/constexp.l +++ b/src/constexp.l @@ -90,6 +90,9 @@ CONSTSUFFIX ([uU][lL]?[lL]?)|([lL][lL]?[uU]?) (0x|0X)[0-9a-fA-F]+{CONSTSUFFIX}? { yyextra->strToken=yytext+2; return TOK_HEXADECIMALINT; } +(0b|0B)[01]+{CONSTSUFFIX}? { yyextra->strToken=yytext+2; + return TOK_BINARYINT; + } (([0-9]+\.[0-9]*)|([0-9]*\.[0-9]+))([eE]([\-\+])?[0-9]+)?([fFlL])? { yyextra->strToken=yytext; return TOK_FLOAT; } diff --git a/src/constexp.y b/src/constexp.y index 560b3c3..4ebbc79 100644 --- a/src/constexp.y +++ b/src/constexp.y @@ -64,6 +64,7 @@ int constexpYYerror(yyscan_t yyscanner, const char *s) %token TOK_OCTALINT %token TOK_DECIMALINT %token TOK_HEXADECIMALINT +%token TOK_BINARYINT %token TOK_CHARACTER %token TOK_FLOAT @@ -276,6 +277,11 @@ constant: TOK_OCTALINT struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner); $$ = parseHexadecimal(yyextra->strToken); } + | TOK_BINARYINT + { + struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner); + $$ = parseBinary(yyextra->strToken); + } | TOK_CHARACTER { struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner); diff --git a/src/cppvalue.cpp b/src/cppvalue.cpp index 77677d9..8cd7c5c 100644 --- a/src/cppvalue.cpp +++ b/src/cppvalue.cpp @@ -51,6 +51,16 @@ CPPValue parseHexadecimal(const std::string& token) return CPPValue(val); } +CPPValue parseBinary(const std::string& token) +{ + long val = 0; + for (const char *p = token.c_str(); *p != 0; p++) + { + if (*p >= '0' && *p <= '1') val = val * 2 + *p - '0'; + } + return CPPValue(val); +} + CPPValue parseCharacter(const std::string& token) // does not work for '\n' and the alike { if (token[1]=='\\') diff --git a/src/cppvalue.h b/src/cppvalue.h index 7732068..74fe4d7 100644 --- a/src/cppvalue.h +++ b/src/cppvalue.h @@ -52,6 +52,7 @@ class CPPValue extern CPPValue parseOctal(const std::string& token); extern CPPValue parseDecimal(const std::string& token); extern CPPValue parseHexadecimal(const std::string& token); +extern CPPValue parseBinary(const std::string& token); extern CPPValue parseCharacter(const std::string& token); extern CPPValue parseFloat(const std::string& token); diff --git a/src/qcstring.h b/src/qcstring.h index f7cccb7..886573a 100644 --- a/src/qcstring.h +++ b/src/qcstring.h @@ -42,7 +42,7 @@ typedef unsigned long ulong; typedef int64_t int64; typedef uint64_t uint64; #define ASSERT(x) if ( !(x) )\ - fprintf(stderr,"ASSERT: \"%s\" in %s (%d)",#x,__FILE__,__LINE__) + fprintf(stderr,"ASSERT: \"%s\" in %s (%d)\n",#x,__FILE__,__LINE__) /***************************************************************************** |