Mercurial > octave-nkf
comparison libinterp/parse-tree/lex.ll @ 18238:8f256148d82b
maint: Periodic merge of gui-release to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 07 Jan 2014 16:07:54 -0500 |
parents | 3cad99b56fa7 af8a70d6885c |
children | 89e3601c33aa |
comparison
equal
deleted
inserted
replaced
18232:3cad99b56fa7 | 18238:8f256148d82b |
---|---|
41 #include <config.h> | 41 #include <config.h> |
42 #endif | 42 #endif |
43 | 43 |
44 } | 44 } |
45 | 45 |
46 %s COMMAND_START | 46 %x COMMAND_START |
47 %s MATRIX_START | 47 %s MATRIX_START |
48 | 48 |
49 %x INPUT_FILE_START | 49 %x INPUT_FILE_START |
50 | 50 |
51 %x BLOCK_COMMENT_START | 51 %x BLOCK_COMMENT_START |
323 %{ | 323 %{ |
324 // Commands normally end at the end of a line or a semicolon. | 324 // Commands normally end at the end of a line or a semicolon. |
325 %} | 325 %} |
326 | 326 |
327 <COMMAND_START>({CCHAR}[^\r\n]*)?{NL} { | 327 <COMMAND_START>({CCHAR}[^\r\n]*)?{NL} { |
328 curr_lexer->lexer_debug ("<COMMAND_START>({CCHAR}[^\\r\\n]*)?{NL}"); | 328 curr_lexer->lexer_debug ("<COMMAND_START>({CCHAR}[^\\r\\n])?{NL}"); |
329 | 329 |
330 COMMAND_ARG_FINISH; | 330 COMMAND_ARG_FINISH; |
331 | 331 |
332 curr_lexer->input_line_number++; | 332 curr_lexer->input_line_number++; |
333 curr_lexer->current_input_column = 1; | 333 curr_lexer->current_input_column = 1; |
337 | 337 |
338 return curr_lexer->handle_token ('\n'); | 338 return curr_lexer->handle_token ('\n'); |
339 } | 339 } |
340 | 340 |
341 <COMMAND_START>[\,\;] { | 341 <COMMAND_START>[\,\;] { |
342 curr_lexer->lexer_debug( "<COMMAND_START>[\\,\\;]" ); | 342 curr_lexer->lexer_debug ("<COMMAND_START>[\\,\\;]"); |
343 | 343 |
344 if (yytext[0] != ',' || curr_lexer->command_arg_paren_count == 0) | 344 if (yytext[0] != ',' || curr_lexer->command_arg_paren_count == 0) |
345 { | 345 { |
346 COMMAND_ARG_FINISH; | 346 COMMAND_ARG_FINISH; |
347 curr_lexer->looking_for_object_index = false; | 347 curr_lexer->looking_for_object_index = false; |
359 // Unbalanced parentheses serve as pseudo-quotes: they are included in | 359 // Unbalanced parentheses serve as pseudo-quotes: they are included in |
360 // the final argument string, but they cause parentheses and quotes to | 360 // the final argument string, but they cause parentheses and quotes to |
361 // be slurped into that argument as well. | 361 // be slurped into that argument as well. |
362 %} | 362 %} |
363 | 363 |
364 <COMMAND_START>[\(\[\{]+ { | 364 <COMMAND_START>[\(\[\{]* { |
365 curr_lexer->lexer_debug ("<COMMAND_START>[\\(\\[\\{]+"); | 365 curr_lexer->lexer_debug ("<COMMAND_START>[\\(\\[\\{]+"); |
366 | 366 |
367 curr_lexer->command_arg_paren_count += yyleng; | 367 curr_lexer->command_arg_paren_count += yyleng; |
368 curr_lexer->string_text += yytext; | 368 curr_lexer->string_text += yytext; |
369 curr_lexer->current_input_column += yyleng; | 369 curr_lexer->current_input_column += yyleng; |
370 } | 370 } |
371 | 371 |
372 <COMMAND_START>[\)\]\}]+ { | 372 <COMMAND_START>[\)\]\}]* { |
373 curr_lexer->lexer_debug ("<COMMAND_START>[\\)\\]\\}]+"); | 373 curr_lexer->lexer_debug ("<COMMAND_START>[\\)\\]\\}]+"); |
374 | 374 |
375 curr_lexer->command_arg_paren_count -= yyleng; | 375 curr_lexer->command_arg_paren_count -= yyleng; |
376 curr_lexer->string_text += yytext; | 376 curr_lexer->string_text += yytext; |
377 curr_lexer->current_input_column += yyleng; | 377 curr_lexer->current_input_column += yyleng; |
405 // In standard command argument processing, whitespace separates | 405 // In standard command argument processing, whitespace separates |
406 // arguments. In the presence of unbalanced parentheses, it is | 406 // arguments. In the presence of unbalanced parentheses, it is |
407 // incorporated into the argument. | 407 // incorporated into the argument. |
408 %} | 408 %} |
409 | 409 |
410 <COMMAND_START>{S}+ { | 410 <COMMAND_START>{S}* { |
411 curr_lexer->lexer_debug ("<COMMAND_START>{S}+"); | 411 curr_lexer->lexer_debug ("<COMMAND_START>{S}*"); |
412 | 412 |
413 if (curr_lexer->command_arg_paren_count == 0) | 413 if (curr_lexer->command_arg_paren_count == 0) |
414 COMMAND_ARG_FINISH; | 414 COMMAND_ARG_FINISH; |
415 else | 415 else |
416 curr_lexer->string_text += yytext; | 416 curr_lexer->string_text += yytext; |
420 | 420 |
421 %{ | 421 %{ |
422 // Everything else is slurped into the command arguments. | 422 // Everything else is slurped into the command arguments. |
423 %} | 423 %} |
424 | 424 |
425 <COMMAND_START>(\.|[^#% \t\r\n\.\,\;\"\'\(\[\{\}\]\)]+) { | 425 <COMMAND_START>([\.]|[^#% \t\r\n\.\,\;\"\'\(\[\{\}\]\)]*) { |
426 curr_lexer->lexer_debug ("<COMMAND_START>(\\.|[^#% \\t\\r\\n\\.\\,\\;\\\"\\'\\(\\[\\{\\}\\]\\)]+)"); | 426 curr_lexer->lexer_debug ("<COMMAND_START>([\.]|[^#% \\t\\r\n\\.\\,\\;\\\"\\'\\(\\[\\{\\}\\]\\)]*"); |
427 | 427 |
428 curr_lexer->string_text += yytext; | 428 curr_lexer->string_text += yytext; |
429 curr_lexer->current_input_column += yyleng; | 429 curr_lexer->current_input_column += yyleng; |
430 } | 430 } |
431 | 431 |