| Line 77... |
Line 77... |
| 77 |
vector. It copies the value of the \code{isFile} argument, to help
|
77 |
vector. It copies the value of the \code{isFile} argument, to help
|
| 78 |
debuggers identify whether this text comes from a real file in the
|
78 |
debuggers identify whether this text comes from a real file in the
|
| 79 |
file system.
|
79 |
file system.
|
| 80 |
|
80 |
|
| 81 |
The \code{srcfilealias} function produces an object of the descendant
|
81 |
The \code{srcfilealias} function produces an object of the descendant
|
| 82 |
class \code{srcfilealias}, which gives an alternate name to another
|
82 |
class \code{srcfilealias}, which gives an alternate name to another
|
| 83 |
srcfile. This is produced by the parser when a \code{#line} directive
|
83 |
srcfile. This is produced by the parser when a \code{#line} directive
|
| 84 |
is used.
|
84 |
is used.
|
| 85 |
|
85 |
|
| 86 |
The \code{getSrcLines} function reads the specified lines from
|
86 |
The \code{getSrcLines} function reads the specified lines from
|
| 87 |
\code{srcfile}.
|
87 |
\code{srcfile}.
|
| 88 |
|
88 |
|
| 89 |
The \code{srcref} function produces an object of class
|
89 |
The \code{srcref} function produces an object of class
|
| 90 |
\code{srcref}, which describes a range of characters in a \code{
|
90 |
\code{srcref}, which describes a range of characters in a \code{
|
| Line 104... |
Line 104... |
| 104 |
and \code{close} for classes \code{srcfile} and \code{srcfilecopy}.
|
104 |
and \code{close} for classes \code{srcfile} and \code{srcfilecopy}.
|
| 105 |
The \code{open} method opens its internal \code{\link{file}} connection at
|
105 |
The \code{open} method opens its internal \code{\link{file}} connection at
|
| 106 |
a particular line; if it was already open, it will be repositioned
|
106 |
a particular line; if it was already open, it will be repositioned
|
| 107 |
to that line.
|
107 |
to that line.
|
| 108 |
|
108 |
|
| 109 |
Methods are defined for \code{print}, \code{summary} and
|
109 |
Methods are defined for \code{print}, \code{summary} and
|
| 110 |
\code{as.character} for class \code{srcref}. The \code{as.character}
|
110 |
\code{as.character} for class \code{srcref}. The \code{as.character}
|
| 111 |
method will read the associated source file to obtain the text
|
111 |
method will read the associated source file to obtain the text
|
| 112 |
corresponding to the reference. The exact behaviour depends on the
|
112 |
corresponding to the reference. The exact behaviour depends on the
|
| 113 |
class of the source file. If the source file inherits from
|
113 |
class of the source file. If the source file inherits from
|
| 114 |
class \code{"srcfilecopy"}, the lines are taken from the saved copy
|
114 |
class \code{"srcfilecopy"}, the lines are taken from the saved copy
|
| 115 |
using the "parsed" line counts. If not, an attempt
|
115 |
using the "parsed" line counts. If not, an attempt
|
| 116 |
is made to read the file, and the original line numbers of the
|
116 |
is made to read the file, and the original line numbers of the
|
| 117 |
\code{srcref} record (i.e. elements 1 and 3) are used. If an error
|
117 |
\code{srcref} record (i.e. elements 1 and 3) are used. If an error
|
| 118 |
occurs (e.g. the file no longer exists), text like
|
118 |
occurs (e.g. the file no longer exists), text like
|
| 119 |
\code{<srcref: "file" chars 1:1 to 2:10>} will be returned instead,
|
119 |
\code{<srcref: "file" chars 1:1 to 2:10>} will be returned instead,
|
| 120 |
indicating the \code{line:column} ranges of the first and last
|
120 |
indicating the \code{line:column} ranges of the first and last
|
| 121 |
character. The \code{summary} method defaults to this type of
|
121 |
character. The \code{summary} method defaults to this type of
|
| 122 |
display.
|
122 |
display.
|
| 123 |
|
123 |
|
| 124 |
Lists of \code{srcref} objects may be attached to expressions as the
|
124 |
Lists of \code{srcref} objects may be attached to expressions as the
|
| 125 |
\code{"srcref"} attribute. (The list of \code{srcref} objects should be the same
|
125 |
\code{"srcref"} attribute. (The list of \code{srcref} objects should be the same
|
| 126 |
length as the expression.) By default, expressions are printed by
|
126 |
length as the expression.) By default, expressions are printed by
|
| 127 |
\code{\link{print.default}} using the associated \code{srcref}. To
|
127 |
\code{\link{print.default}} using the associated \code{srcref}. To
|