The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
# Copyright (c) 2005 - 2006 Hans Jeuken. All rights reserved.
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.

# This file was generated from the 'katexml/yacc.xml' file of the syntax highlight
# engine of the kate text editor (http://kate.kde.org

#kate xml version 1.03
#kate version 2.4
#kate author Jan Villat (jan.villat@net2000.ch)
#generated: Wed Nov  1 21:17:55 2006, localtime

package Syntax::Highlight::Engine::Kate::Yacc_Bison;

use vars qw($VERSION);
$VERSION = '0.02';

use strict;
use warnings;
use base('Syntax::Highlight::Engine::Kate::Template');

sub new {
	my $proto = shift;
	my $class = ref($proto) || $proto;
	my $self = $class->SUPER::new(@_);
	$self->attributes({
		'Alert' => 'Alert',
		'Backslash Code' => 'String',
		'Comment' => 'Comment',
		'Content-Type Delimiter' => 'BaseN',
		'Data Type' => 'DataType',
		'Definition' => 'Normal',
		'Directive' => 'Keyword',
		'Normal Text' => 'Normal',
		'Rule' => 'String',
		'String' => 'String',
		'String Char' => 'Char',
	});
	$self->contextdata({
		'C Declarations' => {
			callback => \&parseCDeclarations,
			attribute => 'Normal Text',
		},
		'Char' => {
			callback => \&parseChar,
			attribute => 'String Char',
			lineending => '#pop',
		},
		'Comment' => {
			callback => \&parseComment,
			attribute => 'Comment',
		},
		'CommentSlash' => {
			callback => \&parseCommentSlash,
			attribute => 'Comment',
		},
		'CommentStar' => {
			callback => \&parseCommentStar,
			attribute => 'Comment',
		},
		'Declarations' => {
			callback => \&parseDeclarations,
			attribute => 'Normal Text',
		},
		'Dol' => {
			callback => \&parseDol,
			attribute => 'Normal Text',
			fallthrough => 'DolEnd',
		},
		'DolEnd' => {
			callback => \&parseDolEnd,
			attribute => 'Normal Text',
		},
		'Normal C Bloc' => {
			callback => \&parseNormalCBloc,
			attribute => 'Normal Text',
		},
		'PC type' => {
			callback => \&parsePCtype,
			attribute => 'Data Type',
			lineending => '#pop#pop#pop',
		},
		'Percent Command' => {
			callback => \&parsePercentCommand,
			attribute => 'Directive',
			lineending => '#pop',
		},
		'Percent Command In' => {
			callback => \&parsePercentCommandIn,
			attribute => 'NormalText',
			lineending => '#pop#pop',
		},
		'Pre Start' => {
			callback => \&parsePreStart,
			attribute => 'Normal Text',
		},
		'Rule In' => {
			callback => \&parseRuleIn,
			attribute => 'Definition',
		},
		'Rules' => {
			callback => \&parseRules,
			attribute => 'Rule',
		},
		'String' => {
			callback => \&parseString,
			attribute => 'String',
			lineending => '#pop',
		},
		'StringOrChar' => {
			callback => \&parseStringOrChar,
			attribute => 'NormalText',
		},
		'Union In' => {
			callback => \&parseUnionIn,
			attribute => 'Normal Text',
		},
		'Union InIn' => {
			callback => \&parseUnionInIn,
			attribute => 'Normal Text',
		},
		'Union Start' => {
			callback => \&parseUnionStart,
			attribute => 'Normal Text',
		},
		'User Code' => {
			callback => \&parseUserCode,
			attribute => 'Normal Text',
		},
	});
	$self->deliminators('.():!+,-<=>%&*/;?[]^{|}~\\');
	$self->basecontext('Pre Start');
	$self->keywordscase(1);
	$self->initialize;
	bless ($self, $class);
	return $self;
}

sub language {
	return 'Yacc/Bison';
}

sub parseCDeclarations {
	my ($self, $text) = @_;
	# type => IncludeRules
	if ($self->includeRules('Comment', $text)) {
		return 1
	}
	# type => Detect2Chars
	if ($self->testDetect2Chars($text, '%', '}', 0, 0, 0, 0, 0, '#pop', 'Content-Type Delimiter')) {
		return 1
	}
	# type => IncludeRules
	if ($self->includePlugin('C++', $text)) {
		return 1
	}
	return 0;
};

sub parseChar {
	my ($self, $text) = @_;
	# type => RegExpr
	if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Backslash Code')) {
		return 1
	}
	# type => DetectChar
	if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'String Char')) {
		return 1
	}
	return 0;
};

sub parseComment {
	my ($self, $text) = @_;
	# type => Detect2Chars
	if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'CommentStar', 'Comment')) {
		return 1
	}
	# type => Detect2Chars
	if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'CommentSlash', 'Comment')) {
		return 1
	}
	return 0;
};

sub parseCommentSlash {
	my ($self, $text) = @_;
	# type => RegExpr
	if ($self->testRegExpr($text, '[^\\\\]$', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
		return 1
	}
	return 0;
};

sub parseCommentStar {
	my ($self, $text) = @_;
	# type => Detect2Chars
	if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
		return 1
	}
	return 0;
};

sub parseDeclarations {
	my ($self, $text) = @_;
	# type => IncludeRules
	if ($self->includeRules('Comment', $text)) {
		return 1
	}
	# type => StringDetect
	if ($self->testStringDetect($text, '%union', 0, 0, 0, undef, 0, 'Union Start', 'Directive')) {
		return 1
	}
	# type => Detect2Chars
	if ($self->testDetect2Chars($text, '%', '%', 0, 0, 0, undef, 0, 'Rules', 'Content-Type Delimiter')) {
		return 1
	}
	# type => Detect2Chars
	if ($self->testDetect2Chars($text, '%', '{', 0, 0, 0, 0, 0, 'C Declarations', 'Content-Type Delimiter')) {
		return 1
	}
	# type => DetectChar
	if ($self->testDetectChar($text, '%', 0, 0, 0, undef, 0, 'Percent Command', 'Directive')) {
		return 1
	}
	return 0;
};

sub parseDol {
	my ($self, $text) = @_;
	# type => RegExpr
	if ($self->testRegExpr($text, '<[^>]+>', 0, 0, 0, undef, 0, 'DolEnd', 'Data Type')) {
		return 1
	}
	return 0;
};

sub parseDolEnd {
	my ($self, $text) = @_;
	# type => RegExpr
	if ($self->testRegExpr($text, '\\d+', 0, 0, 0, undef, 0, '#pop#pop', 'Directive')) {
		return 1
	}
	# type => DetectChar
	if ($self->testDetectChar($text, '$', 0, 0, 0, undef, 0, '#pop#pop', 'Directive')) {
		return 1
	}
	return 0;
};

sub parseNormalCBloc {
	my ($self, $text) = @_;
	# type => DetectChar
	if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'Normal C Bloc', 'Normal Text')) {
		return 1
	}
	# type => DetectChar
	if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
		return 1
	}
	# type => IncludeRules
	if ($self->includePlugin('C++', $text)) {
		return 1
	}
	# type => DetectChar
	if ($self->testDetectChar($text, '$', 0, 0, 0, undef, 0, 'Dol', 'Directive')) {
		return 1
	}
	return 0;
};

sub parsePCtype {
	my ($self, $text) = @_;
	# type => DetectChar
	if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop', 'Data Type')) {
		return 1
	}
	return 0;
};

sub parsePercentCommand {
	my ($self, $text) = @_;
	# type => IncludeRules
	if ($self->includeRules('Comment', $text)) {
		return 1
	}
	# type => RegExpr
	if ($self->testRegExpr($text, '\\W', 0, 0, 1, undef, 0, 'Percent Command In', 'Normal Text')) {
		return 1
	}
	return 0;
};

sub parsePercentCommandIn {
	my ($self, $text) = @_;
	# type => IncludeRules
	if ($self->includeRules('StringOrChar', $text)) {
		return 1
	}
	# type => DetectChar
	if ($self->testDetectChar($text, '<', 0, 0, 0, undef, 0, 'PC type', 'Data Type')) {
		return 1
	}
	return 0;
};

sub parsePreStart {
	my ($self, $text) = @_;
	# type => IncludeRules
	if ($self->includeRules('Comment', $text)) {
		return 1
	}
	# type => DetectSpaces
	if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
		return 1
	}
	# type => Detect2Chars
	if ($self->testDetect2Chars($text, '%', '{', 0, 0, 0, 0, 0, 'C Declarations', 'Content-Type Delimiter')) {
		return 1
	}
	# type => RegExpr
	if ($self->testRegExpr($text, '.', 0, 0, 1, undef, 0, 'Declarations', 'Normal Text')) {
		return 1
	}
	return 0;
};

sub parseRuleIn {
	my ($self, $text) = @_;
	# type => IncludeRules
	if ($self->includeRules('Comment', $text)) {
		return 1
	}
	# type => DetectChar
	if ($self->testDetectChar($text, ';', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
		return 1
	}
	# type => DetectChar
	if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'Normal C Bloc', 'Normal Text')) {
		return 1
	}
	# type => DetectChar
	if ($self->testDetectChar($text, '|', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
		return 1
	}
	# type => IncludeRules
	if ($self->includeRules('StringOrChar', $text)) {
		return 1
	}
	return 0;
};

sub parseRules {
	my ($self, $text) = @_;
	# type => IncludeRules
	if ($self->includeRules('Comment', $text)) {
		return 1
	}
	# type => Detect2Chars
	if ($self->testDetect2Chars($text, '%', '%', 0, 0, 0, undef, 0, 'User Code', 'Content-Type Delimiter')) {
		return 1
	}
	# type => DetectChar
	if ($self->testDetectChar($text, ':', 0, 0, 0, undef, 0, 'Rule In', 'Normal Text')) {
		return 1
	}
	return 0;
};

sub parseString {
	my ($self, $text) = @_;
	# type => RegExpr
	if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Backslash Code')) {
		return 1
	}
	# type => DetectChar
	if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
		return 1
	}
	return 0;
};

sub parseStringOrChar {
	my ($self, $text) = @_;
	# type => DetectChar
	if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'Char', 'String Char')) {
		return 1
	}
	# type => DetectChar
	if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
		return 1
	}
	return 0;
};

sub parseUnionIn {
	my ($self, $text) = @_;
	# type => DetectChar
	if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'Union InIn', 'Normal Text')) {
		return 1
	}
	# type => DetectChar
	if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop#pop', 'Normal Text')) {
		return 1
	}
	# type => IncludeRules
	if ($self->includePlugin('C++', $text)) {
		return 1
	}
	return 0;
};

sub parseUnionInIn {
	my ($self, $text) = @_;
	# type => DetectChar
	if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'Union InIn', 'Normal Text')) {
		return 1
	}
	# type => DetectChar
	if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
		return 1
	}
	# type => IncludeRules
	if ($self->includePlugin('C++', $text)) {
		return 1
	}
	return 0;
};

sub parseUnionStart {
	my ($self, $text) = @_;
	# type => IncludeRules
	if ($self->includeRules('Comment', $text)) {
		return 1
	}
	# type => DetectSpaces
	if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) {
		return 1
	}
	# type => DetectChar
	if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'Union In', 'Normal Text')) {
		return 1
	}
	# type => RegExpr
	if ($self->testRegExpr($text, '.', 0, 0, 0, undef, 0, '#pop', 'Alert')) {
		return 1
	}
	return 0;
};

sub parseUserCode {
	my ($self, $text) = @_;
	# type => IncludeRules
	if ($self->includePlugin('C++', $text)) {
		return 1
	}
	return 0;
};


1;

__END__

=head1 NAME

Syntax::Highlight::Engine::Kate::Yacc_Bison - a Plugin for Yacc/Bison syntax highlighting

=head1 SYNOPSIS

 require Syntax::Highlight::Engine::Kate::Yacc_Bison;
 my $sh = new Syntax::Highlight::Engine::Kate::Yacc_Bison([
 ]);

=head1 DESCRIPTION

Syntax::Highlight::Engine::Kate::Yacc_Bison is a  plugin module that provides syntax highlighting
for Yacc/Bison to the Syntax::Haghlight::Engine::Kate highlighting engine.

This code is generated from the syntax definition files used
by the Kate project.
It works quite fine, but can use refinement and optimization.

It inherits Syntax::Higlight::Engine::Kate::Template. See also there.

=cut

=head1 AUTHOR

Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)

=cut

=head1 BUGS

Unknown. If you find any, please contact the author

=cut