@@ -70,48 +70,48 @@ static NestingLevels *nestingLevels = NULL;
7070* FUNCTION DEFINITIONS
7171*/
7272
73- static NestingLevel * getNestingLevel (const int kind , unsigned long adjustment_when_pop )
73+ static NestingLevel * getNestingLevel (const int kind , unsigned long adjustmentWhenPop )
7474{
7575 NestingLevel * nl ;
7676 tagEntryInfo * e ;
77- unsigned long line = getInputLineNumber ();
77+ unsigned long line = getInputLineNumber ();
7878
79- line = (line > adjustment_when_pop )? (line - adjustment_when_pop ): 0 ;
79+ line = (line > adjustmentWhenPop )? (line - adjustmentWhenPop ): 0 ;
8080
8181 while (1 )
8282 {
83- nl = nestingLevelsGetCurrent (nestingLevels );
83+ nl = nestingLevelsGetCurrent (nestingLevels );
8484 e = getEntryOfNestingLevel (nl );
8585 if ((nl && (e == NULL )) || (e && (e -> kindIndex >= kind )))
86- nestingLevelsPopFull (nestingLevels , HT_UINT_TO_PTR ((unsigned int )line ));
86+ nestingLevelsPopFull (nestingLevels , HT_UINT_TO_PTR ((unsigned int )line ));
8787 else
8888 break ;
8989 }
9090 return nl ;
9191}
9292
9393
94- static int makeMarkdownTag (const vString * const name , const int kind , const bool two_line )
94+ static int makeMarkdownTag (const vString * const name , const int kind , const bool twoLine )
9595{
9696 int r = CORK_NIL ;
9797
9898 if (vStringLength (name ) > 0 )
9999 {
100- const NestingLevel * const nl = getNestingLevel (kind , two_line ? 2 : 1 );
100+ const NestingLevel * const nl = getNestingLevel (kind , twoLine ? 2 : 1 );
101101 tagEntryInfo * parent = getEntryOfNestingLevel (nl );
102102 tagEntryInfo e ;
103103
104104 initTagEntry (& e , vStringValue (name ), kind );
105105
106- if (two_line )
106+ if (twoLine )
107107 {
108108 /* we want the line before the '---' underline chars */
109- const unsigned long line = getInputLineNumber ();
109+ const unsigned long line = getInputLineNumber ();
110110 Assert (line > 0 );
111111 if (line > 0 )
112112 {
113113 e .lineNumber -- ;
114- e .filePosition = getInputFilePositionForLine (line - 1 );
114+ e .filePosition = getInputFilePositionForLine (line - 1 );
115115 }
116116 }
117117
@@ -126,47 +126,47 @@ static int makeMarkdownTag (const vString* const name, const int kind, const boo
126126
127127static int makeSectionMarkdownTag (const vString * const name , const int kind , const char * marker )
128128{
129- int r = makeMarkdownTag (name , kind , marker [0 ] != '#' );
129+ int r = makeMarkdownTag (name , kind , marker [0 ] != '#' );
130130 attachParserFieldToCorkEntry (r , MarkdownFields [F_MARKER ].ftype , marker );
131131
132- nestingLevelsPush (nestingLevels , r );
132+ nestingLevelsPush (nestingLevels , r );
133133 return r ;
134134}
135135
136136
137- static vString * get_heading (const int kind , const unsigned char * line ,
138- const int line_len , bool * delimited )
137+ static vString * getHeading (const int kind , const unsigned char * line ,
138+ const int lineLen , bool * delimited )
139139{
140140 int pos = 0 ;
141141 int start = kind + 1 ;
142- int end = line_len - 1 ;
143- vString * name = vStringNew ();
142+ int end = lineLen - 1 ;
143+ vString * name = vStringNew ();
144144
145145 Assert (kind >= 0 && kind < K_SECTION_COUNT );
146- Assert (line_len > start );
146+ Assert (lineLen > start );
147147
148148 * delimited = false;
149- while (isspace (line [pos ])) ++ pos ;
149+ while (isspace (line [pos ])) ++ pos ;
150150 while (line [end ] == line [pos ] && end - 1 >= 0 && line [end - 1 ] != '\\' )
151151 {
152152 -- end ;
153153 * delimited = true;
154154 }
155- while (isspace (line [start ])) ++ start ;
156- while (isspace (line [end ])) -- end ;
155+ while (isspace (line [start ])) ++ start ;
156+ while (isspace (line [end ])) -- end ;
157157
158158 if (start <= end )
159- vStringNCatS (name , (const char * )(& (line [start ])), end - start + 1 );
159+ vStringNCatS (name , (const char * )(& (line [start ])), end - start + 1 );
160160
161161 return name ;
162162}
163163
164164
165- static int get_first_char_pos (const unsigned char * line , int line_len , bool * indented )
165+ static int getFirstCharPos (const unsigned char * line , int lineLen , bool * indented )
166166{
167167 int indent = 0 ;
168168 int i ;
169- for (i = 0 ; i < line_len && isspace (line [i ]); i ++ )
169+ for (i = 0 ; i < lineLen && isspace (line [i ]); i ++ )
170170 indent += line [i ] == '\t' ? 4 : 1 ;
171171 * indented = indent >= 4 ;
172172 return i ;
@@ -178,30 +178,30 @@ static void fillEndField (NestingLevel *nl, void *ctxData)
178178 tagEntryInfo * e = getEntryOfNestingLevel (nl );
179179 if (e )
180180 {
181- unsigned long line = (unsigned long )(HT_PTR_TO_UINT (ctxData ));
181+ unsigned long line = (unsigned long )(HT_PTR_TO_UINT (ctxData ));
182182 e -> extensionFields .endLine = line ;
183183 }
184184}
185185
186186
187- static void findMarkdownTags (void )
187+ static void findMarkdownTags (void )
188188{
189- vString * prev_line = vStringNew ();
190- vString * codeLang = vStringNew ();
189+ vString * prevLine = vStringNew ();
190+ vString * codeLang = vStringNew ();
191191 const unsigned char * line ;
192- char in_code_char = 0 ;
192+ char inCodeChar = 0 ;
193193 long startSourceLineNumber = 0 ;
194194 long startLineNumber = 0 ;
195195 bool inPreambule = false;
196196
197- nestingLevels = nestingLevelsNewFull (0 , fillEndField );
197+ nestingLevels = nestingLevelsNewFull (0 , fillEndField );
198198
199- while ((line = readLineFromInputFile ()) != NULL )
199+ while ((line = readLineFromInputFile ()) != NULL )
200200 {
201- int line_len = strlen ((const char * ) line );
202- bool line_processed = false;
201+ int lineLen = strlen ((const char * ) line );
202+ bool lineProcessed = false;
203203 bool indented ;
204- int pos = get_first_char_pos (line , line_len , & indented );
204+ int pos = getFirstCharPos (line , lineLen , & indented );
205205 int lineNum = getInputLineNumber ();
206206
207207 if (lineNum == 1 || inPreambule )
@@ -217,97 +217,97 @@ static void findMarkdownTags(void)
217217 if (line [pos ] == '`' || line [pos ] == '~' )
218218 {
219219 char c = line [pos ];
220- char other_c = c == '`' ? '~' : '`' ;
221- int n_same ;
222- for (n_same = 1 ; line [n_same ] == line [pos ]; ++ n_same );
220+ char otherC = c == '`' ? '~' : '`' ;
221+ int nSame ;
222+ for (nSame = 1 ; line [nSame ] == line [pos ]; ++ nSame );
223223
224- if (in_code_char != other_c && n_same >= 3 )
224+ if (inCodeChar != otherC && nSame >= 3 )
225225 {
226- in_code_char = in_code_char ? 0 : c ;
227- if (in_code_char == c && strstr ((const char * )(line + pos + n_same ), "```" ) != NULL )
228- in_code_char = 0 ;
229- else if (in_code_char )
226+ inCodeChar = inCodeChar ? 0 : c ;
227+ if (inCodeChar == c && strstr ((const char * )(line + pos + nSame ), "```" ) != NULL )
228+ inCodeChar = 0 ;
229+ else if (inCodeChar )
230230 {
231231 startSourceLineNumber = getSourceLineNumber ();
232232 startLineNumber = getInputLineNumber ();
233- vStringClear (codeLang );
234- vStringCatS (codeLang , (const char * )(line + pos + n_same ));
235- vStringStripLeading (codeLang );
236- vStringStripTrailing (codeLang );
233+ vStringClear (codeLang );
234+ vStringCatS (codeLang , (const char * )(line + pos + nSame ));
235+ vStringStripLeading (codeLang );
236+ vStringStripTrailing (codeLang );
237237 }
238238 else
239239 {
240240 long endLineNumber = getInputLineNumber () - 1 ;
241241 if (codeLang -> size > 0 )
242- makePromise (vStringValue (codeLang ), startLineNumber , 0 ,
242+ makePromise (vStringValue (codeLang ), startLineNumber , 0 ,
243243 endLineNumber , 0 , startSourceLineNumber );
244244 }
245245
246- line_processed = true;
246+ lineProcessed = true;
247247 }
248248 }
249249
250250 /* code block */
251- if (in_code_char )
252- line_processed = true;
251+ if (inCodeChar )
252+ lineProcessed = true;
253253
254254 /* code block using indent */
255255 else if (indented )
256- line_processed = true;
256+ lineProcessed = true;
257257
258258 /* if it's a title underline, or a delimited block marking character */
259259 else if (line [pos ] == '=' || line [pos ] == '-' || line [pos ] == '#' || line [pos ] == '>' )
260260 {
261- int n_same ;
262- for (n_same = 1 ; line [n_same ] == line [pos ]; ++ n_same );
261+ int nSame ;
262+ for (nSame = 1 ; line [nSame ] == line [pos ]; ++ nSame );
263263
264264 /* quote */
265265 if (line [pos ] == '>' )
266- ; /* just to make sure line_processed = true so it won't be in a heading */
266+ ; /* just to make sure lineProcessed = true so it won't be in a heading */
267267 /* is it a two line title */
268268 else if (line [pos ] == '=' || line [pos ] == '-' )
269269 {
270270 char marker [2 ] = { line [pos ], '\0' };
271271 int kind = line [pos ] == '=' ? K_CHAPTER : K_SECTION ;
272- bool whitespace_terminated = true;
272+ bool whitespaceTerminated = true;
273273
274- for (int i = pos + n_same ; i < line_len ; i ++ )
274+ for (int i = pos + nSame ; i < lineLen ; i ++ )
275275 {
276- if (!isspace (line [i ]))
276+ if (!isspace (line [i ]))
277277 {
278- whitespace_terminated = false;
278+ whitespaceTerminated = false;
279279 break ;
280280 }
281281 }
282282
283- vStringStripLeading ( prev_line );
284- vStringStripTrailing ( prev_line );
285- if (whitespace_terminated && vStringLength ( prev_line ) > 0 )
286- makeSectionMarkdownTag ( prev_line , kind , marker );
283+ vStringStripLeading ( prevLine );
284+ vStringStripTrailing ( prevLine );
285+ if (whitespaceTerminated && vStringLength ( prevLine ) > 0 )
286+ makeSectionMarkdownTag ( prevLine , kind , marker );
287287 }
288288 /* otherwise is it a one line title */
289- else if (line [pos ] == '#' && n_same <= K_SECTION_COUNT && isspace (line [n_same ]))
289+ else if (line [pos ] == '#' && nSame <= K_SECTION_COUNT && isspace (line [nSame ]))
290290 {
291- int kind = n_same - 1 ;
291+ int kind = nSame - 1 ;
292292 bool delimited = false;
293- vString * name = get_heading (kind , line , line_len , & delimited );
294- if (vStringLength (name ) > 0 )
295- makeSectionMarkdownTag (name , kind , delimited ? "##" : "#" );
296- vStringDelete (name );
293+ vString * name = getHeading (kind , line , lineLen , & delimited );
294+ if (vStringLength (name ) > 0 )
295+ makeSectionMarkdownTag (name , kind , delimited ? "##" : "#" );
296+ vStringDelete (name );
297297 }
298298
299- line_processed = true;
299+ lineProcessed = true;
300300 }
301301
302- vStringClear ( prev_line );
303- if (!line_processed )
304- vStringCatS ( prev_line , (const char * ) line );
302+ vStringClear ( prevLine );
303+ if (!lineProcessed )
304+ vStringCatS ( prevLine , (const char * ) line );
305305 }
306- vStringDelete ( prev_line );
307- vStringDelete (codeLang );
306+ vStringDelete ( prevLine );
307+ vStringDelete (codeLang );
308308 {
309309 unsigned int line = (unsigned int )getInputLineNumber ();
310- nestingLevelsFreeFull (nestingLevels , HT_UINT_TO_PTR (line ));
310+ nestingLevelsFreeFull (nestingLevels , HT_UINT_TO_PTR (line ));
311311 }
312312}
313313
@@ -320,9 +320,9 @@ extern parserDefinition* MarkdownParser (void)
320320 def -> extensions = extensions ;
321321 def -> useCork = CORK_QUEUE ;
322322 def -> kindTable = MarkdownKinds ;
323- def -> kindCount = ARRAY_SIZE (MarkdownKinds );
323+ def -> kindCount = ARRAY_SIZE (MarkdownKinds );
324324 def -> fieldTable = MarkdownFields ;
325- def -> fieldCount = ARRAY_SIZE (MarkdownFields );
325+ def -> fieldCount = ARRAY_SIZE (MarkdownFields );
326326 def -> defaultScopeSeparator = "\"\"" ;
327327 def -> parser = findMarkdownTags ;
328328
0 commit comments