Changeset 77 for pjproject/trunk/pjlib-util/include/pjlib-util/scanner.h
- Timestamp:
- Nov 22, 2005 11:51:50 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib-util/include/pjlib-util/scanner.h
r73 r77 194 194 typedef struct pj_scanner 195 195 { 196 char *begin; /**< Start of input buffer. 197 char *end; /**< End of input buffer. 198 char *curptr; /**< Current pointer. 199 int line; /**< Current line.*/200 int col; /**< Current column.*/201 int skip_ws; /**< Skip whitespace flag.*/196 char *begin; /**< Start of input buffer. */ 197 char *end; /**< End of input buffer. */ 198 char *curptr; /**< Current pointer. */ 199 int line; /**< Current line. */ 200 char *start_line; /**< Where current line starts. */ 201 int skip_ws; /**< Skip whitespace flag. */ 202 202 pj_syn_err_func_ptr callback; /**< Syntax error callback. */ 203 203 } pj_scanner; … … 211 211 { 212 212 char *curptr; /**< Current scanner's pointer. */ 213 int line; /**< Current line. 214 int col; /**< Current column.*/213 int line; /**< Current line. */ 214 char *start_line; /**< Start of current line. */ 215 215 } pj_scan_state; 216 216 … … 326 326 /** 327 327 * Get characters between quotes. If current input doesn't match begin_quote, 328 * syntax error will be thrown. 328 * syntax error will be thrown. Note that the resulting string will contain 329 * the enclosing quote. 329 330 * 330 331 * @param scanner The scanner. … … 334 335 */ 335 336 PJ_DECL(void) pj_scan_get_quote( pj_scanner *scanner, 336 337 337 int begin_quote, int end_quote, 338 pj_str_t *out); 338 339 339 340 /** … … 356 357 */ 357 358 PJ_DECL(int) pj_scan_get_char( pj_scanner *scanner ); 358 359 360 /**361 * Get a newline from the scanner. A newline is defined as '\\n', or '\\r', or362 * "\\r\\n". If current input is not newline, syntax error will be thrown.363 *364 * @param scanner The scanner.365 */366 PJ_DECL(void) pj_scan_get_newline( pj_scanner *scanner );367 359 368 360 … … 439 431 PJ_DECL(int) pj_scan_stricmp( pj_scanner *scanner, const char *s, int len); 440 432 433 /** 434 * Perform case insensitive string comparison of string in current position, 435 * knowing that the string to compare only consists of alphanumeric 436 * characters. 437 * 438 * Note that unlike #pj_scan_stricmp, this function can only return zero or 439 * -1. 440 * 441 * @param scanner The scanner. 442 * @param s The string to compare with. 443 * @param len Length of the string to compare with. 444 * 445 * @return zero if equal or -1. 446 * 447 * @see strnicmp_alnum, pj_stricmp_alnum 448 */ 449 PJ_DECL(int) pj_scan_stricmp_alnum( pj_scanner *scanner, const char *s, 450 int len); 451 452 453 /** 454 * Get a newline from the scanner. A newline is defined as '\\n', or '\\r', or 455 * "\\r\\n". If current input is not newline, syntax error will be thrown. 456 * 457 * @param scanner The scanner. 458 */ 459 PJ_DECL(void) pj_scan_get_newline( pj_scanner *scanner ); 460 441 461 442 462 /** … … 448 468 PJ_DECL(void) pj_scan_skip_whitespace( pj_scanner *scanner ); 449 469 470 471 /** 472 * Skip current line. 473 * 474 * @param scanner The scanner. 475 */ 476 PJ_DECL(void) pj_scan_skip_line( pj_scanner *scanner ); 450 477 451 478 /** … … 470 497 471 498 /** 499 * Get current column position. 500 * 501 * @param scanner The scanner. 502 * 503 * @return The column position. 504 */ 505 PJ_INLINE(int) pj_scan_get_col( pj_scanner *scanner ) 506 { 507 return scanner->curptr - scanner->start_line; 508 } 509 510 /** 472 511 * @} 473 512 */
Note: See TracChangeset
for help on using the changeset viewer.