This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.

For information on migrating to InterSystems IRIS, see How to Migrate to InterSystems IRIS, available on the WRC Distributions page (login required).


class %Library.SyntaxColorReader extends %Library.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.

Property Inventory (Including Private)

Method Inventory (Including Private)


property AtEnd as %Boolean [ Private , Calculated ];
Property methods: AtEndDisplayToLogical(), AtEndGet(), AtEndIsValid(), AtEndLogicalToDisplay(), AtEndNormalize()
property BufferedStream as %Boolean [ Private ];
This is here so that we can give better error messages
Property methods: BufferedStreamDisplayToLogical(), BufferedStreamGet(), BufferedStreamIsValid(), BufferedStreamLogicalToDisplay(), BufferedStreamNormalize(), BufferedStreamSet()
property CSV as %RegisteredObject [ Private ];
Property methods: CSVGet(), CSVGetSwizzled(), CSVIsValid(), CSVNewObject(), CSVSet()
property ErrorInfo as %Stream.Object [ Private ];
Not valid until AtEnd
Property methods: ErrorInfoDelete(), ErrorInfoGet(), ErrorInfoGetObject(), ErrorInfoGetObjectId(), ErrorInfoGetSwizzled(), ErrorInfoIsValid(), ErrorInfoNewObject(), ErrorInfoOid(), ErrorInfoOpen(), ErrorInfoSet(), ErrorInfoSetObject(), ErrorInfoSetObjectId(), ErrorInfoUnSwizzle()
property InfoLine as %String [ Private ];
Not valid until AtEnd
Property methods: InfoLineDisplayToLogical(), InfoLineGet(), InfoLineIsValid(), InfoLineLogicalToDisplay(), InfoLineLogicalToOdbc(), InfoLineNormalize(), InfoLineSet()
property PositionIsNoted as %Boolean [ Private ];
Property methods: PositionIsNotedDisplayToLogical(), PositionIsNotedGet(), PositionIsNotedIsValid(), PositionIsNotedLogicalToDisplay(), PositionIsNotedNormalize(), PositionIsNotedSet()
property RewoundErrorInfo as %Boolean [ Private ];
Whether or not we've rewound ErrorInfo
Property methods: RewoundErrorInfoDisplayToLogical(), RewoundErrorInfoGet(), RewoundErrorInfoIsValid(), RewoundErrorInfoLogicalToDisplay(), RewoundErrorInfoNormalize(), RewoundErrorInfoSet()


method %OnNew(CSV As %Stream.Object, BufferStream As %Boolean = 0) as %Status

Create a %SyntaxColorReader over the given CSV stream

method AtEndGet() as %Boolean

The AtEnd property can be used to check for the end of the reader over the CSV stream

method ForgetNotedPosition() as %Status

Forget the noted position

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

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)

method GetInfoLine() as %String
Return the info line, if any Not valid until AtEnd
method 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 AtEnd
method NextLine(ByRef LineCSV As %List, ByRef ColoringErrors As %Boolean, ByRef ColoringWarnings As %Boolean) as %Boolean

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 NotePosition() as %Status

Note the current stream position, caller must call RestorePosition or ForgetPosition later.

method RestoreNotedPosition() as %Status

Restore the noted position

method Rewind() as %Status

Move back to the beginning of the stream

- not allowed if the position is noted

method SkipLines(N As %Integer)

Move forward N lines - stops if end of file found first (doesn't report any error)

Inherited Members

Inherited Methods (Including Private)