CodeFile Class
Assembly: Topten.Cminor.Compiler.dll
Namespace: Topten.Cminor.Lexical
Holds the contents of a source code file, along with its filename and provides utility functions for stepping through its content.
public class CodeFile
Inheritance
CodeFile → object
Constructors
CodeFile(string, string) | Construct a CodeFile from a string |
Properties
Current | The current character |
EOF | True if the current position is at EOF |
EOL | True if the current position is at the end of a line |
FileName | Gets the filename associated with this StringSource |
Position | The current position as a character index from the start of the file |
SourceText | Gets the source text for this StringSource |
Methods
CapturePosition() | Creates a CodePosition for the current read position |
CharAt(int) | The character at offset from current |
CreatePosition(int) | Creates a CodePosition for a location |
CreatePosition(int, int) | Creates a CodePosition for a range |
DoesMatch(string) | Check if the current position in the string matches a substring (case sensitive) |
DoesMatchI(string) | Check if the current position in the string matches a substring (case insensitive) |
Extract(int) | Extract text from the specified position to the current position |
FromFile(string) | Constructs a CodeFile from a file |
FromFile(string, string) | Constructs a CodeFile for a file, resolving the full path from a base directory. |
Next() | Move to the next character (if available) |
Skip(Func<char,bool>) | Skip characters matching predicate |
Skip(char) | Skip one instance of the specified character (case sensitive) |
Skip(string) | Skip a string (case sensitive) |
SkipAndExtract(Func<char,bool>) | Skip characters matching predicate and return the matched characters |
SkipI(char) | Skip one instance of the specified character (case insensitive) |
SkipI(string) | Skip a string (case insensitive) |
SkipToEOL() | Move the current position to the end of the current line |
SkipUntil(string) | Skip forward until a particular string is matched (case sensitive) |
SkipWhitespace() | Skip over any whitespace at the current position |