This repository has been archived on 2023-07-11. You can view files and clone it, but cannot push or open issues or pull requests.
BWMirror-Generator/src/test/FunctionRegexTest.java

33 lines
1.2 KiB
Java
Raw Normal View History

2014-08-05 04:43:14 -04:00
package test;
2015-02-09 16:40:11 -05:00
import impl.CApiParser;
2014-08-05 04:43:14 -04:00
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* User: PC
* Date: 19. 6. 2014
* Time: 11:28
*/
public class FunctionRegexTest {
// 1 2 3 4 56 7 89 10 11 12,13 14,15
//String FUNC_REGEX = "^(\\s*)(virtual)?\\s(const\\s)?((BWAPI::)|(std::))?((set<(\\w+\\*?)>)|([\\w\\*]+))&?\\s([\\w\\*]+)\\((.*)\\)((\\sconst)?\\s*=\\s*0;)?";
2015-02-09 16:40:11 -05:00
String FUNC_REGEX = "^(\\s*)(virtual)?\\s(const\\s)?(static\\s)?((BWAPI::)|(std)::)?((set<(\\s*(BWAPI::)?\\w+\\*?\\s*)>)|([\\w\\*]+))&?\\s+(&?[\\w\\*]+)\\((.*)\\)(\\s*const)?(\\s*=\\s0)?(;)?\\s*";
2014-08-05 04:43:14 -04:00
String ENUM_VALUE_REGEX = "^(\\s*)(\\w+)(\\s*=\\s*(0x)?([0-9A-Fa-f]+))?\\s*[\\,;]";
2015-02-09 16:40:11 -05:00
Pattern funcPattern = Pattern.compile(CApiParser.FUNC_REGEX);
2014-08-05 04:43:14 -04:00
public void run() {
2015-02-09 16:40:11 -05:00
Matcher matcher = funcPattern.matcher(" static UnitCommand repair(Unit unit, Unit target, bool shiftQueueCommand = false);");
2014-08-05 04:43:14 -04:00
if (matcher.matches()) {
System.out.println("match");
}
}
public static void main(String... args) {
new FunctionRegexTest().run();
}
}