DocBook|Search
Class Reference
%Library.SyntaxColorReader
   
Server:basexml
Instance:SOAXML
User:UnknownUser
 
-
  [BASEXML] >  [%Library] >  [SyntaxColorReader]
Private  Storage  

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.

Inventory

Parameters Properties Methods Queries Indices ForeignKeys Triggers
9


Summary

Methods
%%OIDGet %AddToSaveSet %ClassIsLatestVersion %ClassName
%ConstructClone %DispatchClassMethod %DispatchGetModified %DispatchGetProperty
%DispatchMethod %DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty
%Extends %GetParameter %IsA %IsModified
%New %NormalizeObject %ObjectModified %OnNew
%OriginalNamespace %PackageName %RemoveFromSaveSet %SerializeObject
%SetModified %ValidateObject AtEndGet ForgetNotedPosition
FromCode NextLine NotePosition RestoreNotedPosition
Rewind SkipLines


Methods

• 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 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)