Alt-CWB-ambs
    
    
  
  
  
view release on metacpan or search on metacpan
lib/CWB/CEQL/Parser.pm view on Meta::CPAN
grammar users and is likely to be confusing.  B<CWB::CEQL::Parser> will add
its own stack trace of subrule invocations so that users can pinpoint the
precise location of the syntax error.  In order to make this stack trace
readable and informative, DPP rules should always be given descriptive names: use
C<wildcard_expression> or C<part_of_speech> rather than C<rule1723a>.
The B<HtmlErrorMessage> method will automatically convert HTML metacharacters
and non-ASCII characters to entities, so it is safe to include the returned
HTML code directly in a Web page.  Error messages may use basic wiki-style
formatting: C<''...''> for typewriter font, C<//...//> for italics and
C<**...**> for bold font.  Note that such markup is non-recursive and nested
formatting will be ignored.  User input should always be enclosed in
C<''...''> in error messages so that C<//> and C<**> sequences in the input
are not mistaken as formatting instructions.
=head2 Calling subrules
Most DPP rules divide the input string into one or more subconstituents,
similar to the rules of a standard context-free grammar.  The main difference
is that a DPP rule has to settle on the specific positions and categories
of the subconstituents, rather than just listing possible category sequences.
lib/CWB/CEQL/Parser.pm view on Meta::CPAN
}
=item I<$html_code> = I<$grammar>->B<HtmlErrorMessage>;
If the last parse failed, returns HTML-formatted error message and backtrace
of the callstack.  The string I<$html_code> is valid HTML and can directly be
included in a generated Web page.  In particular, unsafe and non-ASCII
characters have been encoded as HTML entities.  Simple, non-recursive
wiki-style markup in an error message is interpreted in the following way:
  **<text>**    <text> is shown in bold font (<b> ... </b>)
  //<text>//    <text> is displayed in italics (<i> ... </i>)
  ''<text>''    <text> is shown in typewriter font (<code> ... </code>)
Lines starting with C< - > (note the two blanks) are converted into list items.
=cut
sub HtmlErrorMessage {
  my $self = shift;
  my @text_lines = $self->ErrorMessage();
lib/CWB/CEQL/Parser.pm view on Meta::CPAN
Format one or more text lines with simple wiki-style markup as HTML.  The
string I<$html_code> is valid HTML and can directly be included in a generated
Web page.  In particular, unsafe and non-ASCII characters are automatically
encoded as HTML entities.  The following typographic markup is supported:
=over 4
=item *
C<< **<text>** >> - <text> is displayed in bold face (C<< <b> ... </b> >>)
=item *
C<< //<text>// >> - <text> is displayed in italics (C<< <i> ... </i> >>)
=item *
C<< ''<text>'' >> - <text> is shown in typewriter font (C<< <code> ... </code> >>)
=item *
lib/CWB/CEQL/Parser.pm view on Meta::CPAN
hyphen) are converted into list items
=item *
all other lines are formatted as separate paragraphs (C<< <p> ... </p> >>)
=back
The wiki markup is non-recursive, i.e. no substitutions will be applied to
the text wrapped in C<''...''> etc.  This behaviour is intentional, so that
e.g. B<**> in a query expression will not be mistaken for a bold face marker,
(as long as the query is displayed in typewriter font, i.e. as C<''<query>''>).
=cut
sub formatHtmlText {
  my $self = shift;
  my @html_lines = ();
  my $in_list = 0;
  while (@_) {
    my $line = shift;
( run in 0.322 second using v1.01-cache-2.11-cpan-c333fce770f )