Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ehuelsmann update perl #711

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6346f4a
Update generated content
ehuelsmann Sep 1, 2019
23ec70b
Update rule matching for Rule, Example and Scenario Outline
ehuelsmann Sep 1, 2019
24d12d0
Update Perl modules based on *.feature.token tests
ehuelsmann Sep 1, 2019
41f1469
Update Perl Gherkin::AstBuilder: Berp rules were renamed
ehuelsmann Sep 1, 2019
7782cd9
Remove UTF8->ascii coding from Gherkin::TokenFormatterBuilder
ehuelsmann Sep 1, 2019
84e8c2b
Remove empty arrays and strings from the AST
ehuelsmann Sep 1, 2019
4a1a3b2
Update Perl AST generation - gherkinDocument level
ehuelsmann Sep 1, 2019
e6a12d7
Perl implementation compliance with *.feature.ast.ndjson
ehuelsmann Sep 1, 2019
a7dcbf1
Force UTF-8 output from gherkin-generate-tokens
ehuelsmann Sep 1, 2019
cdf314b
Stop wrapping parser output in gherkin-generate ast and pretty print …
ehuelsmann Sep 1, 2019
7a920a0
Fix Perl implementation pickles compliance (except `id` and 'Rule')
ehuelsmann Sep 2, 2019
301d7f8
Stop wrapping the returned value in a 'document' in Perl's gherkin-ge…
ehuelsmann Sep 2, 2019
9aac1f6
Add Rule/Example blocks support to pickle compiler in Perl implementa…
ehuelsmann Sep 2, 2019
ea3a994
Pretty-print the output of Perl's gherkin-generate-pickles
ehuelsmann Sep 2, 2019
5a0ba02
Enable testing of Perl implementation
ehuelsmann Sep 2, 2019
e613c31
Generate correct pickle ID values in Perl pickle compiler
ehuelsmann Sep 2, 2019
2bbbbac
merge master
aslakhellesoy Sep 25, 2019
32fd202
Add gherkin/perl to CircleCI config
aslakhellesoy Sep 25, 2019
190bcd4
Fix typo
aslakhellesoy Sep 25, 2019
9d36dc1
Merge branch 'master' into ehuelsmann-update-perl
aslakhellesoy Sep 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,19 @@ jobs:
cd gherkin/c
make

### Perl

gherkin-perl:
executor: docker-cucumber-build
steps:
- attach_workspace:
at: "~/cucumber"
- run:
name: gherkin/perl
command: |
cd gherkin/perl
make

###
### Workflows ###
###
Expand Down Expand Up @@ -672,3 +685,7 @@ workflows:
- gherkin-c:
requires:
- checkout

- gherkin-perl:
requires:
- checkout
4 changes: 2 additions & 2 deletions gherkin/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
MAKEFILES = go/Makefile javascript/Makefile ruby/Makefile java/Makefile
include default.mk
MAKEFILES = go/Makefile javascript/Makefile ruby/Makefile java/Makefile perl/Makefile
include default.mk
9 changes: 2 additions & 7 deletions gherkin/perl/bin/gherkin-generate-ast
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,13 @@ package App::GherkinGenerateAst;
sub run {
my ($class, $fh, @file_list) = @_;

my $json = Cpanel::JSON::XS->new->utf8->canonical;
my $json = Cpanel::JSON::XS->new->utf8->convert_blessed->canonical->pretty;

my $parser = Gherkin::Parser->new();

for my $file (@file_list) {
my $gherkin_document = $parser->parse($file);
my $event = {
type => 'gherkin-document',
uri => $file,
document => $gherkin_document
};
print $fh $json->encode( $event );
print $fh $json->encode( $gherkin_document );
print "\n"
}

Expand Down
18 changes: 7 additions & 11 deletions gherkin/perl/bin/gherkin-generate-pickles
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
#!/usr/bin/env perl

package App::GherkinGeneratePickles;

use strict;
use warnings;
use lib 'lib';

use Cpanel::JSON::XS;
use Path::Class;

use Gherkin::Parser;
use Gherkin::Pickles::Compiler;

package App::GherkinGeneratePickles;

sub run {
my ( $class, $fh, @file_list ) = @_;
my $json = Cpanel::JSON::XS->new->utf8->canonical;
my $json = Cpanel::JSON::XS->new->utf8->pretty->canonical;

my $parser = Gherkin::Parser->new();

for my $file (@file_list) {
my $source = file($file)->slurp;
my $pickles = Gherkin::Pickles::Compiler->compile(
$parser->parse($file)
$parser->parse($file), $source
);
for my $pickle (@$pickles) {
my $event = {
type => 'pickle',
uri => $file,
pickle => $pickle
};
print $fh $json->encode($event);
print "\n"
print $fh $json->encode($pickle);
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions gherkin/perl/bin/gherkin-generate-tokens
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use strict;
use warnings;
use lib 'lib';
use utf8;

use Gherkin::Parser;
use Gherkin::TokenFormatterBuilder;
Expand All @@ -20,4 +21,5 @@ sub run {

}

binmode STDOUT, ':utf8';
__PACKAGE__->run(\*STDOUT, @ARGV) unless caller;
6 changes: 4 additions & 2 deletions gherkin/perl/gherkin-perl.razor
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ our %states_to_match_names = (

sub parse {
my ( $self, $token_scanner, $token_matcher ) = @@_;
my $additional = {};
$additional->{'uri'} = $token_scanner unless ref $token_scanner;

$token_matcher ||= Gherkin::TokenMatcher->new();
$token_scanner = Gherkin::TokenScanner->new($token_scanner)
Expand Down Expand Up @@ -87,7 +89,7 @@ sub parse {
last if $token->is_eof();
}

$self->_end_rule( $context, '@Model.RuleSet.StartRule.Name' );
$self->_end_rule( $context, '@Model.RuleSet.StartRule.Name', $additional );

if ( my @@errors = $context->errors ) {
Gherkin::Exceptions::CompositeParser->throw(@@errors);
Expand All @@ -109,7 +111,7 @@ sub match_@(rule.Name.Replace("#", "")) {
my ($self, $context, $token) = @@_;
@if (rule.Name != "#EOF")
{
@: return if $token->is_eof;
@:return if $token->is_eof;
}
return $self->handle_external_error(
$context,
Expand Down