feat(gantt.jison): update parser to accept a inclusive end date arg

if a line contains inclusiveEndDates then it will toggle the chart to use inclusive end dates
This commit is contained in:
Jason Würtz 2019-07-07 16:28:31 -03:00
parent 0a567a3ef9
commit 16f3338b3d
2 changed files with 7 additions and 5 deletions

View File

@ -55,6 +55,7 @@ that id.
"gantt" return 'gantt';
"dateFormat"\s[^#\n;]+ return 'dateFormat';
"inclusiveEndDates" return 'inclusiveEndDates';
"axisFormat"\s[^#\n;]+ return 'axisFormat';
"excludes"\s[^#\n;]+ return 'excludes';
\d\d\d\d"-"\d\d"-"\d\d return 'date';
@ -91,9 +92,10 @@ line
;
statement
: 'dateFormat' {yy.setDateFormat($1.substr(11));$$=$1.substr(11);}
| 'axisFormat' {yy.setAxisFormat($1.substr(11));$$=$1.substr(11);}
| 'excludes' {yy.setExcludes($1.substr(9));$$=$1.substr(9);}
: dateFormat {yy.setDateFormat($1.substr(11));$$=$1.substr(11);}
| inclusiveEndDates {yy.enableInclusiveEndDates();$$=$1.substr(18);}
| axisFormat {yy.setAxisFormat($1.substr(11));$$=$1.substr(11);}
| excludes {yy.setExcludes($1.substr(9));$$=$1.substr(9);}
| title {yy.setTitle($1.substr(6));$$=$1.substr(6);}
| section {yy.addSection($1.substr(8));$$=$1.substr(8);}
| clickStatement

View File

@ -15,8 +15,8 @@ describe('when parsing a gantt diagram it', function () {
parser.parse(str)
})
it('should handle a dateFormat definition with inclusivity specified', function () {
const str = 'gantt\ndateFormat yyyy-mm-dd inclusive'
it('should handle a inclusive end date definition', function () {
const str = 'gantt\ndateFormat yyyy-mm-dd\ninclusiveEndDates'
parser.parse(str)
})