Ingy döt Net > Pegex-0.20 > lib/Pegex/Syntax.pod

Download:
Pegex-0.20.tar.gz

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Source   Latest Release: Pegex-0.44

Pegex Syntax ^

Pegex has a fairly simple set of syntax constructs. This document details them all.

A Pegex grammar is just a set of named rules. They look like this

    rule_name_1: <rule>* <body> /1/
    rule_name_2: /rule body 2/

A rule is a name followed by a ':' followed by a rule body. It can optionally end with a semicolon, if you want to put more than one on a line.

Basic Tokens

Pegex only has 3 kinds of basic tokens:

Rule Reference

A rule reference is the name of a rule inside angle brackets.

    <sub_rule_name>
Regular Expression

A regular expression is a string inside forward slashes.

    /regular expression/
Error Message

An error message is a string inside backticks.

    `error message`

More to come...

syntax highlighting: