Mercurial > hg > octave-lyh
annotate libinterp/parse-tree/pt-idx.h @ 16253:a89cf57ba3a5
partial cleanup of continuation handling in lexer
* lex.h, lex.ll (octave_lexer::handle_continuation): New function.
(octave_lexer::finish_comment): Move to octave_lexer::finish_comment.
Don't return token. New argument, looking_at_continuation. If not
handling continuation, unput newline character.
(^{S}*{CCHAR}\{{S}*{NL}): Call yyless before finishing comment.
(^{S}*{CCHAR}\{{S}*{NL}, <BLOCK_COMMENT_START>^{S}*{CCHAR}\{{S}*{NL},
<LINE_COMMENT_START>{ANY_INCLUDING_NL},
<LINE_COMMENT_START>{S}*{CCHAR}.*{NL}): Don't return token.
(<LINE_COMMENT_START>{S}*{CCHAR}.*{NL}): Don't give COMMAND_START
start state special treatment.
({CONT}{S}*{NL}|{CONT}{S}*{COMMENT}):
Call octave_lexer::handle_continuation.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 09 Mar 2013 21:44:14 -0500 |
parents | 2fc554ffbc28 |
children |
rev | line source |
---|---|
2980 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
3 Copyright (C) 1996-2012 John W. Eaton |
2980 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
2980 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
2980 | 20 |
21 */ | |
22 | |
23 #if !defined (octave_tree_index_h) | |
24 #define octave_tree_index_h 1 | |
25 | |
4219 | 26 #include <list> |
27 | |
2980 | 28 class tree_argument_list; |
29 | |
30 class tree_walker; | |
31 | |
11056
4bec51eb58e2
replace Octave_map->octave_map in pt-idx.h
Jaroslav Hajek <highegg@gmail.com>
parents:
10832
diff
changeset
|
32 class octave_map; |
2980 | 33 class octave_value; |
34 class octave_value_list; | |
35 class octave_lvalue; | |
36 | |
37 #include "str-vec.h" | |
38 | |
39 #include "pt-exp.h" | |
7336 | 40 #include "symtab.h" |
2980 | 41 |
42 // Index expressions. | |
43 | |
44 class | |
45 tree_index_expression : public tree_expression | |
46 { | |
47 public: | |
48 | |
49 tree_index_expression (tree_expression *e = 0, tree_argument_list *lst = 0, | |
10313 | 50 int l = -1, int c = -1, char t = '('); |
2980 | 51 |
3930 | 52 tree_index_expression (tree_expression *e, const std::string& n, |
10313 | 53 int l = -1, int c = -1); |
3930 | 54 |
4131 | 55 tree_index_expression (tree_expression *e, tree_expression* df, |
10313 | 56 int l = -1, int c = -1); |
4131 | 57 |
2980 | 58 ~tree_index_expression (void); |
59 | |
5099 | 60 bool has_magic_end (void) const; |
4267 | 61 |
3933 | 62 void append (tree_argument_list *lst = 0, char t = '('); |
3930 | 63 |
3933 | 64 void append (const std::string& n); |
65 | |
4131 | 66 void append (tree_expression *df); |
67 | |
3933 | 68 bool is_index_expression (void) const { return true; } |
2980 | 69 |
3523 | 70 std::string name (void) const; |
2991 | 71 |
3933 | 72 tree_expression *expression (void) { return expr; } |
3930 | 73 |
4219 | 74 std::list<tree_argument_list *> arg_lists (void) { return args; } |
3930 | 75 |
3933 | 76 std::string type_tags (void) { return type; } |
2980 | 77 |
4219 | 78 std::list<string_vector> arg_names (void) { return arg_nm; } |
2980 | 79 |
3933 | 80 bool lvalue_ok (void) const { return expr->lvalue_ok (); } |
3010 | 81 |
3933 | 82 bool rvalue_ok (void) const { return true; } |
2980 | 83 |
8658
73c4516fae10
New evaluator and debugger derived from tree-walker class
John W. Eaton <jwe@octave.org>
parents:
8011
diff
changeset
|
84 octave_value rvalue1 (int nargout = 1); |
2980 | 85 |
86 octave_value_list rvalue (int nargout); | |
87 | |
10832
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
88 octave_value_list rvalue (int nargout, const std::list<octave_lvalue> *lvalue_list); |
1b2fcd122c6a
allow user detect ignored outputs in m-functions
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
89 |
2980 | 90 octave_lvalue lvalue (void); |
91 | |
7767
71f068b22fcc
scope and context fixes for function handles
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
92 tree_index_expression *dup (symbol_table::scope_id scope, |
10313 | 93 symbol_table::context_id context) const; |
5861 | 94 |
2980 | 95 void accept (tree_walker& tw); |
96 | |
97 private: | |
98 | |
3930 | 99 // The LHS of this index expression. |
2980 | 100 tree_expression *expr; |
101 | |
3933 | 102 // The indices (only valid if type == paren || type == brace). |
4219 | 103 std::list<tree_argument_list *> args; |
2980 | 104 |
3930 | 105 // The type of this index expression. |
3933 | 106 std::string type; |
3929 | 107 |
4131 | 108 // The names of the arguments. Used for constant struct element |
109 // references. | |
4219 | 110 std::list<string_vector> arg_nm; |
3933 | 111 |
4131 | 112 // The list of dynamic field names, if any. |
4219 | 113 std::list<tree_expression *> dyn_field; |
4131 | 114 |
7790
c23fab029f46
tree_index_expression constructor: delete default arg values
John W. Eaton <jwe@octave.org>
parents:
7767
diff
changeset
|
115 tree_index_expression (int l, int c); |
5861 | 116 |
11056
4bec51eb58e2
replace Octave_map->octave_map in pt-idx.h
Jaroslav Hajek <highegg@gmail.com>
parents:
10832
diff
changeset
|
117 octave_map make_arg_struct (void) const; |
4131 | 118 |
4219 | 119 std::string |
120 get_struct_index | |
121 (std::list<string_vector>::const_iterator p_arg_nm, | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
122 std::list<tree_expression *>::const_iterator p_dyn_field) const; |
2988 | 123 |
124 // No copying! | |
125 | |
126 tree_index_expression (const tree_index_expression&); | |
127 | |
128 tree_index_expression& operator = (const tree_index_expression&); | |
2980 | 129 }; |
130 | |
131 #endif |