taskjuggler 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +280 -0
- data/README +31 -0
- data/Rakefile +20 -0
- data/benchmarks/UTF-8-Strings.rb +58 -0
- data/benchmarks/allocate.tjp +30 -0
- data/benchmarks/booking.tjp +62 -0
- data/benchmarks/depends.tjp +112 -0
- data/benchmarks/htmltaskreport.tjp +45 -0
- data/benchmarks/runbench.rb +24 -0
- data/bin/tj3 +3 -0
- data/bin/tj3man +3 -0
- data/doc/classes/AppConfig.html +808 -0
- data/doc/classes/Arguments.html +226 -0
- data/doc/classes/String.html +395 -0
- data/doc/classes/TaskJuggler.html +1358 -0
- data/doc/classes/TaskJuggler/Account.html +257 -0
- data/doc/classes/TaskJuggler/AccountScenario.html +218 -0
- data/doc/classes/TaskJuggler/Allocation.html +419 -0
- data/doc/classes/TaskJuggler/AllocationAttribute.html +291 -0
- data/doc/classes/TaskJuggler/AttributeBase.html +608 -0
- data/doc/classes/TaskJuggler/AttributeDefinition.html +259 -0
- data/doc/classes/TaskJuggler/Booking.html +307 -0
- data/doc/classes/TaskJuggler/BookingListAttribute.html +263 -0
- data/doc/classes/TaskJuggler/BooleanAttribute.html +261 -0
- data/doc/classes/TaskJuggler/CSVFile.html +325 -0
- data/doc/classes/TaskJuggler/Charge.html +279 -0
- data/doc/classes/TaskJuggler/ChargeListAttribute.html +229 -0
- data/doc/classes/TaskJuggler/ChargeSet.html +440 -0
- data/doc/classes/TaskJuggler/ChargeSetListAttribute.html +276 -0
- data/doc/classes/TaskJuggler/ColumnTable.html +260 -0
- data/doc/classes/TaskJuggler/DateAttribute.html +194 -0
- data/doc/classes/TaskJuggler/DependencyListAttribute.html +267 -0
- data/doc/classes/TaskJuggler/DurationAttribute.html +229 -0
- data/doc/classes/TaskJuggler/FixnumAttribute.html +194 -0
- data/doc/classes/TaskJuggler/FlagListAttribute.html +263 -0
- data/doc/classes/TaskJuggler/FloatAttribute.html +229 -0
- data/doc/classes/TaskJuggler/GanttChart.html +667 -0
- data/doc/classes/TaskJuggler/GanttContainer.html +441 -0
- data/doc/classes/TaskJuggler/GanttHeader.html +280 -0
- data/doc/classes/TaskJuggler/GanttHeaderScaleItem.html +245 -0
- data/doc/classes/TaskJuggler/GanttLine.html +398 -0
- data/doc/classes/TaskJuggler/GanttLoadStack.html +327 -0
- data/doc/classes/TaskJuggler/GanttMilestone.html +415 -0
- data/doc/classes/TaskJuggler/GanttRouter.html +425 -0
- data/doc/classes/TaskJuggler/GanttTaskBar.html +429 -0
- data/doc/classes/TaskJuggler/HTMLDocument.html +240 -0
- data/doc/classes/TaskJuggler/HTMLGraphics.html +231 -0
- data/doc/classes/TaskJuggler/Interval.html +552 -0
- data/doc/classes/TaskJuggler/IntervalListAttribute.html +267 -0
- data/doc/classes/TaskJuggler/KeywordDocumentation.html +796 -0
- data/doc/classes/TaskJuggler/Limits.html +416 -0
- data/doc/classes/TaskJuggler/Limits/Limit.html +381 -0
- data/doc/classes/TaskJuggler/LimitsAttribute.html +261 -0
- data/doc/classes/TaskJuggler/Log.html +613 -0
- data/doc/classes/TaskJuggler/LogicalAttribute.html +226 -0
- data/doc/classes/TaskJuggler/LogicalExpression.html +251 -0
- data/doc/classes/TaskJuggler/LogicalFlag.html +229 -0
- data/doc/classes/TaskJuggler/LogicalFunction.html +324 -0
- data/doc/classes/TaskJuggler/LogicalOperation.html +299 -0
- data/doc/classes/TaskJuggler/Macro.html +194 -0
- data/doc/classes/TaskJuggler/MacroParser.html +360 -0
- data/doc/classes/TaskJuggler/MacroTable.html +366 -0
- data/doc/classes/TaskJuggler/Message.html +281 -0
- data/doc/classes/TaskJuggler/MessageHandler.html +215 -0
- data/doc/classes/TaskJuggler/Project.html +1606 -0
- data/doc/classes/TaskJuggler/ProjectFileParser.html +412 -0
- data/doc/classes/TaskJuggler/PropertyList.html +597 -0
- data/doc/classes/TaskJuggler/PropertySet.html +1200 -0
- data/doc/classes/TaskJuggler/PropertyTreeNode.html +1449 -0
- data/doc/classes/TaskJuggler/Query.html +600 -0
- data/doc/classes/TaskJuggler/RealFormat.html +252 -0
- data/doc/classes/TaskJuggler/ReferenceAttribute.html +194 -0
- data/doc/classes/TaskJuggler/Report.html +528 -0
- data/doc/classes/TaskJuggler/ReportElement.html +1070 -0
- data/doc/classes/TaskJuggler/ReportTable.html +497 -0
- data/doc/classes/TaskJuggler/ReportTableCell.html +518 -0
- data/doc/classes/TaskJuggler/ReportTableColumn.html +364 -0
- data/doc/classes/TaskJuggler/ReportTableElement.html +644 -0
- data/doc/classes/TaskJuggler/ReportTableLegend.html +343 -0
- data/doc/classes/TaskJuggler/ReportTableLine.html +431 -0
- data/doc/classes/TaskJuggler/Resource.html +211 -0
- data/doc/classes/TaskJuggler/ResourceListAttribute.html +267 -0
- data/doc/classes/TaskJuggler/ResourceListRE.html +249 -0
- data/doc/classes/TaskJuggler/ResourceScenario.html +1137 -0
- data/doc/classes/TaskJuggler/RichText.html +537 -0
- data/doc/classes/TaskJuggler/RichTextAttribute.html +229 -0
- data/doc/classes/TaskJuggler/RichTextDocument.html +418 -0
- data/doc/classes/TaskJuggler/RichTextElement.html +829 -0
- data/doc/classes/TaskJuggler/RichTextException.html +212 -0
- data/doc/classes/TaskJuggler/RichTextParser.html +317 -0
- data/doc/classes/TaskJuggler/RichTextProtocolExample.html +303 -0
- data/doc/classes/TaskJuggler/RichTextProtocolHandler.html +194 -0
- data/doc/classes/TaskJuggler/RichTextScanner.html +561 -0
- data/doc/classes/TaskJuggler/RichTextSnip.html +364 -0
- data/doc/classes/TaskJuggler/RichTextSyntaxRules.html +883 -0
- data/doc/classes/TaskJuggler/Scenario.html +163 -0
- data/doc/classes/TaskJuggler/ScenarioData.html +354 -0
- data/doc/classes/TaskJuggler/Scoreboard.html +638 -0
- data/doc/classes/TaskJuggler/Shift.html +255 -0
- data/doc/classes/TaskJuggler/ShiftAssignment.html +488 -0
- data/doc/classes/TaskJuggler/ShiftAssignments.html +715 -0
- data/doc/classes/TaskJuggler/ShiftAssignmentsAttribute.html +261 -0
- data/doc/classes/TaskJuggler/ShiftScenario.html +282 -0
- data/doc/classes/TaskJuggler/SourceFileInfo.html +247 -0
- data/doc/classes/TaskJuggler/StringAttribute.html +229 -0
- data/doc/classes/TaskJuggler/SymbolAttribute.html +194 -0
- data/doc/classes/TaskJuggler/SyntaxReference.html +516 -0
- data/doc/classes/TaskJuggler/TOCEntry.html +242 -0
- data/doc/classes/TaskJuggler/TableColumnDefinition.html +273 -0
- data/doc/classes/TaskJuggler/TableOfContents.html +256 -0
- data/doc/classes/TaskJuggler/Task.html +203 -0
- data/doc/classes/TaskJuggler/TaskDependency.html +251 -0
- data/doc/classes/TaskJuggler/TaskListAttribute.html +267 -0
- data/doc/classes/TaskJuggler/TaskListRE.html +250 -0
- data/doc/classes/TaskJuggler/TaskScenario.html +2206 -0
- data/doc/classes/TaskJuggler/TextParser.html +670 -0
- data/doc/classes/TaskJuggler/TextParser/Pattern.html +923 -0
- data/doc/classes/TaskJuggler/TextParser/Rule.html +779 -0
- data/doc/classes/TaskJuggler/TextParser/StackElement.html +267 -0
- data/doc/classes/TaskJuggler/TextParser/TextParserResultArray.html +212 -0
- data/doc/classes/TaskJuggler/TextParser/TokenDoc.html +221 -0
- data/doc/classes/TaskJuggler/TextScanner.html +708 -0
- data/doc/classes/TaskJuggler/TextScanner/BufferStreamHandle.html +355 -0
- data/doc/classes/TaskJuggler/TextScanner/FileStreamHandle.html +341 -0
- data/doc/classes/TaskJuggler/TextScanner/StreamHandle.html +260 -0
- data/doc/classes/TaskJuggler/TjException.html +185 -0
- data/doc/classes/TaskJuggler/TjTime.html +1845 -0
- data/doc/classes/TaskJuggler/TjpExample.html +310 -0
- data/doc/classes/TaskJuggler/TjpExportRE.html +329 -0
- data/doc/classes/TaskJuggler/TjpSyntaxRules.html +8928 -0
- data/doc/classes/TaskJuggler/UserManual.html +606 -0
- data/doc/classes/TaskJuggler/WorkingHours.html +582 -0
- data/doc/classes/TaskJuggler/WorkingHoursAttribute.html +284 -0
- data/doc/classes/TaskJuggler/XMLBlob.html +207 -0
- data/doc/classes/TaskJuggler/XMLComment.html +206 -0
- data/doc/classes/TaskJuggler/XMLDocument.html +293 -0
- data/doc/classes/TaskJuggler/XMLElement.html +341 -0
- data/doc/classes/TaskJuggler/XMLNamedText.html +174 -0
- data/doc/classes/TaskJuggler/XMLText.html +221 -0
- data/doc/files/COPYING.html +448 -0
- data/doc/files/README.html +134 -0
- data/doc/files/lib/AccountScenario_rb.html +116 -0
- data/doc/files/lib/Account_rb.html +118 -0
- data/doc/files/lib/Allocation_rb.html +118 -0
- data/doc/files/lib/AppConfig_rb.html +116 -0
- data/doc/files/lib/AttributeBase_rb.html +106 -0
- data/doc/files/lib/AttributeDefinition_rb.html +106 -0
- data/doc/files/lib/Attributes_rb.html +130 -0
- data/doc/files/lib/Booking_rb.html +106 -0
- data/doc/files/lib/ChargeSet_rb.html +116 -0
- data/doc/files/lib/Charge_rb.html +116 -0
- data/doc/files/lib/HTMLDocument_rb.html +116 -0
- data/doc/files/lib/Interval_rb.html +116 -0
- data/doc/files/lib/KeywordDocumentation_rb.html +122 -0
- data/doc/files/lib/Limits_rb.html +116 -0
- data/doc/files/lib/Log_rb.html +116 -0
- data/doc/files/lib/LogicalExpression_rb.html +122 -0
- data/doc/files/lib/LogicalFlag_rb.html +116 -0
- data/doc/files/lib/LogicalFunction_rb.html +116 -0
- data/doc/files/lib/LogicalOperation_rb.html +116 -0
- data/doc/files/lib/MacroParser_rb.html +118 -0
- data/doc/files/lib/MacroTable_rb.html +122 -0
- data/doc/files/lib/MessageHandler_rb.html +106 -0
- data/doc/files/lib/Message_rb.html +116 -0
- data/doc/files/lib/ProjectFileParser_rb.html +122 -0
- data/doc/files/lib/Project_rb.html +148 -0
- data/doc/files/lib/PropertyList_rb.html +106 -0
- data/doc/files/lib/PropertySet_rb.html +118 -0
- data/doc/files/lib/PropertyTreeNode_rb.html +106 -0
- data/doc/files/lib/Query_rb.html +116 -0
- data/doc/files/lib/RealFormat_rb.html +106 -0
- data/doc/files/lib/ResourceScenario_rb.html +116 -0
- data/doc/files/lib/Resource_rb.html +118 -0
- data/doc/files/lib/RichTextDocument_rb.html +120 -0
- data/doc/files/lib/RichTextElement_rb.html +120 -0
- data/doc/files/lib/RichTextParser_rb.html +120 -0
- data/doc/files/lib/RichTextProtocolExample_rb.html +120 -0
- data/doc/files/lib/RichTextProtocolHandler_rb.html +106 -0
- data/doc/files/lib/RichTextScanner_rb.html +116 -0
- data/doc/files/lib/RichTextSnip_rb.html +118 -0
- data/doc/files/lib/RichTextSyntaxRules_rb.html +106 -0
- data/doc/files/lib/RichText_rb.html +118 -0
- data/doc/files/lib/ScenarioData_rb.html +118 -0
- data/doc/files/lib/Scenario_rb.html +116 -0
- data/doc/files/lib/Scoreboard_rb.html +106 -0
- data/doc/files/lib/ShiftAssignments_rb.html +116 -0
- data/doc/files/lib/ShiftScenario_rb.html +116 -0
- data/doc/files/lib/Shift_rb.html +118 -0
- data/doc/files/lib/SourceFileInfo_rb.html +106 -0
- data/doc/files/lib/SyntaxReference_rb.html +122 -0
- data/doc/files/lib/TOCEntry_rb.html +118 -0
- data/doc/files/lib/TableColumnDefinition_rb.html +106 -0
- data/doc/files/lib/TableOfContents_rb.html +118 -0
- data/doc/files/lib/TaskDependency_rb.html +106 -0
- data/doc/files/lib/TaskJuggler_rb.html +120 -0
- data/doc/files/lib/TaskScenario_rb.html +116 -0
- data/doc/files/lib/Task_rb.html +118 -0
- data/doc/files/lib/TextParser/Pattern_rb.html +116 -0
- data/doc/files/lib/TextParser/Rule_rb.html +106 -0
- data/doc/files/lib/TextParser/StackElement_rb.html +106 -0
- data/doc/files/lib/TextParser/TokenDoc_rb.html +106 -0
- data/doc/files/lib/TextParser_rb.html +124 -0
- data/doc/files/lib/TextScanner_rb.html +128 -0
- data/doc/files/lib/Tj3Config_rb.html +118 -0
- data/doc/files/lib/TjException_rb.html +106 -0
- data/doc/files/lib/TjTime_rb.html +118 -0
- data/doc/files/lib/TjpExample_rb.html +116 -0
- data/doc/files/lib/TjpSyntaxRules_rb.html +106 -0
- data/doc/files/lib/UTF8String_rb.html +132 -0
- data/doc/files/lib/UserManual_rb.html +124 -0
- data/doc/files/lib/WorkingHours_rb.html +116 -0
- data/doc/files/lib/XMLDocument_rb.html +116 -0
- data/doc/files/lib/XMLElement_rb.html +116 -0
- data/doc/files/lib/reports/CSVFile_rb.html +116 -0
- data/doc/files/lib/reports/ColumnTable_rb.html +116 -0
- data/doc/files/lib/reports/GanttChart_rb.html +122 -0
- data/doc/files/lib/reports/GanttContainer_rb.html +116 -0
- data/doc/files/lib/reports/GanttHeaderScaleItem_rb.html +106 -0
- data/doc/files/lib/reports/GanttHeader_rb.html +116 -0
- data/doc/files/lib/reports/GanttLine_rb.html +126 -0
- data/doc/files/lib/reports/GanttLoadStack_rb.html +116 -0
- data/doc/files/lib/reports/GanttMilestone_rb.html +116 -0
- data/doc/files/lib/reports/GanttRouter_rb.html +106 -0
- data/doc/files/lib/reports/GanttTaskBar_rb.html +116 -0
- data/doc/files/lib/reports/HTMLGraphics_rb.html +106 -0
- data/doc/files/lib/reports/ReportElement_rb.html +118 -0
- data/doc/files/lib/reports/ReportTableCell_rb.html +106 -0
- data/doc/files/lib/reports/ReportTableColumn_rb.html +106 -0
- data/doc/files/lib/reports/ReportTableElement_rb.html +122 -0
- data/doc/files/lib/reports/ReportTableLegend_rb.html +106 -0
- data/doc/files/lib/reports/ReportTableLine_rb.html +116 -0
- data/doc/files/lib/reports/ReportTable_rb.html +118 -0
- data/doc/files/lib/reports/Report_rb.html +126 -0
- data/doc/files/lib/reports/ResourceListRE_rb.html +122 -0
- data/doc/files/lib/reports/TaskListRE_rb.html +122 -0
- data/doc/files/lib/reports/TjpExportRE_rb.html +116 -0
- data/doc/files/lib/taskjuggler3_rb.html +276 -0
- data/doc/files/lib/tj3man_rb.html +189 -0
- data/doc/fr_class_index.html +285 -0
- data/doc/fr_file_index.html +223 -0
- data/doc/fr_method_index.html +1953 -0
- data/doc/index.html +21 -0
- data/doc/rdoc-style.css +299 -0
- data/examples/tutorial.tjp +361 -0
- data/gem_spec.rb +30 -0
- data/lib/Account.rb +50 -0
- data/lib/AccountScenario.rb +39 -0
- data/lib/Allocation.rb +102 -0
- data/lib/AppConfig.rb +134 -0
- data/lib/AttributeBase.rb +131 -0
- data/lib/AttributeDefinition.rb +47 -0
- data/lib/Attributes.rb +478 -0
- data/lib/BatchProcessor.rb +209 -0
- data/lib/Booking.rb +59 -0
- data/lib/Charge.rb +71 -0
- data/lib/ChargeSet.rb +126 -0
- data/lib/HTMLDocument.rb +59 -0
- data/lib/Interval.rb +127 -0
- data/lib/KeywordDocumentation.rb +560 -0
- data/lib/Limits.rb +219 -0
- data/lib/Log.rb +160 -0
- data/lib/LogicalExpression.rb +71 -0
- data/lib/LogicalFlag.rb +34 -0
- data/lib/LogicalFunction.rb +102 -0
- data/lib/LogicalOperation.rb +118 -0
- data/lib/MacroParser.rb +77 -0
- data/lib/MacroTable.rb +84 -0
- data/lib/Message.rb +56 -0
- data/lib/MessageHandler.rb +34 -0
- data/lib/Project.rb +662 -0
- data/lib/ProjectFileParser.rb +333 -0
- data/lib/PropertyList.rb +181 -0
- data/lib/PropertySet.rb +304 -0
- data/lib/PropertyTreeNode.rb +461 -0
- data/lib/Query.rb +227 -0
- data/lib/RealFormat.rb +73 -0
- data/lib/Resource.rb +42 -0
- data/lib/ResourceScenario.rb +511 -0
- data/lib/RichText.rb +147 -0
- data/lib/RichTextDocument.rb +139 -0
- data/lib/RichTextElement.rb +391 -0
- data/lib/RichTextParser.rb +66 -0
- data/lib/RichTextProtocolExample.rb +65 -0
- data/lib/RichTextProtocolHandler.rb +35 -0
- data/lib/RichTextScanner.rb +390 -0
- data/lib/RichTextSnip.rb +104 -0
- data/lib/RichTextSyntaxRules.rb +265 -0
- data/lib/Scenario.rb +27 -0
- data/lib/ScenarioData.rb +65 -0
- data/lib/Scoreboard.rb +141 -0
- data/lib/Shift.rb +48 -0
- data/lib/ShiftAssignments.rb +291 -0
- data/lib/ShiftScenario.rb +46 -0
- data/lib/SourceFileInfo.rb +37 -0
- data/lib/SyntaxReference.rb +284 -0
- data/lib/TOCEntry.rb +76 -0
- data/lib/TableColumnDefinition.rb +54 -0
- data/lib/TableOfContents.rb +46 -0
- data/lib/Task.rb +37 -0
- data/lib/TaskDependency.rb +39 -0
- data/lib/TaskJuggler.rb +84 -0
- data/lib/TaskScenario.rb +1622 -0
- data/lib/TextParser.rb +416 -0
- data/lib/TextParser/Pattern.rb +263 -0
- data/lib/TextParser/Rule.rb +171 -0
- data/lib/TextParser/StackElement.rb +45 -0
- data/lib/TextParser/TokenDoc.rb +38 -0
- data/lib/TextScanner.rb +682 -0
- data/lib/Tj3Config.rb +27 -0
- data/lib/TjException.rb +27 -0
- data/lib/TjTime.rb +395 -0
- data/lib/TjpExample.rb +119 -0
- data/lib/TjpSyntaxRules.rb +4022 -0
- data/lib/UTF8String.rb +100 -0
- data/lib/UserManual.rb +282 -0
- data/lib/WorkingHours.rb +323 -0
- data/lib/XMLDocument.rb +54 -0
- data/lib/XMLElement.rb +175 -0
- data/lib/reports/CSVFile.rb +146 -0
- data/lib/reports/ColumnTable.rb +66 -0
- data/lib/reports/GanttChart.rb +308 -0
- data/lib/reports/GanttContainer.rb +107 -0
- data/lib/reports/GanttHeader.rb +141 -0
- data/lib/reports/GanttHeaderScaleItem.rb +42 -0
- data/lib/reports/GanttLine.rb +329 -0
- data/lib/reports/GanttLoadStack.rb +113 -0
- data/lib/reports/GanttMilestone.rb +80 -0
- data/lib/reports/GanttRouter.rb +375 -0
- data/lib/reports/GanttTaskBar.rb +95 -0
- data/lib/reports/HTMLGraphics.rb +65 -0
- data/lib/reports/Report.rb +344 -0
- data/lib/reports/ReportElement.rb +427 -0
- data/lib/reports/ReportTable.rb +144 -0
- data/lib/reports/ReportTableCell.rb +142 -0
- data/lib/reports/ReportTableColumn.rb +82 -0
- data/lib/reports/ReportTableElement.rb +852 -0
- data/lib/reports/ReportTableLegend.rb +167 -0
- data/lib/reports/ReportTableLine.rb +87 -0
- data/lib/reports/ResourceListRE.rb +72 -0
- data/lib/reports/TaskListRE.rb +73 -0
- data/lib/reports/TjpExportRE.rb +394 -0
- data/lib/taskjuggler3.rb +106 -0
- data/lib/tj3man.rb +88 -0
- data/manual/Day_To_Day_Juggling +168 -0
- data/manual/Getting_Started +61 -0
- data/manual/How_To_Contribute +185 -0
- data/manual/Installation +68 -0
- data/manual/Intro +102 -0
- data/manual/Reporting_Bugs +26 -0
- data/manual/Rich_Text_Attributes +90 -0
- data/manual/TaskJuggler_2x_Migration +40 -0
- data/manual/Tutorial +579 -0
- data/manual/fdl +450 -0
- data/prj_cfg.rb +43 -0
- data/setup.rb +1585 -0
- data/tasks/csts.rake +72 -0
- data/tasks/gem.rake +14 -0
- data/tasks/manual.rake +10 -0
- data/tasks/missing.rake +21 -0
- data/tasks/rcov.rake +14 -0
- data/tasks/rdoc.rake +17 -0
- data/tasks/rexml_fix.rb +16 -0
- data/tasks/rexml_fix_19.rb +49 -0
- data/tasks/show.rake +21 -0
- data/tasks/stats.rake +25 -0
- data/tasks/test.rake +11 -0
- data/test/MessageChecker.rb +53 -0
- data/test/TestSuite/CSV-Reports/celltext-Reference.csv +14 -0
- data/test/TestSuite/CSV-Reports/celltext.tjp +7 -0
- data/test/TestSuite/CSV-Reports/genrefs +6 -0
- data/test/TestSuite/CSV-Reports/project-1.tji +57 -0
- data/test/TestSuite/CSV-Reports/resourcereport-Reference.csv +4 -0
- data/test/TestSuite/CSV-Reports/resourcereport.tjp +10 -0
- data/test/TestSuite/CSV-Reports/resourcereport_with_tasks-Reference.csv +22 -0
- data/test/TestSuite/CSV-Reports/resourcereport_with_tasks.tjp +11 -0
- data/test/TestSuite/CSV-Reports/sortByTree-Reference.csv +14 -0
- data/test/TestSuite/CSV-Reports/sortByTree.tjp +8 -0
- data/test/TestSuite/CSV-Reports/sortBy_duration.down-Reference.csv +14 -0
- data/test/TestSuite/CSV-Reports/sortBy_duration.down.tjp +10 -0
- data/test/TestSuite/CSV-Reports/sortBy_effort.up-Reference.csv +14 -0
- data/test/TestSuite/CSV-Reports/sortBy_effort.up.tjp +10 -0
- data/test/TestSuite/CSV-Reports/sortBy_plan.start.down-Reference.csv +14 -0
- data/test/TestSuite/CSV-Reports/sortBy_plan.start.down.tjp +10 -0
- data/test/TestSuite/CSV-Reports/taskreport-Reference.csv +14 -0
- data/test/TestSuite/CSV-Reports/taskreport.tjp +10 -0
- data/test/TestSuite/CSV-Reports/taskreport_with_resources-Reference.csv +24 -0
- data/test/TestSuite/CSV-Reports/taskreport_with_resources.tjp +11 -0
- data/test/TestSuite/Scheduler/Correct/Allocate.tjp +86 -0
- data/test/TestSuite/Scheduler/Correct/AutomaticMilestones.tjp +63 -0
- data/test/TestSuite/Scheduler/Correct/Booking.tjp +161 -0
- data/test/TestSuite/Scheduler/Correct/Depends.tjp +50 -0
- data/test/TestSuite/Scheduler/Correct/Duration.tjp +34 -0
- data/test/TestSuite/Scheduler/Correct/InheritStartEnd.tjp +129 -0
- data/test/TestSuite/Scheduler/Correct/Limits.tjp +81 -0
- data/test/TestSuite/Scheduler/Correct/MultipleMandatories.tjp +43 -0
- data/test/TestSuite/Scheduler/Correct/Optimize-1.tjp +28 -0
- data/test/TestSuite/Scheduler/Correct/Optimize-2.tjp +33 -0
- data/test/TestSuite/Scheduler/Correct/Optimize-3.tjp +33 -0
- data/test/TestSuite/Scheduler/Correct/Optimize-4.tjp +34 -0
- data/test/TestSuite/Scheduler/Correct/Optimize-5.tjp +62 -0
- data/test/TestSuite/Scheduler/Correct/Precedes.tjp +50 -0
- data/test/TestSuite/Scheduler/Correct/Shift.tjp +102 -0
- data/test/TestSuite/Scheduler/Errors/account_no_leaf.tjp +13 -0
- data/test/TestSuite/Scheduler/Errors/booking_conflict.tjp +10 -0
- data/test/TestSuite/Scheduler/Errors/booking_no_duty.tjp +9 -0
- data/test/TestSuite/Scheduler/Errors/booking_on_vacation.tjp +9 -0
- data/test/TestSuite/Scheduler/Errors/container_booking.tjp +14 -0
- data/test/TestSuite/Scheduler/Errors/container_duration.tjp +11 -0
- data/test/TestSuite/Scheduler/Errors/effort_no_allocations.tjp +7 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_1.tjp +19 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_10.tjp +36 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_11.tjp +27 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_12.tjp +20 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_13.tjp +27 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_14.tjp +26 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_2.tjp +24 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_3.tjp +18 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_4.tjp +36 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_5.tjp +37 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_6.tjp +35 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_7.tjp +46 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_8.tjp +51 -0
- data/test/TestSuite/Scheduler/Errors/loop_detected_9.tjp +20 -0
- data/test/TestSuite/Scheduler/Errors/maxend.tjp +8 -0
- data/test/TestSuite/Scheduler/Errors/maxstart.tjp +8 -0
- data/test/TestSuite/Scheduler/Errors/milestone_booking.tjp +10 -0
- data/test/TestSuite/Scheduler/Errors/milestone_duration.tjp +8 -0
- data/test/TestSuite/Scheduler/Errors/milestone_start_end.tjp +8 -0
- data/test/TestSuite/Scheduler/Errors/minend.tjp +8 -0
- data/test/TestSuite/Scheduler/Errors/minstart.tjp +8 -0
- data/test/TestSuite/Scheduler/Errors/multiple_durations.tjp +11 -0
- data/test/TestSuite/Scheduler/Errors/no_tasks.tjp +6 -0
- data/test/TestSuite/Scheduler/Errors/not_scheduled.tjp +8 -0
- data/test/TestSuite/Scheduler/Errors/task_depend_child.tjp +10 -0
- data/test/TestSuite/Scheduler/Errors/task_depend_multi.tjp +13 -0
- data/test/TestSuite/Scheduler/Errors/task_depend_parent.tjp +11 -0
- data/test/TestSuite/Scheduler/Errors/task_depend_self.tjp +10 -0
- data/test/TestSuite/Scheduler/Errors/task_depend_unknown.tjp +10 -0
- data/test/TestSuite/Scheduler/Errors/task_overspecified_1.tjp +9 -0
- data/test/TestSuite/Scheduler/Errors/task_overspecified_2.tjp +14 -0
- data/test/TestSuite/Scheduler/Errors/task_overspecified_3.tjp +14 -0
- data/test/TestSuite/Scheduler/Errors/task_underspecified_1.tjp +8 -0
- data/test/TestSuite/Scheduler/Errors/task_underspecified_2.tjp +8 -0
- data/test/TestSuite/Scheduler/Errors/task_underspecified_3.tjp +9 -0
- data/test/TestSuite/Syntax/Correct/Account.tjp +53 -0
- data/test/TestSuite/Syntax/Correct/Allocate-1.tjp +24 -0
- data/test/TestSuite/Syntax/Correct/Alternative.tjp +13 -0
- data/test/TestSuite/Syntax/Correct/AutoMacros.tjp +14 -0
- data/test/TestSuite/Syntax/Correct/Booking.tjp +26 -0
- data/test/TestSuite/Syntax/Correct/Caption.tjp +33 -0
- data/test/TestSuite/Syntax/Correct/Celltext.tjp +28 -0
- data/test/TestSuite/Syntax/Correct/Comments.tjp +29 -0
- data/test/TestSuite/Syntax/Correct/Complete.tjp +16 -0
- data/test/TestSuite/Syntax/Correct/CompletedWork.tji +20 -0
- data/test/TestSuite/Syntax/Correct/CriticalPath.tjp +31 -0
- data/test/TestSuite/Syntax/Correct/Currencyformat.tjp +12 -0
- data/test/TestSuite/Syntax/Correct/CustomAttributes.tjp +14 -0
- data/test/TestSuite/Syntax/Correct/Depends1.tjp +22 -0
- data/test/TestSuite/Syntax/Correct/Durations.tjp +29 -0
- data/test/TestSuite/Syntax/Correct/Efficiency.tjp +19 -0
- data/test/TestSuite/Syntax/Correct/Export.tjp +40 -0
- data/test/TestSuite/Syntax/Correct/Flags.tjp +32 -0
- data/test/TestSuite/Syntax/Correct/Freeze.tjp +28 -0
- data/test/TestSuite/Syntax/Correct/Gap.tjp +15 -0
- data/test/TestSuite/Syntax/Correct/HtmlTaskReport.tjp +33 -0
- data/test/TestSuite/Syntax/Correct/Limits-1.tjp +71 -0
- data/test/TestSuite/Syntax/Correct/LoadUnits.tjp +31 -0
- data/test/TestSuite/Syntax/Correct/Macro-1.tjp +19 -0
- data/test/TestSuite/Syntax/Correct/Mandatory.tjp +17 -0
- data/test/TestSuite/Syntax/Correct/Milestone.tjp +12 -0
- data/test/TestSuite/Syntax/Correct/MinMax.tjp +17 -0
- data/test/TestSuite/Syntax/Correct/Numberformat.tjp +12 -0
- data/test/TestSuite/Syntax/Correct/Period.tjp +16 -0
- data/test/TestSuite/Syntax/Correct/Persistent.tjp +11 -0
- data/test/TestSuite/Syntax/Correct/Precedes1.tjp +17 -0
- data/test/TestSuite/Syntax/Correct/Priority.tjp +30 -0
- data/test/TestSuite/Syntax/Correct/Project.tjp +21 -0
- data/test/TestSuite/Syntax/Correct/ProjectIDs.tjp +23 -0
- data/test/TestSuite/Syntax/Correct/RawHTML.tjp +29 -0
- data/test/TestSuite/Syntax/Correct/Reports.tjp +54 -0
- data/test/TestSuite/Syntax/Correct/Resource.tjp +20 -0
- data/test/TestSuite/Syntax/Correct/Responsible.tjp +16 -0
- data/test/TestSuite/Syntax/Correct/Scenario.tjp +15 -0
- data/test/TestSuite/Syntax/Correct/Scheduling.tjp +26 -0
- data/test/TestSuite/Syntax/Correct/Select.tjp +27 -0
- data/test/TestSuite/Syntax/Correct/Shift.tjp +55 -0
- data/test/TestSuite/Syntax/Correct/Simple.tjp +25 -0
- data/test/TestSuite/Syntax/Correct/String.tjp +12 -0
- data/test/TestSuite/Syntax/Correct/Supplement.tjp +24 -0
- data/test/TestSuite/Syntax/Correct/TaskRoot.tjp +34 -0
- data/test/TestSuite/Syntax/Correct/TimeFrame.tjp +19 -0
- data/test/TestSuite/Syntax/Correct/Timezone.tjp +8 -0
- data/test/TestSuite/Syntax/Correct/Vacation.tjp +33 -0
- data/test/TestSuite/Syntax/Correct/csvtest +16 -0
- data/test/TestSuite/Syntax/Correct/manual2example.rb +24 -0
- data/test/TestSuite/Syntax/Correct/tutorial.tjp +485 -0
- data/test/TestSuite/Syntax/Errors/bad_include.tjp +11 -0
- data/test/TestSuite/Syntax/Errors/booking_group.tjp +14 -0
- data/test/TestSuite/Syntax/Errors/booking_milestone.tjp +13 -0
- data/test/TestSuite/Syntax/Errors/booking_no_leaf.tjp +13 -0
- data/test/TestSuite/Syntax/Errors/chargeset.tjp +14 -0
- data/test/TestSuite/Syntax/Errors/chargeset_master.tjp +15 -0
- data/test/TestSuite/Syntax/Errors/container_attribute.tjp +13 -0
- data/test/TestSuite/Syntax/Errors/cost_acct_no_top.tjp +24 -0
- data/test/TestSuite/Syntax/Errors/cost_rev_same.tjp +24 -0
- data/test/TestSuite/Syntax/Errors/date_in_range.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/effort_zero.tjp +8 -0
- data/test/TestSuite/Syntax/Errors/empty.tjp +1 -0
- data/test/TestSuite/Syntax/Errors/export_bad_extn.tjp +9 -0
- data/test/TestSuite/Syntax/Errors/extend_id_cap.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/interval_end_in_range.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/interval_start_in_range.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/leaf_resource_id_expected.tjp +12 -0
- data/test/TestSuite/Syntax/Errors/misaligned_date.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/no_csv_suffix.tjp +10 -0
- data/test/TestSuite/Syntax/Errors/no_html_suffix.tjp +10 -0
- data/test/TestSuite/Syntax/Errors/operand_attribute.tjp +11 -0
- data/test/TestSuite/Syntax/Errors/operand_unkn_flag.tjp +11 -0
- data/test/TestSuite/Syntax/Errors/operand_unkn_scen.tjp +11 -0
- data/test/TestSuite/Syntax/Errors/overtime_range.tjp +13 -0
- data/test/TestSuite/Syntax/Errors/purge_no_list.tjp +8 -0
- data/test/TestSuite/Syntax/Errors/purge_unknown_id.tjp +8 -0
- data/test/TestSuite/Syntax/Errors/report_end.tjp +10 -0
- data/test/TestSuite/Syntax/Errors/report_redifinition.tjp +10 -0
- data/test/TestSuite/Syntax/Errors/report_start.tjp +10 -0
- data/test/TestSuite/Syntax/Errors/resource_exists.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/resource_id_expected.tjp +8 -0
- data/test/TestSuite/Syntax/Errors/rev_acct_no_top.tjp +24 -0
- data/test/TestSuite/Syntax/Errors/scenario_exists.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/shift_assignment_overlap.tjp +15 -0
- data/test/TestSuite/Syntax/Errors/shift_exists.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/shift_id_expected.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/sloppy_range.tjp +13 -0
- data/test/TestSuite/Syntax/Errors/sort_direction.tjp +11 -0
- data/test/TestSuite/Syntax/Errors/sort_unknown_scen.tjp +11 -0
- data/test/TestSuite/Syntax/Errors/sorting_crit_exptd1.tjp +11 -0
- data/test/TestSuite/Syntax/Errors/sorting_crit_exptd2.tjp +11 -0
- data/test/TestSuite/Syntax/Errors/sorting_wbs.tjp +11 -0
- data/test/TestSuite/Syntax/Errors/start_before_end1.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/start_before_end2.tjp +6 -0
- data/test/TestSuite/Syntax/Errors/task_complete.tjp +8 -0
- data/test/TestSuite/Syntax/Errors/task_exists.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/task_priority.tjp +8 -0
- data/test/TestSuite/Syntax/Errors/task_without_chargeset.tjp +9 -0
- data/test/TestSuite/Syntax/Errors/time_interval.tjp +12 -0
- data/test/TestSuite/Syntax/Errors/too_many_bangs.tjp +10 -0
- data/test/TestSuite/Syntax/Errors/undecl_flag.tjp +6 -0
- data/test/TestSuite/Syntax/Errors/unknown_projectid.tjp +7 -0
- data/test/TestSuite/Syntax/Errors/unknown_scenario_id.tjp +6 -0
- data/test/TestSuite/Syntax/Errors/unknown_scenario_idx.tjp +11 -0
- data/test/TestSuite/Syntax/Errors/unknown_task.tjp +10 -0
- data/test/all.rb +31 -0
- data/test/test_BatchProcessor.rb +54 -0
- data/test/test_CSV-Reports.rb +101 -0
- data/test/test_Limits.rb +104 -0
- data/test/test_LogicalExpression.rb +110 -0
- data/test/test_MacroTable.rb +51 -0
- data/test/test_Project.rb +57 -0
- data/test/test_PropertySet.rb +71 -0
- data/test/test_Query.rb +83 -0
- data/test/test_RealFormat.rb +83 -0
- data/test/test_RichText.rb +869 -0
- data/test/test_Scheduler.rb +42 -0
- data/test/test_ShiftAssignments.rb +77 -0
- data/test/test_Syntax.rb +41 -0
- data/test/test_TextScanner.rb +95 -0
- data/test/test_TjTime.rb +114 -0
- data/test/test_TjpExample.rb +169 -0
- data/test/test_UTF8String.rb +84 -0
- data/test/test_WorkingHours.rb +56 -0
- metadata +649 -0
@@ -0,0 +1,66 @@
|
|
1
|
+
#!/usr/bin/env ruby -w
|
2
|
+
# encoding: UTF-8
|
3
|
+
#
|
4
|
+
# = RichTextParser.rb -- The TaskJuggler III Project Management Software
|
5
|
+
#
|
6
|
+
# Copyright (c) 2006, 2007, 2008, 2009 by Chris Schlaeger <cs@kde.org>
|
7
|
+
#
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of version 2 of the GNU General Public License as
|
10
|
+
# published by the Free Software Foundation.
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'TextParser'
|
14
|
+
require 'RichTextScanner'
|
15
|
+
require 'RichTextSyntaxRules'
|
16
|
+
|
17
|
+
class TaskJuggler
|
18
|
+
|
19
|
+
# This is the parser class used by the RichText class to convert the input
|
20
|
+
# text into an intermediate representation. Most of the actual work is done
|
21
|
+
# by the generic TextParser class. The syntax description for the markup
|
22
|
+
# language is provided by the RichTextSyntaxRules module. To break the input
|
23
|
+
# String into tokens, the RichTextScanner class is used.
|
24
|
+
class RichTextParser < TextParser
|
25
|
+
|
26
|
+
include RichTextSyntaxRules
|
27
|
+
|
28
|
+
# Create the parser and initialize the rule set. _rt_ is the RichText object
|
29
|
+
# the resulting tree of RichTextElement objects should belong to.
|
30
|
+
def initialize(rt, sectionCounter = [ 0, 0, 0] )
|
31
|
+
super()
|
32
|
+
@richText = rt
|
33
|
+
# These are the tokens that can be returned by the RichTextScanner.
|
34
|
+
@variables = %w( LINEBREAK SPACE WORD BOLD ITALIC CODE BOLDITALIC PRE
|
35
|
+
HREF HREFEND REF REFEND HLINE
|
36
|
+
TITLE1 TITLE2 TITLE3 TITLE1END TITLE2END TITLE3END
|
37
|
+
BULLET1 BULLET2 BULLET3 NUMBER1 NUMBER2 NUMBER3 )
|
38
|
+
# Load the rule set into the parser.
|
39
|
+
initRules
|
40
|
+
# The sections and numbered list can each nest 3 levels deep. We use these
|
41
|
+
# counter Arrays to generate proper 1.2.3 type labels.
|
42
|
+
@sectionCounter = sectionCounter
|
43
|
+
@numberListCounter = [ 0, 0, 0 ]
|
44
|
+
end
|
45
|
+
|
46
|
+
# Construct the parser and get ready to read.
|
47
|
+
def open(text)
|
48
|
+
# Make sure that the last line is properly terminated with a newline.
|
49
|
+
# Multiple newlines at the end are simply ignored.
|
50
|
+
@scanner = RichTextScanner.new(text + "\n\n")
|
51
|
+
end
|
52
|
+
|
53
|
+
# Get the next token from the scanner.
|
54
|
+
def nextToken
|
55
|
+
@scanner.nextToken
|
56
|
+
end
|
57
|
+
|
58
|
+
# Return the last fetch token again to the scanner.
|
59
|
+
def returnToken(token)
|
60
|
+
@scanner.returnToken(token)
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
@@ -0,0 +1,65 @@
|
|
1
|
+
#!/usr/bin/env ruby -w
|
2
|
+
# encoding: UTF-8
|
3
|
+
#
|
4
|
+
# = RichTextProtocolExample.rb -- The TaskJuggler III Project Management Software
|
5
|
+
#
|
6
|
+
# Copyright (c) 2006, 2007, 2008, 2009 by Chris Schlaeger <cs@kde.org>
|
7
|
+
#
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of version 2 of the GNU General Public License as
|
10
|
+
# published by the Free Software Foundation.
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'RichTextProtocolHandler'
|
14
|
+
require 'TjpExample'
|
15
|
+
require 'XMLElement'
|
16
|
+
|
17
|
+
class TaskJuggler
|
18
|
+
|
19
|
+
# This class is a specialized RichTextProtocolHandler that turns references to
|
20
|
+
# TJP example code in the test/TestSuite/Syntax/Correct directory into
|
21
|
+
# embedded example code. It currently only supports HTML.
|
22
|
+
class RichTextProtocolExample < RichTextProtocolHandler
|
23
|
+
|
24
|
+
def initialize
|
25
|
+
super('example')
|
26
|
+
end
|
27
|
+
|
28
|
+
# Not supported for this protocol
|
29
|
+
def to_s(path, args)
|
30
|
+
''
|
31
|
+
end
|
32
|
+
|
33
|
+
# Return a XMLElement tree that represents the example file as HTML code.
|
34
|
+
def to_html(path, args)
|
35
|
+
if args.length > 1
|
36
|
+
raise "The example protocol may only take upto one argument."
|
37
|
+
elsif args.length == 1
|
38
|
+
tag = args[0]
|
39
|
+
else
|
40
|
+
tag = nil
|
41
|
+
end
|
42
|
+
|
43
|
+
example = TjpExample.new
|
44
|
+
fileName = AppConfig.dataDirs('test')[0] +
|
45
|
+
"TestSuite/Syntax/Correct/#{path}.tjp"
|
46
|
+
example.open(fileName)
|
47
|
+
frame = XMLElement.new('div', 'class' => 'codeframe')
|
48
|
+
frame << (pre = XMLElement.new('pre', 'class' => 'code'))
|
49
|
+
unless (text = example.to_s(tag))
|
50
|
+
raise "There is no tag '#{tag}' in file " +
|
51
|
+
"#{fileName}."
|
52
|
+
end
|
53
|
+
pre << XMLText.new(text)
|
54
|
+
frame
|
55
|
+
end
|
56
|
+
|
57
|
+
# Not supported for this protocol.
|
58
|
+
def to_tagged(path, args)
|
59
|
+
nil
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env ruby -w
|
2
|
+
# encoding: UTF-8
|
3
|
+
#
|
4
|
+
# = RichTextProtocolHandler.rb -- The TaskJuggler III Project Management Software
|
5
|
+
#
|
6
|
+
# Copyright (c) 2006, 2007, 2008, 2009 by Chris Schlaeger <cs@kde.org>
|
7
|
+
#
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of version 2 of the GNU General Public License as
|
10
|
+
# published by the Free Software Foundation.
|
11
|
+
#
|
12
|
+
|
13
|
+
class TaskJuggler
|
14
|
+
|
15
|
+
# This class is the abstract base class for all RichText protocol handlers. A
|
16
|
+
# protocol handler is responsible for a certain protocol such as 'example' or
|
17
|
+
# 'query'. Protocols are used in internal RichText references such as
|
18
|
+
# '[[example:Allocation 2]]'. 'example' is the protocol, 'Allocation' is the
|
19
|
+
# path and '2' is the first argument. Arguments are optional. Protocol handler
|
20
|
+
# can turn such internal references into Strings or XMLElement trees.
|
21
|
+
# Therefor, each derived handler needs to implement a to_s, to_html and
|
22
|
+
# to_tagged method that takes two parameter. The first is the path, the second
|
23
|
+
# is the argument Array.
|
24
|
+
class RichTextProtocolHandler
|
25
|
+
|
26
|
+
attr_reader :protocol
|
27
|
+
|
28
|
+
def initialize(protocol)
|
29
|
+
@protocol = protocol
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
@@ -0,0 +1,390 @@
|
|
1
|
+
#!/usr/bin/env ruby -w
|
2
|
+
# encoding: UTF-8
|
3
|
+
#
|
4
|
+
# = RichTextScanner.rb -- The TaskJuggler III Project Management Software
|
5
|
+
#
|
6
|
+
# Copyright (c) 2006, 2007, 2008, 2009 by Chris Schlaeger <cs@kde.org>
|
7
|
+
#
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of version 2 of the GNU General Public License as
|
10
|
+
# published by the Free Software Foundation.
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'UTF8String'
|
14
|
+
|
15
|
+
class TaskJuggler
|
16
|
+
|
17
|
+
# The RichTextScanner is used by the RichTextParser to chop the input text
|
18
|
+
# into digestable tokens. The parser and the scanner only communicate over
|
19
|
+
# RichTextScanner#nextToken and RichTextScanner#returnToken. The scanner can
|
20
|
+
# break the text into words and special tokens.
|
21
|
+
class RichTextScanner
|
22
|
+
|
23
|
+
# Create the RichTextScanner object and initialize all state variables.
|
24
|
+
def initialize(text)
|
25
|
+
# The token buffer is used to hold a returned token. Only one token can
|
26
|
+
# be returned at a time.
|
27
|
+
@tokenBuffer = nil
|
28
|
+
# A reference to the input text.
|
29
|
+
@text = text
|
30
|
+
# The reference text should not change during processing. So we can
|
31
|
+
# determine the length upfront. It's frequently used.
|
32
|
+
@textLength = text.length
|
33
|
+
# The number of current line.
|
34
|
+
@lineNo = 1
|
35
|
+
# This is the current position withing @text.
|
36
|
+
@pos = 0
|
37
|
+
# This flag is set to true whenever we are at the start of a text line.
|
38
|
+
@beginOfLine = true
|
39
|
+
# This is the position of the start of the currently processed line.
|
40
|
+
# It's only used for error reporting.
|
41
|
+
@lineStart = 0
|
42
|
+
# Most of the wiki markup interpretation can be turned on/off by using
|
43
|
+
# <nowiki>...</nowiki> in the text. This flag keeps this state.
|
44
|
+
@wikiEnabled = true
|
45
|
+
# Enable to trigger printout instead of exception.
|
46
|
+
@debug = false
|
47
|
+
end
|
48
|
+
|
49
|
+
# This is a wrapper for nextToken only used for debugging.
|
50
|
+
#def nextToken
|
51
|
+
# tok = nextTokenI
|
52
|
+
# puts "#{tok[0]}: #{tok[1]}"
|
53
|
+
# tok
|
54
|
+
#end
|
55
|
+
|
56
|
+
# Return the next token from the input text.
|
57
|
+
def nextToken
|
58
|
+
# If we have a returned token, this is returned first.
|
59
|
+
if @tokenBuffer
|
60
|
+
tok = @tokenBuffer
|
61
|
+
@tokenBuffer = nil
|
62
|
+
return tok
|
63
|
+
end
|
64
|
+
|
65
|
+
# Some characters have only a special meaning at the start of the line.
|
66
|
+
# When the last token pushed the cursor into a new line, this flag is set
|
67
|
+
# to true.
|
68
|
+
if @beginOfLine && @wikiEnabled
|
69
|
+
# Reset the flag again.
|
70
|
+
@beginOfLine = false
|
71
|
+
|
72
|
+
# We already know that the last newline was a real linebreak. Further
|
73
|
+
# newlines can safely be ignored.
|
74
|
+
readSequence("\n")
|
75
|
+
|
76
|
+
case (c = nextChar)
|
77
|
+
when '='
|
78
|
+
# Headings start with 2 or more = and must be followed by a space.
|
79
|
+
level = readSequenceMax('=', 4)
|
80
|
+
if level == 1
|
81
|
+
# 1 = does not mean anything. Push it back and process it as normal
|
82
|
+
# text further down.
|
83
|
+
returnChar
|
84
|
+
else
|
85
|
+
# Between the = characters and the title text must be exactly one
|
86
|
+
# space.
|
87
|
+
return [ "TITLE#{level - 1}", '=' * level ] if nextChar == ' '
|
88
|
+
# If that's missing, The = are treated as normal text further down.
|
89
|
+
returnChar(level + 1)
|
90
|
+
end
|
91
|
+
when '-'
|
92
|
+
# Horizontal ruler. Must have exactly 4 -.
|
93
|
+
level = readSequenceMax('-', 4)
|
94
|
+
return [ "HLINE", '-' * 4 ] if level == 4
|
95
|
+
returnChar(level)
|
96
|
+
when '*'
|
97
|
+
# Bullet lists start with one to three * characters.
|
98
|
+
level = readSequenceMax('*')
|
99
|
+
# Between the * characters and the bullet text must be exactly one
|
100
|
+
# space.
|
101
|
+
return [ "BULLET#{level}", '*' * level ] if nextChar == ' '
|
102
|
+
# If that's missing, The # are treated as normal text further down.
|
103
|
+
returnChar(level + 1)
|
104
|
+
when '#'
|
105
|
+
# Numbered list start with one to three # characters.
|
106
|
+
level = readSequenceMax('#')
|
107
|
+
# Between the # characters and the bullet text must be exactly one
|
108
|
+
# space.
|
109
|
+
return [ "NUMBER#{level}", '#' * level ] if nextChar == ' '
|
110
|
+
# If that's missing, The # are treated as normal text further down.
|
111
|
+
returnChar(level + 1)
|
112
|
+
when ' '
|
113
|
+
# Lines that start with a space are treated as verbatim text.
|
114
|
+
return [ "PRE", readCode ] if (c = peek) && c != "\n"
|
115
|
+
else
|
116
|
+
# If the character is not a known control character we push it back
|
117
|
+
# and treat it as normal text further down.
|
118
|
+
returnChar
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
# Not all sequences of inline markup characters are control sequences. In
|
123
|
+
# case we detect a sequence that has not the right number of characters,
|
124
|
+
# we push them back and start over with this flag set to true.
|
125
|
+
ignoreInlineMarkup = false
|
126
|
+
|
127
|
+
loop do
|
128
|
+
c = nextChar
|
129
|
+
if c.nil?
|
130
|
+
# We've reached the end of the text.
|
131
|
+
return [ '.', '<END>' ]
|
132
|
+
elsif c == ' ' || c == "\t"
|
133
|
+
# Sequences of tabs or spaces are treated as token boundaries, but
|
134
|
+
# otherwise they are ignored.
|
135
|
+
readSequence(' ', "\t")
|
136
|
+
return [ 'SPACE', ' ' ]
|
137
|
+
elsif c == "'" && !ignoreInlineMarkup && @wikiEnabled
|
138
|
+
# Sequence of 2 ' means italic, 3 ' means bold, 4 ' means monospaced
|
139
|
+
# code, 5 ' means italic and bold. Anything else is just normal text.
|
140
|
+
level = readSequenceMax("'", 5)
|
141
|
+
if level == 2
|
142
|
+
return [ 'ITALIC', "'" * level ]
|
143
|
+
elsif level == 3
|
144
|
+
return [ 'BOLD', "'" * level ]
|
145
|
+
elsif level == 4
|
146
|
+
return [ 'CODE', "'" * level ]
|
147
|
+
elsif level == 5
|
148
|
+
return [ 'BOLDITALIC', "'" * level ]
|
149
|
+
else
|
150
|
+
# We have not found the right syntax. Treat the found characters as
|
151
|
+
# normal text. Push all ' back and start again but ignoring the '
|
152
|
+
# code for once.
|
153
|
+
returnChar(level)
|
154
|
+
ignoreInlineMarkup = true
|
155
|
+
next
|
156
|
+
end
|
157
|
+
elsif c == '=' && !ignoreInlineMarkup && @wikiEnabled
|
158
|
+
level = readSequenceMax('=', 4)
|
159
|
+
if level > 1
|
160
|
+
return [ "TITLE#{level - 1}END", '=' * level ]
|
161
|
+
else
|
162
|
+
# We have not found the right syntax. Treat found characters as
|
163
|
+
# normal text. Push all = back and start again but ignoring the =
|
164
|
+
# code for once.
|
165
|
+
returnChar(level)
|
166
|
+
ignoreInlineMarkup = true
|
167
|
+
next
|
168
|
+
end
|
169
|
+
elsif c == '[' && @wikiEnabled
|
170
|
+
level = readSequenceMax('[', 2)
|
171
|
+
return [ level == 1 ? 'HREF' : 'REF', '[' * level ]
|
172
|
+
elsif c == ']' && @wikiEnabled
|
173
|
+
level = readSequenceMax(']', 2)
|
174
|
+
return [ level == 1 ? 'HREFEND' : 'REFEND', ']' * level ]
|
175
|
+
elsif c == "\n"
|
176
|
+
# Newlines are pretty important as they can terminate blocks and turn
|
177
|
+
# the next character into the start of a control sequence.
|
178
|
+
# Hard linebreaks consist of a newline followed by another newline or
|
179
|
+
# any of the begin-of-line control characters.
|
180
|
+
if (c = nextChar) && "\n*# =-".include?(c)
|
181
|
+
returnChar if c != "\n"
|
182
|
+
# The next character may be a control character.
|
183
|
+
@beginOfLine = true
|
184
|
+
return [ 'LINEBREAK', "\n" ]
|
185
|
+
elsif c.nil?
|
186
|
+
# We hit the end of the text.
|
187
|
+
return [ '.', '<END>' ]
|
188
|
+
else
|
189
|
+
# Single line breaks are treated as spaces. Return the char after
|
190
|
+
# the newline and start with this one again.
|
191
|
+
returnChar
|
192
|
+
return [ 'SPACE', ' ' ]
|
193
|
+
end
|
194
|
+
elsif c == '<'
|
195
|
+
if peekMatch('nowiki>')
|
196
|
+
# Turn most wiki markup interpretation off.
|
197
|
+
@pos += 'nowiki>'.length
|
198
|
+
@wikiEnabled = false
|
199
|
+
next
|
200
|
+
elsif peekMatch('/nowiki>')
|
201
|
+
# Turn most wiki markup interpretation on.
|
202
|
+
@pos += '/nowiki>'.length
|
203
|
+
@wikiEnabled = true
|
204
|
+
next
|
205
|
+
else
|
206
|
+
returnChar
|
207
|
+
end
|
208
|
+
else
|
209
|
+
# Reset this flag again.
|
210
|
+
ignoreInlineMarkup = false
|
211
|
+
str = ''
|
212
|
+
str << c
|
213
|
+
# Now we can collect characters of a word until we hit a whitespace.
|
214
|
+
while (c = nextChar) && !" \n\t".include?(c)
|
215
|
+
if @wikiEnabled
|
216
|
+
# Or at least to ' characters in a row.
|
217
|
+
break if c == "'" && peek == "'"
|
218
|
+
# Or a ] or <
|
219
|
+
break if ']<'.include?(c)
|
220
|
+
else
|
221
|
+
# Make sure we find the </nowiki> tag even within a word.
|
222
|
+
break if c == '<'
|
223
|
+
end
|
224
|
+
str << c
|
225
|
+
end
|
226
|
+
# Return the character that indicated the word end.
|
227
|
+
returnChar
|
228
|
+
return [ 'WORD', str ]
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
# Return the last issued token to the token buffer.
|
234
|
+
def returnToken(token)
|
235
|
+
unless @tokenBuffer.nil?
|
236
|
+
raise TjException.new, 'Token buffer overflow!'
|
237
|
+
end
|
238
|
+
@tokenBuffer = token
|
239
|
+
end
|
240
|
+
|
241
|
+
# Report the current cursor position.
|
242
|
+
def sourceFileInfo
|
243
|
+
[ @lineNo, @pos ]
|
244
|
+
end
|
245
|
+
|
246
|
+
# This function makes more sense for parsers that process actual files. As
|
247
|
+
# we don't have a file name, we just return 'input text'.
|
248
|
+
def fileName
|
249
|
+
'input text'
|
250
|
+
end
|
251
|
+
|
252
|
+
# The parser uses this function to report any errors during parsing.
|
253
|
+
def error(id, text, foo)
|
254
|
+
if @debug
|
255
|
+
$stderr.puts "Line #{@lineNo}: #{text}\n" +
|
256
|
+
"#{@text[@lineStart, @pos - @lineStart]}"
|
257
|
+
else
|
258
|
+
raise RichTextException.new(id, @lineNo, text,
|
259
|
+
@text[@lineStart, @pos - @lineStart])
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
private
|
264
|
+
|
265
|
+
# Deliver the next character. Keep track of the cursor position. In case we
|
266
|
+
# reach the end, nil is returned.
|
267
|
+
def nextChar
|
268
|
+
return nil if @pos >= @textLength
|
269
|
+
c = @text[@pos]
|
270
|
+
@pos += 1
|
271
|
+
if c == ?\n
|
272
|
+
@lineNo += 1
|
273
|
+
# Save the position of the line start for later use during error
|
274
|
+
# reporting. The line begins after the newline.
|
275
|
+
@lineStart = @pos
|
276
|
+
end
|
277
|
+
# Since Ruby 1.9 is returning Strings for String#[] we need to emulate
|
278
|
+
# this for Ruby 1.8.
|
279
|
+
'' << c
|
280
|
+
end
|
281
|
+
|
282
|
+
# Return one or more characters. _n_ is the number of characters to move
|
283
|
+
# back the cursor.
|
284
|
+
def returnChar(n = 1)
|
285
|
+
crossedNewline = false
|
286
|
+
if @pos <= @textLength && @pos >= n
|
287
|
+
# Check for newlines and update @lineNo accordingly.
|
288
|
+
n.times do |i|
|
289
|
+
if @text[@pos - i - 1] == ?\n
|
290
|
+
crossedNewline = true
|
291
|
+
@lineNo -= 1
|
292
|
+
end
|
293
|
+
end
|
294
|
+
@pos -= n
|
295
|
+
end
|
296
|
+
|
297
|
+
# If we have crossed a newline during rewind, we have to find the start of
|
298
|
+
# the current line again.
|
299
|
+
if crossedNewline
|
300
|
+
@lineStart = @pos
|
301
|
+
@lineStart -= 1 while @lineStart > 0 && @text[@lineStart - 1] != ?\n
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
305
|
+
# Return a character further up the text without moving the cursor.
|
306
|
+
# _lookAhead_ is the number of characters to peek ahead. A value of 0 would
|
307
|
+
# return the last character provided by nextChar().
|
308
|
+
def peek(lookAhead = 1)
|
309
|
+
return nil if (@pos + lookAhead - 1) >= @textLength
|
310
|
+
# Since Ruby 1.9 is returning Strings for String#[] we need to emulate
|
311
|
+
# this for Ruby 1.8.
|
312
|
+
'' << @text[@pos + lookAhead - 1]
|
313
|
+
end
|
314
|
+
|
315
|
+
# Return true if the next characters match exactly the character sequence in
|
316
|
+
# word.
|
317
|
+
def peekMatch(word)
|
318
|
+
# Since Ruby 1.9 is returning Strings for String#[] we need to emulate
|
319
|
+
# this for Ruby 1.8.
|
320
|
+
'' << @text[@pos, word.length] == word
|
321
|
+
end
|
322
|
+
|
323
|
+
# Read a sequence of characters that are all contained in the _chars_ Array.
|
324
|
+
# If a character is found that is not in _chars_ the method returns the so
|
325
|
+
# far found sequence of chars as String.
|
326
|
+
def readSequence(*chars)
|
327
|
+
sequence = ''
|
328
|
+
while chars.include?(c = nextChar)
|
329
|
+
sequence << c
|
330
|
+
end
|
331
|
+
# Push back the character that did no longer match.
|
332
|
+
returnChar
|
333
|
+
sequence
|
334
|
+
end
|
335
|
+
|
336
|
+
# Read a sequence of _c_ characters until a different character is found or
|
337
|
+
# _max_ count has been reached.
|
338
|
+
def readSequenceMax(c, max = 3)
|
339
|
+
i = 1
|
340
|
+
while nextChar == c && i < max
|
341
|
+
i += 1
|
342
|
+
end
|
343
|
+
# Return the non matching character.
|
344
|
+
returnChar
|
345
|
+
i
|
346
|
+
end
|
347
|
+
|
348
|
+
# Read a block of pre-formatted text. All lines must start with a space
|
349
|
+
# character.
|
350
|
+
def readCode
|
351
|
+
tok = ''
|
352
|
+
loop do
|
353
|
+
# Read until the end of the line
|
354
|
+
while (c = nextChar) && c != "\n"
|
355
|
+
# Append a found characters.
|
356
|
+
tok << c
|
357
|
+
end
|
358
|
+
# Append the newline.
|
359
|
+
tok << c
|
360
|
+
# If the next line does not start with a space, we've reached the end of
|
361
|
+
# the code block.
|
362
|
+
if (c = nextChar) && c != ' '
|
363
|
+
break
|
364
|
+
end
|
365
|
+
end
|
366
|
+
returnChar
|
367
|
+
@beginOfLine = true
|
368
|
+
tok
|
369
|
+
end
|
370
|
+
|
371
|
+
end
|
372
|
+
|
373
|
+
# Exception raised by the RichTextScanner in case of processing errors. Its
|
374
|
+
# primary purpose is to carry the id, lineNo, error message and the currently
|
375
|
+
# parsed line information.
|
376
|
+
class RichTextException < RuntimeError
|
377
|
+
|
378
|
+
attr_reader :lineNo, :id, :text, :line
|
379
|
+
|
380
|
+
def initialize(id, lineNo, msgText, line)
|
381
|
+
@id = id
|
382
|
+
@lineNo = lineNo
|
383
|
+
@text = msgText
|
384
|
+
@line = line
|
385
|
+
end
|
386
|
+
|
387
|
+
end
|
388
|
+
|
389
|
+
end
|
390
|
+
|