Mercurial > hg > octave-lyh
diff 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 |
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll +++ b/libinterp/parse-tree/lex.ll @@ -821,7 +821,14 @@ "||" { return curr_lexer->handle_op ("||", EXPR_OR_OR); } "<<" { return curr_lexer->handle_incompatible_op ("<<", LSHIFT); } ">>" { return curr_lexer->handle_incompatible_op (">>", RSHIFT); } -";" { return curr_lexer->handle_op (";", ';', true, true); } + +";" { + bool at_beginning_of_statement + = (! (curr_lexer->whitespace_is_significant () + || curr_lexer->looking_at_object_index.front ())); + + return curr_lexer->handle_op (";", ';', true, at_beginning_of_statement); + } "+" { int tok = curr_lexer->handle_unary_op ("+", '+'); @@ -887,8 +894,12 @@ } "," { + bool at_beginning_of_statement + = (! (curr_lexer->whitespace_is_significant () + || curr_lexer->looking_at_object_index.front ())); + return curr_lexer->handle_op - (",", ',', true, ! curr_lexer->looking_at_object_index.front ()); + (",", ',', true, at_beginning_of_statement); } ".'" { @@ -974,7 +985,10 @@ curr_lexer->at_beginning_of_statement = false; if (curr_lexer->looking_at_anon_fcn_args) - curr_lexer->looking_at_anon_fcn_args = false; + { + curr_lexer->looking_at_anon_fcn_args = false; + curr_lexer->nesting_level.anon_fcn_body (); + } return curr_lexer->count_token (')'); }