comparison src/lex.l @ 4930:bdb307dc8613

[project @ 2004-08-05 04:55:26 by jwe]
author jwe
date Thu, 05 Aug 2004 04:55:26 +0000
parents b11223097ad4
children ec98115062d1
comparison
equal deleted inserted replaced
4929:585e9a8c2ef8 4930:bdb307dc8613
601 601
602 %{ 602 %{
603 // Function handles. 603 // Function handles.
604 %} 604 %}
605 605
606 @{IDENT} { 606 "@" {
607 TOK_PUSH_AND_RETURN (&yytext[1], FCN_HANDLE); 607 current_input_column++;
608 lexer_flags.quote_is_transpose = false;
609 lexer_flags.cant_be_identifier = false;
610 lexer_flags.convert_spaces_to_comma = false;
611 lexer_flags.looking_at_function_handle++;
612 COUNT_TOK_AND_RETURN ('@');
608 } 613 }
609 614
610 %{ 615 %{
611 // A new line character. New line characters inside matrix constants 616 // A new line character. New line characters inside matrix constants
612 // are handled by the <MATRIX_START> start state code above. If closest 617 // are handled by the <MATRIX_START> start state code above. If closest
2478 current_input_column += yyleng; 2483 current_input_column += yyleng;
2479 2484
2480 return STRUCT_ELT; 2485 return STRUCT_ELT;
2481 } 2486 }
2482 2487
2488 int kw_token = is_keyword_token (tok);
2489
2490 if (lexer_flags.looking_at_function_handle)
2491 {
2492 if (kw_token)
2493 {
2494 error ("function handles may not refer to keywords");
2495
2496 return LEXICAL_ERROR;
2497 }
2498 else
2499 TOK_PUSH_AND_RETURN (tok, FCN_HANDLE);
2500 }
2501
2483 // If we have a regular keyword, or a plot STYLE, return it. 2502 // If we have a regular keyword, or a plot STYLE, return it.
2484 // Keywords can be followed by identifiers (TOK_RETURN handles 2503 // Keywords can be followed by identifiers (TOK_RETURN handles
2485 // that). 2504 // that).
2486
2487 int kw_token = is_keyword_token (tok);
2488 2505
2489 if (kw_token) 2506 if (kw_token)
2490 { 2507 {
2491 if (kw_token < 0) 2508 if (kw_token < 0)
2492 return kw_token; 2509 return kw_token;
2628 beginning_of_function = false; 2645 beginning_of_function = false;
2629 defining_func = false; 2646 defining_func = false;
2630 parsed_function_name = false; 2647 parsed_function_name = false;
2631 parsing_nested_function = 0; 2648 parsing_nested_function = 0;
2632 2649
2650 // Not initiallly looking at a function handle.
2651 looking_at_function_handle = 0;
2652
2633 // Not parsing a function return or parameter list. 2653 // Not parsing a function return or parameter list.
2634 looking_at_return_list = false; 2654 looking_at_return_list = false;
2635 looking_at_parameter_list = false; 2655 looking_at_parameter_list = false;
2636 2656
2637 // Not parsing a matrix or the left hand side of multi-value 2657 // Not parsing a matrix or the left hand side of multi-value