parse
Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 1258
Parse::RPN 2.34
Parse::RPN is a minimalist RPN parser/processor (a little like FORTH). more>>
Parse::RPN is a minimalist RPN parser/processor (a little like FORTH).
SYNOPSIS
use Parse::RPN;
$result=rpn(string ...);
@results=rpn(string ...);
$error=rpn_error();
string... is a list of RPN operator and value separated by a coma in scalar mode RPN return the result of the calculation (If the stack contain more then one element, you receive a warning and the top value on the stack) in array mode, you receive the content of the stack after evaluation
rpn() receive in entry a scalar of one or more elements coma separated and evaluate as an RPN (Reverse Polish Notation) command. The function split all elements and put in the stack. The operator are case sensitive. The operator are detect as is, if they are alone in the element of the stack. Extra space before or after are allowed (e.g "3,4,ADD" here ADD is an opeartor but it is not the case in "3,4,ADD 1") If element is not part of the predefined operator (dictionary), the element is push as a litteral.
If you would like to put a string which is part of the dictionary, put it between quote or double-quote (e.g "3,4,ADD" here ADD is a literal and the evaluation reurn ADD and a warning because the stack is not empty) If the string contain a coma, you need also to quote or double-quote the string. (be care to close your quoted or double-quoted string)
The evaluation follow the rule of RPN or FORTH or POSTCRIPT or pockect calcutor HP. Look on web for documentation about the use of RPN notation.
I use this module in a application where the final user need to create an maintain a configuration file with the possibility to do calculation on variable returned from application.
The idea of this module is comming from Math::RPN of Owen DeLong, owen@delong.com that I used for more then a year before some of my customer would like more ... I correct a bug (interversion of > and >=), add the STRING function, pattern search and some STACK functions.
rpn_error() return the last error from the evaluation (illegal division by 0, error from the PERL function execution...) each time that rpn() is call the rpn_error() is reinitianised.
<<lessSYNOPSIS
use Parse::RPN;
$result=rpn(string ...);
@results=rpn(string ...);
$error=rpn_error();
string... is a list of RPN operator and value separated by a coma in scalar mode RPN return the result of the calculation (If the stack contain more then one element, you receive a warning and the top value on the stack) in array mode, you receive the content of the stack after evaluation
rpn() receive in entry a scalar of one or more elements coma separated and evaluate as an RPN (Reverse Polish Notation) command. The function split all elements and put in the stack. The operator are case sensitive. The operator are detect as is, if they are alone in the element of the stack. Extra space before or after are allowed (e.g "3,4,ADD" here ADD is an opeartor but it is not the case in "3,4,ADD 1") If element is not part of the predefined operator (dictionary), the element is push as a litteral.
If you would like to put a string which is part of the dictionary, put it between quote or double-quote (e.g "3,4,ADD" here ADD is a literal and the evaluation reurn ADD and a warning because the stack is not empty) If the string contain a coma, you need also to quote or double-quote the string. (be care to close your quoted or double-quoted string)
The evaluation follow the rule of RPN or FORTH or POSTCRIPT or pockect calcutor HP. Look on web for documentation about the use of RPN notation.
I use this module in a application where the final user need to create an maintain a configuration file with the possibility to do calculation on variable returned from application.
The idea of this module is comming from Math::RPN of Owen DeLong, owen@delong.com that I used for more then a year before some of my customer would like more ... I correct a bug (interversion of > and >=), add the STRING function, pattern search and some STACK functions.
rpn_error() return the last error from the evaluation (illegal division by 0, error from the PERL function execution...) each time that rpn() is call the rpn_error() is reinitianised.
Download (0.025MB)
Added: 2007-06-27 License: Perl Artistic License Price:
851 downloads
Kismet Parse 0.2
Kismet Parse project can be used after kismet has sniffed 802.11 traffic and produced .network files. more>>
Kismet Parse project can be used after kismet has sniffed 802.11 traffic and produced .network files.
Kismet Parse is a Perl script that will parse these files to map the MAC addresses of the discovered wireless access point and clients to useful information. The information includes the hardware manufacturer of the device.
<<lessKismet Parse is a Perl script that will parse these files to map the MAC addresses of the discovered wireless access point and clients to useful information. The information includes the hardware manufacturer of the device.
Download (0.007MB)
Added: 2007-08-22 License: GPL (GNU General Public License) Price:
568 downloads
MRTG::Parse 0.03
MRTG::Parse is a Perl extension for parsing and utilizing the logfiles generated by the famous MRTG Tool. more>>
MRTG::Parse is a Perl extension for parsing and utilizing the logfiles generated by the famous MRTG Tool.
SYNOPSIS
use strict;
use MRTG::Parse;
my $mrtg_logfile = "/var/www/htdocs/mrtg/eth0.log";
my $period = "day";
my $desired_unit = "GB";
my ($traffic_incoming, $traffic_outgoing, $traffic_sum) = mrtg_parse($mrtg_logfile, $period, $desired_unit);
print "Incoming Traffic: $traffic_incomingn";
print "Outgoing Traffic: $traffic_outgoingn";
print "= Sum $traffic_sumn";
This perl extension enables its users to parse and utilize the logfiles that are generated by the famous MRTG (Multi Router Traffic Grapher) tool.
mrtg_parse() takes three argument:
1st: filename of the mrtg logfile
2nd: time period to genereate the output for
valid values are:
- individual time periods like: 20040821-20050130 (ISO 8601)
- static values: day, month, year
3rd: the desired unit (optional)
valid values are:
- B, KB, MB, GB, TB
- if missing mrtg_parse will chose an adequate one for you
mrtg_parse() returns three values:
1st: Incoming traffic
2nd: Outgoing traffic
3rd: Sum of incoming and outgoing
<<lessSYNOPSIS
use strict;
use MRTG::Parse;
my $mrtg_logfile = "/var/www/htdocs/mrtg/eth0.log";
my $period = "day";
my $desired_unit = "GB";
my ($traffic_incoming, $traffic_outgoing, $traffic_sum) = mrtg_parse($mrtg_logfile, $period, $desired_unit);
print "Incoming Traffic: $traffic_incomingn";
print "Outgoing Traffic: $traffic_outgoingn";
print "= Sum $traffic_sumn";
This perl extension enables its users to parse and utilize the logfiles that are generated by the famous MRTG (Multi Router Traffic Grapher) tool.
mrtg_parse() takes three argument:
1st: filename of the mrtg logfile
2nd: time period to genereate the output for
valid values are:
- individual time periods like: 20040821-20050130 (ISO 8601)
- static values: day, month, year
3rd: the desired unit (optional)
valid values are:
- B, KB, MB, GB, TB
- if missing mrtg_parse will chose an adequate one for you
mrtg_parse() returns three values:
1st: Incoming traffic
2nd: Outgoing traffic
3rd: Sum of incoming and outgoing
Download (0.005MB)
Added: 2007-04-03 License: Perl Artistic License Price:
938 downloads
Parse::Java 0.01
Parse::Java is a Perl module that acts like a parser for Java code. more>>
Parse::Java is a Perl module that acts like a parser for Java code.
SYNOPSIS
use Parse::Java;
my $ast = Parse::Java->parse_file(MyClass.java);
Parse::Java parses Java code into an Abstract Syntax Tree which can be used for many things like writing compilers and stuff.
As this module is currently under development it isnt yet able to parse much Java. Whats in the t/*.t basically works but not much else.
The lexer should also more or less work fine except expansion of unicode escapes uNNNN.
INTERFACE
This module uses an object-oriented interface.
CLASS METHODS
parse_file ( $path )
Parses the contents of the file $path. Returns an AST representing the code.
parse_string
Parses the source in $string. Returns an AST representing the code.
detokenize ( $ast )
Walks the AST and replaces all Parse::Java::Token-objects with their stringified value.
INSTANCE METHODS
_set_input ( $source )
Sets the input to the lexer.
_next_token
Returns a list with the next token from the stream and its value.
<<lessSYNOPSIS
use Parse::Java;
my $ast = Parse::Java->parse_file(MyClass.java);
Parse::Java parses Java code into an Abstract Syntax Tree which can be used for many things like writing compilers and stuff.
As this module is currently under development it isnt yet able to parse much Java. Whats in the t/*.t basically works but not much else.
The lexer should also more or less work fine except expansion of unicode escapes uNNNN.
INTERFACE
This module uses an object-oriented interface.
CLASS METHODS
parse_file ( $path )
Parses the contents of the file $path. Returns an AST representing the code.
parse_string
Parses the source in $string. Returns an AST representing the code.
detokenize ( $ast )
Walks the AST and replaces all Parse::Java::Token-objects with their stringified value.
INSTANCE METHODS
_set_input ( $source )
Sets the input to the lexer.
_next_token
Returns a list with the next token from the stream and its value.
Download (0.018MB)
Added: 2007-01-16 License: Perl Artistic License Price:
1012 downloads
Test-Parser 1.2
Test::Parser is a collection of parsers for different test output file formats. more>>
Test::Parser is a collection of parsers for different test output file formats. These parse the data into a general purpose data structure that can then be used to create reports, do post-processing analysis, etc.
Test-Parser can also export tests in SpikeSources TRPI test description XML language.
<<lessTest-Parser can also export tests in SpikeSources TRPI test description XML language.
Download (0.053MB)
Added: 2006-05-04 License: GPL (GNU General Public License) Price:
1268 downloads
XML::Parser 2.34
XML::Parser is a perl module for parsing XML documents. more>>
XML::Parser is a perl module for parsing XML documents.
SYNOPSIS
use XML::Parser;
$p1 = new XML::Parser(Style => Debug);
$p1->parsefile(REC-xml-19980210.xml);
$p1->parse( Hello World );
# Alternative
$p2 = new XML::Parser(Handlers => {Start => &handle_start,
End => &handle_end,
Char => &handle_char});
$p2->parse($socket);
# Another alternative
$p3 = new XML::Parser(ErrorContext => 2);
$p3->setHandlers(Char => &text,
Default => &other);
open(FOO, xmlgenerator |);
$p3->parse(*FOO, ProtocolEncoding => ISO-8859-1);
close(FOO);
$p3->parsefile(junk.xml, ErrorContext => 3);
This module provides ways to parse XML documents. It is built on top of XML::Parser::Expat, which is a lower level interface to James Clarks expat library. Each call to one of the parsing methods creates a new instance of XML::Parser::Expat which is then used to parse the document.
Expat options may be provided when the XML::Parser object is created. These options are then passed on to the Expat object on each parse call. They can also be given as extra arguments to the parse methods, in which case they override options given at XML::Parser creation time.
The behavior of the parser is controlled either by "Style" and/or "Handlers" options, or by "setHandlers" method. These all provide mechanisms for XML::Parser to set the handlers needed by XML::Parser::Expat. If neither Style nor Handlers are specified, then parsing just checks the document for being well-formed.
When underlying handlers get called, they receive as their first parameter the Expat object, not the Parser object.
<<lessSYNOPSIS
use XML::Parser;
$p1 = new XML::Parser(Style => Debug);
$p1->parsefile(REC-xml-19980210.xml);
$p1->parse( Hello World );
# Alternative
$p2 = new XML::Parser(Handlers => {Start => &handle_start,
End => &handle_end,
Char => &handle_char});
$p2->parse($socket);
# Another alternative
$p3 = new XML::Parser(ErrorContext => 2);
$p3->setHandlers(Char => &text,
Default => &other);
open(FOO, xmlgenerator |);
$p3->parse(*FOO, ProtocolEncoding => ISO-8859-1);
close(FOO);
$p3->parsefile(junk.xml, ErrorContext => 3);
This module provides ways to parse XML documents. It is built on top of XML::Parser::Expat, which is a lower level interface to James Clarks expat library. Each call to one of the parsing methods creates a new instance of XML::Parser::Expat which is then used to parse the document.
Expat options may be provided when the XML::Parser object is created. These options are then passed on to the Expat object on each parse call. They can also be given as extra arguments to the parse methods, in which case they override options given at XML::Parser creation time.
The behavior of the parser is controlled either by "Style" and/or "Handlers" options, or by "setHandlers" method. These all provide mechanisms for XML::Parser to set the handlers needed by XML::Parser::Expat. If neither Style nor Handlers are specified, then parsing just checks the document for being well-formed.
When underlying handlers get called, they receive as their first parameter the Expat object, not the Parser object.
Download (0.22MB)
Added: 2006-06-14 License: Perl Artistic License Price:
1235 downloads
Parse::Nibbler 1.10
Parse::Nibbler is Perl module to parse huge files using grammars written in pure perl. more>>
Parse::Nibbler is Perl module to parse huge files using grammars written in pure perl.
Create a parser object using the ->new method. This method is provided by the Parse::Nibbler module and should not be overridden.
The main functionality of the Parse::Nibbler module is the Register subroutine. This subroutine is used to define the rules of your grammar. The Register subroutine takes two parameters: A string and a code reference.
The string is the name of the rule (i.e. the name of the subroutine/method)
The code reference is a reference to the code to execute for this rule.
The Register subroutine will take the code reference, wrap it up in another subroutine that acts as a closure, and then installs that code reference as a subroutine with the name matching the given string.
The wrapper code (the closure) is the same for every rule. The wrapper code handles quantifiers, calls the rule, and decides what to do based on the rule passing or failing.
A rule is a code reference with a given string name that have been passed to Register. Here is an example of a rule:
Register ( Name, sub { my $p = shift; $p->AlternateValues( Jim, Scotty, Spock );
}
);
The parser object will always be passed in as the first parameter to your rule. You must pass this into any further rules or any Parse::Nibbler methods.
In the above example, the rule, "Name" is Registered. "Name" calls one of the builtin methods, AlternateValues, defined below. Once a rule is Registered, other rules can call it:
Register ( MedicalDiagnosis, sub { my $p = shift; $p->AlternateValues("Hes", "Shes"); $p->ValueIs("dead"); $p->ValueIs(","); $p->Name; $p->ValueIs("!"); } );
This code registers a rule called "MedicalDiagnosis". It uses some builtin methods, but it also calls the rule just registered, "Name".
Once a user defines a rule, they can use it in other rules by simply calling it as they would call a method.
Rules registered with the Parse::Nibbler module can be called with quantifiers. Quantifiers are passed into the Rule when you call it in your grammar by passing in a string that matches the format described here.
Quantifiers allow you to specify the quantity of rules present. Quantifiers also allow you to specify whether multiple rules have separators.
Quantifiers are specified using the following string format:
{quantifier}
This indicates that there are zero or one Name rules expected: $p->Name({?});
This indicates that there are zero or more Name rules expected: $p->Name({*});
This indicates that there are one or more Name rules expected: $p->Name({+});
This indicates that there are exactly three Name rules expected: $p->Name({3});
This indicates there are 1 to 3 Name rules expected: $p->Name({1:3});
This indicates there are at least 2 Name rules expected: $p->Name({2:);
Separators are specified using the following string format:
/separator/
This indicates 1 or more Name rules, each separated by a comma:
$p->Name({1:}/,/);
It is the job of the Register function to make sure this additional functionality is provided transparently and automagically to you.
If you call a rule with no quantifier and no separator, the rule will assume the quantifier is 1 and there is no separator.
Additional Parse::Nibbler methods are provided to simplify rule definition and to provide smart, automatic error handling, etc. You grammars should only call other rules that you defined, or these methods explained below.
(Note: these methods do not take quantifiers)
############### Method: ValueIs ###############
Parameters: One parameter, required. A string containing the expected value.
Example: $p->ValueIs( stringvalue );
Description:
This method will look at the next lexical and determine if its value matches that of the stringvalue given as a parameter. If it does not match, an exception is raised and the rule fails.
If the values do match, then the parser stores the lexical, and the rule continues.
####################### Method: AlternateValues #######################
Parameters: A list of string parameters, at least two values.
Example: $p-AlternateValues( value1, value2 );
Description:
This method behaves like the ValueIs method, except that it will recieve a list of allowed alternate expected values. The first match that succeeds causes the rule to pass and return.
If no match occurs, then an exception is raised and the rule aborts.
If a match does occur, the parser stores the lexical, and the rule continues.
############## Method: TypeIs ##############
Parameters: One parameter, required. A string containing the expected type.
Description:
This method will look at the next lexical item, and determine if the lexical type matches the type given as a parameter.
Valid type values depend on the Lexer that you use, but possible values may include "Identifier" and "Number", etc.
Use this in a case where your rule requires an identifier type, for example, but it does not care what the name of the identifier is for the rule.
If a match occurs, the parser stores the lexical and the rule continues.
If a match does not occur, an exception is raised, and the rule aborts.
###################### Method: AlternateRules ######################
Parameters: A list of string parameters, at least two.
Example: $p->AlternateRules( Rule1, Rule2 );
Description:
You can describe rule alternation in your rule by calling this method. The method takes a list of strings whose string values match the names of the valid alternate rule names.
In the above example, the McCoy rule is either a declaration of profession or a medical diagnosis. These are two rules that are defined in the same package. The AlternateRules method allows you to define multiple rules that may be valid at the same point in the text.
If a rule in the parameter list succeeds, the AlternateRule method succeeds, and returns immediately.
If no rule succeeds, an exception is thrown, and the rule aborts.
This rule expects either a "DeclareProfession" rule or a "MedicalDiagnosis" rule to be present.
Register ( McCoy, sub { my $p = shift; $p->AlternateRules( DeclareProfession, MedicalDiagnosis ); } );
You can specify quantifiers as part of the alternate rule strings.
$p->AlternateRules( DeclareProfession({+}), MedicalDiagnosis );
The above example indicates that you can have one or more DeclareProfession rules OR ALTERNATELY you can have exactly one MedicalDiagnosis rule.
EXPORT
Register, used to register the rules in your grammar.
<<lessCreate a parser object using the ->new method. This method is provided by the Parse::Nibbler module and should not be overridden.
The main functionality of the Parse::Nibbler module is the Register subroutine. This subroutine is used to define the rules of your grammar. The Register subroutine takes two parameters: A string and a code reference.
The string is the name of the rule (i.e. the name of the subroutine/method)
The code reference is a reference to the code to execute for this rule.
The Register subroutine will take the code reference, wrap it up in another subroutine that acts as a closure, and then installs that code reference as a subroutine with the name matching the given string.
The wrapper code (the closure) is the same for every rule. The wrapper code handles quantifiers, calls the rule, and decides what to do based on the rule passing or failing.
A rule is a code reference with a given string name that have been passed to Register. Here is an example of a rule:
Register ( Name, sub { my $p = shift; $p->AlternateValues( Jim, Scotty, Spock );
}
);
The parser object will always be passed in as the first parameter to your rule. You must pass this into any further rules or any Parse::Nibbler methods.
In the above example, the rule, "Name" is Registered. "Name" calls one of the builtin methods, AlternateValues, defined below. Once a rule is Registered, other rules can call it:
Register ( MedicalDiagnosis, sub { my $p = shift; $p->AlternateValues("Hes", "Shes"); $p->ValueIs("dead"); $p->ValueIs(","); $p->Name; $p->ValueIs("!"); } );
This code registers a rule called "MedicalDiagnosis". It uses some builtin methods, but it also calls the rule just registered, "Name".
Once a user defines a rule, they can use it in other rules by simply calling it as they would call a method.
Rules registered with the Parse::Nibbler module can be called with quantifiers. Quantifiers are passed into the Rule when you call it in your grammar by passing in a string that matches the format described here.
Quantifiers allow you to specify the quantity of rules present. Quantifiers also allow you to specify whether multiple rules have separators.
Quantifiers are specified using the following string format:
{quantifier}
This indicates that there are zero or one Name rules expected: $p->Name({?});
This indicates that there are zero or more Name rules expected: $p->Name({*});
This indicates that there are one or more Name rules expected: $p->Name({+});
This indicates that there are exactly three Name rules expected: $p->Name({3});
This indicates there are 1 to 3 Name rules expected: $p->Name({1:3});
This indicates there are at least 2 Name rules expected: $p->Name({2:);
Separators are specified using the following string format:
/separator/
This indicates 1 or more Name rules, each separated by a comma:
$p->Name({1:}/,/);
It is the job of the Register function to make sure this additional functionality is provided transparently and automagically to you.
If you call a rule with no quantifier and no separator, the rule will assume the quantifier is 1 and there is no separator.
Additional Parse::Nibbler methods are provided to simplify rule definition and to provide smart, automatic error handling, etc. You grammars should only call other rules that you defined, or these methods explained below.
(Note: these methods do not take quantifiers)
############### Method: ValueIs ###############
Parameters: One parameter, required. A string containing the expected value.
Example: $p->ValueIs( stringvalue );
Description:
This method will look at the next lexical and determine if its value matches that of the stringvalue given as a parameter. If it does not match, an exception is raised and the rule fails.
If the values do match, then the parser stores the lexical, and the rule continues.
####################### Method: AlternateValues #######################
Parameters: A list of string parameters, at least two values.
Example: $p-AlternateValues( value1, value2 );
Description:
This method behaves like the ValueIs method, except that it will recieve a list of allowed alternate expected values. The first match that succeeds causes the rule to pass and return.
If no match occurs, then an exception is raised and the rule aborts.
If a match does occur, the parser stores the lexical, and the rule continues.
############## Method: TypeIs ##############
Parameters: One parameter, required. A string containing the expected type.
Description:
This method will look at the next lexical item, and determine if the lexical type matches the type given as a parameter.
Valid type values depend on the Lexer that you use, but possible values may include "Identifier" and "Number", etc.
Use this in a case where your rule requires an identifier type, for example, but it does not care what the name of the identifier is for the rule.
If a match occurs, the parser stores the lexical and the rule continues.
If a match does not occur, an exception is raised, and the rule aborts.
###################### Method: AlternateRules ######################
Parameters: A list of string parameters, at least two.
Example: $p->AlternateRules( Rule1, Rule2 );
Description:
You can describe rule alternation in your rule by calling this method. The method takes a list of strings whose string values match the names of the valid alternate rule names.
In the above example, the McCoy rule is either a declaration of profession or a medical diagnosis. These are two rules that are defined in the same package. The AlternateRules method allows you to define multiple rules that may be valid at the same point in the text.
If a rule in the parameter list succeeds, the AlternateRule method succeeds, and returns immediately.
If no rule succeeds, an exception is thrown, and the rule aborts.
This rule expects either a "DeclareProfession" rule or a "MedicalDiagnosis" rule to be present.
Register ( McCoy, sub { my $p = shift; $p->AlternateRules( DeclareProfession, MedicalDiagnosis ); } );
You can specify quantifiers as part of the alternate rule strings.
$p->AlternateRules( DeclareProfession({+}), MedicalDiagnosis );
The above example indicates that you can have one or more DeclareProfession rules OR ALTERNATELY you can have exactly one MedicalDiagnosis rule.
EXPORT
Register, used to register the rules in your grammar.
Download (0.033MB)
Added: 2007-02-22 License: Perl Artistic License Price:
974 downloads
Parse::Eyapp 1.069577
Parse::Eyapp module contains extensions for Parse::Yapp. more>>
Parse::Eyapp module contains extensions for Parse::Yapp.
SYNOPSIS
use strict;
use Parse::Eyapp;
use Parse::Eyapp::Treeregexp;
sub TERMINAL::info {
$_[0]{attr}
}
my $grammar = q{
%right = # Lowest precedence
%left - + # + and - have more precedence than = Disambiguate a-b-c as (a-b)-c
%left * / # * and / have more precedence than + Disambiguate a/b/c as (a/b)/c
%left NEG # Disambiguate -a-b as (-a)-b and not as -(a-b)
%tree # Let us build an abstract syntax tree ...
%%
line: exp { $_[1] } /* list of expressions separated by ; */
;
/* The %name directive defines the name of the class to which the node being built belongs */
exp:
%name NUM NUM | %name VAR VAR | %name ASSIGN VAR = exp
| %name PLUS exp + exp | %name MINUS exp - exp | %name TIMES exp * exp
| %name DIV exp / exp | %name UMINUS - exp %prec NEG
| ( exp ) { $_[2] } /* Let us simplify a bit the tree */
;
%%
sub _Error { die "Syntax error near ".($_[0]->YYCurval?$_[0]->YYCurval:"end of file")."n" }
sub _Lexer {
my($parser)=shift; # The parser object
for ($parser->YYData->{INPUT}) { # Topicalize
m{Gs+}gc;
$_ eq and return(,undef);
m{G([0-9]+(?:.[0-9]+)?)}gc and return(NUM,$1);
m{G([A-Za-z][A-Za-z0-9_]*)}gc and return(VAR,$1);
m{G(.)}gcs and return($1,$1);
}
}
sub Run {
my($self)=shift;
$self->YYParse( yylex => &_Lexer, yyerror => &_Error, );
}
}; # end grammar
our (@all, $uminus);
Parse::Eyapp->new_grammar( # Create the parser package/class
input=>$grammar,
classname=>Calc, # The name of the package containing the parser
firstline=>7 # String $grammar starts at line 7 (for error diagnostics)
);
my $parser = Calc->new(); # Create a parser
$parser->YYData->{INPUT} = "2*-3+b*0;--2n"; # Set the input
my $t = $parser->Run; # Parse it!
local $Parse::Eyapp::Node::INDENT=2;
print "Syntax Tree:",$t->str;
# Let us transform the tree. Define the tree-regular expressions ..
my $p = Parse::Eyapp::Treeregexp->new( STRING => q{
{ # Example of support code
my %Op = (PLUS=>+, MINUS => -, TIMES=>*, DIV => /);
}
constantfold: /TIMES|PLUS|DIV|MINUS/:bin(NUM($x), NUM($y))
=> {
my $op = $Op{ref($bin)};
$x->{attr} = eval "$x->{attr} $op $y->{attr}";
$_[0] = $NUM[0];
}
uminus: UMINUS(NUM($x)) => { $x->{attr} = -$x->{attr}; $_[0] = $NUM }
zero_times_whatever: TIMES(NUM($x), .) and { $x->{attr} == 0 } => { $_[0] = $NUM }
whatever_times_zero: TIMES(., NUM($x)) and { $x->{attr} == 0 } => { $_[0] = $NUM }
},
OUTPUTFILE=> main.pm
);
$p->generate(); # Create the tranformations
$t->s($uminus); # Transform UMINUS nodes
$t->s(@all); # constant folding and mult. by zero
local $Parse::Eyapp::Node::INDENT=0;
print "nSyntax Tree after transformations:n",$t->str,"n";
<<lessSYNOPSIS
use strict;
use Parse::Eyapp;
use Parse::Eyapp::Treeregexp;
sub TERMINAL::info {
$_[0]{attr}
}
my $grammar = q{
%right = # Lowest precedence
%left - + # + and - have more precedence than = Disambiguate a-b-c as (a-b)-c
%left * / # * and / have more precedence than + Disambiguate a/b/c as (a/b)/c
%left NEG # Disambiguate -a-b as (-a)-b and not as -(a-b)
%tree # Let us build an abstract syntax tree ...
%%
line: exp { $_[1] } /* list of expressions separated by ; */
;
/* The %name directive defines the name of the class to which the node being built belongs */
exp:
%name NUM NUM | %name VAR VAR | %name ASSIGN VAR = exp
| %name PLUS exp + exp | %name MINUS exp - exp | %name TIMES exp * exp
| %name DIV exp / exp | %name UMINUS - exp %prec NEG
| ( exp ) { $_[2] } /* Let us simplify a bit the tree */
;
%%
sub _Error { die "Syntax error near ".($_[0]->YYCurval?$_[0]->YYCurval:"end of file")."n" }
sub _Lexer {
my($parser)=shift; # The parser object
for ($parser->YYData->{INPUT}) { # Topicalize
m{Gs+}gc;
$_ eq and return(,undef);
m{G([0-9]+(?:.[0-9]+)?)}gc and return(NUM,$1);
m{G([A-Za-z][A-Za-z0-9_]*)}gc and return(VAR,$1);
m{G(.)}gcs and return($1,$1);
}
}
sub Run {
my($self)=shift;
$self->YYParse( yylex => &_Lexer, yyerror => &_Error, );
}
}; # end grammar
our (@all, $uminus);
Parse::Eyapp->new_grammar( # Create the parser package/class
input=>$grammar,
classname=>Calc, # The name of the package containing the parser
firstline=>7 # String $grammar starts at line 7 (for error diagnostics)
);
my $parser = Calc->new(); # Create a parser
$parser->YYData->{INPUT} = "2*-3+b*0;--2n"; # Set the input
my $t = $parser->Run; # Parse it!
local $Parse::Eyapp::Node::INDENT=2;
print "Syntax Tree:",$t->str;
# Let us transform the tree. Define the tree-regular expressions ..
my $p = Parse::Eyapp::Treeregexp->new( STRING => q{
{ # Example of support code
my %Op = (PLUS=>+, MINUS => -, TIMES=>*, DIV => /);
}
constantfold: /TIMES|PLUS|DIV|MINUS/:bin(NUM($x), NUM($y))
=> {
my $op = $Op{ref($bin)};
$x->{attr} = eval "$x->{attr} $op $y->{attr}";
$_[0] = $NUM[0];
}
uminus: UMINUS(NUM($x)) => { $x->{attr} = -$x->{attr}; $_[0] = $NUM }
zero_times_whatever: TIMES(NUM($x), .) and { $x->{attr} == 0 } => { $_[0] = $NUM }
whatever_times_zero: TIMES(., NUM($x)) and { $x->{attr} == 0 } => { $_[0] = $NUM }
},
OUTPUTFILE=> main.pm
);
$p->generate(); # Create the tranformations
$t->s($uminus); # Transform UMINUS nodes
$t->s(@all); # constant folding and mult. by zero
local $Parse::Eyapp::Node::INDENT=0;
print "nSyntax Tree after transformations:n",$t->str,"n";
Download (0.36MB)
Added: 2007-06-27 License: Perl Artistic License Price:
849 downloads
Parse::RecDescent 1.94
Parse::RecDescent is a Perl module to generate Recursive-Descent Parsers. more>>
Parse::RecDescent is a Perl module to generate Recursive-Descent Parsers.
SYNOPSIS
use Parse::RecDescent;
# Generate a parser from the specification in $grammar:
$parser = new Parse::RecDescent ($grammar);
# Generate a parser from the specification in $othergrammar
$anotherparser = new Parse::RecDescent ($othergrammar);
# Parse $text using rule startrule (which must be
# defined in $grammar):
$parser->startrule($text);
# Parse $text using rule otherrule (which must also
# be defined in $grammar):
$parser->otherrule($text);
# Change the universal token prefix pattern
# (the default is: s*):
$Parse::RecDescent::skip = [ t]+;
# Replace productions of existing rules (or create new ones)
# with the productions defined in $newgrammar:
$parser->Replace($newgrammar);
# Extend existing rules (or create new ones)
# by adding extra productions defined in $moregrammar:
$parser->Extend($moregrammar);
# Global flags (useful as command line arguments under -s):
$::RD_ERRORS # unless undefined, report fatal errors
$::RD_WARN # unless undefined, also report non-fatal problems
$::RD_HINT # if defined, also suggestion remedies
$::RD_TRACE # if defined, also trace parsers behaviour
$::RD_AUTOSTUB # if defined, generates "stubs" for undefined rules
$::RD_AUTOACTION # if defined, appends specified action to productions
Parse::RecDescent incrementally generates top-down recursive-descent text parsers from simple yacc-like grammar specifications.
Main features:
- Regular expressions or literal strings as terminals (tokens),
- Multiple (non-contiguous) productions for any rule,
- Repeated and optional subrules within productions,
- Full access to Perl within actions specified as part of the grammar,
- Simple automated error reporting during parser generation and parsing,
- The ability to commit to, uncommit to, or reject particular productions during a parse,
- The ability to pass data up and down the parse tree ("down" via subrule argument lists, "up" via subrule return values)
- Incremental extension of the parsing grammar (even during a parse),
- Precompilation of parser objects,
- User-definable reduce-reduce conflict resolution via "scoring" of matching productions.
<<lessSYNOPSIS
use Parse::RecDescent;
# Generate a parser from the specification in $grammar:
$parser = new Parse::RecDescent ($grammar);
# Generate a parser from the specification in $othergrammar
$anotherparser = new Parse::RecDescent ($othergrammar);
# Parse $text using rule startrule (which must be
# defined in $grammar):
$parser->startrule($text);
# Parse $text using rule otherrule (which must also
# be defined in $grammar):
$parser->otherrule($text);
# Change the universal token prefix pattern
# (the default is: s*):
$Parse::RecDescent::skip = [ t]+;
# Replace productions of existing rules (or create new ones)
# with the productions defined in $newgrammar:
$parser->Replace($newgrammar);
# Extend existing rules (or create new ones)
# by adding extra productions defined in $moregrammar:
$parser->Extend($moregrammar);
# Global flags (useful as command line arguments under -s):
$::RD_ERRORS # unless undefined, report fatal errors
$::RD_WARN # unless undefined, also report non-fatal problems
$::RD_HINT # if defined, also suggestion remedies
$::RD_TRACE # if defined, also trace parsers behaviour
$::RD_AUTOSTUB # if defined, generates "stubs" for undefined rules
$::RD_AUTOACTION # if defined, appends specified action to productions
Parse::RecDescent incrementally generates top-down recursive-descent text parsers from simple yacc-like grammar specifications.
Main features:
- Regular expressions or literal strings as terminals (tokens),
- Multiple (non-contiguous) productions for any rule,
- Repeated and optional subrules within productions,
- Full access to Perl within actions specified as part of the grammar,
- Simple automated error reporting during parser generation and parsing,
- The ability to commit to, uncommit to, or reject particular productions during a parse,
- The ability to pass data up and down the parse tree ("down" via subrule argument lists, "up" via subrule return values)
- Incremental extension of the parsing grammar (even during a parse),
- Precompilation of parser objects,
- User-definable reduce-reduce conflict resolution via "scoring" of matching productions.
Download (0.12MB)
Added: 2006-09-23 License: Perl Artistic License Price:
1131 downloads
MIME::Parser 5.420
MIME::Parser is a experimental class for parsing MIME streams. more>>
MIME::Parser is a experimental class for parsing MIME streams.
SYNOPSIS
Before reading further, you should see MIME::Tools to make sure that you understand where this module fits into the grand scheme of things. Go on, do it now. Ill wait.
Ready? Ok...
Basic usage examples
### Create a new parser object:
my $parser = new MIME::Parser;
### Tell it where to put things:
$parser->output_under("/tmp");
### Parse an input filehandle:
$entity = $parser->parse(*STDIN);
### Congratulations: you now have a (possibly multipart) MIME entity!
$entity->dump_skeleton; # for debugging
Examples of input
### Parse from filehandles:
$entity = $parser->parse(*STDIN);
$entity = $parser->parse(IO::File->new("some command|");
### Parse from any object that supports getline() and read():
$entity = $parser->parse($myHandle);
### Parse an in-core MIME message:
$entity = $parser->parse_data($message);
### Parse an MIME message in a file:
$entity = $parser->parse_open("/some/file.msg");
### Parse an MIME message out of a pipeline:
$entity = $parser->parse_open("gunzip - < file.msg.gz |");
### Parse already-split input (as "deliver" would give it to you):
$entity = $parser->parse_two("msg.head", "msg.body");
Examples of output control
### Keep parsed message bodies in core (default outputs to disk):
$parser->output_to_core(1);
### Output each message body to a one-per-message directory:
$parser->output_under("/tmp");
### Output each message body to the same directory:
$parser->output_dir("/tmp");
### Change how nameless message-component files are named:
$parser->output_prefix("msg");
Examples of error recovery
### Normal mechanism:
eval { $entity = $parser->parse(*STDIN) };
if ($@) {
$results = $parser->results;
$decapitated = $parser->last_head; ### get last top-level head
}
### Ultra-tolerant mechanism:
$parser->ignore_errors(1);
$entity = eval { $parser->parse(*STDIN) };
$error = ($@ || $parser->last_error);
### Cleanup all files created by the parse:
eval { $entity = $parser->parse(*STDIN) };
...
$parser->filer->purge;
Examples of parser options
### Automatically attempt to RFC-1522-decode the MIME headers?
$parser->decode_headers(1); ### default is false
### Parse contained "message/rfc822" objects as nested MIME streams?
$parser->extract_nested_messages(0); ### default is true
### Look for uuencode in "text" messages, and extract it?
$parser->extract_uuencode(1); ### default is false
### Should we forgive normally-fatal errors?
$parser->ignore_errors(0); ### default is true
Miscellaneous examples
### Convert a Mail::Internet object to a MIME::Entity:
@lines = (@{$mail->header}, "n", @{$mail->body});
$entity = $parser->parse_data(@lines);
<<lessSYNOPSIS
Before reading further, you should see MIME::Tools to make sure that you understand where this module fits into the grand scheme of things. Go on, do it now. Ill wait.
Ready? Ok...
Basic usage examples
### Create a new parser object:
my $parser = new MIME::Parser;
### Tell it where to put things:
$parser->output_under("/tmp");
### Parse an input filehandle:
$entity = $parser->parse(*STDIN);
### Congratulations: you now have a (possibly multipart) MIME entity!
$entity->dump_skeleton; # for debugging
Examples of input
### Parse from filehandles:
$entity = $parser->parse(*STDIN);
$entity = $parser->parse(IO::File->new("some command|");
### Parse from any object that supports getline() and read():
$entity = $parser->parse($myHandle);
### Parse an in-core MIME message:
$entity = $parser->parse_data($message);
### Parse an MIME message in a file:
$entity = $parser->parse_open("/some/file.msg");
### Parse an MIME message out of a pipeline:
$entity = $parser->parse_open("gunzip - < file.msg.gz |");
### Parse already-split input (as "deliver" would give it to you):
$entity = $parser->parse_two("msg.head", "msg.body");
Examples of output control
### Keep parsed message bodies in core (default outputs to disk):
$parser->output_to_core(1);
### Output each message body to a one-per-message directory:
$parser->output_under("/tmp");
### Output each message body to the same directory:
$parser->output_dir("/tmp");
### Change how nameless message-component files are named:
$parser->output_prefix("msg");
Examples of error recovery
### Normal mechanism:
eval { $entity = $parser->parse(*STDIN) };
if ($@) {
$results = $parser->results;
$decapitated = $parser->last_head; ### get last top-level head
}
### Ultra-tolerant mechanism:
$parser->ignore_errors(1);
$entity = eval { $parser->parse(*STDIN) };
$error = ($@ || $parser->last_error);
### Cleanup all files created by the parse:
eval { $entity = $parser->parse(*STDIN) };
...
$parser->filer->purge;
Examples of parser options
### Automatically attempt to RFC-1522-decode the MIME headers?
$parser->decode_headers(1); ### default is false
### Parse contained "message/rfc822" objects as nested MIME streams?
$parser->extract_nested_messages(0); ### default is true
### Look for uuencode in "text" messages, and extract it?
$parser->extract_uuencode(1); ### default is false
### Should we forgive normally-fatal errors?
$parser->ignore_errors(0); ### default is true
Miscellaneous examples
### Convert a Mail::Internet object to a MIME::Entity:
@lines = (@{$mail->header}, "n", @{$mail->body});
$entity = $parser->parse_data(@lines);
Download (0.38MB)
Added: 2006-11-17 License: Perl Artistic License Price:
1073 downloads
Shell::Parser 0.04
Shell::Parser is a simple shell script parser. more>>
Shell::Parser is a simple shell script parser.
SYNOPSIS
use Shell::Parser;
my $parser = new Shell::Parser syntax => bash, handlers => {
};
$parser->parse(...);
$parser->eof;
This module implements a rudimentary shell script parser in Perl. It was primarily written as a backend for Syntax::Highlight::Shell, in order to simplify the creation of the later.
<<lessSYNOPSIS
use Shell::Parser;
my $parser = new Shell::Parser syntax => bash, handlers => {
};
$parser->parse(...);
$parser->eof;
This module implements a rudimentary shell script parser in Perl. It was primarily written as a backend for Syntax::Highlight::Shell, in order to simplify the creation of the later.
Download (0.017MB)
Added: 2007-04-06 License: Perl Artistic License Price:
934 downloads
Chess::PGN::Parse 0.19
Chess::PGN::Parse is a Perl module that reads and parses PGN (Portable Game Notation) Chess files. more>>
Chess::PGN::Parse is a Perl module that reads and parses PGN (Portable Game Notation) Chess files.
SYNOPSIS
use Chess::PGN::Parse;
use English qw( -no_match_vars );
my $pgnfile = "kk_2001.pgn";
my $pgn = new Chess::PGN::Parse $pgnfile
or die "cant open $pgnfilen";
while ($pgn->read_game()) {
print $pgn->white, ", " , $pgn->black, ", ",
$pgn->result, ", ",
$pgn->game, "n";
}
use Chess::PGN::Parse;
my $text ="";
{
local $INPUT_RECORD_SEPARATOR = undef;
open PGN "< $pgnfile" or die;
$text = ;
close $text;
}
# reads from string instead of a file
my $pgn = new Chess::PGN::Parse undef, $text;
while ($pgn->read_game()) {
print $pgn->white, ", " , $pgn->black, ", ",
$pgn->result, ", ",
$pgn->game, "n";
}
use Chess::PGN::Parse;
my $pgnfile = "kk_2001.pgn";
my $pgn = new Chess::PGN::Parse $pgnfile
or die "cant open $pgnfilen";
my @games = $pgn->smart_read_all();
Chess::PGN::Parse offers a range of methods to read and manipulate Portable Game Notation files. PGN files contain chess games produced by chess programs following a standard format (http://www.schachprobleme.de/chessml/faq/pgn/). It is among the preferred means of chess games distribution. Being a public, well established standard, PGN is understood by many chess archive programs. Parsing simple PGN files is not difficult. However, dealing with some of the intricacies of the Standard is less than trivial. This module offers a clean handle toward reading and parsing complex PGN files.
A PGN file has several tags, which are key/values pairs at the header of each game, in the format [key "value"]
After the header, the game follows. A string of numbered chess moves, optionally interrupted by braced comments and recursive parenthesized variants and comments. While dealing with simple braced comments is straightforward, parsing nested comments can give you more than a headache.
Chess::PGN::Parse most immediate methods are: read_game() reads one game, separating the tags and the game text.
parse_game() parse the current game, and stores the moves into an
array and optionally saves the comments into an array of hashes
for furter usage. It can deal with nested comments and recursive
variations.
quick_parse_game() Same as the above, but doesnt save the comments,
which are just stripped from the text. It cant deal with nested
comments. Should be the preferred method when we know that we are
dealing with simple PGNs.
smart_parse_game() Best of the above methods. A preliminary check
will call parse_game() or quick_parse_game(), depending on the
presence of nested comments in the game.
read_all(), quick_read_all(), smart_read_all() will read all the records
in the current PGN file and return an array of hashes with all the
parsed details from the games.
<<lessSYNOPSIS
use Chess::PGN::Parse;
use English qw( -no_match_vars );
my $pgnfile = "kk_2001.pgn";
my $pgn = new Chess::PGN::Parse $pgnfile
or die "cant open $pgnfilen";
while ($pgn->read_game()) {
print $pgn->white, ", " , $pgn->black, ", ",
$pgn->result, ", ",
$pgn->game, "n";
}
use Chess::PGN::Parse;
my $text ="";
{
local $INPUT_RECORD_SEPARATOR = undef;
open PGN "< $pgnfile" or die;
$text = ;
close $text;
}
# reads from string instead of a file
my $pgn = new Chess::PGN::Parse undef, $text;
while ($pgn->read_game()) {
print $pgn->white, ", " , $pgn->black, ", ",
$pgn->result, ", ",
$pgn->game, "n";
}
use Chess::PGN::Parse;
my $pgnfile = "kk_2001.pgn";
my $pgn = new Chess::PGN::Parse $pgnfile
or die "cant open $pgnfilen";
my @games = $pgn->smart_read_all();
Chess::PGN::Parse offers a range of methods to read and manipulate Portable Game Notation files. PGN files contain chess games produced by chess programs following a standard format (http://www.schachprobleme.de/chessml/faq/pgn/). It is among the preferred means of chess games distribution. Being a public, well established standard, PGN is understood by many chess archive programs. Parsing simple PGN files is not difficult. However, dealing with some of the intricacies of the Standard is less than trivial. This module offers a clean handle toward reading and parsing complex PGN files.
A PGN file has several tags, which are key/values pairs at the header of each game, in the format [key "value"]
After the header, the game follows. A string of numbered chess moves, optionally interrupted by braced comments and recursive parenthesized variants and comments. While dealing with simple braced comments is straightforward, parsing nested comments can give you more than a headache.
Chess::PGN::Parse most immediate methods are: read_game() reads one game, separating the tags and the game text.
parse_game() parse the current game, and stores the moves into an
array and optionally saves the comments into an array of hashes
for furter usage. It can deal with nested comments and recursive
variations.
quick_parse_game() Same as the above, but doesnt save the comments,
which are just stripped from the text. It cant deal with nested
comments. Should be the preferred method when we know that we are
dealing with simple PGNs.
smart_parse_game() Best of the above methods. A preliminary check
will call parse_game() or quick_parse_game(), depending on the
presence of nested comments in the game.
read_all(), quick_read_all(), smart_read_all() will read all the records
in the current PGN file and return an array of hashes with all the
parsed details from the games.
Download (0.026MB)
Added: 2007-08-01 License: Perl Artistic License Price:
818 downloads
XML Parse Library 0.50
XML-Parse library is a lightweight set of re-usable functions for general purpose parsing, checking, and creating xml files. more>>
XML-Parse library is a lightweight set of re-usable functions for general purpose parsing, checking, and creating xml files. It can support stream-oriented, SAX or DOM parsing styles, and includes an optional xsd schema validator and graphical schema generator.
It supports all valid XML, and includes checking for validity. This library has minimal dependencies, and is totally self-contained. XML Parse Library project is written in C and is both speed and memory efficient, and is simple to use. Primary core functions have been posted, and additional advanced and useful XML-related utilities will be added. Released under MIT License.
The XML-Parse library contains functions for parsing and/or creating xml files in a variety of ways. You should use whichever set makes sense for your needs. The functions support the following alternative ways of working with XML files:
- Read whole xml-files into a tokenized tree-structure in memory, and then operate on, traverse, access, or further decode values out of the tree. Your custom application code is usually required to access and operate on the tokenized-values.
- Read xml-files, parse and interpret them as they are being read. Your custom application-specific code can be interspersed with the re-usable parsing calls to interpret, convert, operate-on or store values immediately as input-stream is read, instead of storing in an intermediate tokenized-tree structure. This method reduce time and memory requirements, and supports streaming operations.
- Build xml-tree structures with convenient reusable routines from data in your application, and or modify values in read-in trees.
- Write-out valid xml-files automatically from xml-trees that were constructed or read-into memory by your application.
- Check xml-trees against an arbitrary xml schema definition (XSD).
<<lessIt supports all valid XML, and includes checking for validity. This library has minimal dependencies, and is totally self-contained. XML Parse Library project is written in C and is both speed and memory efficient, and is simple to use. Primary core functions have been posted, and additional advanced and useful XML-related utilities will be added. Released under MIT License.
The XML-Parse library contains functions for parsing and/or creating xml files in a variety of ways. You should use whichever set makes sense for your needs. The functions support the following alternative ways of working with XML files:
- Read whole xml-files into a tokenized tree-structure in memory, and then operate on, traverse, access, or further decode values out of the tree. Your custom application code is usually required to access and operate on the tokenized-values.
- Read xml-files, parse and interpret them as they are being read. Your custom application-specific code can be interspersed with the re-usable parsing calls to interpret, convert, operate-on or store values immediately as input-stream is read, instead of storing in an intermediate tokenized-tree structure. This method reduce time and memory requirements, and supports streaming operations.
- Build xml-tree structures with convenient reusable routines from data in your application, and or modify values in read-in trees.
- Write-out valid xml-files automatically from xml-trees that were constructed or read-into memory by your application.
- Check xml-trees against an arbitrary xml schema definition (XSD).
Download (0.011MB)
Added: 2007-03-23 License: MIT/X Consortium License Price:
947 downloads
Parse::Template 0.37
Parse::Template was initially created to serve as a code generator for the Parse::Lex class. more>>
Parse::Template was initially created to serve as a code generator for the Parse::Lex class. The class is now available as a separate module.
<<less Download (0.022MB)
Added: 2007-07-05 License: Perl Artistic License Price:
841 downloads
BBCode::Parser 0.34
BBCode::Parser is a Perl module that parses BBCode tags. more>>
BBCode::Parser is a Perl module that parses BBCode tags.
BBCode is a simplified markup language used in several online forums and bulletin boards. It originated with phpBB, and remains most popular among applications written in PHP. Generally, users author their posts in BBCode, and the forum converts it to a permitted subset of well-formed HTML.
BBCode::Parser is a proper recursive parser for BBCode-formatted text.
OVERVIEW
A BBCode::Parser object stores various settings that affect the parsing process. Simple settings are typically set when the parser is created using new(), but they can be queried using get() and altered using set().
See "SETTINGS" for more information.
In addition to the simple settings, specific BBCode tags (or classes of tags) can be permitted or forbidden, using permit() and forbid() respectively. By default, the only forbidden tag is [HTML], which is normally a security violation if permitted.
See "CLASSES" for a list of tag classes.
Once the parser has been configured appropriately, parse trees can be created using the parse() method. The parse tree will consist of objects derived from BBCode::Tag; the root of the tree will be a BBCode::Body object.
Converting the parse tree to HTML is quite simple: call toHTML() on the root of the tree. Likewise, the parse tree can be converted back to BBCode by calling toBBCode(). See "METHODS" in BBCode::Tag to find out what other output methods are available.
<<lessBBCode is a simplified markup language used in several online forums and bulletin boards. It originated with phpBB, and remains most popular among applications written in PHP. Generally, users author their posts in BBCode, and the forum converts it to a permitted subset of well-formed HTML.
BBCode::Parser is a proper recursive parser for BBCode-formatted text.
OVERVIEW
A BBCode::Parser object stores various settings that affect the parsing process. Simple settings are typically set when the parser is created using new(), but they can be queried using get() and altered using set().
See "SETTINGS" for more information.
In addition to the simple settings, specific BBCode tags (or classes of tags) can be permitted or forbidden, using permit() and forbid() respectively. By default, the only forbidden tag is [HTML], which is normally a security violation if permitted.
See "CLASSES" for a list of tag classes.
Once the parser has been configured appropriately, parse trees can be created using the parse() method. The parse tree will consist of objects derived from BBCode::Tag; the root of the tree will be a BBCode::Body object.
Converting the parse tree to HTML is quite simple: call toHTML() on the root of the tree. Likewise, the parse tree can be converted back to BBCode by calling toBBCode(). See "METHODS" in BBCode::Tag to find out what other output methods are available.
Download (0.050MB)
Added: 2007-03-20 License: Perl Artistic License Price:
951 downloads
Secleted [ 0 ] software to compare
Copyright Notice:
Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future software development. The above parse search only lists software in full, demo and trial versions for free download. Download links are directly from our mirror sites or publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed