annotate libinterp/parse-tree/pt-const.cc @ 27919:1891570abac8

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2020.
author John W. Eaton <jwe@octave.org>
date Mon, 06 Jan 2020 22:29:51 -0500
parents b442ec6dda5c
children bd51beb6205e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
1 /*
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
2
27919
1891570abac8 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 27918
diff changeset
3 Copyright (C) 1993-2020 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
4
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
5 See the file COPYRIGHT.md in the top-level directory of this distribution
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
6 or <https://octave.org/COPYRIGHT.html/>.
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
7
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
8
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
9 This file is part of Octave.
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
10
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24270
diff changeset
11 Octave is free software: you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
12 under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24270
diff changeset
13 the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
14 (at your option) any later version.
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
15
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
16 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
17 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
19 GNU General Public License for more details.
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
20
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
21 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6959
diff changeset
22 along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24270
diff changeset
23 <https://www.gnu.org/licenses/>.
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
24
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
25 */
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
26
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
27 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21200
diff changeset
28 # include "config.h"
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
29 #endif
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
30
25438
cb1606f78f6b prefer <istream>, <ostream>, or <iosfwd> to <iostream> where possible
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
31 #include <ostream>
581
bc813f5eb025 [project @ 1994-08-07 01:02:15 by jwe]
jwe
parents: 531
diff changeset
32
2971
f2be17e6f1ea [project @ 1997-05-15 18:55:44 by jwe]
jwe
parents: 2960
diff changeset
33 #include "error.h"
20940
48b2ad5ee801 maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents: 19697
diff changeset
34 #include "ovl.h"
2900
5ed088015839 [project @ 1997-04-30 03:26:56 by jwe]
jwe
parents: 2879
diff changeset
35 #include "pager.h"
1742
a02f140ed897 [project @ 1996-01-12 11:09:39 by jwe]
jwe
parents: 1731
diff changeset
36 #include "pt-const.h"
2124
97a566037a75 [project @ 1996-05-12 07:16:36 by jwe]
jwe
parents: 2115
diff changeset
37 #include "pt-walk.h"
1558
297e084c3857 [project @ 1995-10-12 07:20:28 by jwe]
jwe
parents: 1490
diff changeset
38
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
39 namespace octave
2390
c2c1482c34c8 [project @ 1996-10-12 19:13:23 by jwe]
jwe
parents: 2338
diff changeset
40 {
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
41 // We are likely to have a lot of tree_constant objects to allocate,
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
42 // so make the grow_size large.
21055
5e00ed38a58b maint: Replace if/error/else paradigm with just if/error.
Rik <rik@octave.org>
parents: 20940
diff changeset
43
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
44 void
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
45 tree_constant::print (std::ostream& os, bool pr_as_read_syntax,
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
46 bool pr_orig_text)
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
47 {
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
48 if (pr_orig_text && ! m_orig_text.empty ())
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
49 os << m_orig_text;
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
50 else
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
51 m_value.print (os, pr_as_read_syntax);
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
52 }
2390
c2c1482c34c8 [project @ 1996-10-12 19:13:23 by jwe]
jwe
parents: 2338
diff changeset
53
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
54 void
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
55 tree_constant::print_raw (std::ostream& os, bool pr_as_read_syntax,
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
56 bool pr_orig_text)
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
57 {
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
58 if (pr_orig_text && ! m_orig_text.empty ())
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
59 os << m_orig_text;
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
60 else
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
61 m_value.print_raw (os, pr_as_read_syntax);
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
62 }
2532
0e5eb97cb137 [project @ 1996-11-19 18:13:48 by jwe]
jwe
parents: 2477
diff changeset
63
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
64 tree_expression *
24270
bc3819b7cca1 don't use symbol_table:: nesting for symbol_record, symbol_scope, or fcn_info
John W. Eaton <jwe@octave.org>
parents: 23602
diff changeset
65 tree_constant::dup (symbol_scope&) const
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
66 {
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
67 tree_constant *new_tc
24846
7620f1f5290d use m_ prefix for member variables in parse tree classes
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
68 = new tree_constant (m_value, m_orig_text, line (), column ());
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
69
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
70 new_tc->copy_base (*this);
5861
2a6cb4ed8f1e [project @ 2006-06-16 05:09:41 by jwe]
jwe
parents: 5307
diff changeset
71
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
72 return new_tc;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
73 }
2390
c2c1482c34c8 [project @ 1996-10-12 19:13:23 by jwe]
jwe
parents: 2338
diff changeset
74 }