Mercurial > octave-nkf
comparison libinterp/parse-tree/lex.ll @ 18312:7ac2a8b758fc gui-release
maint: Periodic merge of stable to gui-release.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 20 Jan 2014 01:39:38 -0500 |
parents | 043ce3787849 b14cdae65abd |
children | 9d62b5f041ee 1ecfcfa4858e |
comparison
equal
deleted
inserted
replaced
18310:03a8428adef7 | 18312:7ac2a8b758fc |
---|---|
275 CCHAR [#%] | 275 CCHAR [#%] |
276 IDENT ([_$a-zA-Z][_$a-zA-Z0-9]*) | 276 IDENT ([_$a-zA-Z][_$a-zA-Z0-9]*) |
277 EXPON ([DdEe][+-]?{D}+) | 277 EXPON ([DdEe][+-]?{D}+) |
278 NUMBER (({D}+\.?{D}*{EXPON}?)|(\.{D}+{EXPON}?)|(0[xX][0-9a-fA-F]+)) | 278 NUMBER (({D}+\.?{D}*{EXPON}?)|(\.{D}+{EXPON}?)|(0[xX][0-9a-fA-F]+)) |
279 | 279 |
280 ANY_EXCEPT_NL [^\r\n] | |
280 ANY_INCLUDING_NL (.|{NL}) | 281 ANY_INCLUDING_NL (.|{NL}) |
281 | 282 |
282 %% | 283 %% |
283 | 284 |
284 %{ | 285 %{ |
307 %{ | 308 %{ |
308 // Commands can be continued on a second line using the ellipsis. | 309 // Commands can be continued on a second line using the ellipsis. |
309 // If an argument is in construction, it is completed. | 310 // If an argument is in construction, it is completed. |
310 %} | 311 %} |
311 | 312 |
312 <COMMAND_START>(\.\.\.)[^\r\n]*{NL} { | 313 <COMMAND_START>(\.\.\.){ANY_EXCEPT_NL}*{NL} { |
313 curr_lexer->lexer_debug ("<COMMAND_START>(\\.\\.\\.)[^\\r\\n]*{NL}"); | 314 curr_lexer->lexer_debug ("<COMMAND_START>(\\.\\.\\.){ANY_EXCEPT_NL}*{NL}"); |
314 | 315 |
315 COMMAND_ARG_FINISH; | 316 COMMAND_ARG_FINISH; |
316 | 317 |
317 curr_lexer->input_line_number++; | 318 curr_lexer->input_line_number++; |
318 curr_lexer->current_input_column = 1; | 319 curr_lexer->current_input_column = 1; |
322 | 323 |
323 %{ | 324 %{ |
324 // Commands normally end at the end of a line or a semicolon. | 325 // Commands normally end at the end of a line or a semicolon. |
325 %} | 326 %} |
326 | 327 |
327 <COMMAND_START>({CCHAR}[^\r\n]*)?{NL} { | 328 <COMMAND_START>({CCHAR}{ANY_EXCEPT_NL}*)?{NL} { |
328 curr_lexer->lexer_debug ("<COMMAND_START>({CCHAR}[^\\r\\n])?{NL}"); | 329 curr_lexer->lexer_debug ("<COMMAND_START>({CCHAR}{ANY_EXCEPT_NL}*)?{NL}"); |
329 | 330 |
330 COMMAND_ARG_FINISH; | 331 COMMAND_ARG_FINISH; |
331 | 332 |
332 curr_lexer->input_line_number++; | 333 curr_lexer->input_line_number++; |
333 curr_lexer->current_input_column = 1; | 334 curr_lexer->current_input_column = 1; |
631 | 632 |
632 %{ | 633 %{ |
633 // Body of a block comment. | 634 // Body of a block comment. |
634 %} | 635 %} |
635 | 636 |
636 <BLOCK_COMMENT_START>.*{NL} { | 637 <BLOCK_COMMENT_START>{ANY_EXCEPT_NL}*{NL} { |
637 curr_lexer->lexer_debug ("<BLOCK_COMMENT_START>.*{NL}"); | 638 curr_lexer->lexer_debug ("<BLOCK_COMMENT_START>{ANY_EXCEPT_NL}*{NL}"); |
638 | 639 |
639 curr_lexer->input_line_number++; | 640 curr_lexer->input_line_number++; |
640 curr_lexer->current_input_column = 1; | 641 curr_lexer->current_input_column = 1; |
641 curr_lexer->comment_text += yytext; | 642 curr_lexer->comment_text += yytext; |
642 } | 643 } |
643 | 644 |
644 %{ | 645 %{ |
645 // Full-line or end-of-line comment. | 646 // Full-line or end-of-line comment. |
646 %} | 647 %} |
647 | 648 |
648 {S}*{CCHAR}.*{NL} { | 649 {S}*{CCHAR}{ANY_EXCEPT_NL}*{NL} { |
649 curr_lexer->lexer_debug ("{S}*{CCHAR}.*{NL}"); | 650 curr_lexer->lexer_debug ("{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL}"); |
650 | 651 |
651 curr_lexer->push_start_state (LINE_COMMENT_START); | 652 curr_lexer->push_start_state (LINE_COMMENT_START); |
652 yyless (0); | 653 yyless (0); |
653 } | 654 } |
654 | 655 |
655 <LINE_COMMENT_START>{S}*{CCHAR}.*{NL} { | 656 <LINE_COMMENT_START>{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL} { |
656 curr_lexer->lexer_debug ("<LINE_COMMENT_START>{S}*{CCHAR}.*{NL}"); | 657 curr_lexer->lexer_debug ("<LINE_COMMENT_START>{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL}"); |
657 | 658 |
658 bool full_line_comment = curr_lexer->current_input_column == 1; | 659 bool full_line_comment = curr_lexer->current_input_column == 1; |
659 curr_lexer->input_line_number++; | 660 curr_lexer->input_line_number++; |
660 curr_lexer->current_input_column = 1; | 661 curr_lexer->current_input_column = 1; |
661 | 662 |
867 curr_lexer->current_input_column += yyleng; | 868 curr_lexer->current_input_column += yyleng; |
868 curr_lexer->string_text += '\v'; | 869 curr_lexer->string_text += '\v'; |
869 } | 870 } |
870 | 871 |
871 <DQ_STRING_START>(\.\.\.){S}*{NL} | | 872 <DQ_STRING_START>(\.\.\.){S}*{NL} | |
872 <DQ_STRING_START>(\.\.\.){S}*{CCHAR}.*{NL} { | 873 <DQ_STRING_START>(\.\.\.){S}*{CCHAR}{ANY_EXCEPT_NL}*{NL} { |
873 curr_lexer->lexer_debug ("<DQ_STRING_START>(\\.\\.\\.){S}*{NL}|<DQ_STRING_START>(\\.\\.\\.){S}*{CCHAR}.*{NL}"); | 874 curr_lexer->lexer_debug ("<DQ_STRING_START>(\\.\\.\\.){S}*{NL}|<DQ_STRING_START>(\\.\\.\\.){S}*{CCHAR}{ANY_EXCEPT_NL}*{NL}"); |
874 | 875 |
875 static const char *msg = "'...' continuations in double-quoted character strings are obsolete and will not be allowed in a future version of Octave; please use '\\' instead"; | 876 static const char *msg = "'...' continuations in double-quoted character strings are obsolete and will not be allowed in a future version of Octave; please use '\\' instead"; |
876 | 877 |
877 std::string nm = curr_lexer->fcn_file_full_name; | 878 std::string nm = curr_lexer->fcn_file_full_name; |
878 | 879 |
885 | 886 |
886 HANDLE_STRING_CONTINUATION; | 887 HANDLE_STRING_CONTINUATION; |
887 } | 888 } |
888 | 889 |
889 <DQ_STRING_START>\\{S}+{NL} | | 890 <DQ_STRING_START>\\{S}+{NL} | |
890 <DQ_STRING_START>\\{S}*{CCHAR}.*{NL} { | 891 <DQ_STRING_START>\\{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL} { |
891 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\{S}+{NL}|<DQ_STRING_START>\\\\{S}*{CCHAR}.*{NL}"); | 892 curr_lexer->lexer_debug ("<DQ_STRING_START>\\\\{S}+{NL}|<DQ_STRING_START>\\\\{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL}"); |
892 | 893 |
893 static const char *msg = "white space and comments after continuation markers in double-quoted character strings are obsolete and will not be allowed in a future version of Octave"; | 894 static const char *msg = "white space and comments after continuation markers in double-quoted character strings are obsolete and will not be allowed in a future version of Octave"; |
894 | 895 |
895 std::string nm = curr_lexer->fcn_file_full_name; | 896 std::string nm = curr_lexer->fcn_file_full_name; |
896 | 897 |
1075 | 1076 |
1076 %{ | 1077 %{ |
1077 // Continuation lines. Allow arbitrary text after continuations. | 1078 // Continuation lines. Allow arbitrary text after continuations. |
1078 %} | 1079 %} |
1079 | 1080 |
1080 \.\.\..*{NL} { | 1081 \.\.\.{ANY_EXCEPT_NL}*{NL} { |
1081 curr_lexer->lexer_debug ("\\.\\.\\..*{NL}"); | 1082 curr_lexer->lexer_debug ("\\.\\.\\.{ANY_EXCEPT_NL}*{NL}"); |
1082 | 1083 |
1083 curr_lexer->handle_continuation (); | 1084 curr_lexer->handle_continuation (); |
1084 } | 1085 } |
1085 | 1086 |
1086 %{ | 1087 %{ |
1087 // Deprecated C preprocessor style continuation markers. | 1088 // Deprecated C preprocessor style continuation markers. |
1088 %} | 1089 %} |
1089 | 1090 |
1090 \\{S}*{NL} | | 1091 \\{S}*{NL} | |
1091 \\{S}*{CCHAR}.*{NL} { | 1092 \\{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL} { |
1092 curr_lexer->lexer_debug ("\\\\{S}*{NL}|\\\\{S}*{CCHAR}.*{NL}"); | 1093 curr_lexer->lexer_debug ("\\\\{S}*{NL}|\\\\{S}*{CCHAR}{ANY_EXCEPT_NL}*{NL}"); |
1093 | 1094 |
1094 static const char *msg = "using continuation marker \\ outside of double quoted strings is deprecated and will be removed in a future version of Octave"; | 1095 static const char *msg = "using continuation marker \\ outside of double quoted strings is deprecated and will be removed in a future version of Octave"; |
1095 | 1096 |
1096 std::string nm = curr_lexer->fcn_file_full_name; | 1097 std::string nm = curr_lexer->fcn_file_full_name; |
1097 | 1098 |