MCPcopy
hub / github.com/lingodotdev/lingo.dev / parse

Method parse

packages/cli/src/cli/loaders/xcode-strings/parser.ts:13–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11 }
12
13 parse(): Record<string, string> {
14 const result: Record<string, string> = {};
15
16 while (this.pos < this.tokens.length) {
17 const token = this.current();
18
19 // Skip comments
20 if (
21 token.type === TokenType.COMMENT_SINGLE ||
22 token.type === TokenType.COMMENT_MULTI
23 ) {
24 this.advance();
25 continue;
26 }
27
28 // End of file
29 if (token.type === TokenType.EOF) {
30 break;
31 }
32
33 // Expect entry: STRING "=" STRING ";"
34 if (token.type === TokenType.STRING) {
35 const entry = this.parseEntry();
36 if (entry) {
37 result[entry.key] = entry.value;
38 }
39 continue;
40 }
41
42 // Skip unexpected tokens gracefully
43 this.advance();
44 }
45
46 return result;
47 }
48
49 private parseEntry(): { key: string; value: string } | null {
50 // Current token should be STRING (key)

Callers 15

pullFunction · 0.95
createPayloadFunction · 0.80
normalizeCodeFunction · 0.80
normalizeCodeFunction · 0.80
getRcFunction · 0.80
getInstanceMethod · 0.80
xml2objFunction · 0.80
_tryParseJSONFunction · 0.80
findCurrentProjectRootFunction · 0.80
getConfigFunction · 0.80
execAsyncFunction · 0.80
execWithRetryFunction · 0.80

Calls 3

currentMethod · 0.95
advanceMethod · 0.95
parseEntryMethod · 0.95

Tested by 3

normalizeCodeFunction · 0.64
normalizeCodeFunction · 0.64
readLockFunction · 0.64