NAME
Syntax::Kamelon::Indexer - Keeps track of available syntax definitions
SYNOPSIS
use Syntax::Kamelon::Indexer;
my $indexer = Syntax::Kamelon::Indexer->new(%options);
DESCRIPTION
This module keeps track of available syntax definitions. It attemptds to load an index file in the xmlfolder. If that fails it will rebuild the index and attempt to save it.
OPTIONS
The constructor is called with a paired list or hash of options as parameters. You can use the following options.
- indexfile => filename
-
Specifies the filename where Kamelon stores information about available syntax definitions.
By default it points to 'indexrc' in the xmlfolder. If the file does not exist Kamelon will load all xml files in the xmlfolder and attempt to create the indexfile.
Once the indexfile has been created it becomes static. If you add a syntax definition XML file to the xmlfolder it will no longer be recognized. Delete the indexfile and reload Kamelon to fix that.
- noindex => boolean
-
By default 0. If you set this option Kamelon will ignore the existence of an indexfile and manually build the index, without saving it. But it gives you the liberty of adding and removing syntax highlight definition files.
This option comes with a considerable startup penalty.
- xmlfolder => folder
-
This is the place where Kamelon looks for syntax highlight definition XML files. By default it searches @INC for 'Syntax/Kamelon/XML'. Here you find the XML files used in the Kate text editor. They are specially crafted for this module.
METHODS
- AvailableSyntaxes
-
Returns a list of all available syntax definitions.
- CreateExtIndex
-
Creates an index of all available file extensions in the Kate XML files. This is needed if you want to use the SyntaxPropose method.
- CreateIndex
-
Creates an index of all available xml files in the xmlfolder. This may take a while.
- ExtensionSyntaxes($fileextension)
-
Returns a list of Syntax definitions that support the given file extension.
- Extensions($reftofileextensiontable)
-
Sets and returns the table that supports the ExtensionSyntaxes method. It is a hash in the form of:
extension => [syntax1, syntax2, ...]
- FindINC($filename);
-
Searches @INC for $filename and returns the full path of its first occurance.
- GetXMLObject($syntax);
-
Creates and returns a Syntax::Kamelon::XMLData object loaded with the xml file belonging to $syntax.
- IndexFile
-
Sets and returns the index file name. Corrsponds with the indexfile option.
- InfoXXXXX
-
These methods return general information about the syntax definitions.
- Info($syntax, $tag);
-
$tag can have the value: 'ext', 'slcomment', 'mlcommentend', 'mlcommentstart', 'mime', 'menu', 'file' or 'version'.
- InfoExtensions($syntax);
- InfoMLCommentEnd($syntax);
- InfoMLCommentStart($syntax);
- InfoMimeType($syntax);
- InfoSection($syntax);
- InfoSLComment($syntax);
- InfoVersion($syntax);
- InfoXMLFile($syntax);
- LoadIndex($noindex);
-
Loads the index of XMLFolder into memory. $noindex is a boolean. If it is set it will not load the index file but rebuild the index.
- LoadXML($fullpathandfilename);
-
Creates and returns an XMLData object for the given filename.
- SaveIndex
-
Saves the index to xmlfolder/indexfile.
- XMLFolder
-
Sets and returns the xml folder name. Corresponds with the xmlfolder option.
AUTHOR AND COPYRIGHT
This module is written and maintained by:
Hans Jeuken < hanje at cpan dot org >
Copyright (c) 2017 - 2023 by Hans Jeuken, all rights reserved.
Published under the same license as Perl.
SEE ALSO
Syntax::Kamelon, Syntax::Kamelon::Builder, Syntax::Kamelon::Debugger, Syntax::Kamelon::Diagnostics, Syntax::Kamelon::XMLData, Syntax::Kamelon::Format::Base, Syntax::Kamelon::Format::ANSI, Syntax::Kamelon::Format:HTML4
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 100:
Unterminated B<...> sequence
- Around line 102:
Unterminated B<...> sequence