comparison libinterp/parse-tree/lex.ll @ 16265:71ee3afedb69

5/10 commits reworking the lexer
author John W. Eaton <jwe@octave.org>
date Mon, 11 Mar 2013 14:29:19 -0400
parents 9acb86e6ac90
children 36e01847694f 15f55df088e7
comparison
equal deleted inserted replaced
16263:9acb86e6ac90 16265:71ee3afedb69
819 "**" { return curr_lexer->handle_incompatible_op ("**", POW); } 819 "**" { return curr_lexer->handle_incompatible_op ("**", POW); }
820 "&&" { return curr_lexer->handle_op ("&&", EXPR_AND_AND); } 820 "&&" { return curr_lexer->handle_op ("&&", EXPR_AND_AND); }
821 "||" { return curr_lexer->handle_op ("||", EXPR_OR_OR); } 821 "||" { return curr_lexer->handle_op ("||", EXPR_OR_OR); }
822 "<<" { return curr_lexer->handle_incompatible_op ("<<", LSHIFT); } 822 "<<" { return curr_lexer->handle_incompatible_op ("<<", LSHIFT); }
823 ">>" { return curr_lexer->handle_incompatible_op (">>", RSHIFT); } 823 ">>" { return curr_lexer->handle_incompatible_op (">>", RSHIFT); }
824 ";" { return curr_lexer->handle_op (";", ';', true, true); } 824
825 ";" {
826 bool at_beginning_of_statement
827 = (! (curr_lexer->whitespace_is_significant ()
828 || curr_lexer->looking_at_object_index.front ()));
829
830 return curr_lexer->handle_op (";", ';', true, at_beginning_of_statement);
831 }
825 832
826 "+" { 833 "+" {
827 int tok = curr_lexer->handle_unary_op ("+", '+'); 834 int tok = curr_lexer->handle_unary_op ("+", '+');
828 835
829 if (tok < 0) 836 if (tok < 0)
885 else 892 else
886 return tok; 893 return tok;
887 } 894 }
888 895
889 "," { 896 "," {
897 bool at_beginning_of_statement
898 = (! (curr_lexer->whitespace_is_significant ()
899 || curr_lexer->looking_at_object_index.front ()));
900
890 return curr_lexer->handle_op 901 return curr_lexer->handle_op
891 (",", ',', true, ! curr_lexer->looking_at_object_index.front ()); 902 (",", ',', true, at_beginning_of_statement);
892 } 903 }
893 904
894 ".'" { 905 ".'" {
895 return curr_lexer->handle_op (".'", TRANSPOSE, true, false); 906 return curr_lexer->handle_op (".'", TRANSPOSE, true, false);
896 } 907 }
972 983
973 curr_lexer->looking_for_object_index = true; 984 curr_lexer->looking_for_object_index = true;
974 curr_lexer->at_beginning_of_statement = false; 985 curr_lexer->at_beginning_of_statement = false;
975 986
976 if (curr_lexer->looking_at_anon_fcn_args) 987 if (curr_lexer->looking_at_anon_fcn_args)
977 curr_lexer->looking_at_anon_fcn_args = false; 988 {
989 curr_lexer->looking_at_anon_fcn_args = false;
990 curr_lexer->nesting_level.anon_fcn_body ();
991 }
978 992
979 return curr_lexer->count_token (')'); 993 return curr_lexer->count_token (')');
980 } 994 }
981 995
982 "." { 996 "." {