Skip to content
This repository has been archived by the owner on Mar 21, 2021. It is now read-only.

Commit

Permalink
Fixed: #12
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuAA committed Apr 17, 2016
1 parent 89e8679 commit 73cc49d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
14 changes: 8 additions & 6 deletions lib/dsl/grammar.txt
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ entityList

relationshipType = "OneToOne" {return "one-to-one";} / "OneToMany" {return "one-to-many";} / "ManyToOne" {return "many-to-one";} / "ManyToMany" {return "many-to-many";}

type "a type" = head:[A-Z]tail:[a-zA-Z0-9]* {return makeString(concat([head],tail));} //we must check afterward if the type is acceptable.
type "a type" = head:[A-Z]tail:[a-zA-Z0-9]* {return head + tail.join('');}

validation
= "required" {return {key:'required', value:''};}
Expand All @@ -253,22 +253,24 @@ REGEXP "a regular expression"
= word:[a-zA-Z0-9!@#$%^&*()_+\-=\[\]{};':\\|,.<>\/? ]* {return makeString(word);}

ENUMNAME "an enum name"
= head:[A-Z]tail:[a-zA-Z0-9]* {return makeString(concat([head],tail));}
= head:[A-Z]tail:[a-zA-Z0-9]* {return head + tail.join('');}

ENUMPROP "an enum property"
= underscore:[_]*head:[A-Z0-9]tail:[A-Z0-9_]* {return makeString(concat(concat(underscore,[head]), tail));}
= underscore:[_]*head:[A-Z0-9]tail:[A-Z0-9_]* {
return underscore.join('') + head + tail.join('');
}

INTEGER "integer"
= int:[0-9]+ {return parseInt(int.join(""), 10);}

INJECTEDFIELDNAME "an injected field"
= head:[a-zA-Z]tail:[a-zA-Z0-9()]* {return makeString(concat([head],tail));}
= head:[a-zA-Z]tail:[a-zA-Z0-9()]* {return head + tail.join('');}

ENTITYNAME "an entity name"
= head:[A-Z]tail:[a-zA-Z0-9]* {return makeString(concat([head],tail));}
= head:[A-Z]tail:[a-zA-Z0-9]* {return head + tail.join('');}

FIELDNAME "a field name"
= head:[a-zA-Z]tail:[a-zA-Z0-9]* {return makeString(concat([head],tail));}
= head:[a-zA-Z]tail:[a-zA-Z0-9]* {return head + tail.join('');}

space "a space"
= space:['\n'|'\t'|'\r'|' '|\u2028|\u2029]+
Expand Down
6 changes: 4 additions & 2 deletions lib/dsl/jdl_parser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 73cc49d

Please sign in to comment.