From 73cc49d8e814df7e344b31c392b237aa5086a80f Mon Sep 17 00:00:00 2001 From: MathieuAA Date: Mon, 18 Apr 2016 00:00:11 +0200 Subject: [PATCH] Fixed: #12 --- lib/dsl/grammar.txt | 14 ++++++++------ lib/dsl/jdl_parser.js | 6 ++++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/dsl/grammar.txt b/lib/dsl/grammar.txt index 57a13593..b3e5fdc6 100644 --- a/lib/dsl/grammar.txt +++ b/lib/dsl/grammar.txt @@ -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:''};} @@ -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]+ diff --git a/lib/dsl/jdl_parser.js b/lib/dsl/jdl_parser.js index ddb8adf4..d00c122e 100644 --- a/lib/dsl/jdl_parser.js +++ b/lib/dsl/jdl_parser.js @@ -191,7 +191,7 @@ module.exports = (function() { peg$c106 = { type: "class", value: "[A-Z]", description: "[A-Z]" }, peg$c107 = /^[a-zA-Z0-9]/, peg$c108 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" }, - peg$c109 = function(head, tail) {return makeString(concat([head],tail));}, + peg$c109 = function(head, tail) {return head + tail.join('');}, peg$c110 = "required", peg$c111 = { type: "literal", value: "required", description: "\"required\"" }, peg$c112 = function() {return {key:'required', value:''};}, @@ -229,7 +229,9 @@ module.exports = (function() { peg$c144 = { type: "class", value: "[A-Z0-9]", description: "[A-Z0-9]" }, peg$c145 = /^[A-Z0-9_]/, peg$c146 = { type: "class", value: "[A-Z0-9_]", description: "[A-Z0-9_]" }, - peg$c147 = function(underscore, head, tail) {return makeString(concat(concat(underscore,[head]), tail));}, + peg$c147 = function(underscore, head, tail) { + return underscore.join('') + head + tail.join(''); + }, peg$c148 = { type: "other", description: "integer" }, peg$c149 = /^[0-9]/, peg$c150 = { type: "class", value: "[0-9]", description: "[0-9]" },