MCPcopy Create free account
hub / github.com/Snapchat/Valdi / parseMetaDataComment

Function parseMetaDataComment

tsn/src/test262/preprocessor/main.cpp:12–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10namespace fs = filesystem;
11
12static TestCaseData parseMetaDataComment(string& contents) {
13 TestCaseData retval;
14
15 auto state = 0;
16
17 string attribute;
18 string key;
19 string entry;
20
21 // NOTE(rjaber): This parser isn't great but mostly kept it going from the original test harness that we got
22 for (auto c : contents) {
23 switch (state) {
24 case 0:
25 if (c == '\r' || c == '\n') {
26 state = 1;
27 }
28
29 break;
30
31 case 1:
32 if (c <= ' ') {
33 if (c != '\r' && c != '\n') {
34 state = 0;
35 }
36
37 break;
38 }
39
40 attribute.clear();
41
42 attribute.push_back(c);
43
44 state = 2;
45
46 break;
47
48 case 2:
49 if (c == ':') {
50 if (attribute == "negative") {
51 retval.isNegative = true;
52
53 state = 3;
54 } else if (attribute == "includes") {
55 state = 6;
56 } else if (attribute == "flags") {
57 state = 13;
58 } else {
59 state = 0;
60 }
61
62 break;
63 }
64
65 attribute.push_back(c);
66
67 break;
68
69 case 3:

Callers 1

parseMetaDataFunction · 0.85

Calls 1

clearMethod · 0.65

Tested by

no test coverage detected