Changeset 28bccd2 in tol
- Timestamp:
- May 5, 2011, 10:57:08 AM (15 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- e2cfb5f
- Parents:
- d6b52ea
- Location:
- tol
- Files:
-
- 2 edited
-
btol/real_type/datgrav.cpp (modified) (3 diffs)
-
stdlib/general/grammars/_text.tol (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tol/btol/real_type/datgrav.cpp
rd6b52ea r28bccd2 25 25 26 26 #include <tol/tol_bdatgra.h> 27 #include <tol/tol_init.h> 27 28 #include <tol/tol_bout.h> 28 29 #include <tol/tol_bdir.h> … … 2033 2034 DeclareContensClass(BDat, BDatTemporary, BDatMatchText); 2034 2035 DefExtOpr(1, BDatMatchText, "TextMatch", 2, 3, "Text Text Real", 2035 I2("(Text chain, Text pattern [, Real case = 0 ])",2036 I2("(Text string, Text pattern [, Real case = 0 ])", 2036 2037 "(Text cadena, Text modelo [, Real modo = 0 ])"), 2037 2038 I2( … … 2072 2073 //-------------------------------------------------------------------- 2073 2074 { 2075 BText& string = Text(Arg(1)); 2076 BText& pattern = Text(Arg(2)); 2074 2077 BInt mode = 0; 2075 2078 if(Arg(3)) { mode = (BInt)Real(Arg(3)); } 2076 contens_ = (BReal)(Text(Arg(1)).Match(Text(Arg(2)), mode)); 2079 if(TolTclIsEnabled()) 2080 { 2081 BText expr = BText("TextMatch_Tcl(\"")+string+"\",\""+pattern+"\","+mode+")"; 2082 BSyntaxObject* uMatch = GraReal()->EvaluateExpr(expr); 2083 if(uMatch) 2084 { 2085 contens_ = Real(uMatch)!=0; 2086 DESTROY(uMatch); 2087 } 2088 } 2089 else 2090 { 2091 Warning("Using internal version of TextMatch could cause invalid results. " 2092 "Please use a TCL version of TOL like tolsh or tolbase."); 2093 contens_ = (BReal)(string.Match(pattern, mode)); 2094 } 2077 2095 } 2078 2096 -
tol/stdlib/general/grammars/_text.tol
rd6b52ea r28bccd2 1248 1248 WriteFile(filePath, Replace(contens, old, new)) 1249 1249 }; 1250 1251 ////////////////////////////////////////////////////////////////////////////// 1252 Real TextMatch_Tcl(Text text, Text pattern, Real case) 1253 ////////////////////////////////////////////////////////////////////////////// 1254 { 1255 Text text.tcl = "{"<<Replace(Replace(Replace(text, "\\", "\\\\"), 1256 "{", "\\{"), "}", "\\}") << "}"; 1257 Text pattern.tcl = "{"<<Replace(Replace(Replace(pattern, "\\", "\\\\"), 1258 "{", "\\{"), "}", "\\}") << "}"; 1259 Text caseText = If(case, "", "-nocase "); 1260 Eval(Tcl_Eval("string match "<<caseText<<pattern.tcl<<" "<<text.tcl)[1]) 1261 };
Note: See TracChangeset
for help on using the changeset viewer.
