Skip to content

Commit

Permalink
CPAN Release 0.62
Browse files Browse the repository at this point in the history
- Debug color and indent options added by TINITA++
- Recursion controls. Apply PR/46 by @pdl++ (refactored)
- Support Perl regex look-behind assertions
  • Loading branch information
ingydotnet committed Jan 14, 2017
1 parent b46a249 commit 44f0d68
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 76 deletions.
24 changes: 3 additions & 21 deletions Changes
@@ -1,27 +1,9 @@
---
version: 0.61_005
date: Fri Jan 13 15:03:08 PST 2017
changes:
- Fix bug in new DEBUG options
---
version: 0.61_004
date: Wed Jan 11 23:55:02 CET 2017
version: 0.62
date: Fri Jan 13 22:37:55 PST 2017
changes:
- Debug color and indent options added by TINITA++
---
version: 0.61_003
date: Sat Jan 7 01:14:18 PST 2017
changes:
- Release to see if cpantesters is fixed
---
version: 0.61_002
date: Wed Jan 4 21:29:16 CET 2017
changes:
- Apply PR/46 by @pdl++ (refactored)
---
version: 0.61_001
date: Tue Jan 3 22:44:13 PST 2017
changes:
- Recursion controls. Apply PR/46 by @pdl++ (refactored)
- Support Perl regex look-behind assertions
---
version: 0.61
Expand Down
2 changes: 1 addition & 1 deletion Meta
@@ -1,7 +1,7 @@
=meta: 0.0.2

name: Pegex
version: 0.61_005
version: 0.62
abstract: Acmeist PEG Parser Framework
homepage: http://pegex.org
language: perl
Expand Down
4 changes: 2 additions & 2 deletions ReadMe.pod
@@ -1,7 +1,7 @@
=pod

=for comment
DO NOT EDIT. This Pod was generated by Swim v0.1.43.
DO NOT EDIT. This Pod was generated by Swim v0.1.45.
See http://github.com/ingydotnet/swim-pm#readme

=encoding utf8
Expand All @@ -12,7 +12,7 @@ Pegex - Acmeist PEG Parser Framework

=head1 Version

This document describes L<Pegex> version B<0.61_005>.
This document describes L<Pegex> version B<0.62>.

=head1 Synopsis

Expand Down
2 changes: 1 addition & 1 deletion lib/Pegex.pm
@@ -1,6 +1,6 @@
use strict; use warnings;
package Pegex;
our $VERSION = '0.61_005';
our $VERSION = '0.62';

use Pegex::Parser;

Expand Down
112 changes: 61 additions & 51 deletions test/devel/grammars/yaml.pgx
Expand Up @@ -38,32 +38,37 @@
# but there can be ignorable comments on either side of an explicitly marked
# document. NOTE: Not yet dealing with directives.
yaml-stream:
ignore-line*
stream-start
ignore-line* % EOL
(
yaml-document
ignore-line*
)*
stream-end

stream-start: ''
stream-end: / EOL?/

# A YAML Document is a single node of any kind. It may start with an optional
# explicit head marker, and may be terminated with an optional explicit foot
# marker.
yaml-document:
document-head?
top-node
(document-head | document-start)
(yaml-node EOL?)
# It is important to make sure we are on a line boundary here:
ignore-line?
document-foot?
(document-foot | document-end)

# A top level node can be quite a few distinct things:
top-node:
node-prefix? (
| node-alias
| flow-mapping
yaml-node:
yaml-alias |
yaml-prefix? (
| flow-sequence
| flow-mapping
| block-sequence
| block-mapping
| block-scalar
) ( EOL? )
)

#------------------------------------------------------------------------------
# Block Constructs
Expand All @@ -78,30 +83,29 @@ block-node:
# A block sequence is an indented set of nodes each starting with a
# dash+space:
block-sequence:
block-indent
block-indent-sequence
block-sequence-entry+
block-undent

block-sequence-entry:
block-ondent
/ DASH SPACE+ /
block-value
block-ondent-sequence
/ DASH (: SPACE+ | SPACE* (= EOL))/ yaml-node

# A block mapping is an indented set of key / value pairs separated by
# colon+space:
block-mapping:
block-indent
block-mapping-pair+
block-mapping-pair+ %% (EOL ignore-line)*
block-undent

# A block mapping pair is a key / value separated by colon+space:
block-mapping-pair:
block-ondent
block-key
block-value
yaml-node

# block key scalar, has more limitations than a block value scalar.
block-key: / block-scalar block-mapping-separator /
block-key: / block-plain-scalar block-mapping-separator /

# A block value can be any block or flow node:
block-value:
Expand All @@ -110,30 +114,31 @@ block-value:
| block-node

# A scalar in block form can take one of these 5 forms:
block-scalar: /
( literal-scalar
block-scalar:
| literal-scalar
| folded-scalar
| double-quoted-scalar
| single-quoted-scalar
| block-plain-scalar
)
/

#------------------------------------------------------------------------------
# Flow Constructs:
#------------------------------------------------------------------------------

# A flow node can be any one of these 3 kinds:
flow-node:
| flow-sequence
| flow-mapping
| flow-scalar
yaml-prefix? (
| yaml-alias
| flow-sequence
| flow-mapping
| flow-scalar
)

# A flow sequence is zero or more nodes, separated by commas, inside square
# brackets. A trailing comma is allowed.
flow-sequence:
flow-sequence-start
flow-sequence-entry* %% list-separator
flow-node* %% list-separator
flow-sequence-end

# A flow mapping is key / value pairs, separated by commas, inside curly
Expand All @@ -144,16 +149,10 @@ flow-mapping:
flow-mapping-end

# A flow scalar only has 3 basic forms:
flow-scalar: /
( double-quoted-scalar
flow-scalar:
| double-quoted-scalar
| single-quoted-scalar
| flow-plain-scalar
)
/

# A flow sequence entry is any flow node. This rule is an alias, and can maybe
# go away later, but leaving this way now for clarity.
flow-sequence-entry: flow-scalar

# A flow mapping can have any node as key or value, but they must also be in
# flow syntax.
Expand All @@ -164,9 +163,9 @@ flow-mapping-pair:

# Starting and ending rules for flow collections:
flow-sequence-start: /- '[' -/
flow-sequence-end: /- ']' -/
flow-sequence-end: /- ']' SPACE*/
flow-mapping-start: /- '{' -/
flow-mapping-end: /- '}' -/
flow-mapping-end: /- '}' SPACE*/

#------------------------------------------------------------------------------
# Scalar Constructs
Expand All @@ -182,25 +181,26 @@ folded-scalar: / '>' EOL 'XXX' /

# Double quoted scalar.
# XXX Needs work.
double-quoted-scalar: / DOUBLE [^ DOUBLE]* DOUBLE /
double-quoted-scalar: / DOUBLE ((: BACK DOUBLE | [^ DOUBLE])*) DOUBLE /

# Single quoted scalar.
# XXX Needs work.
single-quoted-scalar: / SINGLE [^ SINGLE]* SINGLE /
single-quoted-scalar: / SINGLE ((: SINGLE SINGLE | [^ SINGLE])*) SINGLE /

# Plain (unquoted) scalars can't start with syntax chars, and can't contain
# colon+space.
block-plain-scalar: /
(! char-non-start)
ANY+?
( ANY+? )
(: WS+ comment-text)?
(= COLON WS | EOL | EOS)
/

# Plain (unquoted) scalars in flow context are more restrictive than in block
# context.
flow-plain-scalar: /
(! char-non-start)
ANY+?
( ANY+? )
(= [ chars-syntax COMMA ] | COLON SPACE | COMMA SPACE | EOL | EOS)
/

Expand All @@ -213,47 +213,56 @@ flow-plain-scalar: /
# block-undent: # This rule is written in code in the Grammar class.

# A YAML header is 3 dashes followed by spaces or a newline:
document-head: / '---' (: SPACE+ | (?= EOL)) /
document-head: /
EOL? '---'
(: SPACE+ | (?= EOL))
/

# Implicit document start:
document-start: /(= ALL* [^ EOL])/

# A YAML footer is 3 dots followed by a newline:
document-foot: / '...' EOL /

# Implicit document ending:
document-end: ''

# A node prefix is a anchor and / or tag in any order.
# XXX This construct is hard in PEG. Look for easier way.
node-prefix:
| node-anchor (SPACE+ node-tag)?
| node-tag (SPACE+ node-anchor)?
yaml-prefix:
| yaml-anchor yaml-tag?
| yaml-tag yaml-anchor?

# An explicit node tag.
# TODO This is very incomplete!
node-tag: / BANG BANG? ( WORD+ ) /
# An explicit node tag:
yaml-tag: /('!' NS*) -/

# A Node Anchor is a name for a node. Like '&this'.
# TODO See spec for real definition.
node-anchor: / '&' ( WORD+ ) /
yaml-anchor: / '&' ( WORD+ ) -/

# A Node Alias is a reference to an anchored node. Like '*this'.
node-alias: / '*' ( WORD+ ) /
yaml-alias: / '*' ( WORD+ ) /

# Mapping key / value is always separated by ': ' (colon + space)
flow-mapping-separator: / ':' (: SPACE+ | SPACE* (= EOL)) /
flow-mapping-separator: /- ':' (: SPACE+ | SPACE* (= EOL)) /
block-mapping-separator: / ':' (: SPACE+ | SPACE* (= EOL)) /

# List items separated by ',' (comma)
# XXX Check spec if SPACE is needed
list-separator: / ',' SPACE+ /
list-separator: /- ',' -/

# List of single chars that are YAML syntax (and thus must be avoided in
# various contexts.
chars-syntax: /
AMP
STAR
HASH
LCURLY
RCURLY
LSQUARE
RSQUARE
PERCENT
DOUBLE
SINGLE
/

# YAML's Reserved Chars
Expand All @@ -265,6 +274,7 @@ chars-reserved: /
char-non-start: /[
chars-syntax
chars-reserved
HASH
]/


Expand All @@ -281,7 +291,7 @@ ignore-line: / ignore-text (= EOL) /
ignore-text: / (: comment-text | blank-text ) /

# A '#' starts a comment until end of line.
comment-text: / HASH ANY* /
comment-text: / BLANK* HASH ANY* /

# Spaces and tabs.
blank-text: / BLANK* /
Expand Down

0 comments on commit 44f0d68

Please sign in to comment.