Syntax::Kamelon::Builder - Builds a lexer from an xml file
use Syntax::Kamelon::Builder; my $lexer = Syntax::Kamelon::Builder->new(%options);
This module inherits Syntax::Kamelon::XMLData.
The constructor does not return an object but a data structure called a lexer. Below more details of what it looks like. You will never have the opportunity to call any of it's methods. It creates a lexer and says bye bye. If fact you never have to create an instance of it. Kamelon does that for you.
The constructor is called with a paired list or hash of options as parameters. You must use the following options.
A reference to the main Kamelon object.
Full path and file name of the xml file to load.
my $lexer = { basecontext => 'first', contexts => { first => { }, second => { } }, deliminators => ".|(|)|:|!|+|,|-|<|=|>|%|&|*|/|;|?|[|]|^|{|||}|~|\\", lists => { mycolors => { red => 1, yellow => 1, }, } syntax => 'Name', };
Notice that lists are in fact hashes. This is for faster lookup. After all we only need to know if an entry exists or not.
my $context = { attribute => $something, callbacks => [ #the rules in action [\&testMethod, @options, $contextshifter, $attribute, @resultparsers], [\&testMethod2, @options2, $contextshifter2, $attribute2, @resultparsers2], #etcetera ], debug => [ [$reftohash, #all the data that was previously in the items key of the context hash. ], [], #etcetera ], dynamic => 0, #or 1 emptycontext => \&contextshifter, endcontext => \&contextshifter, fallthroughcontext => undef, #or also a context shifter info => { #All of the data from the context hash except the items key (the rules) } };
Returns the style tag belonging to $attribute in the Attributes hash. If it cannot find it it will log a warning and return the style tag belonging to the current context.
Uses AttributeGet to obtain the styel tag. Returns the format information belonging to the style tag.
Returns true if the context exists in the contexts hash.
Sets and returns the current context.
Returns true if the current context is dynamic.
Sets and returns the current rule within the current context.
Sets and returns the composed deliminators string. It is composed of the general deliminators, the WaekDeliminator and the AdditionalDeliminator.
Returns a reference to the main Kamelon object.
And exacter Warning mechanism than Kamelon has.
Returns a list of the values belonging to @optionstoretrieve.
Generally a char data type consists of one character. However, an escaped character has two. This methods returns the escaped character also as the real character. so a newline for a \n etc.
The initiater of the building process.
Sets up context and stores it in $lexer.
Sets up the rules for $contextname.
Creates an anonymous sub that does a context shift when executed.
All these methods set up specific rules inside a context.
Checks if a syntax is available before creating a context shifter that uses it.
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.
Syntax::Kamelon, Syntax::Kamelon::Debugger, Syntax::Kamelon::Diagnostics, Syntax::Kamelon::Indexer, Syntax::Kamelon::XMLData, Syntax::Kamelon::Format::Base, Syntax::Kamelon::Format::ANSI, Syntax::Kamelon::Format:HTML4
To install Syntax::Kamelon, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Syntax::Kamelon
CPAN shell
perl -MCPAN -e shell install Syntax::Kamelon
For more information on module installation, please visit the detailed CPAN module installation guide.