Mercurial > octave-nkf
comparison src/lex.l @ 5794:1138ced03f14
[project @ 2006-05-08 20:23:04 by jwe]
author | jwe |
---|---|
date | Mon, 08 May 2006 20:23:07 +0000 |
parents | 2a9089b47dc2 |
children | 080c08b192d8 |
comparison
equal
deleted
inserted
replaced
5793:395382df0d8a | 5794:1138ced03f14 |
---|---|
229 const int bracket_brace_paren_nesting_level::BRACKET = 1; | 229 const int bracket_brace_paren_nesting_level::BRACKET = 1; |
230 const int bracket_brace_paren_nesting_level::BRACE = 2; | 230 const int bracket_brace_paren_nesting_level::BRACE = 2; |
231 const int bracket_brace_paren_nesting_level::PAREN = 3; | 231 const int bracket_brace_paren_nesting_level::PAREN = 3; |
232 | 232 |
233 static bracket_brace_paren_nesting_level nesting_level; | 233 static bracket_brace_paren_nesting_level nesting_level; |
234 | |
235 static bool Vwarn_matlab_incompatible = false; | |
236 | |
237 static bool Vwarn_separator_insert = false; | |
238 | |
239 static bool Vwarn_single_quote_string = false; | |
240 | 234 |
241 static unsigned int Vtoken_count = 0; | 235 static unsigned int Vtoken_count = 0; |
242 | 236 |
243 // Forward declarations for functions defined at the bottom of this | 237 // Forward declarations for functions defined at the bottom of this |
244 // file. | 238 // file. |
2479 static void | 2473 static void |
2480 maybe_warn_separator_insert (char sep) | 2474 maybe_warn_separator_insert (char sep) |
2481 { | 2475 { |
2482 std::string nm = curr_fcn_file_full_name; | 2476 std::string nm = curr_fcn_file_full_name; |
2483 | 2477 |
2484 if (Vwarn_separator_insert) | 2478 if (nm.empty ()) |
2485 { | 2479 warning_with_id ("Octave:separator-insert", |
2486 if (nm.empty ()) | 2480 "potential auto-insertion of `%c' near line %d", |
2487 warning ("potential auto-insertion of `%c' near line %d", | 2481 sep, input_line_number); |
2488 sep, input_line_number); | 2482 else |
2489 else | 2483 warning_with_id ("Octave:separator-insert", |
2490 warning ("potential auto-insertion of `%c' near line %d of file %s", | 2484 "potential auto-insertion of `%c' near line %d of file %s", |
2491 sep, input_line_number, nm.c_str ()); | 2485 sep, input_line_number, nm.c_str ()); |
2492 } | |
2493 } | 2486 } |
2494 | 2487 |
2495 static void | 2488 static void |
2496 gripe_single_quote_string (void) | 2489 gripe_single_quote_string (void) |
2497 { | 2490 { |
2498 std::string nm = curr_fcn_file_full_name; | 2491 std::string nm = curr_fcn_file_full_name; |
2499 | 2492 |
2500 if (Vwarn_single_quote_string) | 2493 if (nm.empty ()) |
2501 { | 2494 warning_with_id ("Octave:single-quote-string", |
2502 if (nm.empty ()) | 2495 "single quote delimited string near line %d", |
2503 warning ("single quote delimited string near line %d", | 2496 input_line_number); |
2504 input_line_number); | 2497 else |
2505 else | 2498 warning_with_id ("Octave:single-quote-string", |
2506 warning ("single quote delimited string near line %d of file %s", | 2499 "single quote delimited string near line %d of file %s", |
2507 input_line_number, nm.c_str ()); | 2500 input_line_number, nm.c_str ()); |
2508 } | |
2509 } | 2501 } |
2510 | 2502 |
2511 static void | 2503 static void |
2512 gripe_matlab_incompatible (const std::string& msg) | 2504 gripe_matlab_incompatible (const std::string& msg) |
2513 { | 2505 { |
2514 if (Vwarn_matlab_incompatible) | 2506 warning_with_id ("Octave:matlab-incompatible", |
2515 warning ("potential Matlab compatibility problem: %s", msg.c_str ()); | 2507 "potential Matlab compatibility problem: %s", |
2508 msg.c_str ()); | |
2516 } | 2509 } |
2517 | 2510 |
2518 static void | 2511 static void |
2519 maybe_gripe_matlab_incompatible_comment (char c) | 2512 maybe_gripe_matlab_incompatible_comment (char c) |
2520 { | 2513 { |
2545 @end deftypefn") | 2538 @end deftypefn") |
2546 { | 2539 { |
2547 return octave_value (Vtoken_count); | 2540 return octave_value (Vtoken_count); |
2548 } | 2541 } |
2549 | 2542 |
2550 static int | |
2551 warn_matlab_incompatible (void) | |
2552 { | |
2553 Vwarn_matlab_incompatible = check_preference ("warn_matlab_incompatible"); | |
2554 | |
2555 return 0; | |
2556 } | |
2557 | |
2558 static int | |
2559 warn_separator_insert (void) | |
2560 { | |
2561 Vwarn_separator_insert = check_preference ("warn_separator_insert"); | |
2562 | |
2563 return 0; | |
2564 } | |
2565 | |
2566 static int | |
2567 warn_single_quote_string (void) | |
2568 { | |
2569 Vwarn_single_quote_string = check_preference ("warn_single_quote_string"); | |
2570 | |
2571 return 0; | |
2572 } | |
2573 | |
2574 void | |
2575 symbols_of_lex (void) | |
2576 { | |
2577 DEFVAR (warn_matlab_incompatible, false, warn_matlab_incompatible, | |
2578 "-*- texinfo -*-\n\ | |
2579 @defvr {Built-in Variable} warn_matlab_incompatible\n\ | |
2580 Print warnings for Octave language features that may cause\n\ | |
2581 compatibility problems with Matlab.\n\ | |
2582 @end defvr"); | |
2583 | |
2584 DEFVAR (warn_separator_insert, false, warn_separator_insert, | |
2585 "-*- texinfo -*-\n\ | |
2586 @defvr {Built-in Variable} warn_separator_insert\n\ | |
2587 Print warning if commas or semicolons might be inserted\n\ | |
2588 automatically in literal matrices.\n\ | |
2589 @end defvr"); | |
2590 | |
2591 DEFVAR (warn_single_quote_string, false, warn_single_quote_string, | |
2592 "-*- texinfo -*-\n\ | |
2593 @defvr {Built-in Variable} warn_single_quote_string\n\ | |
2594 Print warning if a signle quote character is used to introduce a\n\ | |
2595 string constant.\n\ | |
2596 @end defvr"); | |
2597 } | |
2598 | |
2599 /* | 2543 /* |
2600 ;;; Local Variables: *** | 2544 ;;; Local Variables: *** |
2601 ;;; mode: C++ *** | 2545 ;;; mode: C++ *** |
2602 ;;; End: *** | 2546 ;;; End: *** |
2603 */ | 2547 */ |