Skip to content

Commit

Permalink
perl6 grammar ported
Browse files Browse the repository at this point in the history
  • Loading branch information
ingydotnet committed Oct 1, 2011
1 parent df2c318 commit 5a8c671
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 4 deletions.
49 changes: 49 additions & 0 deletions cdent-base.pgx
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,49 @@
%grammar cdent-base
%version 0.0.1

module:
<module_start>
<doc_comment>?
<comment>*
<include_runtime>?
<class>+ %%% <comment>*
<module_end>
<comment>*

doc_comment:
<doc_comment_begin>
[ !<doc_comment_end> <doc_comment_line> ]*
<doc_comment_end>

class:
<class_start>
<class_body>
<class_end>

class_body:
<indent>
<method>+ %%% <comment>*
<undent>

method:
<method_start>
<method_body>
<method_end>

method_body:
<indent>
<statement>+ %%% <comment>*

statement: [ <println> | <comment> ]

comment: [ <line_comment> | <blank_line> ]

line_comment: /<line_comment_start>(<line>)/

line: /<ANY>*<EOL>/
blank_line: /~<EOL>/

module_start: //
module_end: //

id: /<WORD>+/
21 changes: 21 additions & 0 deletions cdent.perl6.pgx
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,21 @@
%grammar cdent-perl6
%extends cdent-base
%version 0.0.1

line_comment_start: /<HASH>/

doc_comment_begin: /<HASH>{3}<BREAK>/
doc_comment_line: /<HASH><SPACE>?(<ANY>*<BREAK>)/
doc_comment_end: /<HASH>{3}<SPACE>/

include_runtime: /use CDent;/

class_start: /class<SPACE>~(<Id>)<WS>~<LCURLY><BREAK>/

class_end: /<RCURLY><BREAK>/

method_start: /method<SPACE>~(<Id>)<SPACE>~<LCURLY><BREAK>/

method_end: /<RCURLY><BREAK>/

println: /say<SPACE>~(<ANY>+)<SEMI><BREAK>/
4 changes: 0 additions & 4 deletions cdent.pgx

This file was deleted.

0 comments on commit 5a8c671

Please sign in to comment.