Parse::LexEvent man page on Fedora

Man page or keyword search:  
man Server   31170 pages
apropos Keyword Search (all sections)
Output format
Fedora logo
[printable version]

Parse::LexEvent(3)    User Contributed Perl Documentation   Parse::LexEvent(3)

NAME
       "Parse::LexEvent" - Generator of event-oriented lexical analyzers (1.00
       ALPHA)

SYNOPSIS
	 use Parse::LexEvent;

	 sub string {
	   print $_[0]->name, ": $_[1]\n";
	 }
	 sub comment {
	   print $_[0]->name, ": $_[1]\n";
	 }
	 sub remainder {
	   print $_[0]->name, ": $_[1]\n";
	 }

	 $lexer = Parse::LexEvent->new()->configure(
	      From => \*DATA,
	      Tokens =>
		[
		 Type => 'Simple', Name => 'ccomment', Handler => 'comment',
		      Regex => '//.*\n',
		 Type => 'Delimited', Name => 'comment', Handler => 'comment',
		      Start => '/[*]', End => '[*]/',
		 Type => 'Quoted', Name => 'squotes', Handler => 'string', Quote => qq!\'!,
		 Type => 'Quoted', Name => 'dquotes', Handler => 'string', Quote => qq!\"!,
		 Type => 'Simple', Name => 'remainder',
		      Regex => '(?s:[^/\'\"]+)', ReadMore => 1,
		]
	     )->parse();
	 __END__
	 /*
	   C comment
	 */
	 // C++ comment
	 var d = "string in double quotes";
	 var s = 'string in single quotes';
	 var i = 10;
	 var y = 100;

DESCRIPTION
       "Parse::LexEvent" generates lexical analyzers in the fashion of
       "Parse::Lex", but the generated analyzers emit an event at the finish
       of recognition of each token.  This event corresponds to the call of a
       procedure whose name is that of the token.  It is possible to give a
       different name to this procedure by making use of the "Handler"
       parameter when defining a token.

       An application using "Parse::LexEvent" must define the required
       procedures.  These procedures take the token object as first argument
       and the recognized character string as the second.

       "Parse::LexEvent" inherits from "Parse::ALex" and possesses all the
       methods described in the documentation of the "Parse::Lex" class,
       except for the methods "analyze()", "every()" "next()", and "nextis()".

   Methods
       parse()
	   This method runs the analysis of data specified by "from()".

EXAMPLES
       cparser.pl - This analyzer recognizes three types of structures: C ou
       C++ comments, strings within quotation marks, and the rest.  It emits
       an event specific to each.  You can use it, for example, to analyze C,
       C++ or Javascript programs.

SEE ALSO
       "Parse::Lex", "Parse::Token".

AUTHOR
       Philippe Verdret.

COPYRIGHT
       Copyright (c) 1999 Philippe Verdret. All rights reserved.  This module
       is free software; you can redistribute it and/or modify it under the
       same terms as Perl itself.

perl v5.14.0			  2010-03-26		    Parse::LexEvent(3)
[top]

List of man pages available for Fedora

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net