doc/TaskJuggler/TextParser/Scanner.html in taskjuggler-0.1.1 vs doc/TaskJuggler/TextParser/Scanner.html in taskjuggler-0.2.0

- old
+ new

@@ -250,16 +250,28 @@ <li><a href="../../TaskJuggler/HTMLElements.html">TaskJuggler::HTMLElements</a></li> <li><a href="../../TaskJuggler/HTMLGraphics.html">TaskJuggler::HTMLGraphics</a></li> + <li><a href="../../TaskJuggler/ICalReport.html">TaskJuggler::ICalReport</a></li> + + <li><a href="../../TaskJuggler/ICalendar.html">TaskJuggler::ICalendar</a></li> + + <li><a href="../../TaskJuggler/ICalendar/Component.html">TaskJuggler::ICalendar::Component</a></li> + + <li><a href="../../TaskJuggler/ICalendar/Event.html">TaskJuggler::ICalendar::Event</a></li> + + <li><a href="../../TaskJuggler/ICalendar/Journal.html">TaskJuggler::ICalendar::Journal</a></li> + + <li><a href="../../TaskJuggler/ICalendar/Person.html">TaskJuggler::ICalendar::Person</a></li> + + <li><a href="../../TaskJuggler/ICalendar/Todo.html">TaskJuggler::ICalendar::Todo</a></li> + <li><a href="../../TaskJuggler/Interval.html">TaskJuggler::Interval</a></li> <li><a href="../../TaskJuggler/IntervalList.html">TaskJuggler::IntervalList</a></li> - <li><a href="../../TaskJuggler/IntervalListAttribute.html">TaskJuggler::IntervalListAttribute</a></li> - <li><a href="../../TaskJuggler/JobInfo.html">TaskJuggler::JobInfo</a></li> <li><a href="../../TaskJuggler/Journal.html">TaskJuggler::Journal</a></li> <li><a href="../../TaskJuggler/JournalEntry.html">TaskJuggler::JournalEntry</a></li> @@ -370,10 +382,12 @@ <li><a href="../../TaskJuggler/ReportBase.html">TaskJuggler::ReportBase</a></li> <li><a href="../../TaskJuggler/ReportContext.html">TaskJuggler::ReportContext</a></li> + <li><a href="../../TaskJuggler/ReportScenario.html">TaskJuggler::ReportScenario</a></li> + <li><a href="../../TaskJuggler/ReportServer.html">TaskJuggler::ReportServer</a></li> <li><a href="../../TaskJuggler/ReportServerIface.html">TaskJuggler::ReportServerIface</a></li> <li><a href="../../TaskJuggler/ReportServerRecord.html">TaskJuggler::ReportServerRecord</a></li> @@ -428,10 +442,12 @@ <li><a href="../../TaskJuggler/ScenarioListAttribute.html">TaskJuggler::ScenarioListAttribute</a></li> <li><a href="../../TaskJuggler/Scoreboard.html">TaskJuggler::Scoreboard</a></li> + <li><a href="../../TaskJuggler/ScoreboardInterval.html">TaskJuggler::ScoreboardInterval</a></li> + <li><a href="../../TaskJuggler/SheetHandlerBase.html">TaskJuggler::SheetHandlerBase</a></li> <li><a href="../../TaskJuggler/SheetReceiver.html">TaskJuggler::SheetReceiver</a></li> <li><a href="../../TaskJuggler/SheetSender.html">TaskJuggler::SheetSender</a></li> @@ -474,10 +490,14 @@ <li><a href="../../TaskJuggler/TableOfContents.html">TaskJuggler::TableOfContents</a></li> <li><a href="../../TaskJuggler/TableReport.html">TaskJuggler::TableReport</a></li> + <li><a href="../../TaskJuggler/TagFile.html">TaskJuggler::TagFile</a></li> + + <li><a href="../../TaskJuggler/TagFile/TagFileEntry.html">TaskJuggler::TagFile::TagFileEntry</a></li> + <li><a href="../../TaskJuggler/Task.html">TaskJuggler::Task</a></li> <li><a href="../../TaskJuggler/TaskDepListAttribute.html">TaskJuggler::TaskDepListAttribute</a></li> <li><a href="../../TaskJuggler/TaskDependency.html">TaskJuggler::TaskDependency</a></li> @@ -524,10 +544,14 @@ <li><a href="../../TaskJuggler/TextParser/TokenDoc.html">TaskJuggler::TextParser::TokenDoc</a></li> <li><a href="../../TaskJuggler/TextReport.html">TaskJuggler::TextReport</a></li> + <li><a href="../../TaskJuggler/TimeInterval.html">TaskJuggler::TimeInterval</a></li> + + <li><a href="../../TaskJuggler/TimeIntervalListAttribute.html">TaskJuggler::TimeIntervalListAttribute</a></li> + <li><a href="../../TaskJuggler/TimeSheet.html">TaskJuggler::TimeSheet</a></li> <li><a href="../../TaskJuggler/TimeSheetReceiver.html">TaskJuggler::TimeSheetReceiver</a></li> <li><a href="../../TaskJuggler/TimeSheetRecord.html">TaskJuggler::TimeSheetRecord</a></li> @@ -678,53 +702,53 @@ <div class="method-source-code" id="new-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 194</span> -194: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">masterFile</span>, <span class="ruby-identifier">messageHandler</span>, <span class="ruby-identifier">log</span>, <span class="ruby-identifier">tokenPatterns</span>, <span class="ruby-identifier">defaultMode</span>) -195: <span class="ruby-ivar">@masterFile</span> = <span class="ruby-identifier">masterFile</span> -196: <span class="ruby-ivar">@messageHandler</span> = <span class="ruby-identifier">messageHandler</span> -197: <span class="ruby-ivar">@log</span> = <span class="ruby-identifier">log</span> -198: <span class="ruby-comment cmt"># This table contains all macros that may be expanded when found in the</span> -199: <span class="ruby-comment cmt"># text.</span> -200: <span class="ruby-ivar">@macroTable</span> = <span class="ruby-constant">MacroTable</span>.<span class="ruby-identifier">new</span> -201: <span class="ruby-comment cmt"># The currently processed IO object.</span> -202: <span class="ruby-ivar">@cf</span> = <span class="ruby-keyword kw">nil</span> -203: <span class="ruby-comment cmt"># This Array stores the currently processed nested files. It's an Array</span> -204: <span class="ruby-comment cmt"># of Arrays. The nested Array consists of 2 elements, the IO object and</span> -205: <span class="ruby-comment cmt"># the @tokenBuffer.</span> -206: <span class="ruby-ivar">@fileStack</span> = [] -207: <span class="ruby-comment cmt"># This flag is set if we have reached the end of a file. Since we will</span> -208: <span class="ruby-comment cmt"># only know when the next new token is requested that the file is really</span> -209: <span class="ruby-comment cmt"># done now, we have to use this flag.</span> -210: <span class="ruby-ivar">@finishLastFile</span> = <span class="ruby-keyword kw">false</span> -211: <span class="ruby-comment cmt"># True if the scanner operates on a buffer.</span> -212: <span class="ruby-ivar">@fileNameIsBuffer</span> = <span class="ruby-keyword kw">false</span> -213: <span class="ruby-comment cmt"># A SourceFileInfo of the start of the currently processed token.</span> -214: <span class="ruby-ivar">@startOfToken</span> = <span class="ruby-keyword kw">nil</span> -215: <span class="ruby-comment cmt"># Line number correction for error messages.</span> -216: <span class="ruby-ivar">@lineDelta</span> = <span class="ruby-value">0</span> -217: <span class="ruby-comment cmt"># Lists of regexps that describe the detectable tokens. The Arrays are</span> -218: <span class="ruby-comment cmt"># grouped by mode.</span> -219: <span class="ruby-ivar">@patternsByMode</span> = { } -220: <span class="ruby-comment cmt"># The currently active scanner mode.</span> -221: <span class="ruby-ivar">@scannerMode</span> = <span class="ruby-keyword kw">nil</span> -222: <span class="ruby-comment cmt"># The mode that the scanner is in at the start and end of file</span> -223: <span class="ruby-ivar">@defaultMode</span> = <span class="ruby-identifier">defaultMode</span> -224: <span class="ruby-comment cmt"># Points to the currently active pattern set as defined by the mode.</span> -225: <span class="ruby-ivar">@activePatterns</span> = <span class="ruby-keyword kw">nil</span> -226: -227: <span class="ruby-identifier">tokenPatterns</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pat</span><span class="ruby-operator">|</span> -228: <span class="ruby-identifier">type</span> = <span class="ruby-identifier">pat</span>[<span class="ruby-value">0</span>] -229: <span class="ruby-identifier">regExp</span> = <span class="ruby-identifier">pat</span>[<span class="ruby-value">1</span>] -230: <span class="ruby-identifier">mode</span> = <span class="ruby-identifier">pat</span>[<span class="ruby-value">2</span>] <span class="ruby-operator">||</span> <span class="ruby-value">:tjp</span> -231: <span class="ruby-identifier">postProc</span> = <span class="ruby-identifier">pat</span>[<span class="ruby-value">3</span>] -232: <span class="ruby-identifier">addPattern</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">regExp</span>, <span class="ruby-identifier">mode</span>, <span class="ruby-identifier">postProc</span>) -233: <span class="ruby-keyword kw">end</span> -234: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">mode</span> = <span class="ruby-identifier">defaultMode</span> -235: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 203</span> +203: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">masterFile</span>, <span class="ruby-identifier">messageHandler</span>, <span class="ruby-identifier">log</span>, <span class="ruby-identifier">tokenPatterns</span>, <span class="ruby-identifier">defaultMode</span>) +204: <span class="ruby-ivar">@masterFile</span> = <span class="ruby-identifier">masterFile</span> +205: <span class="ruby-ivar">@messageHandler</span> = <span class="ruby-identifier">messageHandler</span> +206: <span class="ruby-ivar">@log</span> = <span class="ruby-identifier">log</span> +207: <span class="ruby-comment cmt"># This table contains all macros that may be expanded when found in the</span> +208: <span class="ruby-comment cmt"># text.</span> +209: <span class="ruby-ivar">@macroTable</span> = <span class="ruby-constant">MacroTable</span>.<span class="ruby-identifier">new</span> +210: <span class="ruby-comment cmt"># The currently processed IO object.</span> +211: <span class="ruby-ivar">@cf</span> = <span class="ruby-keyword kw">nil</span> +212: <span class="ruby-comment cmt"># This Array stores the currently processed nested files. It's an Array</span> +213: <span class="ruby-comment cmt"># of Arrays. The nested Array consists of 2 elements, the IO object and</span> +214: <span class="ruby-comment cmt"># the @tokenBuffer.</span> +215: <span class="ruby-ivar">@fileStack</span> = [] +216: <span class="ruby-comment cmt"># This flag is set if we have reached the end of a file. Since we will</span> +217: <span class="ruby-comment cmt"># only know when the next new token is requested that the file is really</span> +218: <span class="ruby-comment cmt"># done now, we have to use this flag.</span> +219: <span class="ruby-ivar">@finishLastFile</span> = <span class="ruby-keyword kw">false</span> +220: <span class="ruby-comment cmt"># True if the scanner operates on a buffer.</span> +221: <span class="ruby-ivar">@fileNameIsBuffer</span> = <span class="ruby-keyword kw">false</span> +222: <span class="ruby-comment cmt"># A SourceFileInfo of the start of the currently processed token.</span> +223: <span class="ruby-ivar">@startOfToken</span> = <span class="ruby-keyword kw">nil</span> +224: <span class="ruby-comment cmt"># Line number correction for error messages.</span> +225: <span class="ruby-ivar">@lineDelta</span> = <span class="ruby-value">0</span> +226: <span class="ruby-comment cmt"># Lists of regexps that describe the detectable tokens. The Arrays are</span> +227: <span class="ruby-comment cmt"># grouped by mode.</span> +228: <span class="ruby-ivar">@patternsByMode</span> = { } +229: <span class="ruby-comment cmt"># The currently active scanner mode.</span> +230: <span class="ruby-ivar">@scannerMode</span> = <span class="ruby-keyword kw">nil</span> +231: <span class="ruby-comment cmt"># The mode that the scanner is in at the start and end of file</span> +232: <span class="ruby-ivar">@defaultMode</span> = <span class="ruby-identifier">defaultMode</span> +233: <span class="ruby-comment cmt"># Points to the currently active pattern set as defined by the mode.</span> +234: <span class="ruby-ivar">@activePatterns</span> = <span class="ruby-keyword kw">nil</span> +235: +236: <span class="ruby-identifier">tokenPatterns</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pat</span><span class="ruby-operator">|</span> +237: <span class="ruby-identifier">type</span> = <span class="ruby-identifier">pat</span>[<span class="ruby-value">0</span>] +238: <span class="ruby-identifier">regExp</span> = <span class="ruby-identifier">pat</span>[<span class="ruby-value">1</span>] +239: <span class="ruby-identifier">mode</span> = <span class="ruby-identifier">pat</span>[<span class="ruby-value">2</span>] <span class="ruby-operator">||</span> <span class="ruby-value">:tjp</span> +240: <span class="ruby-identifier">postProc</span> = <span class="ruby-identifier">pat</span>[<span class="ruby-value">3</span>] +241: <span class="ruby-identifier">addPattern</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">regExp</span>, <span class="ruby-identifier">mode</span>, <span class="ruby-identifier">postProc</span>) +242: <span class="ruby-keyword kw">end</span> +243: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">mode</span> = <span class="ruby-identifier">defaultMode</span> +244: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -759,14 +783,14 @@ <div class="method-source-code" id="add-acro-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 465</span> -465: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">addMacro</span>(<span class="ruby-identifier">macro</span>) -466: <span class="ruby-ivar">@macroTable</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">macro</span>) -467: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 474</span> +474: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">addMacro</span>(<span class="ruby-identifier">macro</span>) +475: <span class="ruby-ivar">@macroTable</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">macro</span>) +476: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -803,24 +827,24 @@ <div class="method-source-code" id="add-attern-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 245</span> -245: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">addPattern</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">regExp</span>, <span class="ruby-identifier">mode</span>, <span class="ruby-identifier">postProc</span> = <span class="ruby-keyword kw">nil</span>) -246: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">mode</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>) -247: <span class="ruby-identifier">mode</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> -248: <span class="ruby-comment cmt"># The pattern is active in multiple modes</span> -249: <span class="ruby-ivar">@patternsByMode</span>[<span class="ruby-identifier">m</span>] = [] <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@patternsByMode</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">m</span>) -250: <span class="ruby-ivar">@patternsByMode</span>[<span class="ruby-identifier">m</span>] <span class="ruby-operator">&lt;&lt;</span> [ <span class="ruby-identifier">type</span>, <span class="ruby-identifier">regExp</span>, <span class="ruby-identifier">postProc</span> ] -251: <span class="ruby-keyword kw">end</span> -252: <span class="ruby-keyword kw">else</span> -253: <span class="ruby-comment cmt"># The pattern is only active in one specific mode.</span> -254: <span class="ruby-ivar">@patternsByMode</span>[<span class="ruby-identifier">mode</span>] = [] <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@patternsByMode</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">mode</span>) -255: <span class="ruby-ivar">@patternsByMode</span>[<span class="ruby-identifier">mode</span>] <span class="ruby-operator">&lt;&lt;</span> [ <span class="ruby-identifier">type</span>, <span class="ruby-identifier">regExp</span>, <span class="ruby-identifier">postProc</span> ] -256: <span class="ruby-keyword kw">end</span> -257: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 254</span> +254: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">addPattern</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">regExp</span>, <span class="ruby-identifier">mode</span>, <span class="ruby-identifier">postProc</span> = <span class="ruby-keyword kw">nil</span>) +255: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">mode</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>) +256: <span class="ruby-identifier">mode</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> +257: <span class="ruby-comment cmt"># The pattern is active in multiple modes</span> +258: <span class="ruby-ivar">@patternsByMode</span>[<span class="ruby-identifier">m</span>] = [] <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@patternsByMode</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">m</span>) +259: <span class="ruby-ivar">@patternsByMode</span>[<span class="ruby-identifier">m</span>] <span class="ruby-operator">&lt;&lt;</span> [ <span class="ruby-identifier">type</span>, <span class="ruby-identifier">regExp</span>, <span class="ruby-identifier">postProc</span> ] +260: <span class="ruby-keyword kw">end</span> +261: <span class="ruby-keyword kw">else</span> +262: <span class="ruby-comment cmt"># The pattern is only active in one specific mode.</span> +263: <span class="ruby-ivar">@patternsByMode</span>[<span class="ruby-identifier">mode</span>] = [] <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@patternsByMode</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">mode</span>) +264: <span class="ruby-ivar">@patternsByMode</span>[<span class="ruby-identifier">mode</span>] <span class="ruby-operator">&lt;&lt;</span> [ <span class="ruby-identifier">type</span>, <span class="ruby-identifier">regExp</span>, <span class="ruby-identifier">postProc</span> ] +265: <span class="ruby-keyword kw">end</span> +266: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -849,19 +873,19 @@ <div class="method-source-code" id="close-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 289</span> -289: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close</span> -290: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@fileNameIsBuffer</span> -291: <span class="ruby-ivar">@log</span>.<span class="ruby-identifier">startProgressMeter</span>(<span class="ruby-node">&quot;Reading file #{@masterFile}&quot;</span>) -292: <span class="ruby-ivar">@log</span>.<span class="ruby-identifier">stopProgressMeter</span> -293: <span class="ruby-keyword kw">end</span> -294: <span class="ruby-ivar">@fileStack</span> = [] -295: <span class="ruby-ivar">@cf</span> = <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-keyword kw">nil</span> -296: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 298</span> +298: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close</span> +299: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@fileNameIsBuffer</span> +300: <span class="ruby-ivar">@log</span>.<span class="ruby-identifier">startProgressMeter</span>(<span class="ruby-node">&quot;Reading file #{@masterFile}&quot;</span>) +301: <span class="ruby-ivar">@log</span>.<span class="ruby-identifier">stopProgressMeter</span> +302: <span class="ruby-keyword kw">end</span> +303: <span class="ruby-ivar">@fileStack</span> = [] +304: <span class="ruby-ivar">@cf</span> = <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-keyword kw">nil</span> +305: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -890,14 +914,14 @@ <div class="method-source-code" id="error-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 494</span> -494: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">error</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">sfi</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">data</span> = <span class="ruby-keyword kw">nil</span>) -495: <span class="ruby-identifier">message</span>(<span class="ruby-value">:error</span>, <span class="ruby-identifier">id</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">sfi</span>, <span class="ruby-identifier">data</span>) -496: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 504</span> +504: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">error</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">sfi</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">data</span> = <span class="ruby-keyword kw">nil</span>) +505: <span class="ruby-identifier">message</span>(<span class="ruby-value">:error</span>, <span class="ruby-identifier">id</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">sfi</span>, <span class="ruby-identifier">data</span>) +506: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -910,44 +934,45 @@ <a name="method-i-expandMacro"></a> <div class="method-heading"> <span class="method-name">expandMacro</span><span - class="method-args">(prefix, args)</span> + class="method-args">(prefix, args, callLength)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> <p> Expand a macro and inject it into the input stream. <em>prefix</em> is any string that was found right before the macro call. We have to inject it before the expanded macro. <em>args</em> is an Array of Strings. The first -is the macro name, the rest are the parameters. +is the macro name, the rest are the parameters. <em>callLength</em> is the +number of characters for the complete macro call &#8220;${&#8230;}&#8221;. </p> <div class="method-source-code" id="expand-acro-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 478</span> -478: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">expandMacro</span>(<span class="ruby-identifier">prefix</span>, <span class="ruby-identifier">args</span>) -479: <span class="ruby-comment cmt"># Get the expanded macro from the @macroTable.</span> -480: <span class="ruby-identifier">macro</span>, <span class="ruby-identifier">text</span> = <span class="ruby-ivar">@macroTable</span>.<span class="ruby-identifier">resolve</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">sourceFileInfo</span>) -481: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">macro</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">text</span> -482: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'undefined_macro'</span>, <span class="ruby-node">&quot;Undefined macro '#{args[0]}' called&quot;</span>) -483: <span class="ruby-keyword kw">end</span> -484: -485: <span class="ruby-comment cmt"># If the expanded macro is empty, we can ignore it.</span> -486: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">text</span> <span class="ruby-operator">==</span> <span class="ruby-value str">''</span> -487: -488: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">injectMacro</span>(<span class="ruby-identifier">macro</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">prefix</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">text</span>) -489: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'macro_stack_overflow'</span>, <span class="ruby-value str">&quot;Too many nested macro calls.&quot;</span>) -490: <span class="ruby-keyword kw">end</span> -491: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 488</span> +488: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">expandMacro</span>(<span class="ruby-identifier">prefix</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">callLength</span>) +489: <span class="ruby-comment cmt"># Get the expanded macro from the @macroTable.</span> +490: <span class="ruby-identifier">macro</span>, <span class="ruby-identifier">text</span> = <span class="ruby-ivar">@macroTable</span>.<span class="ruby-identifier">resolve</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">sourceFileInfo</span>) +491: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">macro</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">text</span> +492: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'undefined_macro'</span>, <span class="ruby-node">&quot;Undefined macro '#{args[0]}' called&quot;</span>) +493: <span class="ruby-keyword kw">end</span> +494: +495: <span class="ruby-comment cmt"># If the expanded macro is empty, we can ignore it.</span> +496: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">text</span> <span class="ruby-operator">==</span> <span class="ruby-value str">''</span> +497: +498: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">injectMacro</span>(<span class="ruby-identifier">macro</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">prefix</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">text</span>, <span class="ruby-identifier">callLength</span>) +499: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'macro_stack_overflow'</span>, <span class="ruby-value str">&quot;Too many nested macro calls.&quot;</span>) +500: <span class="ruby-keyword kw">end</span> +501: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -977,14 +1002,14 @@ <div class="method-source-code" id="file-ame-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 346</span> -346: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fileName</span> -347: <span class="ruby-ivar">@cf</span> <span class="ruby-operator">?</span> <span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">fileName</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@masterFile</span> -348: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 355</span> +355: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fileName</span> +356: <span class="ruby-ivar">@cf</span> <span class="ruby-operator">?</span> <span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">fileName</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@masterFile</span> +357: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1016,46 +1041,46 @@ <div class="method-source-code" id="include-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 302</span> -302: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">include</span>(<span class="ruby-identifier">includeFileName</span>, <span class="ruby-identifier">sfi</span>, &amp;<span class="ruby-identifier">block</span>) -303: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">includeFileName</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">!=</span> <span class="ruby-value str">'/'</span> -304: <span class="ruby-identifier">pathOfCallingFile</span> = <span class="ruby-ivar">@fileStack</span>.<span class="ruby-identifier">last</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">dirname</span> -305: <span class="ruby-identifier">path</span> = <span class="ruby-identifier">pathOfCallingFile</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">?</span> <span class="ruby-value str">''</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">pathOfCallingFile</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'/'</span> -306: <span class="ruby-comment cmt"># If the included file is not an absolute name, we interpret the file</span> -307: <span class="ruby-comment cmt"># name relative to the including file.</span> -308: <span class="ruby-identifier">includeFileName</span> = <span class="ruby-identifier">path</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">includeFileName</span> -309: <span class="ruby-keyword kw">end</span> -310: -311: <span class="ruby-comment cmt"># Try to dectect recursive inclusions. This will not work if files are</span> -312: <span class="ruby-comment cmt"># accessed via filesystem links.</span> -313: <span class="ruby-ivar">@fileStack</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">entry</span><span class="ruby-operator">|</span> -314: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">includeFileName</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">entry</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">fileName</span> -315: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'include_recursion'</span>, -316: <span class="ruby-node">&quot;Recursive inclusion of #{includeFileName} detected&quot;</span>, <span class="ruby-identifier">sfi</span>) -317: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 311</span> +311: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">include</span>(<span class="ruby-identifier">includeFileName</span>, <span class="ruby-identifier">sfi</span>, &amp;<span class="ruby-identifier">block</span>) +312: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">includeFileName</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">!=</span> <span class="ruby-value str">'/'</span> +313: <span class="ruby-identifier">pathOfCallingFile</span> = <span class="ruby-ivar">@fileStack</span>.<span class="ruby-identifier">last</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">dirname</span> +314: <span class="ruby-identifier">path</span> = <span class="ruby-identifier">pathOfCallingFile</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">?</span> <span class="ruby-value str">''</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">pathOfCallingFile</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'/'</span> +315: <span class="ruby-comment cmt"># If the included file is not an absolute name, we interpret the file</span> +316: <span class="ruby-comment cmt"># name relative to the including file.</span> +317: <span class="ruby-identifier">includeFileName</span> = <span class="ruby-identifier">path</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">includeFileName</span> 318: <span class="ruby-keyword kw">end</span> 319: -320: <span class="ruby-comment cmt"># Save @tokenBuffer in the record of the parent file.</span> -321: <span class="ruby-ivar">@fileStack</span>.<span class="ruby-identifier">last</span>[<span class="ruby-value">1</span>] = <span class="ruby-ivar">@tokenBuffer</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@fileStack</span>.<span class="ruby-identifier">empty?</span> -322: <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-keyword kw">nil</span> -323: <span class="ruby-ivar">@finishLastFile</span> = <span class="ruby-keyword kw">false</span> -324: -325: <span class="ruby-comment cmt"># Open the new file and push the handle on the @fileStack.</span> -326: <span class="ruby-keyword kw">begin</span> -327: <span class="ruby-ivar">@fileStack</span> <span class="ruby-operator">&lt;&lt;</span> [ (<span class="ruby-ivar">@cf</span> = <span class="ruby-constant">FileStreamHandle</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">includeFileName</span>, <span class="ruby-ivar">@log</span>)), -328: <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">block</span> ] -329: <span class="ruby-ivar">@log</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;Parsing file #{includeFileName}&quot;</span> -330: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StandardError</span> -331: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'bad_include'</span>, <span class="ruby-node">&quot;Cannot open include file #{includeFileName}&quot;</span>, <span class="ruby-identifier">sfi</span>) -332: <span class="ruby-keyword kw">end</span> +320: <span class="ruby-comment cmt"># Try to dectect recursive inclusions. This will not work if files are</span> +321: <span class="ruby-comment cmt"># accessed via filesystem links.</span> +322: <span class="ruby-ivar">@fileStack</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">entry</span><span class="ruby-operator">|</span> +323: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">includeFileName</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">entry</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">fileName</span> +324: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'include_recursion'</span>, +325: <span class="ruby-node">&quot;Recursive inclusion of #{includeFileName} detected&quot;</span>, <span class="ruby-identifier">sfi</span>) +326: <span class="ruby-keyword kw">end</span> +327: <span class="ruby-keyword kw">end</span> +328: +329: <span class="ruby-comment cmt"># Save @tokenBuffer in the record of the parent file.</span> +330: <span class="ruby-ivar">@fileStack</span>.<span class="ruby-identifier">last</span>[<span class="ruby-value">1</span>] = <span class="ruby-ivar">@tokenBuffer</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@fileStack</span>.<span class="ruby-identifier">empty?</span> +331: <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-keyword kw">nil</span> +332: <span class="ruby-ivar">@finishLastFile</span> = <span class="ruby-keyword kw">false</span> 333: -334: <span class="ruby-comment cmt"># Return the name of the included file.</span> -335: <span class="ruby-identifier">includeFileName</span> -336: <span class="ruby-keyword kw">end</span></pre> +334: <span class="ruby-comment cmt"># Open the new file and push the handle on the @fileStack.</span> +335: <span class="ruby-keyword kw">begin</span> +336: <span class="ruby-ivar">@fileStack</span> <span class="ruby-operator">&lt;&lt;</span> [ (<span class="ruby-ivar">@cf</span> = <span class="ruby-constant">FileStreamHandle</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">includeFileName</span>, <span class="ruby-ivar">@log</span>)), +337: <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">block</span> ] +338: <span class="ruby-ivar">@log</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;Parsing file #{includeFileName}&quot;</span> +339: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StandardError</span> +340: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'bad_include'</span>, <span class="ruby-node">&quot;Cannot open include file #{includeFileName}&quot;</span>, <span class="ruby-identifier">sfi</span>) +341: <span class="ruby-keyword kw">end</span> +342: +343: <span class="ruby-comment cmt"># Return the name of the included file.</span> +344: <span class="ruby-identifier">includeFileName</span> +345: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1085,14 +1110,14 @@ <div class="method-source-code" id="macro-efined--source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 470</span> -470: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">macroDefined?</span>(<span class="ruby-identifier">name</span>) -471: <span class="ruby-ivar">@macroTable</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">name</span>) -472: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 479</span> +479: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">macroDefined?</span>(<span class="ruby-identifier">name</span>) +480: <span class="ruby-ivar">@macroTable</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">name</span>) +481: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1122,17 +1147,17 @@ <div class="method-source-code" id="mode--source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 261</span> -261: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mode=</span>(<span class="ruby-identifier">newMode</span>) -262: <span class="ruby-comment cmt">#puts &quot;**** New mode: #{newMode}&quot;</span> -263: <span class="ruby-ivar">@activePatterns</span> = <span class="ruby-ivar">@patternsByMode</span>[<span class="ruby-identifier">newMode</span>] -264: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Undefined mode #{newMode}&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@activePatterns</span> -265: <span class="ruby-ivar">@scannerMode</span> = <span class="ruby-identifier">newMode</span> -266: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 270</span> +270: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mode=</span>(<span class="ruby-identifier">newMode</span>) +271: <span class="ruby-comment cmt">#puts &quot;**** New mode: #{newMode}&quot;</span> +272: <span class="ruby-ivar">@activePatterns</span> = <span class="ruby-ivar">@patternsByMode</span>[<span class="ruby-identifier">newMode</span>] +273: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Undefined mode #{newMode}&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@activePatterns</span> +274: <span class="ruby-ivar">@scannerMode</span> = <span class="ruby-identifier">newMode</span> +275: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1164,98 +1189,98 @@ <div class="method-source-code" id="next-oken-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 365</span> -365: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nextToken</span> -366: <span class="ruby-comment cmt"># If we have a pushed-back token, return that first.</span> -367: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@tokenBuffer</span>.<span class="ruby-identifier">nil?</span> -368: <span class="ruby-identifier">res</span> = <span class="ruby-ivar">@tokenBuffer</span> -369: <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-keyword kw">nil</span> -370: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">res</span> -371: <span class="ruby-keyword kw">end</span> -372: -373: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@finishLastFile</span> -374: <span class="ruby-comment cmt"># The previously processed file has now really been processed to</span> -375: <span class="ruby-comment cmt"># completion. Close it and remove the corresponding entry from the</span> -376: <span class="ruby-comment cmt"># @fileStack.</span> -377: <span class="ruby-ivar">@finishLastFile</span> = <span class="ruby-keyword kw">false</span> -378: <span class="ruby-comment cmt">#@log &lt;&lt; &quot;Completed file #{@cf.fileName}&quot;</span> -379: -380: <span class="ruby-comment cmt"># If we have a block to be executed on EOF, we call it now.</span> -381: <span class="ruby-identifier">onEof</span> = <span class="ruby-ivar">@fileStack</span>.<span class="ruby-identifier">last</span>[<span class="ruby-value">2</span>] -382: <span class="ruby-identifier">onEof</span>.<span class="ruby-identifier">call</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">onEof</span> -383: -384: <span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@cf</span> -385: <span class="ruby-ivar">@fileStack</span>.<span class="ruby-identifier">pop</span> -386: -387: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@fileStack</span>.<span class="ruby-identifier">empty?</span> -388: <span class="ruby-comment cmt"># We are done with the top-level file now.</span> -389: <span class="ruby-ivar">@cf</span> = <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-keyword kw">nil</span> -390: <span class="ruby-ivar">@finishLastFile</span> = <span class="ruby-keyword kw">true</span> -391: <span class="ruby-keyword kw">return</span> [ <span class="ruby-value">:endOfText</span>, <span class="ruby-value str">'&lt;EOT&gt;'</span>, <span class="ruby-ivar">@startOfToken</span> ] -392: <span class="ruby-keyword kw">else</span> -393: <span class="ruby-comment cmt"># Continue parsing the file that included the current file.</span> -394: <span class="ruby-ivar">@cf</span>, <span class="ruby-identifier">tokenBuffer</span> = <span class="ruby-ivar">@fileStack</span>.<span class="ruby-identifier">last</span> -395: <span class="ruby-ivar">@log</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;Parsing file #{@cf.fileName} ...&quot;</span> -396: <span class="ruby-comment cmt"># If we have a left over token from previously processing this file,</span> -397: <span class="ruby-comment cmt"># return it now.</span> -398: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tokenBuffer</span> -399: <span class="ruby-ivar">@finishLastFile</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tokenBuffer</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">:eof</span> -400: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">tokenBuffer</span> -401: <span class="ruby-keyword kw">end</span> -402: <span class="ruby-keyword kw">end</span> -403: <span class="ruby-keyword kw">end</span> -404: -405: <span class="ruby-comment cmt"># Start processing characters from the input.</span> -406: <span class="ruby-ivar">@startOfToken</span> = <span class="ruby-identifier">sourceFileInfo</span> -407: <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span> -408: <span class="ruby-identifier">match</span> = <span class="ruby-keyword kw">nil</span> -409: <span class="ruby-keyword kw">begin</span> -410: <span class="ruby-ivar">@activePatterns</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">type</span>, <span class="ruby-identifier">re</span>, <span class="ruby-identifier">postProc</span><span class="ruby-operator">|</span> -411: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">match</span> = <span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">re</span>)) -412: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">match</span> <span class="ruby-operator">==</span> <span class="ruby-value">:scannerEOF</span> -413: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@scannerMode</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@defaultMode</span> -414: <span class="ruby-comment cmt"># The stream resets the line number to 1. Since we still</span> -415: <span class="ruby-comment cmt"># know the start of the token, we setup @lineDelta so that</span> -416: <span class="ruby-comment cmt"># sourceFileInfo() returns the proper line number.</span> -417: <span class="ruby-ivar">@lineDelta</span> = <span class="ruby-operator">-</span>(<span class="ruby-ivar">@startOfToken</span>.<span class="ruby-identifier">lineNo</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>) -418: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'runaway_token'</span>, -419: <span class="ruby-node">&quot;Unterminated token starting at #{@startOfToken}&quot;</span>) -420: <span class="ruby-keyword kw">end</span> -421: <span class="ruby-comment cmt"># We've found the end of an input file. Return a special token</span> -422: <span class="ruby-comment cmt"># that describes the end of a file.</span> -423: <span class="ruby-ivar">@finishLastFile</span> = <span class="ruby-keyword kw">true</span> -424: <span class="ruby-keyword kw">return</span> [ <span class="ruby-value">:eof</span>, <span class="ruby-value str">'&lt;END&gt;'</span>, <span class="ruby-ivar">@startOfToken</span> ] -425: <span class="ruby-keyword kw">end</span> -426: -427: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;#{re} matches empty string&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">match</span>.<span class="ruby-identifier">empty?</span> -428: <span class="ruby-comment cmt"># If we have a post processing method, call it now. It may modify</span> -429: <span class="ruby-comment cmt"># the type or the found token String.</span> -430: <span class="ruby-identifier">type</span>, <span class="ruby-identifier">match</span> = <span class="ruby-identifier">postProc</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">match</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">postProc</span> -431: -432: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-comment cmt"># Ignore certain tokens with nil type.</span> -433: -434: <span class="ruby-keyword kw">return</span> [ <span class="ruby-identifier">type</span>, <span class="ruby-identifier">match</span>, <span class="ruby-ivar">@startOfToken</span> ] -435: <span class="ruby-keyword kw">end</span> -436: <span class="ruby-keyword kw">end</span> -437: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ArgumentError</span> -438: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'scan_encoding_error'</span>, <span class="ruby-identifier">$!</span>.<span class="ruby-identifier">to_s</span>) -439: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 374</span> +374: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nextToken</span> +375: <span class="ruby-comment cmt"># If we have a pushed-back token, return that first.</span> +376: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@tokenBuffer</span>.<span class="ruby-identifier">nil?</span> +377: <span class="ruby-identifier">res</span> = <span class="ruby-ivar">@tokenBuffer</span> +378: <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-keyword kw">nil</span> +379: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">res</span> +380: <span class="ruby-keyword kw">end</span> +381: +382: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@finishLastFile</span> +383: <span class="ruby-comment cmt"># The previously processed file has now really been processed to</span> +384: <span class="ruby-comment cmt"># completion. Close it and remove the corresponding entry from the</span> +385: <span class="ruby-comment cmt"># @fileStack.</span> +386: <span class="ruby-ivar">@finishLastFile</span> = <span class="ruby-keyword kw">false</span> +387: <span class="ruby-comment cmt">#@log &lt;&lt; &quot;Completed file #{@cf.fileName}&quot;</span> +388: +389: <span class="ruby-comment cmt"># If we have a block to be executed on EOF, we call it now.</span> +390: <span class="ruby-identifier">onEof</span> = <span class="ruby-ivar">@fileStack</span>.<span class="ruby-identifier">last</span>[<span class="ruby-value">2</span>] +391: <span class="ruby-identifier">onEof</span>.<span class="ruby-identifier">call</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">onEof</span> +392: +393: <span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@cf</span> +394: <span class="ruby-ivar">@fileStack</span>.<span class="ruby-identifier">pop</span> +395: +396: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@fileStack</span>.<span class="ruby-identifier">empty?</span> +397: <span class="ruby-comment cmt"># We are done with the top-level file now.</span> +398: <span class="ruby-ivar">@cf</span> = <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-keyword kw">nil</span> +399: <span class="ruby-ivar">@finishLastFile</span> = <span class="ruby-keyword kw">true</span> +400: <span class="ruby-keyword kw">return</span> [ <span class="ruby-value">:endOfText</span>, <span class="ruby-value str">'&lt;EOT&gt;'</span>, <span class="ruby-ivar">@startOfToken</span> ] +401: <span class="ruby-keyword kw">else</span> +402: <span class="ruby-comment cmt"># Continue parsing the file that included the current file.</span> +403: <span class="ruby-ivar">@cf</span>, <span class="ruby-identifier">tokenBuffer</span> = <span class="ruby-ivar">@fileStack</span>.<span class="ruby-identifier">last</span> +404: <span class="ruby-ivar">@log</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;Parsing file #{@cf.fileName} ...&quot;</span> +405: <span class="ruby-comment cmt"># If we have a left over token from previously processing this file,</span> +406: <span class="ruby-comment cmt"># return it now.</span> +407: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tokenBuffer</span> +408: <span class="ruby-ivar">@finishLastFile</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tokenBuffer</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">:eof</span> +409: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">tokenBuffer</span> +410: <span class="ruby-keyword kw">end</span> +411: <span class="ruby-keyword kw">end</span> +412: <span class="ruby-keyword kw">end</span> +413: +414: <span class="ruby-comment cmt"># Start processing characters from the input.</span> +415: <span class="ruby-ivar">@startOfToken</span> = <span class="ruby-identifier">sourceFileInfo</span> +416: <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span> +417: <span class="ruby-identifier">match</span> = <span class="ruby-keyword kw">nil</span> +418: <span class="ruby-keyword kw">begin</span> +419: <span class="ruby-ivar">@activePatterns</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">type</span>, <span class="ruby-identifier">re</span>, <span class="ruby-identifier">postProc</span><span class="ruby-operator">|</span> +420: <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">match</span> = <span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">re</span>)) +421: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">match</span> <span class="ruby-operator">==</span> <span class="ruby-value">:scannerEOF</span> +422: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@scannerMode</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@defaultMode</span> +423: <span class="ruby-comment cmt"># The stream resets the line number to 1. Since we still</span> +424: <span class="ruby-comment cmt"># know the start of the token, we setup @lineDelta so that</span> +425: <span class="ruby-comment cmt"># sourceFileInfo() returns the proper line number.</span> +426: <span class="ruby-ivar">@lineDelta</span> = <span class="ruby-operator">-</span>(<span class="ruby-ivar">@startOfToken</span>.<span class="ruby-identifier">lineNo</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>) +427: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'runaway_token'</span>, +428: <span class="ruby-node">&quot;Unterminated token starting at #{@startOfToken}&quot;</span>) +429: <span class="ruby-keyword kw">end</span> +430: <span class="ruby-comment cmt"># We've found the end of an input file. Return a special token</span> +431: <span class="ruby-comment cmt"># that describes the end of a file.</span> +432: <span class="ruby-ivar">@finishLastFile</span> = <span class="ruby-keyword kw">true</span> +433: <span class="ruby-keyword kw">return</span> [ <span class="ruby-value">:eof</span>, <span class="ruby-value str">'&lt;END&gt;'</span>, <span class="ruby-ivar">@startOfToken</span> ] +434: <span class="ruby-keyword kw">end</span> +435: +436: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;#{re} matches empty string&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">match</span>.<span class="ruby-identifier">empty?</span> +437: <span class="ruby-comment cmt"># If we have a post processing method, call it now. It may modify</span> +438: <span class="ruby-comment cmt"># the type or the found token String.</span> +439: <span class="ruby-identifier">type</span>, <span class="ruby-identifier">match</span> = <span class="ruby-identifier">postProc</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">match</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">postProc</span> 440: -441: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">match</span>.<span class="ruby-identifier">nil?</span> -442: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">eof?</span> -443: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'unexpected_eof'</span>, -444: <span class="ruby-value str">&quot;Unexpected end of file found&quot;</span>) -445: <span class="ruby-keyword kw">else</span> -446: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'no_token_match'</span>, -447: <span class="ruby-node">&quot;Unexpected characters found: '#{@cf.peek(10)}...'&quot;</span>) -448: <span class="ruby-keyword kw">end</span> -449: <span class="ruby-keyword kw">end</span> -450: <span class="ruby-keyword kw">end</span> -451: <span class="ruby-keyword kw">end</span></pre> +441: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-comment cmt"># Ignore certain tokens with nil type.</span> +442: +443: <span class="ruby-keyword kw">return</span> [ <span class="ruby-identifier">type</span>, <span class="ruby-identifier">match</span>, <span class="ruby-ivar">@startOfToken</span> ] +444: <span class="ruby-keyword kw">end</span> +445: <span class="ruby-keyword kw">end</span> +446: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ArgumentError</span> +447: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'scan_encoding_error'</span>, <span class="ruby-identifier">$!</span>.<span class="ruby-identifier">to_s</span>) +448: <span class="ruby-keyword kw">end</span> +449: +450: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">match</span>.<span class="ruby-identifier">nil?</span> +451: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">eof?</span> +452: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'unexpected_eof'</span>, +453: <span class="ruby-value str">&quot;Unexpected end of file found&quot;</span>) +454: <span class="ruby-keyword kw">else</span> +455: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'no_token_match'</span>, +456: <span class="ruby-node">&quot;Unexpected characters found: '#{@cf.peek(10)}...'&quot;</span>) +457: <span class="ruby-keyword kw">end</span> +458: <span class="ruby-keyword kw">end</span> +459: <span class="ruby-keyword kw">end</span> +460: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1285,27 +1310,27 @@ <div class="method-source-code" id="open-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 271</span> -271: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">open</span>(<span class="ruby-identifier">fileNameIsBuffer</span> = <span class="ruby-keyword kw">false</span>) -272: <span class="ruby-ivar">@fileNameIsBuffer</span> = <span class="ruby-identifier">fileNameIsBuffer</span> -273: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fileNameIsBuffer</span> -274: <span class="ruby-ivar">@fileStack</span> = [ [ <span class="ruby-ivar">@cf</span> = <span class="ruby-constant">BufferStreamHandle</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@masterFile</span>, <span class="ruby-ivar">@log</span>), -275: <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">nil</span> ] ] -276: <span class="ruby-keyword kw">else</span> -277: <span class="ruby-keyword kw">begin</span> -278: <span class="ruby-ivar">@fileStack</span> = [ [ <span class="ruby-ivar">@cf</span> = <span class="ruby-constant">FileStreamHandle</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@masterFile</span>, <span class="ruby-ivar">@log</span>), -279: <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">nil</span> ] ] -280: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StandardError</span> -281: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'open_file'</span>, <span class="ruby-node">&quot;Cannot open file #{@masterFile}&quot;</span>) -282: <span class="ruby-keyword kw">end</span> -283: <span class="ruby-keyword kw">end</span> -284: <span class="ruby-ivar">@masterPath</span> = <span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">dirname</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'/'</span> -285: <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-keyword kw">nil</span> -286: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 280</span> +280: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">open</span>(<span class="ruby-identifier">fileNameIsBuffer</span> = <span class="ruby-keyword kw">false</span>) +281: <span class="ruby-ivar">@fileNameIsBuffer</span> = <span class="ruby-identifier">fileNameIsBuffer</span> +282: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fileNameIsBuffer</span> +283: <span class="ruby-ivar">@fileStack</span> = [ [ <span class="ruby-ivar">@cf</span> = <span class="ruby-constant">BufferStreamHandle</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@masterFile</span>, <span class="ruby-ivar">@log</span>), +284: <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">nil</span> ] ] +285: <span class="ruby-keyword kw">else</span> +286: <span class="ruby-keyword kw">begin</span> +287: <span class="ruby-ivar">@fileStack</span> = [ [ <span class="ruby-ivar">@cf</span> = <span class="ruby-constant">FileStreamHandle</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@masterFile</span>, <span class="ruby-ivar">@log</span>), +288: <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">nil</span> ] ] +289: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StandardError</span> +290: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'open_file'</span>, <span class="ruby-node">&quot;Cannot open file #{@masterFile}&quot;</span>) +291: <span class="ruby-keyword kw">end</span> +292: <span class="ruby-keyword kw">end</span> +293: <span class="ruby-ivar">@masterPath</span> = <span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">dirname</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'/'</span> +294: <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-keyword kw">nil</span> +295: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1335,19 +1360,19 @@ <div class="method-source-code" id="return-oken-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 455</span> -455: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">returnToken</span>(<span class="ruby-identifier">token</span>) -456: <span class="ruby-comment cmt">#@log &lt;&lt; &quot;-&gt; Returning Token: [#{token[0]}][#{token[1]}]&quot;</span> -457: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@tokenBuffer</span>.<span class="ruby-identifier">nil?</span> -458: <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-ivar">@tokenBuffer</span> -459: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Fatal Error: Cannot return more than 1 token in a row&quot;</span> -460: <span class="ruby-keyword kw">end</span> -461: <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-identifier">token</span> -462: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 464</span> +464: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">returnToken</span>(<span class="ruby-identifier">token</span>) +465: <span class="ruby-comment cmt">#@log &lt;&lt; &quot;-&gt; Returning Token: [#{token[0]}][#{token[1]}]&quot;</span> +466: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@tokenBuffer</span>.<span class="ruby-identifier">nil?</span> +467: <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-ivar">@tokenBuffer</span> +468: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Fatal Error: Cannot return more than 1 token in a row&quot;</span> +469: <span class="ruby-keyword kw">end</span> +470: <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-identifier">token</span> +471: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1377,15 +1402,15 @@ <div class="method-source-code" id="source-ile-nfo-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 339</span> -339: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sourceFileInfo</span> -340: <span class="ruby-ivar">@cf</span> <span class="ruby-operator">?</span> <span class="ruby-constant">SourceFileInfo</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">fileName</span>, <span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">lineNo</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@lineDelta</span>, <span class="ruby-value">0</span>) <span class="ruby-operator">:</span> -341: <span class="ruby-constant">SourceFileInfo</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@masterFile</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>) -342: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 348</span> +348: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sourceFileInfo</span> +349: <span class="ruby-ivar">@cf</span> <span class="ruby-operator">?</span> <span class="ruby-constant">SourceFileInfo</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">fileName</span>, <span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">lineNo</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@lineDelta</span>, <span class="ruby-value">0</span>) <span class="ruby-operator">:</span> +350: <span class="ruby-constant">SourceFileInfo</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@masterFile</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>) +351: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1412,14 +1437,14 @@ <div class="method-source-code" id="warning-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 498</span> -498: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">warning</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">sfi</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">data</span> = <span class="ruby-keyword kw">nil</span>) -499: <span class="ruby-identifier">message</span>(<span class="ruby-value">:warning</span>, <span class="ruby-identifier">id</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">sfi</span>, <span class="ruby-identifier">data</span>) -500: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 508</span> +508: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">warning</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">sfi</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">data</span> = <span class="ruby-keyword kw">nil</span>) +509: <span class="ruby-identifier">message</span>(<span class="ruby-value">:warning</span>, <span class="ruby-identifier">id</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">sfi</span>, <span class="ruby-identifier">data</span>) +510: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1452,38 +1477,39 @@ <div class="method-source-code" id="message-source"> <pre> - <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 504</span> -504: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">message</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">id</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">sfi</span>, <span class="ruby-identifier">data</span>) -505: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">empty?</span> -506: <span class="ruby-identifier">line</span> = <span class="ruby-ivar">@cf</span> <span class="ruby-operator">?</span> <span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">line</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span> -507: <span class="ruby-identifier">sfi</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">sourceFileInfo</span> -508: -509: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@cf</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">macroStack</span>.<span class="ruby-identifier">empty?</span> -510: <span class="ruby-ivar">@messageHandler</span>.<span class="ruby-identifier">info</span>(<span class="ruby-value str">'macro_stack'</span>, <span class="ruby-value str">'Macro call history:'</span>, <span class="ruby-keyword kw">nil</span>) -511: -512: <span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">macroStack</span>.<span class="ruby-identifier">reverse_each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">entry</span><span class="ruby-operator">|</span> -513: <span class="ruby-identifier">macro</span> = <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">macro</span> -514: <span class="ruby-identifier">args</span> = <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">args</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">1</span>] -515: <span class="ruby-identifier">args</span>.<span class="ruby-identifier">collect!</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-value str">'&quot;'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">a</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'&quot;'</span> } -516: <span class="ruby-ivar">@messageHandler</span>.<span class="ruby-identifier">info</span>(<span class="ruby-value str">'macro_stack'</span>, -517: <span class="ruby-node">&quot; ${#{macro.name} #{args.join(' ')}}&quot;</span>, -518: <span class="ruby-identifier">macro</span>.<span class="ruby-identifier">sourceFileInfo</span>) -519: <span class="ruby-keyword kw">end</span> -520: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File lib/taskjuggler/TextParser/Scanner.rb, line 514</span> +514: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">message</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">id</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">sfi</span>, <span class="ruby-identifier">data</span>) +515: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">empty?</span> +516: <span class="ruby-identifier">line</span> = <span class="ruby-ivar">@cf</span> <span class="ruby-operator">?</span> <span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">line</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span> +517: <span class="ruby-identifier">sfi</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">sourceFileInfo</span> +518: +519: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@cf</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">macroStack</span>.<span class="ruby-identifier">empty?</span> +520: <span class="ruby-ivar">@messageHandler</span>.<span class="ruby-identifier">info</span>(<span class="ruby-value str">'macro_stack'</span>, <span class="ruby-value str">'Macro call history:'</span>, <span class="ruby-keyword kw">nil</span>) 521: -522: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span> -523: <span class="ruby-keyword kw">when</span> <span class="ruby-value">:error</span> -524: <span class="ruby-ivar">@messageHandler</span>.<span class="ruby-identifier">error</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">sfi</span>, <span class="ruby-identifier">line</span>, <span class="ruby-identifier">data</span>) -525: <span class="ruby-keyword kw">when</span> <span class="ruby-value">:warning</span> -526: <span class="ruby-ivar">@messageHandler</span>.<span class="ruby-identifier">warning</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">sfi</span>, <span class="ruby-identifier">line</span>, <span class="ruby-identifier">data</span>) -527: <span class="ruby-keyword kw">else</span> -528: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Unknown message type #{type}&quot;</span> -529: <span class="ruby-keyword kw">end</span> -530: <span class="ruby-keyword kw">end</span> -531: <span class="ruby-keyword kw">end</span></pre> +522: <span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">macroStack</span>.<span class="ruby-identifier">reverse_each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">entry</span><span class="ruby-operator">|</span> +523: <span class="ruby-identifier">macro</span> = <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">macro</span> +524: <span class="ruby-identifier">args</span> = <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">args</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">1</span>] +525: <span class="ruby-identifier">args</span>.<span class="ruby-identifier">collect!</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-value str">'&quot;'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">a</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'&quot;'</span> } +526: <span class="ruby-ivar">@messageHandler</span>.<span class="ruby-identifier">info</span>(<span class="ruby-value str">'macro_stack'</span>, +527: <span class="ruby-node">&quot; ${#{macro.name}#{args.empty? ? '' : ' '}&quot;</span> <span class="ruby-operator">+</span> +528: <span class="ruby-node">&quot;#{args.join(' ')}}&quot;</span>, +529: <span class="ruby-identifier">macro</span>.<span class="ruby-identifier">sourceFileInfo</span>) +530: <span class="ruby-keyword kw">end</span> +531: <span class="ruby-keyword kw">end</span> +532: +533: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span> +534: <span class="ruby-keyword kw">when</span> <span class="ruby-value">:error</span> +535: <span class="ruby-ivar">@messageHandler</span>.<span class="ruby-identifier">error</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">sfi</span>, <span class="ruby-identifier">line</span>, <span class="ruby-identifier">data</span>) +536: <span class="ruby-keyword kw">when</span> <span class="ruby-value">:warning</span> +537: <span class="ruby-ivar">@messageHandler</span>.<span class="ruby-identifier">warning</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">sfi</span>, <span class="ruby-identifier">line</span>, <span class="ruby-identifier">data</span>) +538: <span class="ruby-keyword kw">else</span> +539: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Unknown message type #{type}&quot;</span> +540: <span class="ruby-keyword kw">end</span> +541: <span class="ruby-keyword kw">end</span> +542: <span class="ruby-keyword kw">end</span></pre> </div> </div>