MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / skipWhitespace

Method skipWhitespace

tools/mcdevicetree.js:1077–1116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1075 }
1076
1077 skipWhitespace() {
1078 const length = this.length, content = this.contentS;
1079 let pos = this.pos;
1080 while (pos < length) {
1081 const code = content.charCodeAt(pos);
1082
1083 if (this.isWhitespace(code)) {
1084 pos++;
1085 continue;
1086 }
1087
1088 if (code === SLASH && pos + 1 < length) {
1089 const nextCode = content.charCodeAt(pos + 1);
1090
1091 if (nextCode === 42) { // '/*'
1092 pos += 2;
1093 while (pos < length - 1) {
1094 if (content.charCodeAt(pos) === 42 &&
1095 content.charCodeAt(pos + 1) === SLASH) {
1096 pos += 2;
1097 break;
1098 }
1099 pos++;
1100 }
1101 continue;
1102 }
1103
1104 if (nextCode === SLASH) { // '//'
1105 pos += 2;
1106 while (pos < length && content.charCodeAt(pos) !== LF) {
1107 pos++;
1108 }
1109 continue;
1110 }
1111 }
1112
1113 break;
1114 }
1115 this.pos = pos;
1116 }
1117
1118 skipToRoot() {
1119 let searchPos = 0;

Callers 4

parseNodeMethod · 0.95
parsePropertyMethod · 0.95
parseValueMethod · 0.95
parseArrayMethod · 0.95

Calls 1

isWhitespaceMethod · 0.95

Tested by

no test coverage detected