Mercurial > hg > octave-nkf
comparison src/oct-parse.yy @ 15466:d174210ce1ec stable
use ' instead of ` in error messages, warnings and most comments
* intro.txi, io.txi, munge-texi.cc, octave.texi, cmd-edit.cc,
data-conv.cc, file-ops.cc, glob-match.h, kpse.cc, oct-env.cc,
oct-locbuf.h, oct-md5.cc, oct-rand.cc, general/interp2.m, doc.m,
get_first_help_sentence.m, help.m, print_usage.m,
__additional_help_message__.m, type.m, unimplemented.m, which.m,
cast.m, dir.m, license.m, mkoctfile.m, recycle.m, tempdir.m,
optimset.m, pkg/pkg.m, closereq.m, colstyle.m, __fltk_print__.m,
__gnuplot_print__.m, __go_draw_figure__.m, __pie__.m, __pltopt__.m,
__print_parse_opts__.m, uigetdir.m, uigetfile.m, uiputfile.m, stft.m,
mean.m, anova.m, cor_test.m, t_test_regression.m, __magick_read__.cc,
dlmread.cc, schur.cc, data.cc, debug.cc, defun-dld.h, defun.cc,
defun.h, dynamic-ld.cc, error.cc, error.h, gl-render.cc, graphics.cc,
gripes.cc, input.cc, lex.ll, load-path.cc, load-save.cc, ls-hdf5.cc,
ls-mat-ascii.cc, ls-mat4.cc, ls-mat5.cc, ls-oct-ascii.cc,
ls-oct-binary.cc, oct-hist.cc, oct-parse.yy, oct-stream.cc,
oct-stream.h, octave.cc, ov-base-diag.cc, ov-base.cc, ov-class.cc,
ov-colon.h, ov-struct.cc, ov-typeinfo.cc, ov.cc, pager.cc,
pr-output.cc, pt-binop.cc, pt-eval.cc, pt-id.cc, pt-idx.cc,
pt-misc.cc, pt-unop.cc, symtab.cc, symtab.h, toplev.cc, txt-eng-ft.cc,
utils.cc, variables.cc, test_eval-catch.m, test_try.m:
Use ' instead of ` in error messages, warnings, and most comments.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 01 Oct 2012 17:18:49 -0400 |
parents | c27491205e48 |
children |
comparison
equal
deleted
inserted
replaced
15437:c9954a15bc03 | 15466:d174210ce1ec |
---|---|
898 { $$ = make_boolean_op (EXPR_AND_AND, $1, $2, $3); } | 898 { $$ = make_boolean_op (EXPR_AND_AND, $1, $2, $3); } |
899 | simple_expr EXPR_OR_OR simple_expr | 899 | simple_expr EXPR_OR_OR simple_expr |
900 { $$ = make_boolean_op (EXPR_OR_OR, $1, $2, $3); } | 900 { $$ = make_boolean_op (EXPR_OR_OR, $1, $2, $3); } |
901 ; | 901 ; |
902 | 902 |
903 // Arrange for the lexer to return CLOSE_BRACE for `]' by looking ahead | 903 // Arrange for the lexer to return CLOSE_BRACE for ']' by looking ahead |
904 // one token for an assignment op. | 904 // one token for an assignment op. |
905 | 905 |
906 assign_lhs : simple_expr | 906 assign_lhs : simple_expr |
907 { | 907 { |
908 $$ = new tree_argument_list ($1); | 908 $$ = new tree_argument_list ($1); |
1212 ABORT_PARSE; | 1212 ABORT_PARSE; |
1213 } | 1213 } |
1214 ; | 1214 ; |
1215 | 1215 |
1216 // =========================================== | 1216 // =========================================== |
1217 // Some `subroutines' for function definitions | 1217 // Some 'subroutines' for function definitions |
1218 // =========================================== | 1218 // =========================================== |
1219 | 1219 |
1220 push_fcn_symtab : // empty | 1220 push_fcn_symtab : // empty |
1221 { | 1221 { |
1222 current_function_depth++; | 1222 current_function_depth++; |
1724 | 1724 |
1725 static void | 1725 static void |
1726 end_error (const char *type, token::end_tok_type ettype, int l, int c) | 1726 end_error (const char *type, token::end_tok_type ettype, int l, int c) |
1727 { | 1727 { |
1728 static const char *fmt | 1728 static const char *fmt |
1729 = "`%s' command matched by `%s' near line %d column %d"; | 1729 = "'%s' command matched by '%s' near line %d column %d"; |
1730 | 1730 |
1731 switch (ettype) | 1731 switch (ettype) |
1732 { | 1732 { |
1733 case token::simple_end: | 1733 case token::simple_end: |
1734 error (fmt, type, "end", l, c); | 1734 error (fmt, type, "end", l, c); |
1855 ("Octave:assign-as-truth-value", | 1855 ("Octave:assign-as-truth-value", |
1856 "suggest parenthesis around assignment used as truth value"); | 1856 "suggest parenthesis around assignment used as truth value"); |
1857 else | 1857 else |
1858 warning_with_id | 1858 warning_with_id |
1859 ("Octave:assign-as-truth-value", | 1859 ("Octave:assign-as-truth-value", |
1860 "suggest parenthesis around assignment used as truth value near line %d, column %d in file `%s'", | 1860 "suggest parenthesis around assignment used as truth value near line %d, column %d in file '%s'", |
1861 expr->line (), expr->column (), curr_fcn_file_full_name.c_str ()); | 1861 expr->line (), expr->column (), curr_fcn_file_full_name.c_str ()); |
1862 } | 1862 } |
1863 } | 1863 } |
1864 | 1864 |
1865 // Maybe print a warning about switch labels that aren't constants. | 1865 // Maybe print a warning about switch labels that aren't constants. |
1873 warning_with_id ("Octave:variable-switch-label", | 1873 warning_with_id ("Octave:variable-switch-label", |
1874 "variable switch label"); | 1874 "variable switch label"); |
1875 else | 1875 else |
1876 warning_with_id | 1876 warning_with_id |
1877 ("Octave:variable-switch-label", | 1877 ("Octave:variable-switch-label", |
1878 "variable switch label near line %d, column %d in file `%s'", | 1878 "variable switch label near line %d, column %d in file '%s'", |
1879 expr->line (), expr->column (), curr_fcn_file_full_name.c_str ()); | 1879 expr->line (), expr->column (), curr_fcn_file_full_name.c_str ()); |
1880 } | 1880 } |
1881 } | 1881 } |
1882 | 1882 |
1883 static tree_expression * | 1883 static tree_expression * |
2840 | 2840 |
2841 if (nm != id_name) | 2841 if (nm != id_name) |
2842 { | 2842 { |
2843 warning_with_id | 2843 warning_with_id |
2844 ("Octave:function-name-clash", | 2844 ("Octave:function-name-clash", |
2845 "function name `%s' does not agree with function file name `%s'", | 2845 "function name '%s' does not agree with function file name '%s'", |
2846 id_name.c_str (), curr_fcn_file_full_name.c_str ()); | 2846 id_name.c_str (), curr_fcn_file_full_name.c_str ()); |
2847 | 2847 |
2848 id_name = nm; | 2848 id_name = nm; |
2849 } | 2849 } |
2850 } | 2850 } |
2880 | 2880 |
2881 file_stat fs (nm); | 2881 file_stat fs (nm); |
2882 | 2882 |
2883 if (fs && fs.is_newer (now)) | 2883 if (fs && fs.is_newer (now)) |
2884 warning_with_id ("Octave:future-time-stamp", | 2884 warning_with_id ("Octave:future-time-stamp", |
2885 "time stamp for `%s' is in the future", nm.c_str ()); | 2885 "time stamp for '%s' is in the future", nm.c_str ()); |
2886 } | 2886 } |
2887 else if (! (input_from_tmp_history_file || input_from_startup_file) | 2887 else if (! (input_from_tmp_history_file || input_from_startup_file) |
2888 && reading_script_file | 2888 && reading_script_file |
2889 && curr_fcn_file_name == id_name) | 2889 && curr_fcn_file_name == id_name) |
2890 { | 2890 { |
2891 warning ("function `%s' defined within script file `%s'", | 2891 warning ("function '%s' defined within script file '%s'", |
2892 id_name.c_str (), curr_fcn_file_full_name.c_str ()); | 2892 id_name.c_str (), curr_fcn_file_full_name.c_str ()); |
2893 } | 2893 } |
2894 | 2894 |
2895 fcn->stash_function_name (id_name); | 2895 fcn->stash_function_name (id_name); |
2896 fcn->stash_fcn_location (input_line_number, current_input_column); | 2896 fcn->stash_fcn_location (input_line_number, current_input_column); |
3093 if (current_function_depth > 0) | 3093 if (current_function_depth > 0) |
3094 retval = new tree_static_command (lst, l, c); | 3094 retval = new tree_static_command (lst, l, c); |
3095 else | 3095 else |
3096 { | 3096 { |
3097 if (reading_script_file) | 3097 if (reading_script_file) |
3098 warning ("ignoring persistent declaration near line %d of file `%s'", | 3098 warning ("ignoring persistent declaration near line %d of file '%s'", |
3099 l, curr_fcn_file_full_name.c_str ()); | 3099 l, curr_fcn_file_full_name.c_str ()); |
3100 else | 3100 else |
3101 warning ("ignoring persistent declaration near line %d", l); | 3101 warning ("ignoring persistent declaration near line %d", l); |
3102 } | 3102 } |
3103 break; | 3103 break; |
3178 tree_statement *tmp = t->back(); | 3178 tree_statement *tmp = t->back(); |
3179 | 3179 |
3180 if (tmp->is_expression ()) | 3180 if (tmp->is_expression ()) |
3181 warning_with_id | 3181 warning_with_id |
3182 ("Octave:missing-semicolon", | 3182 ("Octave:missing-semicolon", |
3183 "missing semicolon near line %d, column %d in file `%s'", | 3183 "missing semicolon near line %d, column %d in file '%s'", |
3184 tmp->line (), tmp->column (), curr_fcn_file_full_name.c_str ()); | 3184 tmp->line (), tmp->column (), curr_fcn_file_full_name.c_str ()); |
3185 } | 3185 } |
3186 } | 3186 } |
3187 | 3187 |
3188 static tree_statement_list * | 3188 static tree_statement_list * |
3589 | 3589 |
3590 fcn_ptr = primary_fcn_ptr; | 3590 fcn_ptr = primary_fcn_ptr; |
3591 } | 3591 } |
3592 } | 3592 } |
3593 else if (require_file) | 3593 else if (require_file) |
3594 error ("no such file, `%s'", ff.c_str ()); | 3594 error ("no such file, '%s'", ff.c_str ()); |
3595 else if (! warn_for.empty ()) | 3595 else if (! warn_for.empty ()) |
3596 error ("%s: unable to open file `%s'", warn_for.c_str (), ff.c_str ()); | 3596 error ("%s: unable to open file '%s'", warn_for.c_str (), ff.c_str ()); |
3597 | 3597 |
3598 return fcn_ptr; | 3598 return fcn_ptr; |
3599 } | 3599 } |
3600 | 3600 |
3601 std::string | 3601 std::string |
3877 } | 3877 } |
3878 } | 3878 } |
3879 } | 3879 } |
3880 if (! found) | 3880 if (! found) |
3881 warning_with_id ("Octave:autoload-relative-file-name", | 3881 warning_with_id ("Octave:autoload-relative-file-name", |
3882 "autoload: `%s' is not an absolute file name", | 3882 "autoload: '%s' is not an absolute file name", |
3883 nm.c_str ()); | 3883 nm.c_str ()); |
3884 } | 3884 } |
3885 autoload_map[argv[1]] = nm; | 3885 autoload_map[argv[1]] = nm; |
3886 } | 3886 } |
3887 } | 3887 } |
3993 | 3993 |
3994 delete fcn; | 3994 delete fcn; |
3995 } | 3995 } |
3996 } | 3996 } |
3997 else | 3997 else |
3998 error ("source: error sourcing file `%s'", | 3998 error ("source: error sourcing file '%s'", |
3999 file_full_name.c_str ()); | 3999 file_full_name.c_str ()); |
4000 } | 4000 } |
4001 } | 4001 } |
4002 | 4002 |
4003 DEFUN (mfilename, args, , | 4003 DEFUN (mfilename, args, , |
4122 retval = fcn.do_multi_index_op (nargout, args); | 4122 retval = fcn.do_multi_index_op (nargout, args); |
4123 else | 4123 else |
4124 { | 4124 { |
4125 maybe_missing_function_hook (name); | 4125 maybe_missing_function_hook (name); |
4126 if (! error_state) | 4126 if (! error_state) |
4127 error ("feval: function `%s' not found", name.c_str ()); | 4127 error ("feval: function '%s' not found", name.c_str ()); |
4128 } | 4128 } |
4129 | 4129 |
4130 return retval; | 4130 return retval; |
4131 } | 4131 } |
4132 | 4132 |
4262 | 4262 |
4263 if (fcn.is_defined ()) | 4263 if (fcn.is_defined ()) |
4264 retval = feval (fcn.function_value (), args.splice (0, 1), | 4264 retval = feval (fcn.function_value (), args.splice (0, 1), |
4265 nargout); | 4265 nargout); |
4266 else | 4266 else |
4267 error ("builtin: lookup for symbol `%s' failed", name.c_str ()); | 4267 error ("builtin: lookup for symbol '%s' failed", name.c_str ()); |
4268 } | 4268 } |
4269 else | 4269 else |
4270 error ("builtin: function name (F) must be a string"); | 4270 error ("builtin: function name (F) must be a string"); |
4271 } | 4271 } |
4272 else | 4272 else |