MCPcopy Index your code
hub / github.com/IBM/Project_CodeNet / emit

Function emit

tools/tokenizer/pytokenize.c:54–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52static const unsigned num_keywords = sizeof(keywords)/sizeof(keywords[0]);
53
54static void emit(const char *s, unsigned line, unsigned col)
55{
56 if (output_layout) {
57 switch (mode) {
58 case RAW:
59 fprintf(stdout, "#%s#\n", s);
60 break;
61 case PLAIN:
62 fprintf(stdout, "(%4u,%3u) layout: %s\n", line, col, s);
63 break;
64 case CSV:
65 fprintf(stdout, "%u,%u,layout,%s\n", line, col, s);
66 break;
67 case JSON:
68 case JSONL:
69 if (first_time)
70 first_time = 0;
71 else {
72 if (mode == JSON) fputc(',', stdout);
73 fputc('\n', stdout);
74 }
75 fprintf(stdout, "{ \"line\": %u, \"column\": %u, "
76 "\"class\": \"layout\", \"token\": \"%s\" }", line, col, s);
77 break;
78 case XML:
79 fprintf(stdout,
80 "<token line=\"%u\" column=\"%u\" class=\"layout\">%s</token>\n",
81 line, col, s);
82 break;
83 }
84 }
85}
86
87// Fixed size stack of indentations; hard check for overflow!
88#define MAX_INDENTS 128

Callers 2

process_newlineFunction · 0.85
tokenizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected