Mercurial > hg > octave-lyh
comparison libinterp/parse-tree/lex.ll @ 15576:6ea536cb7360 classdef
maint: periodic merge of default to classdef
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Thu, 01 Nov 2012 15:01:20 -0400 |
parents | 947cf10c94da 6437fa7263dd |
children | 0259254a3ccc |
comparison
equal
deleted
inserted
replaced
15228:947cf10c94da | 15576:6ea536cb7360 |
---|---|
107 if ((result = octave_read (buf, max_size)) < 0) \ | 107 if ((result = octave_read (buf, max_size)) < 0) \ |
108 YY_FATAL_ERROR ("octave_read () in flex scanner failed"); | 108 YY_FATAL_ERROR ("octave_read () in flex scanner failed"); |
109 | 109 |
110 // Try to avoid crashing out completely on fatal scanner errors. | 110 // Try to avoid crashing out completely on fatal scanner errors. |
111 // The call to yy_fatal_error should never happen, but it avoids a | 111 // The call to yy_fatal_error should never happen, but it avoids a |
112 // `static function defined but not used' warning from gcc. | 112 // 'static function defined but not used' warning from gcc. |
113 | 113 |
114 #ifdef YY_FATAL_ERROR | 114 #ifdef YY_FATAL_ERROR |
115 #undef YY_FATAL_ERROR | 115 #undef YY_FATAL_ERROR |
116 #endif | 116 #endif |
117 #define YY_FATAL_ERROR(msg) \ | 117 #define YY_FATAL_ERROR(msg) \ |
437 TOK_PUSH_AND_RETURN (tok, SQ_STRING); | 437 TOK_PUSH_AND_RETURN (tok, SQ_STRING); |
438 } | 438 } |
439 | 439 |
440 %{ | 440 %{ |
441 // For this and the next two rules, we're looking at ']', and we | 441 // For this and the next two rules, we're looking at ']', and we |
442 // need to know if the next token is `=' or `=='. | 442 // need to know if the next token is '=' or '=='. |
443 // | 443 // |
444 // It would have been so much easier if the delimiters were simply | 444 // It would have been so much easier if the delimiters were simply |
445 // different for the expression on the left hand side of the equals | 445 // different for the expression on the left hand side of the equals |
446 // operator. | 446 // operator. |
447 // | 447 // |
679 handle_number (); | 679 handle_number (); |
680 COUNT_TOK_AND_RETURN (IMAG_NUM); | 680 COUNT_TOK_AND_RETURN (IMAG_NUM); |
681 } | 681 } |
682 | 682 |
683 %{ | 683 %{ |
684 // Real numbers. Don't grab the `.' part of a dot operator as part of | 684 // Real numbers. Don't grab the '.' part of a dot operator as part of |
685 // the constant. | 685 // the constant. |
686 %} | 686 %} |
687 | 687 |
688 {D}+/\.[\*/\\^\'] | | 688 {D}+/\.[\*/\\^\'] | |
689 {NUMBER} { | 689 {NUMBER} { |
728 { | 728 { |
729 warning ("block comment open at end of input"); | 729 warning ("block comment open at end of input"); |
730 | 730 |
731 if ((reading_fcn_file || reading_script_file || reading_classdef_file) | 731 if ((reading_fcn_file || reading_script_file || reading_classdef_file) |
732 && ! curr_fcn_file_name.empty ()) | 732 && ! curr_fcn_file_name.empty ()) |
733 warning ("near line %d of file `%s.m'", | 733 warning ("near line %d of file '%s.m'", |
734 input_line_number, curr_fcn_file_name.c_str ()); | 734 input_line_number, curr_fcn_file_name.c_str ()); |
735 } | 735 } |
736 | 736 |
737 TOK_RETURN (END_OF_INPUT); | 737 TOK_RETURN (END_OF_INPUT); |
738 } | 738 } |
1076 | 1076 |
1077 if (c != EOF) | 1077 if (c != EOF) |
1078 { | 1078 { |
1079 current_input_column++; | 1079 current_input_column++; |
1080 | 1080 |
1081 error ("invalid character `%s' (ASCII %d) near line %d, column %d", | 1081 error ("invalid character '%s' (ASCII %d) near line %d, column %d", |
1082 undo_string_escape (static_cast<char> (c)), c, | 1082 undo_string_escape (static_cast<char> (c)), c, |
1083 input_line_number, current_input_column); | 1083 input_line_number, current_input_column); |
1084 | 1084 |
1085 return LEXICAL_ERROR; | 1085 return LEXICAL_ERROR; |
1086 } | 1086 } |
1513 case static_kw: | 1513 case static_kw: |
1514 if ((reading_fcn_file || reading_script_file | 1514 if ((reading_fcn_file || reading_script_file |
1515 || reading_classdef_file) | 1515 || reading_classdef_file) |
1516 && ! curr_fcn_file_full_name.empty ()) | 1516 && ! curr_fcn_file_full_name.empty ()) |
1517 warning_with_id ("Octave:deprecated-keyword", | 1517 warning_with_id ("Octave:deprecated-keyword", |
1518 "the `static' keyword is obsolete and will be removed from a future version of Octave; please use `persistent' instead; near line %d of file `%s'", | 1518 "the 'static' keyword is obsolete and will be removed from a future version of Octave; please use 'persistent' instead; near line %d of file '%s'", |
1519 input_line_number, | 1519 input_line_number, |
1520 curr_fcn_file_full_name.c_str ()); | 1520 curr_fcn_file_full_name.c_str ()); |
1521 else | 1521 else |
1522 warning_with_id ("Octave:deprecated-keyword", | 1522 warning_with_id ("Octave:deprecated-keyword", |
1523 "the `static' keyword is obsolete and will be removed from a future version of Octave; please use `persistent' instead; near line %d", | 1523 "the 'static' keyword is obsolete and will be removed from a future version of Octave; please use 'persistent' instead; near line %d", |
1524 input_line_number); | 1524 input_line_number); |
1525 // fall through ... | 1525 // fall through ... |
1526 | 1526 |
1527 case persistent_kw: | 1527 case persistent_kw: |
1528 break; | 1528 break; |
2555 xunput (s[len], yytext); | 2555 xunput (s[len], yytext); |
2556 | 2556 |
2557 return false; | 2557 return false; |
2558 } | 2558 } |
2559 | 2559 |
2560 // We have seen a `.' and need to see if it is the start of a | 2560 // We have seen a '.' and need to see if it is the start of a |
2561 // continuation. If so, this eats it, up to and including the new | 2561 // continuation. If so, this eats it, up to and including the new |
2562 // line character. | 2562 // line character. |
2563 | 2563 |
2564 static bool | 2564 static bool |
2565 have_ellipsis_continuation (bool trailing_comments_ok) | 2565 have_ellipsis_continuation (bool trailing_comments_ok) |
3351 // Kluge alert. | 3351 // Kluge alert. |
3352 // | 3352 // |
3353 // If we are looking at a text style function, set up to gobble its | 3353 // If we are looking at a text style function, set up to gobble its |
3354 // arguments. | 3354 // arguments. |
3355 // | 3355 // |
3356 // If the following token is `=', or if we are parsing a function | 3356 // If the following token is '=', or if we are parsing a function |
3357 // return list or function parameter list, or if we are looking at | 3357 // return list or function parameter list, or if we are looking at |
3358 // something like [ab,cd] = foo (), force the symbol to be inserted | 3358 // something like [ab,cd] = foo (), force the symbol to be inserted |
3359 // as a variable in the current symbol table. | 3359 // as a variable in the current symbol table. |
3360 | 3360 |
3361 if (! is_variable (tok)) | 3361 if (! is_variable (tok)) |
3577 { | 3577 { |
3578 std::string nm = curr_fcn_file_full_name; | 3578 std::string nm = curr_fcn_file_full_name; |
3579 | 3579 |
3580 if (nm.empty ()) | 3580 if (nm.empty ()) |
3581 warning_with_id ("Octave:separator-insert", | 3581 warning_with_id ("Octave:separator-insert", |
3582 "potential auto-insertion of `%c' near line %d", | 3582 "potential auto-insertion of '%c' near line %d", |
3583 sep, input_line_number); | 3583 sep, input_line_number); |
3584 else | 3584 else |
3585 warning_with_id ("Octave:separator-insert", | 3585 warning_with_id ("Octave:separator-insert", |
3586 "potential auto-insertion of `%c' near line %d of file %s", | 3586 "potential auto-insertion of '%c' near line %d of file %s", |
3587 sep, input_line_number, nm.c_str ()); | 3587 sep, input_line_number, nm.c_str ()); |
3588 } | 3588 } |
3589 | 3589 |
3590 static void | 3590 static void |
3591 gripe_single_quote_string (void) | 3591 gripe_single_quote_string (void) |