Class: KipperFileStream
compiler.KipperFileStream
A UTF-16 file stream, which stores the content of a file/string in an CodePointCharStream.
If name is not set during construction, it will default to "anonymous-script".
Since
0.0.3
Table of contents
Constructors
Properties
Accessors
Constructors
constructor
• new KipperFileStream(options
)
Constructor for the KipperFileStream class.
Parameters
Name | Type | Description |
---|---|---|
options |
Object |
- |
options.charStream? |
CodePointCharStream |
The CodePointCharStream, which will be, if not set, auto-generated by the stringContent. |
options.filePath? |
string |
The path to the file. If this is undefined, then it will default to the value in name. |
options.name? |
string |
The relative or absolute path to the file |
options.stringContent? |
string |
The content of the stream. If options.charStream is set, this will be ignored, and the options.charStream.toString will be used instead. |
Defined in
kipper/core/src/compiler/lexer-parser/file-stream.ts:27
Properties
_charStream
• Private
Readonly
_charStream: CodePointCharStream
Defined in
kipper/core/src/compiler/lexer-parser/file-stream.ts:16
_filePath
• Private
Readonly
_filePath: string
Defined in
kipper/core/src/compiler/lexer-parser/file-stream.ts:14
_name
• Private
Readonly
_name: string
Defined in
kipper/core/src/compiler/lexer-parser/file-stream.ts:12
Accessors
charStream
• get
charStream(): CodePointCharStream
Returns the Antlr4 CodePointCharStream for the initialised stringContent.
This is a copy of the stream, so modifying it will not modify the original stream.
Returns
CodePointCharStream
Defined in
kipper/core/src/compiler/lexer-parser/file-stream.ts:47
filePath
• get
filePath(): string
Returns the file path of the file.
If filePath wasn't set during construction, then this defaults to name.
Returns
string
Defined in
kipper/core/src/compiler/lexer-parser/file-stream.ts:76
lines
• get
lines(): string
[]
Returns the lines of code inside the charStream.
The returned lines have the line ending stripped away!
Since
0.4.0
Returns
string
[]
Defined in
kipper/core/src/compiler/lexer-parser/file-stream.ts:64
name
• get
name(): string
Returns the identifier of the file.
Returns
string
Defined in
kipper/core/src/compiler/lexer-parser/file-stream.ts:83
stringContent
• get
stringContent(): string
Returns the string content of the file.
Returns
string
Defined in
kipper/core/src/compiler/lexer-parser/file-stream.ts:54