class %Library.SyntaxColorReader extends %RegisteredObject
Front end for reading the CSV output from %SyntaxColor:Color. Instead of reading the stream directly and reconstructing the lines you can use a %SyntaxColorReader object and call its NextLine method.
To create a %SyntaxColorReader object you can pass a CSV stream to %New; alternatively you can call FromCode and it will call %SyntaxColor for you.
method AtEndGet() as %Boolean
Create a %SyntaxColorReader over the given CSV stream
method ForgetNotedPosition() as %Status
The AtEnd property can be used to check for the end of the reader over the CSV stream
classmethod FromCode(Code As %Stream.Object, Language As %String, ExtraFlags As %String, ByRef Reader As %Library.SyntaxColorReader, ByRef AnyColoringErrors As %Boolean, ByRef AnyColoringWarnings As %Boolean, Symbols As %String = "", BufferStream As %Boolean = 0) as %Status
Forget the noted position
method GetInfoLine() as %String
Given a code stream, language, optional extra flags and/or symbols string for %SyntaxColor:Color
Return a %SyntaxColorReader over the resulting CSV and whether there were any coloring errors/warnings (anywhere in the document)
Return the info line, if any Not valid until AtEndmethod NextErrorInfo(Output Description As %String, Output Source As %String, Output Location As %String, Output LineNumber As %Integer, Output LineOffset As %Integer) as %Boolean
Return the next error info Not valid until AtEndmethod NextLine(ByRef LineCSV As %List, ByRef ColoringErrors As %Boolean, ByRef ColoringWarnings As %Boolean) as %Boolean
method NotePosition() as %Status
Return a structured list of coloring information about the current line of code represented by the CSV stream, advancing the stream. In general, a number of lines will be read from the CSV stream to make up one logical line corresponding to a line of the original code. CSV lines of the form "\n" determine logical line boundaries.
If the stream is at its end this method returns 0, otherwise 1.
If 1 is returned the ByRef parameters are set up from the stream items which were read :-
- LineCSV is set to a list of items, where each item is $LB(lang,terminal,code)
- ColoringErrors and ColoringWarnings are set to whether there were any coloring errors/warnings at all on the line
method RestoreNotedPosition() as %Status
Note the current stream position, caller must call RestorePosition or ForgetPosition later.
method Rewind() as %Status
Restore the noted position
method SkipLines(N As %Integer)
Move back to the beginning of the stream
- not allowed if the position is noted
Move forward N lines - stops if end of file found first (doesn't report any error)