Mercurial > hg > octave-lyh
comparison src/parse.y @ 7723:74f5e0c7de9e
first pass at handling block comments
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 19 Apr 2008 01:59:31 -0400 |
parents | 4e2eafef689c |
children | 13820b9f5fd9 |
comparison
equal
deleted
inserted
replaced
7722:c3bb0b7a4261 | 7723:74f5e0c7de9e |
---|---|
2843 | 2843 |
2844 if (c == '\r') | 2844 if (c == '\r') |
2845 { | 2845 { |
2846 c = getc (f); | 2846 c = getc (f); |
2847 | 2847 |
2848 if (c != '\n') | 2848 if (c == '\n') |
2849 input_line_number++; | |
2850 else | |
2849 { | 2851 { |
2850 ungetc (c, f); | 2852 ungetc (c, f); |
2851 c = '\r'; | 2853 c = '\r'; |
2852 } | 2854 } |
2853 } | 2855 } |
2856 else if (c == '\n') | |
2857 input_line_number++; | |
2854 | 2858 |
2855 return c; | 2859 return c; |
2856 } | 2860 } |
2857 | 2861 |
2858 class | 2862 class |
2881 case '\t': | 2885 case '\t': |
2882 current_input_column++; | 2886 current_input_column++; |
2883 break; | 2887 break; |
2884 | 2888 |
2885 case '\n': | 2889 case '\n': |
2886 input_line_number++; | |
2887 current_input_column = 0; | 2890 current_input_column = 0; |
2888 break; | 2891 break; |
2889 | 2892 |
2890 default: | 2893 default: |
2891 current_input_column--; | 2894 current_input_column--; |
2918 eof = skip_white_space (stdio_reader); | 2921 eof = skip_white_space (stdio_reader); |
2919 | 2922 |
2920 if (eof) | 2923 if (eof) |
2921 break; | 2924 break; |
2922 | 2925 |
2923 txt = grab_comment_block (stdio_reader, eof); | 2926 txt = grab_comment_block (stdio_reader, true, eof); |
2924 | 2927 |
2925 if (txt.empty ()) | 2928 if (txt.empty ()) |
2926 break; | 2929 break; |
2927 | 2930 |
2928 if (! (have_help_text || looks_like_copyright (txt))) | 2931 if (! (have_help_text || looks_like_copyright (txt))) |
3025 if (ffile) | 3028 if (ffile) |
3026 { | 3029 { |
3027 bool eof; | 3030 bool eof; |
3028 | 3031 |
3029 std::string help_txt = gobble_leading_white_space (ffile, eof); | 3032 std::string help_txt = gobble_leading_white_space (ffile, eof); |
3030 | |
3031 if (! help_txt.empty ()) | |
3032 help_buf.push (help_txt); | |
3033 | 3033 |
3034 if (! eof) | 3034 if (! eof) |
3035 { | 3035 { |
3036 std::string file_type; | 3036 std::string file_type; |
3037 | 3037 |
3076 | 3076 |
3077 unwind_protect_ptr (curr_fcn_ptr); | 3077 unwind_protect_ptr (curr_fcn_ptr); |
3078 curr_fcn_ptr = 0; | 3078 curr_fcn_ptr = 0; |
3079 | 3079 |
3080 reset_parser (); | 3080 reset_parser (); |
3081 | |
3082 if (! help_txt.empty ()) | |
3083 help_buf.push (help_txt); | |
3081 | 3084 |
3082 if (parsing_script) | 3085 if (parsing_script) |
3083 prep_lexer_for_script (); | 3086 prep_lexer_for_script (); |
3084 | 3087 |
3085 lexer_flags.parsing_class_method = ! dispatch_type.empty (); | 3088 lexer_flags.parsing_class_method = ! dispatch_type.empty (); |