HKSyntaxDefinition Class Reference

This class representas a compiled syntax definition file and is needed by the HighlighterKit internals in order to do any syntax highlighting. More...

List of all members.

Public Member Functions

(id) - initWithContextList:
 Initializes a syntax definition manually.
(HKTextPattern **) - contextBeginnings
(const char *) - contextBeginningCharacters
 Returns an array of characters which might start a context.
(unsigned int) - numberOfContextBeginningCharacters
 Returns the number of elements in the array returned by -[HKSyntaxDefinition contextBeginningCharacters].
(const char *) - contextSkipCharactersForContext:
 For a given context, returns the characters which should be skipped when searching for a context ending.
(unsigned int) - numberOfContextSkipCharactersForContext:
 Returns the number of elements in the array returned by -[HKSyntaxDefinition contextSkipCharactersForContext:].
(HKTextPattern **) - contextSkipsForContext:
 Returns a NULL pointer terminated list of text patterns which represent the patters the parser should skip when looking for context ends.
(HKTextPattern *) - contextEndingForContext:
 Returns the context ending symbol for the context identified by `ctxt'.
(NSColor *) - foregroundColorForContext:
 Returns the foreground color for a given context.
(NSColor *) - backgroundColorForContext:
 Returns the background color for a given context.
(BOOL) - isItalicFontForContext:
 Returns YES if an italic (or slanted) font should be used to draw the contents of a context.
(BOOL) - isBoldFontForContext:
 Returns YES if a bold font should be used to draw the contents of a context.
(HKTextPattern **) - keywordsInContext:
 Returns a NULL pointer terminated list of text patterns representing keywords to be matched inside context `context'.
(NSColor *) - foregroundColorForKeyword:inContext:
 Returns the color with which the keyword identified by `keyword' in `contextName' should be colored.
(NSColor *) - backgroundColorForKeyword:inContext:
 Returns the background color with which the keyword identified by `keyword' in `contextName' should be colored.
(BOOL) - isItalicFontForKeyword:inContext:
 Returns YES if the font with which the keyword identified by `keyword' should be italic (or slanted) and NO if it should be normal.
(BOOL) - isBoldFontForKeyword:inContext:
 Returns YES if the font with which the keyword identified by `keyword' should be bold and NO if it should be normal weigth.
(id) - initWithContextList:
(HKTextPattern **) - contextBeginnings
(const char *) - contextBeginningCharacters
(unsigned int) - numberOfContextBeginningCharacters
(const char *) - contextSkipCharactersForContext:
(unsigned int) - numberOfContextSkipCharactersForContext:
(HKTextPattern **) - contextSkipsForContext:
(HKTextPattern *) - contextEndingForContext:
(NSColor *) - foregroundColorForContext:
(NSColor *) - backgroundColorForContext:
(BOOL) - isItalicFontForContext:
(BOOL) - isBoldFontForContext:
(HKTextPattern **) - keywordsInContext:
(NSColor *) - foregroundColorForKeyword:inContext:
(NSColor *) - backgroundColorForKeyword:inContext:
(BOOL) - isItalicFontForKeyword:inContext:
(BOOL) - isBoldFontForKeyword:inContext:
(id) - initWithContextList:
(HKTextPattern **) - contextBeginnings
(const char *) - contextBeginningCharacters
(unsigned int) - numberOfContextBeginningCharacters
(const char *) - contextSkipCharactersForContext:
(unsigned int) - numberOfContextSkipCharactersForContext:
(HKTextPattern **) - contextSkipsForContext:
(HKTextPattern *) - contextEndingForContext:
(NSColor *) - foregroundColorForContext:
(NSColor *) - backgroundColorForContext:
(BOOL) - isItalicFontForContext:
(BOOL) - isBoldFontForContext:
(HKTextPattern **) - keywordsInContext:
(NSColor *) - foregroundColorForKeyword:inContext:
(NSColor *) - backgroundColorForKeyword:inContext:
(BOOL) - isItalicFontForKeyword:inContext:
(BOOL) - isBoldFontForKeyword:inContext:
(id) - initWithContextList:
(HKTextPattern **) - contextBeginnings
(const char *) - contextBeginningCharacters
(unsigned int) - numberOfContextBeginningCharacters
(const char *) - contextSkipCharactersForContext:
(unsigned int) - numberOfContextSkipCharactersForContext:
(HKTextPattern **) - contextSkipsForContext:
(HKTextPattern *) - contextEndingForContext:
(NSColor *) - foregroundColorForContext:
(NSColor *) - backgroundColorForContext:
(BOOL) - isItalicFontForContext:
(BOOL) - isBoldFontForContext:
(HKTextPattern **) - keywordsInContext:
(NSColor *) - foregroundColorForKeyword:inContext:
(NSColor *) - backgroundColorForKeyword:inContext:
(BOOL) - isItalicFontForKeyword:inContext:
(BOOL) - isBoldFontForKeyword:inContext:
(id) - initWithContextList:
(HKTextPattern **) - contextBeginnings
(const char *) - contextBeginningCharacters
(unsigned int) - numberOfContextBeginningCharacters
(const char *) - contextSkipCharactersForContext:
(unsigned int) - numberOfContextSkipCharactersForContext:
(HKTextPattern **) - contextSkipsForContext:
(HKTextPattern *) - contextEndingForContext:
(NSColor *) - foregroundColorForContext:
(NSColor *) - backgroundColorForContext:
(BOOL) - isItalicFontForContext:
(BOOL) - isBoldFontForContext:
(HKTextPattern **) - keywordsInContext:
(NSColor *) - foregroundColorForKeyword:inContext:
(NSColor *) - backgroundColorForKeyword:inContext:
(BOOL) - isItalicFontForKeyword:inContext:
(BOOL) - isBoldFontForKeyword:inContext:

Static Public Member Functions

(NSString *) + findSyntaxFileForType:
 Locates a syntax file of the apropriate type and returns it's path.
(HKSyntaxDefinition *) + syntaxDefinitionForType:
 Retrieves a syntax definition of the specified type.
(NSString *) + findSyntaxFileForType:
(HKSyntaxDefinition *) + syntaxDefinitionForType:
(NSString *) + findSyntaxFileForType:
(HKSyntaxDefinition *) + syntaxDefinitionForType:
(NSString *) + findSyntaxFileForType:
(HKSyntaxDefinition *) + syntaxDefinitionForType:
(NSString *) + findSyntaxFileForType:
(HKSyntaxDefinition *) + syntaxDefinitionForType:

Protected Attributes

HKTextPattern ** contextBeginnings
 Returns a NULL pointer terminated list of context beginning symbols.
char contextBeginningChars [128]
HKTextPattern *** contextSkips
char ** contextSkipChars
HKTextPattern ** contextEndings
NSArray * contextGraphics
HKTextPattern *** keywords
NSArray * keywordGraphics
HKTextPattern ** contextBeginnings
HKTextPattern *** contextSkips
char ** contextSkipChars
HKTextPattern ** contextEndings
NSArray * contextGraphics
HKTextPattern *** keywords
NSArray * keywordGraphics
HKTextPattern ** contextBeginnings
HKTextPattern *** contextSkips
char ** contextSkipChars
HKTextPattern ** contextEndings
NSArray * contextGraphics
HKTextPattern *** keywords
NSArray * keywordGraphics
HKTextPattern ** contextBeginnings
HKTextPattern *** contextSkips
char ** contextSkipChars
HKTextPattern ** contextEndings
NSArray * contextGraphics
HKTextPattern *** keywords
NSArray * keywordGraphics
HKTextPattern ** contextBeginnings
HKTextPattern *** contextSkips
char ** contextSkipChars
HKTextPattern ** contextEndings
NSArray * contextGraphics
HKTextPattern *** keywords
NSArray * keywordGraphics


Detailed Description

This class representas a compiled syntax definition file and is needed by the HighlighterKit internals in order to do any syntax highlighting.

Member Function Documentation

+ (NSString *) findSyntaxFileForType: (NSString *)  type  

Locates a syntax file of the apropriate type and returns it's path.

This method is used when creating syntax definitions of a certain type. Syntax files can be placed in a variety of places in the file system so that this method will find them:

  • in one of the system's domains in the 'Library/SyntaxDefinitions' subdirectory (or any of it's subdirectories)
  • in the application's main bundle as a resource
  • in this framework's bundle as a resource

The syntax file is matched by looking at the file's extension - it must say "syntax". Then the `type' argument is matched against the file's name (in a case insensitive manner) - they must match. After that a path to the file is returned.

Parameters:
type The syntax file type which to look for.
Returns:
If found, a path to the syntax file, or `nil' if not.

Referenced by syntaxDefinitionForType:.

+ (HKSyntaxDefinition *) syntaxDefinitionForType: (NSString *)  type  

Retrieves a syntax definition of the specified type.

It is better if you use this method instead of constructing syntax definition objects by hand, since this method uses the standardized search algorithms for syntax files (see +[HKSyntaxDefinition findSyntaxFileForType:]) and also caches the resulting syntax definition (syntax definitions are, by nature, immutable), making later queries faster.

Parameters:
type The syntax type name from which to construct the definition.
Returns:
The syntax definition, if it was found. If it wasn't, then `nil'.

References findSyntaxFileForType:.

- (id) initWithContextList: (NSArray *)  contexts  

Initializes a syntax definition manually.

Parameters:
contexts An array of context definitions as found in the `Contexts' key of a syntax definition file.
Returns:
Self if initialization succeeded, `nil' otherwise.

References contextBeginnings.

- (NSColor *) foregroundColorForKeyword: (unsigned int)  keyword
inContext: (unsigned int)  context 

Returns the color with which the keyword identified by `keyword' in `contextName' should be colored.

The argument `keyword' is the index of the keyword in the array returned by -keywordsInContext:.

- (NSColor *) backgroundColorForKeyword: (unsigned int)  keyword
inContext: (unsigned int)  context 

Returns the background color with which the keyword identified by `keyword' in `contextName' should be colored.

The argument `keyword' is the index of the keyword in the array returned by -keywordsInContext:.


The documentation for this class was generated from the following files:

Generated on Thu Nov 25 10:47:43 2010 for HighlighterKit by  doxygen 1.5.5