Merge pull request #792 from jopapo/master

Added exclude weekdays to definition
This commit is contained in:
Knut Sveidqvist 2019-05-28 22:12:18 +02:00 committed by GitHub
commit 9191663a1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 165 additions and 38 deletions

View File

@ -22,6 +22,8 @@
**Merged pull requests:** **Merged pull requests:**
- Adding weekend ignore do Gantt [\$314] (https://github.com/knsv/mermaid/issues/314)
- Adding init argument to the global API [\#137](https://github.com/knsv/mermaid/pull/137) ([bollwyvl](https://github.com/bollwyvl)) - Adding init argument to the global API [\#137](https://github.com/knsv/mermaid/pull/137) ([bollwyvl](https://github.com/bollwyvl))
- Add description of manual calling of init [\#136](https://github.com/knsv/mermaid/pull/136) ([bollwyvl](https://github.com/bollwyvl)) - Add description of manual calling of init [\#136](https://github.com/knsv/mermaid/pull/136) ([bollwyvl](https://github.com/bollwyvl))

View File

@ -49,6 +49,7 @@ sequenceDiagram
gantt gantt
dateFormat YYYY-MM-DD dateFormat YYYY-MM-DD
title Adding GANTT diagram to mermaid title Adding GANTT diagram to mermaid
excludes weekdays 2014-01-10
section A section section A section
Completed task :done, des1, 2014-01-06,2014-01-08 Completed task :done, des1, 2014-01-06,2014-01-08

1
dist/index.html vendored
View File

@ -268,6 +268,7 @@ gantt
dateFormat YYYY-MM-DD dateFormat YYYY-MM-DD
axisFormat %d/%m axisFormat %d/%m
title Adding GANTT diagram to mermaid title Adding GANTT diagram to mermaid
excludes weekdays 2014-01-10
section A section section A section
Completed task :done, des1, 2014-01-06,2014-01-08 Completed task :done, des1, 2014-01-06,2014-01-08

View File

@ -17,10 +17,16 @@ describe('when parsing a gantt diagram it', function () {
parser.parse(str) parser.parse(str)
}) })
it('should handle an excludes definition', function () {
const str = 'gantt\ndateFormat yyyy-mm-dd\ntitle Adding gantt diagram functionality to mermaid\nexcludes weekdays 2019-02-01'
parser.parse(str)
})
it('should handle a section definition', function () { it('should handle a section definition', function () {
const str = 'gantt\n' + const str = 'gantt\n' +
'dateFormat yyyy-mm-dd\n' + 'dateFormat yyyy-mm-dd\n' +
'title Adding gantt diagram functionality to mermaid\n' + 'title Adding gantt diagram functionality to mermaid\n' +
'excludes weekdays 2019-02-01\n' +
'section Documentation' 'section Documentation'
parser.parse(str) parser.parse(str)

View File

@ -3,6 +3,7 @@ import { logger } from '../../logger'
let dateFormat = '' let dateFormat = ''
let axisFormat = '' let axisFormat = ''
let excludes = []
let title = '' let title = ''
let sections = [] let sections = []
let tasks = [] let tasks = []
@ -31,6 +32,10 @@ export const setDateFormat = function (txt) {
dateFormat = txt dateFormat = txt
} }
export const setExcludes = function (txt) {
excludes = txt.toLowerCase().split(/[\s,]+/)
}
export const setTitle = function (txt) { export const setTitle = function (txt) {
title = txt title = txt
} }
@ -58,6 +63,42 @@ export const getTasks = function () {
return tasks return tasks
} }
const isInvalidDate = function (date, dateFormat, excludes) {
if (date.isoWeekday() >= 6 && excludes.indexOf('weekends') >= 0) {
return true
}
if (excludes.indexOf(date.format('dddd').toLowerCase()) >= 0) {
return true
}
return excludes.indexOf(date.format(dateFormat.trim())) >= 0
}
const checkTaskDates = function (task, dateFormat, excludes) {
if (!excludes.length || task.manualEndTime) return
let startTime = moment(task.startTime, dateFormat, true)
startTime.add(1, 'd')
let endTime = moment(task.endTime, dateFormat, true)
let renderEndTime = fixTaskDates(startTime, endTime, dateFormat, excludes)
task.endTime = endTime.toDate()
task.renderEndTime = renderEndTime
}
const fixTaskDates = function (startTime, endTime, dateFormat, excludes) {
let invalid = false
let renderEndTime = null
while (startTime.date() <= endTime.date()) {
if (!invalid) {
renderEndTime = endTime.toDate()
}
invalid = isInvalidDate(startTime, dateFormat, excludes)
if (invalid) {
endTime.add(1, 'd')
}
startTime.add(1, 'd')
}
return renderEndTime
}
const getStartDate = function (prevTime, dateFormat, str) { const getStartDate = function (prevTime, dateFormat, str) {
str = str.trim() str = str.trim()
@ -77,8 +118,9 @@ const getStartDate = function (prevTime, dateFormat, str) {
} }
// Check for actual date set // Check for actual date set
if (moment(str, dateFormat.trim(), true).isValid()) { let mDate = moment(str, dateFormat.trim(), true)
return moment(str, dateFormat.trim(), true).toDate() if (mDate.isValid()) {
return mDate.toDate()
} else { } else {
logger.debug('Invalid date:' + str) logger.debug('Invalid date:' + str)
logger.debug('With date format:' + dateFormat.trim()) logger.debug('With date format:' + dateFormat.trim())
@ -92,8 +134,9 @@ const getEndDate = function (prevTime, dateFormat, str) {
str = str.trim() str = str.trim()
// Check for actual date // Check for actual date
if (moment(str, dateFormat.trim(), true).isValid()) { let mDate = moment(str, dateFormat.trim(), true)
return moment(str, dateFormat.trim()).toDate() if (mDate.isValid()) {
return mDate.toDate()
} }
const d = moment(prevTime) const d = moment(prevTime)
@ -119,7 +162,6 @@ const getEndDate = function (prevTime, dateFormat, str) {
d.add(durationStatement[1], 'weeks') d.add(durationStatement[1], 'weeks')
break break
} }
return d.toDate()
} }
// Default date - now // Default date - now
return d.toDate() return d.toDate()
@ -181,25 +223,32 @@ const compileData = function (prevTask, dataStr) {
data[i] = data[i].trim() data[i] = data[i].trim()
} }
let endTimeData = ''
switch (data.length) { switch (data.length) {
case 1: case 1:
task.id = parseId() task.id = parseId()
task.startTime = prevTask.endTime task.startTime = prevTask.endTime
task.endTime = getEndDate(task.startTime, dateFormat, data[0]) endTimeData = data[0]
break break
case 2: case 2:
task.id = parseId() task.id = parseId()
task.startTime = getStartDate(undefined, dateFormat, data[0]) task.startTime = getStartDate(undefined, dateFormat, data[0])
task.endTime = getEndDate(task.startTime, dateFormat, data[1]) endTimeData = data[1]
break break
case 3: case 3:
task.id = parseId(data[0]) task.id = parseId(data[0])
task.startTime = getStartDate(undefined, dateFormat, data[1]) task.startTime = getStartDate(undefined, dateFormat, data[1])
task.endTime = getEndDate(task.startTime, dateFormat, data[2]) endTimeData = data[2]
break break
default: default:
} }
if (endTimeData) {
task.endTime = getEndDate(task.startTime, dateFormat, endTimeData)
task.manualEndTime = endTimeData === moment(task.endTime).format(dateFormat.trim())
checkTaskDates(task, dateFormat, excludes)
}
return task return task
} }
@ -270,6 +319,8 @@ export const addTask = function (descr, data) {
section: currentSection, section: currentSection,
type: currentSection, type: currentSection,
processed: false, processed: false,
manualEndTime: false,
renderEndTime: null,
raw: { data: data }, raw: { data: data },
task: descr task: descr
} }
@ -333,6 +384,8 @@ const compileTasks = function () {
rawTasks[pos].endTime = getEndDate(rawTasks[pos].startTime, dateFormat, rawTasks[pos].raw.endTime.data) rawTasks[pos].endTime = getEndDate(rawTasks[pos].startTime, dateFormat, rawTasks[pos].raw.endTime.data)
if (rawTasks[pos].endTime) { if (rawTasks[pos].endTime) {
rawTasks[pos].processed = true rawTasks[pos].processed = true
rawTasks[pos].manualEndTime = rawTasks[pos].raw.endTime.data === moment(rawTasks[pos].endTime).format(dateFormat.trim())
checkTaskDates(rawTasks[pos], dateFormat, excludes)
} }
} }
@ -359,5 +412,6 @@ export default {
getTasks, getTasks,
addTask, addTask,
findTaskById, findTaskById,
addTaskOrg addTaskOrg,
setExcludes
} }

View File

@ -172,4 +172,60 @@ describe('when using the ganttDb', function () {
expect(tasks[2].startTime).toEqual(moment('2013-01-15', 'YYYY-MM-DD').toDate()) expect(tasks[2].startTime).toEqual(moment('2013-01-15', 'YYYY-MM-DD').toDate())
expect(tasks[2].endTime).toEqual(moment('2013-01-17', 'YYYY-MM-DD').toDate()) expect(tasks[2].endTime).toEqual(moment('2013-01-17', 'YYYY-MM-DD').toDate())
}) })
it('should ignore weekends', function () {
ganttDb.setDateFormat('YYYY-MM-DD')
ganttDb.setExcludes('weekends 2019-02-06,friday')
ganttDb.addSection('weekends skip test')
ganttDb.addTask('test1', 'id1,2019-02-01,1d')
ganttDb.addTask('test2', 'id2,after id1,2d')
ganttDb.addTask('test3', 'id3,after id2,7d')
ganttDb.addTask('test4', 'id4,2019-02-01,2019-02-20') // Fixed endTime
ganttDb.addTask('test5', 'id5,after id4,1d')
ganttDb.addSection('full ending taks on last day')
ganttDb.addTask('test6', 'id6,2019-02-13,2d')
ganttDb.addTask('test7', 'id7,after id6,1d')
const tasks = ganttDb.getTasks()
expect(tasks[0].startTime).toEqual(moment('2019-02-01', 'YYYY-MM-DD').toDate())
expect(tasks[0].endTime).toEqual(moment('2019-02-04', 'YYYY-MM-DD').toDate())
expect(tasks[0].renderEndTime).toEqual(moment('2019-02-02', 'YYYY-MM-DD').toDate())
expect(tasks[0].id).toEqual('id1')
expect(tasks[0].task).toEqual('test1')
expect(tasks[1].startTime).toEqual(moment('2019-02-04', 'YYYY-MM-DD').toDate())
expect(tasks[1].endTime).toEqual(moment('2019-02-07', 'YYYY-MM-DD').toDate())
expect(tasks[1].renderEndTime).toEqual(moment('2019-02-06', 'YYYY-MM-DD').toDate())
expect(tasks[1].id).toEqual('id2')
expect(tasks[1].task).toEqual('test2')
expect(tasks[2].startTime).toEqual(moment('2019-02-07', 'YYYY-MM-DD').toDate())
expect(tasks[2].endTime).toEqual(moment('2019-02-20', 'YYYY-MM-DD').toDate())
expect(tasks[2].renderEndTime).toEqual(moment('2019-02-20', 'YYYY-MM-DD').toDate())
expect(tasks[2].id).toEqual('id3')
expect(tasks[2].task).toEqual('test3')
expect(tasks[3].startTime).toEqual(moment('2019-02-01', 'YYYY-MM-DD').toDate())
expect(tasks[3].endTime).toEqual(moment('2019-02-20', 'YYYY-MM-DD').toDate())
expect(tasks[3].renderEndTime).toBeNull() // Fixed end
expect(tasks[3].id).toEqual('id4')
expect(tasks[3].task).toEqual('test4')
expect(tasks[4].startTime).toEqual(moment('2019-02-20', 'YYYY-MM-DD').toDate())
expect(tasks[4].endTime).toEqual(moment('2019-02-21', 'YYYY-MM-DD').toDate())
expect(tasks[4].renderEndTime).toEqual(moment('2019-02-21', 'YYYY-MM-DD').toDate())
expect(tasks[4].id).toEqual('id5')
expect(tasks[4].task).toEqual('test5')
expect(tasks[5].startTime).toEqual(moment('2019-02-13', 'YYYY-MM-DD').toDate())
expect(tasks[5].endTime).toEqual(moment('2019-02-18', 'YYYY-MM-DD').toDate())
expect(tasks[5].renderEndTime).toEqual(moment('2019-02-15', 'YYYY-MM-DD').toDate())
expect(tasks[5].id).toEqual('id6')
expect(tasks[5].task).toEqual('test6')
expect(tasks[6].startTime).toEqual(moment('2019-02-18', 'YYYY-MM-DD').toDate())
expect(tasks[6].endTime).toEqual(moment('2019-02-19', 'YYYY-MM-DD').toDate())
expect(tasks[6].id).toEqual('id7')
expect(tasks[6].task).toEqual('test7')
})
}) })

View File

@ -135,7 +135,7 @@ export const draw = function (text, id) {
return i * theGap + theTopPad return i * theGap + theTopPad
}) })
.attr('width', function (d) { .attr('width', function (d) {
return (timeScale(d.endTime) - timeScale(d.startTime)) return (timeScale(d.renderEndTime || d.endTime) - timeScale(d.startTime))
}) })
.attr('height', theBarHeight) .attr('height', theBarHeight)
.attr('class', function (d) { .attr('class', function (d) {
@ -178,7 +178,7 @@ export const draw = function (text, id) {
.attr('font-size', conf.fontSize) .attr('font-size', conf.fontSize)
.attr('x', function (d) { .attr('x', function (d) {
const startX = timeScale(d.startTime) const startX = timeScale(d.startTime)
const endX = timeScale(d.endTime) const endX = timeScale(d.renderEndTime || d.endTime)
const textWidth = this.getBBox().width const textWidth = this.getBBox().width
// Check id text width > width of rectangle // Check id text width > width of rectangle

View File

@ -20,14 +20,15 @@
"gantt" return 'gantt'; "gantt" return 'gantt';
"dateFormat"\s[^#\n;]+ return 'dateFormat'; "dateFormat"\s[^#\n;]+ return 'dateFormat';
"axisFormat"\s[^#\n;]+ return 'axisFormat'; "axisFormat"\s[^#\n;]+ return 'axisFormat';
"excludes"\s[^#\n;]+ return 'excludes';
\d\d\d\d"-"\d\d"-"\d\d return 'date'; \d\d\d\d"-"\d\d"-"\d\d return 'date';
"title"\s[^#\n;]+ return 'title'; "title"\s[^#\n;]+ return 'title';
"section"\s[^#:\n;]+ return 'section'; "section"\s[^#:\n;]+ return 'section';
[^#:\n;]+ return 'taskTxt'; [^#:\n;]+ return 'taskTxt';
":"[^#\n;]+ return 'taskData'; ":"[^#\n;]+ return 'taskData';
":" return ':'; ":" return ':';
<<EOF>> return 'EOF'; <<EOF>> return 'EOF';
. return 'INVALID'; . return 'INVALID';
/lex /lex
@ -56,6 +57,7 @@ line
statement statement
: 'dateFormat' {yy.setDateFormat($1.substr(11));$$=$1.substr(11);} : 'dateFormat' {yy.setDateFormat($1.substr(11));$$=$1.substr(11);}
| 'axisFormat' {yy.setAxisFormat($1.substr(11));$$=$1.substr(11);} | '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);} | title {yy.setTitle($1.substr(6));$$=$1.substr(6);}
| section {yy.addSection($1.substr(8));$$=$1.substr(8);} | section {yy.addSection($1.substr(8));$$=$1.substr(8);}
| taskTxt taskData {yy.addTask($1,$2);$$='task';} | taskTxt taskData {yy.addTask($1,$2);$$='task';}

View File

@ -72,12 +72,12 @@
} }
*/ */
var parser = (function(){ var parser = (function(){
var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[6,8,10,11,12,13,14,15],$V1=[1,9],$V2=[1,10],$V3=[1,11],$V4=[1,12],$V5=[1,13]; var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[6,8,10,11,12,13,14,15,16],$V1=[1,9],$V2=[1,10],$V3=[1,11],$V4=[1,12],$V5=[1,13],$V6=[1,14];
var parser = {trace: function trace () { }, var parser = {trace: function trace() { },
yy: {}, yy: {},
symbols_: {"error":2,"start":3,"gantt":4,"document":5,"EOF":6,"line":7,"SPACE":8,"statement":9,"NL":10,"dateFormat":11,"axisFormat":12,"title":13,"section":14,"taskTxt":15,"taskData":16,"$accept":0,"$end":1}, symbols_: {"error":2,"start":3,"gantt":4,"document":5,"EOF":6,"line":7,"SPACE":8,"statement":9,"NL":10,"dateFormat":11,"axisFormat":12,"excludes":13,"title":14,"section":15,"taskTxt":16,"taskData":17,"$accept":0,"$end":1},
terminals_: {2:"error",4:"gantt",6:"EOF",8:"SPACE",10:"NL",11:"dateFormat",12:"axisFormat",13:"title",14:"section",15:"taskTxt",16:"taskData"}, terminals_: {2:"error",4:"gantt",6:"EOF",8:"SPACE",10:"NL",11:"dateFormat",12:"axisFormat",13:"excludes",14:"title",15:"section",16:"taskTxt",17:"taskData"},
productions_: [0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,1],[9,1],[9,1],[9,2]], productions_: [0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,2]],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
/* this == yyval */ /* this == yyval */
@ -105,19 +105,22 @@ case 9:
yy.setAxisFormat($$[$0].substr(11));this.$=$$[$0].substr(11); yy.setAxisFormat($$[$0].substr(11));this.$=$$[$0].substr(11);
break; break;
case 10: case 10:
yy.setTitle($$[$0].substr(6));this.$=$$[$0].substr(6); yy.setExcludes($$[$0].substr(9));this.$=$$[$0].substr(9);
break; break;
case 11: case 11:
yy.addSection($$[$0].substr(8));this.$=$$[$0].substr(8); yy.setTitle($$[$0].substr(6));this.$=$$[$0].substr(6);
break; break;
case 12: case 12:
yy.addSection($$[$0].substr(8));this.$=$$[$0].substr(8);
break;
case 13:
yy.addTask($$[$0-1],$$[$0]);this.$='task'; yy.addTask($$[$0-1],$$[$0]);this.$='task';
break; break;
} }
}, },
table: [{3:1,4:[1,2]},{1:[3]},o($V0,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:$V1,12:$V2,13:$V3,14:$V4,15:$V5},o($V0,[2,7],{1:[2,1]}),o($V0,[2,3]),{9:14,11:$V1,12:$V2,13:$V3,14:$V4,15:$V5},o($V0,[2,5]),o($V0,[2,6]),o($V0,[2,8]),o($V0,[2,9]),o($V0,[2,10]),o($V0,[2,11]),{16:[1,15]},o($V0,[2,4]),o($V0,[2,12])], table: [{3:1,4:[1,2]},{1:[3]},o($V0,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:$V1,12:$V2,13:$V3,14:$V4,15:$V5,16:$V6},o($V0,[2,7],{1:[2,1]}),o($V0,[2,3]),{9:15,11:$V1,12:$V2,13:$V3,14:$V4,15:$V5,16:$V6},o($V0,[2,5]),o($V0,[2,6]),o($V0,[2,8]),o($V0,[2,9]),o($V0,[2,10]),o($V0,[2,11]),o($V0,[2,12]),{17:[1,16]},o($V0,[2,4]),o($V0,[2,13])],
defaultActions: {}, defaultActions: {},
parseError: function parseError (str, hash) { parseError: function parseError(str, hash) {
if (hash.recoverable) { if (hash.recoverable) {
this.trace(str); this.trace(str);
} else { } else {
@ -409,7 +412,7 @@ showPosition:function () {
}, },
// test the lexed token: return FALSE when not a match, otherwise return token // test the lexed token: return FALSE when not a match, otherwise return token
test_match:function(match, indexed_rule) { test_match:function (match, indexed_rule) {
var token, var token,
lines, lines,
backup; backup;
@ -539,7 +542,7 @@ next:function () {
}, },
// return next match that has a token // return next match that has a token
lex:function lex () { lex:function lex() {
var r = this.next(); var r = this.next();
if (r) { if (r) {
return r; return r;
@ -549,12 +552,12 @@ lex:function lex () {
}, },
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
begin:function begin (condition) { begin:function begin(condition) {
this.conditionStack.push(condition); this.conditionStack.push(condition);
}, },
// pop the previously active lexer condition state off the condition stack // pop the previously active lexer condition state off the condition stack
popState:function popState () { popState:function popState() {
var n = this.conditionStack.length - 1; var n = this.conditionStack.length - 1;
if (n > 0) { if (n > 0) {
return this.conditionStack.pop(); return this.conditionStack.pop();
@ -564,7 +567,7 @@ popState:function popState () {
}, },
// produce the lexer rule set which is active for the currently active lexer condition state // produce the lexer rule set which is active for the currently active lexer condition state
_currentRules:function _currentRules () { _currentRules:function _currentRules() {
if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
} else { } else {
@ -573,7 +576,7 @@ _currentRules:function _currentRules () {
}, },
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
topState:function topState (n) { topState:function topState(n) {
n = this.conditionStack.length - 1 - Math.abs(n || 0); n = this.conditionStack.length - 1 - Math.abs(n || 0);
if (n >= 0) { if (n >= 0) {
return this.conditionStack[n]; return this.conditionStack[n];
@ -583,7 +586,7 @@ topState:function topState (n) {
}, },
// alias for begin(condition) // alias for begin(condition)
pushState:function pushState (condition) { pushState:function pushState(condition) {
this.begin(condition); this.begin(condition);
}, },
@ -611,9 +614,9 @@ case 5:return 11;
break; break;
case 6:return 12; case 6:return 12;
break; break;
case 7:return 'date'; case 7:return 13;
break; break;
case 8:return 13; case 8:return 'date';
break; break;
case 9:return 14; case 9:return 14;
break; break;
@ -621,16 +624,18 @@ case 10:return 15;
break; break;
case 11:return 16; case 11:return 16;
break; break;
case 12:return ':'; case 12:return 17;
break; break;
case 13:return 6; case 13:return ':';
break; break;
case 14:return 'INVALID'; case 14:return 6;
break;
case 15:return 'INVALID';
break; break;
} }
}, },
rules: [/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:gantt\b)/i,/^(?:dateFormat\s[^#\n;]+)/i,/^(?:axisFormat\s[^#\n;]+)/i,/^(?:\d\d\d\d-\d\d-\d\d\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i], rules: [/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:gantt\b)/i,/^(?:dateFormat\s[^#\n;]+)/i,/^(?:axisFormat\s[^#\n;]+)/i,/^(?:excludes\s[^#\n;]+)/i,/^(?:\d\d\d\d-\d\d-\d\d\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],
conditions: {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],"inclusive":true}} conditions: {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],"inclusive":true}}
}); });
return lexer; return lexer;
})(); })();
@ -647,7 +652,7 @@ if (typeof require !== 'undefined' && typeof exports !== 'undefined') {
exports.parser = parser; exports.parser = parser;
exports.Parser = parser.Parser; exports.Parser = parser.Parser;
exports.parse = function () { return parser.parse.apply(parser, arguments); }; exports.parse = function () { return parser.parse.apply(parser, arguments); };
exports.main = function commonjsMain (args) { exports.main = function commonjsMain(args) {
if (!args[1]) { if (!args[1]) {
console.log('Usage: '+args[0]+' FILE'); console.log('Usage: '+args[0]+' FILE');
process.exit(1); process.exit(1);