Finished CURL, added REGEX support
This commit is contained in:
parent
0aeb962a4e
commit
b204d34e86
@ -24,6 +24,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <regex>
|
||||
|
||||
/* DEFINES */
|
||||
#define MAIN int main (int argc, char** argv) {
|
||||
@ -88,7 +89,8 @@
|
||||
#define NEXT }
|
||||
#define STRARRAY VECTOR<CSTRING>
|
||||
#define LEN(x) x.size()
|
||||
|
||||
#define REGQUERY std::regex
|
||||
#define REGMATCH std::smatch
|
||||
|
||||
|
||||
|
||||
|
12
runtime.inc
12
runtime.inc
@ -18,6 +18,16 @@ DECLARE FUNCTION CSTRING FORMAT$ (CONSTANT CSTRING fmt, ...);
|
||||
DECLARE FUNCTION VECTOR<CSTRING> SPLIT (CONSTANT CSTRING input, CONSTANT CSTRING separators, BOOL remove_empty = TRUE);
|
||||
DECLARE SUB PRINT (CSTRING);
|
||||
DECLARE SUB SAVEFILE(CSTRING src, CSTRING fname);
|
||||
DECLARE FUNCTION CSTRING REGEX (CSTRING src, CSTRING query);
|
||||
|
||||
FUNCTION CSTRING REGEX (CSTRING src, CSTRING query) {
|
||||
CSTRING result;
|
||||
REGMATCH match;
|
||||
REGQUERY term(query);
|
||||
if (regex_search(src, match, term) == true)
|
||||
result = match[1];
|
||||
return result;
|
||||
ENDFUNCTION
|
||||
|
||||
FUNCTION VECTOR<CSTRING> SPLIT (CONSTANT CSTRING input, CONSTANT CSTRING separators, BOOL remove_empty) BEGIN
|
||||
DIM VECTOR<CSTRING> lst;
|
||||
@ -127,7 +137,7 @@ ENDFUNCTION
|
||||
FUNCTION CSTRING MCASE$ (CSTRING S) BEGIN
|
||||
DIM AS CSTRING tmpStr(S);
|
||||
DIM AS bool capFlag = FALSE;
|
||||
DIM AS register size_t i;
|
||||
DIM AS size_t i;
|
||||
|
||||
|
||||
std::transform(tmpStr.begin(),tmpStr.end(),tmpStr.begin(),::tolower);
|
||||
|
Loading…
Reference in New Issue
Block a user