Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ac8f68
commit b781e6a
Showing
8 changed files
with
286 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
= C'Dent | ||
|
||
C'Dent is a programming methodology for writing code in one programming language and creating equivalent code in other programming langauges. | ||
|
||
|
||
The primary focus of C'Dent is to: | ||
|
||
1) Define the structure of a programming language agnostic, object oriented module that can be used to create faithful representations in many backend languages. | ||
2) Define "C'Dent subsets" of several popular |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
= C'Dent Object-Oriented-Module Model Specification | ||
|
||
== Introduction | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
../lib/cdent/parser/cdent/grammar.py: cd/grammar.yaml | ||
bin/grammar-module $< $@ | ||
|
||
../lib/cdent/parser/python/grammar.py: py/grammar.yaml | ||
bin/grammar-module $< $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
# RegExp atoms | ||
ALL: '[\s\S]' # Any unicode character | ||
WS: '[\ \t]' # A space or tab character | ||
BR: '\n' # A newline character | ||
EOL: '\r?\n' # A Unix or DOS line ending | ||
ANY: '.' # Any character except newline | ||
LC: '[a-z]' # Lower case ASCII alphabetic character | ||
UC: '[A-Z]' # Upper case ASCII alphabetic character | ||
AN: '[A-Za-z0-9]' # ASCII alphanumeric character | ||
WC: '\w' # ie '[A-Za-z0-9_]' - A "word" character | ||
NUM: '[0-9]' # A numeric digit | ||
DS: '\$' # A dollar sign | ||
DOT: '\.' # A period character | ||
OCT: '#' # An octothorpe (or hash) character | ||
BS: '\\' # A backslash character | ||
SQ: "'" # A single quote character | ||
DB: '"' # A double quote character | ||
|
||
Line: /$CHAR*$EOL/ | ||
BlankLine: /$WS*$EOL/ | ||
|
||
# Module parsing grammar | ||
Module: | ||
- DocComment | ||
- Comment* | ||
- IncludeCDent | ||
- Comment* | ||
- Class | ||
- (Class|Comment)* | ||
- Ending | ||
- Comments* | ||
|
||
DocComment: | ||
- DocCommentBegin | ||
- DocCommentLine* | ||
- DocCommentEnd | ||
|
||
Comment: (LineComment|BlankLine) | ||
|
||
Ending: // | ||
|
||
LineComment: /$line_comment_start($Line)/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,207 @@ | ||
--- | ||
ANY: '[\s\S]' # Any unicode character | ||
SPACE: '[\ \t]' # A space or tab character | ||
SPACES: '\ \t' # For use in character classes | ||
BREAK: '\n' # A newline character | ||
EOL: '\r?\n' # A Unix or DOS line ending | ||
NON_BREAK: '.' # Any character except newline | ||
LOWER: '[a-z]' # Lower case ASCII alphabetic character | ||
UPPER: '[A-Z]' # Upper case ASCII alphabetic character | ||
ALPHANUM: '[A-Za-z0-9]' # ASCII alphanumeric character | ||
WORD: '\w' # ie '[A-Za-z0-9_]' - A "word" character | ||
DIGIT: '[0-9]' # A numeric digit | ||
DOLLAR: '\$' # A dollar sign | ||
DOT: '\.' # A period character | ||
HASH: '#' # An octothorpe (or hash) character | ||
BACK: '\' # A backslash character | ||
SINGLE: "'" # A single quote character | ||
DOUBLE: '"' # A double quote character | ||
ESCAPE: '[0nt]' # One of the escapable character IDs | ||
|
||
document: | ||
- meta_section | ||
- test_section | ||
- /: | ||
- data_section | ||
^: '?' | ||
|
||
meta_section: | ||
- /(?:$comment|$blank_line)*/ | ||
- /: | ||
- meta_testml_statement | ||
- _: No TestML meta directive found | ||
- /: | ||
- meta_statement | ||
- comment | ||
- blank_line | ||
^: '*' | ||
|
||
comment: /$HASH$line/ | ||
line: /$NON_BREAK*$EOL/ | ||
blank_line: /$SPACE*$EOL/ | ||
|
||
meta_testml_statement: /%TestML:$SPACE+($testml_version)(?:$SPACE+$comment|$EOL)/ | ||
|
||
testml_version: /($DIGIT$DOT$DIGIT+)/ | ||
|
||
meta_statement: /%($meta_keyword):$SPACE+($meta_value)(?:$SPACE+$comment|$EOL)/ | ||
|
||
meta_keyword: /(?:$core_meta_keyword|$user_meta_keyword)/ | ||
core_meta_keyword: /(?:Title|Data|Plan|BlockMarker|PointMarker)/ | ||
user_meta_keyword: /$LOWER$WORD*/ | ||
|
||
meta_value: /(?:$single_quoted_string|$double_quoted_string|$unquoted_string)/ | ||
|
||
single_quoted_string: /(?:$SINGLE(([^$BREAK$BACK$SINGLE]|$BACK$SINGLE|$BACK$BACK)*?)$SINGLE)/ | ||
|
||
double_quoted_string: /(?:$DOUBLE(([^$BREAK$BACK$DOUBLE]|$BACK$DOUBLE|$BACK$BACK|$BACK$ESCAPE)*?)$DOUBLE)/ | ||
|
||
unquoted_string: /[^$SPACES$BREAK$HASH](?:[^$BREAK$HASH]*[^$SPACES$BREAK$HASH])?/ | ||
|
||
test_section: | ||
- /: | ||
- ws | ||
- test_statement | ||
^: '*' | ||
|
||
ws: /(?:$SPACE|$EOL|$comment)/ | ||
|
||
test_statement: | ||
- test_expression | ||
- =: assertion_expression | ||
^: '?' | ||
- /: | ||
- /;/ | ||
- _: You seem to be missing a semicolon | ||
|
||
test_expression: | ||
- sub_expression | ||
- /: | ||
- - '!assertion_call_start' | ||
- call_indicator | ||
- sub_expression | ||
^: '*' | ||
|
||
sub_expression: | ||
- /: | ||
- transform_call | ||
- data_point | ||
- quoted_string | ||
- constant | ||
|
||
transform_call: | ||
- transform_name | ||
- /\($ws*/ | ||
- argument_list | ||
- /$ws*\)/ | ||
|
||
transform_name: | ||
/: | ||
- user_transform | ||
- core_transform | ||
|
||
user_transform: /($LOWER$WORD*)/ | ||
|
||
core_transform: /($UPPER$WORD*)/ | ||
|
||
call_indicator: /(?:$DOT$ws*|$ws*$DOT)/ | ||
|
||
data_point: /($DOLLAR$LOWER$WORD*)/ | ||
|
||
constant: /($UPPER$WORD*)/ | ||
|
||
argument_list: | ||
=: | ||
- argument | ||
- =: | ||
- /$ws*,$ws*/ | ||
- argument | ||
^: '*' | ||
^: '?' | ||
|
||
argument: | ||
- sub_expression | ||
|
||
quoted_string: | ||
/: | ||
- single_quoted_string | ||
- double_quoted_string | ||
|
||
assertion_expression: | ||
/: | ||
- assertion_operation | ||
- assertion_call | ||
|
||
assertion_operation: | ||
- /$ws+/ | ||
- assertion_operator | ||
- /$ws+/ | ||
- test_expression | ||
|
||
assertion_operator: /(==)/ | ||
|
||
assertion_call: | ||
- assertion_call_start | ||
- test_expression | ||
- /$ws*\)/ | ||
|
||
assertion_call_start: | ||
- /$call_indicator$assertion_name\($ws*/ | ||
|
||
assertion_name: /EQ/ | ||
|
||
data_section: /($block_marker(?:$SPACE|$EOL)$ANY+|\Z)/ | ||
|
||
data: | ||
=: data_block | ||
^: '*' | ||
|
||
data_block: | ||
- block_header | ||
- /: | ||
- blank_line | ||
- comment | ||
^: '*' | ||
- =: block_point | ||
^: '*' | ||
|
||
block_header: | ||
- block_marker | ||
- =: | ||
- /$SPACE+/ | ||
- block_label | ||
^: '?' | ||
- /$SPACE*$EOL/ | ||
|
||
block_marker: /===/ | ||
|
||
block_label: | ||
- /([^$SPACES$BREAK]($NON_BREAK*[^SPACES$BREAK])?)/ | ||
|
||
block_point: | ||
/: | ||
- lines_point | ||
- phrase_point | ||
|
||
lines_point: | ||
- /$point_marker$SPACE+/ | ||
- user_point_name | ||
- /$SPACE*$EOL/ | ||
- point_lines | ||
|
||
user_point_name: /($LOWER$WORD*)/ | ||
|
||
point_lines: /((?:(?!$block_marker|$point_marker)$line)*)/ | ||
|
||
phrase_point: | ||
- /$point_marker$SPACE+/ | ||
- user_point_name | ||
- /:$SPACE/ | ||
- point_phrase | ||
- /$EOL/ | ||
- /(?:$comment|$blank_line)*/ | ||
|
||
point_phrase: /($NON_BREAK*)/ | ||
|
||
|
||
point_marker: /---/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
line_comment_start: '#' | ||
|
||
TQ: '""""' # Python triple quote | ||
|
||
DocCommentBegin: /$TQ$BS$WS*$EOL/ | ||
DocCommentLine: /($ANY*$EOL)/ | ||
DocCommentEnd: /$TQ$WS*$EOL/ | ||
|
||
IncludeCDent: /from cdent import */ | ||
|
||
Class: | ||
- ClassSignatureLine | ||
- ClassBody | ||
|
||
ClassSignatureLine: /class$WS+$Id$OP$Id?$CP$CN$EOL/ | ||
|
Empty file.
Empty file.