Skip to content
This repository has been archived by the owner on Oct 28, 2019. It is now read-only.

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
Now can deal with enum values containing underscores, such as:
  - _ABC,
  - DE_F,
  - GHI_,
  - __ABC_,
  - ___DE_F__,
  - etc.

See #44 for the reported issue.
  • Loading branch information
MathieuAA committed Aug 21, 2015
1 parent 4239206 commit 02f5077
Show file tree
Hide file tree
Showing 3 changed files with 210 additions and 171 deletions.
10 changes: 5 additions & 5 deletions lib/dsl/exemple.jh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sentity Departement{
departementName String
entity Department{
departmentName String
}

entity JobHistory{
Expand All @@ -21,7 +21,7 @@ entity Employee{
phoneNumber String,
hireDAte DateTime,
salary Long,
comissionPct Long
commissionPct Long
}

entity Location {
Expand All @@ -42,7 +42,7 @@ entity Country{


relationship OneToMany{
Departement{employee} to Employee{departement}
Department{employee} to Employee{departement}
}

relationship OneToMany{
Expand All @@ -66,5 +66,5 @@ relationship ManyToMany{
}

relationship OneToOne{
Departement{location} to Location{department}
Department{location} to Location{department}
}
8 changes: 4 additions & 4 deletions lib/dsl/grammar.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
*
* This the grammar we used to generate the parser jhGrammar.js
* We use the online tool http://pegjs.org/online to generate the parser
* Modifying this file wont affect the program, this just to have a more readable grammar.
* This the grammar we use to generate the parser jhGrammar.js.
* We use the online tool http://pegjs.org/online to generate the parser.
* Modifying this file won't affect the program, this is just to have a more readable grammar.
*/

{
Expand Down Expand Up @@ -89,7 +89,7 @@ ENUMNAME "an enum name"
= head:[A-Z]tail:[a-zA-Z0-9]* {return makeString(concat([head],tail));}

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

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

0 comments on commit 02f5077

Please sign in to comment.