doc/TaskJuggler/TextScanner.html in taskjuggler-0.0.6 vs doc/TaskJuggler/TextScanner.html in taskjuggler-0.0.7

- old
+ new

@@ -206,10 +206,14 @@ <li><a href="../TaskJuggler/DependencyListAttribute.html">TaskJuggler::DependencyListAttribute</a></li> <li><a href="../TaskJuggler/DurationAttribute.html">TaskJuggler::DurationAttribute</a></li> + <li><a href="../TaskJuggler/FileList.html">TaskJuggler::FileList</a></li> + + <li><a href="../TaskJuggler/FileRecord.html">TaskJuggler::FileRecord</a></li> + <li><a href="../TaskJuggler/FixnumAttribute.html">TaskJuggler::FixnumAttribute</a></li> <li><a href="../TaskJuggler/FlagListAttribute.html">TaskJuggler::FlagListAttribute</a></li> <li><a href="../TaskJuggler/FloatAttribute.html">TaskJuggler::FloatAttribute</a></li> @@ -278,12 +282,10 @@ <li><a href="../TaskJuggler/LogicalOperation.html">TaskJuggler::LogicalOperation</a></li> <li><a href="../TaskJuggler/Macro.html">TaskJuggler::Macro</a></li> - <li><a href="../TaskJuggler/MacroParser.html">TaskJuggler::MacroParser</a></li> - <li><a href="../TaskJuggler/MacroTable.html">TaskJuggler::MacroTable</a></li> <li><a href="../TaskJuggler/ManagerResponsibilities.html">TaskJuggler::ManagerResponsibilities</a></li> <li><a href="../TaskJuggler/ManagerStatusRecord.html">TaskJuggler::ManagerStatusRecord</a></li> @@ -344,10 +346,12 @@ <li><a href="../TaskJuggler/RTFReport.html">TaskJuggler::RTFReport</a></li> <li><a href="../TaskJuggler/RTFReportLink.html">TaskJuggler::RTFReportLink</a></li> + <li><a href="../TaskJuggler/RTFWithQuerySupport.html">TaskJuggler::RTFWithQuerySupport</a></li> + <li><a href="../TaskJuggler/RealFormat.html">TaskJuggler::RealFormat</a></li> <li><a href="../TaskJuggler/RealFormatAttribute.html">TaskJuggler::RealFormatAttribute</a></li> <li><a href="../TaskJuggler/ReferenceAttribute.html">TaskJuggler::ReferenceAttribute</a></li> @@ -390,12 +394,10 @@ <li><a href="../TaskJuggler/RichTextDocument.html">TaskJuggler::RichTextDocument</a></li> <li><a href="../TaskJuggler/RichTextElement.html">TaskJuggler::RichTextElement</a></li> - <li><a href="../TaskJuggler/RichTextException.html">TaskJuggler::RichTextException</a></li> - <li><a href="../TaskJuggler/RichTextFunctionExample.html">TaskJuggler::RichTextFunctionExample</a></li> <li><a href="../TaskJuggler/RichTextFunctionHandler.html">TaskJuggler::RichTextFunctionHandler</a></li> <li><a href="../TaskJuggler/RichTextImage.html">TaskJuggler::RichTextImage</a></li> @@ -432,10 +434,12 @@ <li><a href="../TaskJuggler/ShiftAssignmentsAttribute.html">TaskJuggler::ShiftAssignmentsAttribute</a></li> <li><a href="../TaskJuggler/ShiftScenario.html">TaskJuggler::ShiftScenario</a></li> + <li><a href="../TaskJuggler/SimpleQueryExpander.html">TaskJuggler::SimpleQueryExpander</a></li> + <li><a href="../TaskJuggler/SortListAttribute.html">TaskJuggler::SortListAttribute</a></li> <li><a href="../TaskJuggler/SourceFileInfo.html">TaskJuggler::SourceFileInfo</a></li> <li><a href="../TaskJuggler/StatusSheetReceiver.html">TaskJuggler::StatusSheetReceiver</a></li> @@ -542,10 +546,12 @@ <li><a href="../TaskJuggler/URLParameter.html">TaskJuggler::URLParameter</a></li> <li><a href="../TaskJuggler/UserManual.html">TaskJuggler::UserManual</a></li> + <li><a href="../TaskJuggler/VimSyntax.html">TaskJuggler::VimSyntax</a></li> + <li><a href="../TaskJuggler/WebServer.html">TaskJuggler::WebServer</a></li> <li><a href="../TaskJuggler/WorkingHours.html">TaskJuggler::WorkingHours</a></li> <li><a href="../TaskJuggler/WorkingHoursAttribute.html">TaskJuggler::WorkingHoursAttribute</a></li> @@ -614,11 +620,11 @@ <a name="method-c-new"></a> <div class="method-heading"> <span class="method-name">new</span><span - class="method-args">(masterFile, messageHandler)</span> + class="method-args">(masterFile, messageHandler, tokenPatterns, defaultMode)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> @@ -635,41 +641,50 @@ <div class="method-source-code" id="new-source"> <pre> - <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 187</span> -187: <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>) -188: <span class="ruby-ivar">@masterFile</span> = <span class="ruby-identifier">masterFile</span> -189: <span class="ruby-ivar">@messageHandler</span> = <span class="ruby-identifier">messageHandler</span> -190: <span class="ruby-comment cmt"># This table contains all macros that may be expanded when found in the</span> -191: <span class="ruby-comment cmt"># text.</span> -192: <span class="ruby-ivar">@macroTable</span> = <span class="ruby-constant">MacroTable</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">messageHandler</span>) -193: <span class="ruby-comment cmt"># The currently processed IO object.</span> -194: <span class="ruby-ivar">@cf</span> = <span class="ruby-keyword kw">nil</span> -195: <span class="ruby-comment cmt"># This Array stores the currently processed nested files. It's an Array</span> -196: <span class="ruby-comment cmt"># of Arrays. The nested Array consists of 2 elements, the IO object and</span> -197: <span class="ruby-comment cmt"># the @tokenBuffer.</span> -198: <span class="ruby-ivar">@fileStack</span> = [] -199: <span class="ruby-comment cmt"># This flag is set if we have reached the end of a file. Since we will</span> -200: <span class="ruby-comment cmt"># only know when the next new token is requested that the file is really</span> -201: <span class="ruby-comment cmt"># done now, we have to use this flag.</span> -202: <span class="ruby-ivar">@finishLastFile</span> = <span class="ruby-keyword kw">false</span> -203: <span class="ruby-comment cmt"># True if the scanner operates on a buffer.</span> -204: <span class="ruby-ivar">@fileNameIsBuffer</span> = <span class="ruby-keyword kw">false</span> -205: <span class="ruby-comment cmt"># A SourceFileInfo of the start of the currently processed token.</span> -206: <span class="ruby-ivar">@startOfToken</span> = <span class="ruby-keyword kw">nil</span> -207: <span class="ruby-comment cmt"># Line number correction for error messages.</span> -208: <span class="ruby-ivar">@lineDelta</span> = <span class="ruby-value">0</span> -209: <span class="ruby-comment cmt"># Lists of regexps that describe the detectable tokens. The Arrays are</span> -210: <span class="ruby-comment cmt"># grouped by mode.</span> -211: <span class="ruby-ivar">@patternsByMode</span> = { } -212: <span class="ruby-comment cmt"># The currently active scanner mode.</span> -213: <span class="ruby-ivar">@scannerMode</span> = <span class="ruby-keyword kw">nil</span> -214: <span class="ruby-comment cmt"># Points to the currently active pattern set as defined by the mode.</span> -215: <span class="ruby-ivar">@activePatterns</span> = <span class="ruby-keyword kw">nil</span> -216: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 186</span> +186: <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">tokenPatterns</span>, <span class="ruby-identifier">defaultMode</span>) +187: <span class="ruby-ivar">@masterFile</span> = <span class="ruby-identifier">masterFile</span> +188: <span class="ruby-ivar">@messageHandler</span> = <span class="ruby-identifier">messageHandler</span> +189: <span class="ruby-comment cmt"># This table contains all macros that may be expanded when found in the</span> +190: <span class="ruby-comment cmt"># text.</span> +191: <span class="ruby-ivar">@macroTable</span> = <span class="ruby-constant">MacroTable</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">messageHandler</span>) +192: <span class="ruby-comment cmt"># The currently processed IO object.</span> +193: <span class="ruby-ivar">@cf</span> = <span class="ruby-keyword kw">nil</span> +194: <span class="ruby-comment cmt"># This Array stores the currently processed nested files. It's an Array</span> +195: <span class="ruby-comment cmt"># of Arrays. The nested Array consists of 2 elements, the IO object and</span> +196: <span class="ruby-comment cmt"># the @tokenBuffer.</span> +197: <span class="ruby-ivar">@fileStack</span> = [] +198: <span class="ruby-comment cmt"># This flag is set if we have reached the end of a file. Since we will</span> +199: <span class="ruby-comment cmt"># only know when the next new token is requested that the file is really</span> +200: <span class="ruby-comment cmt"># done now, we have to use this flag.</span> +201: <span class="ruby-ivar">@finishLastFile</span> = <span class="ruby-keyword kw">false</span> +202: <span class="ruby-comment cmt"># True if the scanner operates on a buffer.</span> +203: <span class="ruby-ivar">@fileNameIsBuffer</span> = <span class="ruby-keyword kw">false</span> +204: <span class="ruby-comment cmt"># A SourceFileInfo of the start of the currently processed token.</span> +205: <span class="ruby-ivar">@startOfToken</span> = <span class="ruby-keyword kw">nil</span> +206: <span class="ruby-comment cmt"># Line number correction for error messages.</span> +207: <span class="ruby-ivar">@lineDelta</span> = <span class="ruby-value">0</span> +208: <span class="ruby-comment cmt"># Lists of regexps that describe the detectable tokens. The Arrays are</span> +209: <span class="ruby-comment cmt"># grouped by mode.</span> +210: <span class="ruby-ivar">@patternsByMode</span> = { } +211: <span class="ruby-comment cmt"># The currently active scanner mode.</span> +212: <span class="ruby-ivar">@scannerMode</span> = <span class="ruby-keyword kw">nil</span> +213: <span class="ruby-comment cmt"># Points to the currently active pattern set as defined by the mode.</span> +214: <span class="ruby-ivar">@activePatterns</span> = <span class="ruby-keyword kw">nil</span> +215: +216: <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> +217: <span class="ruby-identifier">type</span> = <span class="ruby-identifier">pat</span>[<span class="ruby-value">0</span>] +218: <span class="ruby-identifier">regExp</span> = <span class="ruby-identifier">pat</span>[<span class="ruby-value">1</span>] +219: <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> +220: <span class="ruby-identifier">postProc</span> = <span class="ruby-identifier">pat</span>[<span class="ruby-value">3</span>] +221: <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>) +222: <span class="ruby-keyword kw">end</span> +223: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">mode</span> = <span class="ruby-identifier">defaultMode</span> +224: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -704,14 +719,14 @@ <div class="method-source-code" id="add-acro-source"> <pre> - <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 424</span> -424: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">addMacro</span>(<span class="ruby-identifier">macro</span>) -425: <span class="ruby-ivar">@macroTable</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">macro</span>) -426: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 436</span> +436: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">addMacro</span>(<span class="ruby-identifier">macro</span>) +437: <span class="ruby-ivar">@macroTable</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">macro</span>) +438: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -748,24 +763,24 @@ <div class="method-source-code" id="add-attern-source"> <pre> - <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 226</span> -226: <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>) -227: <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>) -228: <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> -229: <span class="ruby-comment cmt"># The pattern is active in multiple modes</span> -230: <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>) -231: <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> ] -232: <span class="ruby-keyword kw">end</span> -233: <span class="ruby-keyword kw">else</span> -234: <span class="ruby-comment cmt"># The pattern is only active in one specific mode.</span> -235: <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>) -236: <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> ] -237: <span class="ruby-keyword kw">end</span> -238: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 234</span> +234: <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>) +235: <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>) +236: <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> +237: <span class="ruby-comment cmt"># The pattern is active in multiple modes</span> +238: <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>) +239: <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> ] +240: <span class="ruby-keyword kw">end</span> +241: <span class="ruby-keyword kw">else</span> +242: <span class="ruby-comment cmt"># The pattern is only active in one specific mode.</span> +243: <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>) +244: <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> ] +245: <span class="ruby-keyword kw">end</span> +246: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -794,19 +809,19 @@ <div class="method-source-code" id="close-source"> <pre> - <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 268</span> -268: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close</span> -269: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@fileNameIsBuffer</span> -270: <span class="ruby-constant">Log</span>.<span class="ruby-identifier">startProgressMeter</span>(<span class="ruby-node">&quot;Reading file #{@masterFile}&quot;</span>) -271: <span class="ruby-constant">Log</span>.<span class="ruby-identifier">stopProgressMeter</span> -272: <span class="ruby-keyword kw">end</span> -273: <span class="ruby-ivar">@fileStack</span> = [] -274: <span class="ruby-ivar">@cf</span> = <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-keyword kw">nil</span> -275: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 276</span> +276: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close</span> +277: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@fileNameIsBuffer</span> +278: <span class="ruby-constant">Log</span>.<span class="ruby-identifier">startProgressMeter</span>(<span class="ruby-node">&quot;Reading file #{@masterFile}&quot;</span>) +279: <span class="ruby-constant">Log</span>.<span class="ruby-identifier">stopProgressMeter</span> +280: <span class="ruby-keyword kw">end</span> +281: <span class="ruby-ivar">@fileStack</span> = [] +282: <span class="ruby-ivar">@cf</span> = <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-keyword kw">nil</span> +283: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -819,11 +834,11 @@ <a name="method-i-error"></a> <div class="method-heading"> <span class="method-name">error</span><span - class="method-args">(id, text, property = nil, sfi = nil)</span> + class="method-args">(id, text, sfi = nil, data = nil)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> @@ -835,14 +850,14 @@ <div class="method-source-code" id="error-source"> <pre> - <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 449</span> -449: <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">property</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">sfi</span> = <span class="ruby-keyword kw">nil</span>) -450: <span class="ruby-identifier">message</span>(<span class="ruby-value str">'error'</span>, <span class="ruby-identifier">id</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">property</span>, <span class="ruby-identifier">sfi</span>) -451: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 465</span> +465: <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>) +466: <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>) +467: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -874,21 +889,25 @@ <div class="method-source-code" id="expand-acro-source"> <pre> - <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 437</span> -437: <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>) -438: <span class="ruby-comment cmt"># Get the expanded macro from the @macroTable.</span> -439: <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>) -440: <span class="ruby-comment cmt"># If the expanded macro is empty, we can ignore it.</span> -441: <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> -442: -443: <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>) -444: <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>) -445: <span class="ruby-keyword kw">end</span> -446: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 449</span> +449: <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>) +450: <span class="ruby-comment cmt"># Get the expanded macro from the @macroTable.</span> +451: <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>) +452: <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> +453: <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>) +454: <span class="ruby-keyword kw">end</span> +455: +456: <span class="ruby-comment cmt"># If the expanded macro is empty, we can ignore it.</span> +457: <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> +458: +459: <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>) +460: <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>) +461: <span class="ruby-keyword kw">end</span> +462: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -918,14 +937,14 @@ <div class="method-source-code" id="file-ame-source"> <pre> - <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 321</span> -321: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fileName</span> -322: <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> -323: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 332</span> +332: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fileName</span> +333: <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> +334: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -948,51 +967,54 @@ <div class="method-description"> <p> Continue processing with a new file specified by <em>includeFileName</em>. When this file is finished, we will continue in the old file after the -location where we started with the new file. +location where we started with the new file. The method returns the full +qualified name of the included file. </p> <div class="method-source-code" id="include-source"> <pre> - <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 280</span> -280: <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>) -281: <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> -282: <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> -283: <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> -284: <span class="ruby-comment cmt"># If the included file is not an absolute name, we interpret the file</span> -285: <span class="ruby-comment cmt"># name relative to the including file.</span> -286: <span class="ruby-identifier">includeFileName</span> = <span class="ruby-identifier">path</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">includeFileName</span> -287: <span class="ruby-keyword kw">end</span> -288: -289: <span class="ruby-comment cmt"># Try to dectect recursive inclusions. This will not work if files are</span> -290: <span class="ruby-comment cmt"># accessed via filesystem links.</span> -291: <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> -292: <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> -293: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'include_recursion'</span>, -294: <span class="ruby-node">&quot;Recursive inclusion of #{includeFileName} detected&quot;</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">sfi</span>) -295: <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 289</span> +289: <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>) +290: <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> +291: <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> +292: <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> +293: <span class="ruby-comment cmt"># If the included file is not an absolute name, we interpret the file</span> +294: <span class="ruby-comment cmt"># name relative to the including file.</span> +295: <span class="ruby-identifier">includeFileName</span> = <span class="ruby-identifier">path</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">includeFileName</span> 296: <span class="ruby-keyword kw">end</span> 297: -298: <span class="ruby-comment cmt"># Save @tokenBuffer in the record of the parent file.</span> -299: <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> -300: <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-keyword kw">nil</span> -301: <span class="ruby-ivar">@finishLastFile</span> = <span class="ruby-keyword kw">false</span> -302: -303: <span class="ruby-comment cmt"># Open the new file and push the handle on the @fileStack.</span> -304: <span class="ruby-keyword kw">begin</span> -305: <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-keyword kw">nil</span>, ] -306: <span class="ruby-constant">Log</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;Parsing file #{includeFileName}&quot;</span> -307: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StandardError</span> -308: <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>, -309: <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">sfi</span>) -310: <span class="ruby-keyword kw">end</span> -311: <span class="ruby-keyword kw">end</span></pre> +298: <span class="ruby-comment cmt"># Try to dectect recursive inclusions. This will not work if files are</span> +299: <span class="ruby-comment cmt"># accessed via filesystem links.</span> +300: <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> +301: <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> +302: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'include_recursion'</span>, +303: <span class="ruby-node">&quot;Recursive inclusion of #{includeFileName} detected&quot;</span>, <span class="ruby-identifier">sfi</span>) +304: <span class="ruby-keyword kw">end</span> +305: <span class="ruby-keyword kw">end</span> +306: +307: <span class="ruby-comment cmt"># Save @tokenBuffer in the record of the parent file.</span> +308: <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> +309: <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-keyword kw">nil</span> +310: <span class="ruby-ivar">@finishLastFile</span> = <span class="ruby-keyword kw">false</span> +311: +312: <span class="ruby-comment cmt"># Open the new file and push the handle on the @fileStack.</span> +313: <span class="ruby-keyword kw">begin</span> +314: <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-keyword kw">nil</span>, ] +315: <span class="ruby-constant">Log</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;Parsing file #{includeFileName}&quot;</span> +316: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StandardError</span> +317: <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>) +318: <span class="ruby-keyword kw">end</span> +319: +320: <span class="ruby-comment cmt"># Return the name of the included file.</span> +321: <span class="ruby-identifier">includeFileName</span> +322: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1022,80 +1044,24 @@ <div class="method-source-code" id="macro-efined--source"> <pre> - <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 429</span> -429: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">macroDefined?</span>(<span class="ruby-identifier">name</span>) -430: <span class="ruby-ivar">@macroTable</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">name</span>) -431: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 441</span> +441: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">macroDefined?</span>(<span class="ruby-identifier">name</span>) +442: <span class="ruby-ivar">@macroTable</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">name</span>) +443: <span class="ruby-keyword kw">end</span></pre> </div> </div> </div> - <div id="message-method" class="method-detail "> - <a name="method-i-message"></a> - - <div class="method-heading"> - - <span class="method-name">message</span><span - class="method-args">(type, id, text, property, sfi)</span> - <span class="method-click-advice">click to toggle source</span> - - </div> - - <div class="method-description"> - - - - - - <div class="method-source-code" - id="message-source"> -<pre> - <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 457</span> -457: <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">property</span>, <span class="ruby-identifier">sfi</span>) -458: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">empty?</span> -459: <span class="ruby-identifier">message</span> = <span class="ruby-constant">Message</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">type</span>, <span class="ruby-identifier">text</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;\n&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">to_s</span>, -460: <span class="ruby-identifier">property</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">sfi</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">sourceFileInfo</span>) -461: <span class="ruby-ivar">@messageHandler</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">message</span>) -462: -463: <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> -464: <span class="ruby-identifier">message</span> = <span class="ruby-constant">Message</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'macro_stack'</span>, <span class="ruby-value str">'info'</span>, <span class="ruby-value str">'Macro call history:'</span>) -465: <span class="ruby-ivar">@messageHandler</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">message</span>) -466: -467: <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> -468: <span class="ruby-identifier">macro</span> = <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">macro</span> -469: <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>] -470: <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> } -471: <span class="ruby-identifier">message</span> = <span class="ruby-constant">Message</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'macro_stack'</span>, <span class="ruby-value str">'info'</span>, -472: <span class="ruby-node">&quot; ${#{macro.name} #{args.join(' ')}}&quot;</span>, -473: <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">macro</span>.<span class="ruby-identifier">sourceFileInfo</span>) -474: <span class="ruby-ivar">@messageHandler</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">message</span>) -475: <span class="ruby-keyword kw">end</span> -476: <span class="ruby-keyword kw">end</span> -477: <span class="ruby-keyword kw">end</span> -478: -479: <span class="ruby-comment cmt"># An empty strings signals an already reported error</span> -480: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value str">''</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'error'</span> -481: <span class="ruby-keyword kw">end</span></pre> - </div> - - </div> - - - - - </div> - - <div id="mode--method" class="method-detail "> <a name="method-i-mode%3D"></a> <div class="method-heading"> @@ -1115,17 +1081,17 @@ <div class="method-source-code" id="mode--source"> <pre> - <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 242</span> -242: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mode=</span>(<span class="ruby-identifier">newMode</span>) -243: <span class="ruby-comment cmt">#puts &quot;**** New mode: #{newMode}&quot;</span> -244: <span class="ruby-ivar">@activePatterns</span> = <span class="ruby-ivar">@patternsByMode</span>[<span class="ruby-identifier">newMode</span>] -245: <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> -246: <span class="ruby-ivar">@scannerMode</span> = <span class="ruby-identifier">newMode</span> -247: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 250</span> +250: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mode=</span>(<span class="ruby-identifier">newMode</span>) +251: <span class="ruby-comment cmt">#puts &quot;**** New mode: #{newMode}&quot;</span> +252: <span class="ruby-ivar">@activePatterns</span> = <span class="ruby-ivar">@patternsByMode</span>[<span class="ruby-identifier">newMode</span>] +253: <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> +254: <span class="ruby-ivar">@scannerMode</span> = <span class="ruby-identifier">newMode</span> +255: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1157,82 +1123,83 @@ <div class="method-source-code" id="next-oken-source"> <pre> - <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 340</span> -340: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nextToken</span> -341: <span class="ruby-comment cmt"># If we have a pushed-back token, return that first.</span> -342: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@tokenBuffer</span>.<span class="ruby-identifier">nil?</span> -343: <span class="ruby-identifier">res</span> = <span class="ruby-ivar">@tokenBuffer</span> -344: <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-keyword kw">nil</span> -345: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">res</span> -346: <span class="ruby-keyword kw">end</span> -347: -348: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@finishLastFile</span> -349: <span class="ruby-comment cmt"># The previously processed file has now really been processed to</span> -350: <span class="ruby-comment cmt"># completion. Close it and remove the corresponding entry from the</span> -351: <span class="ruby-comment cmt"># @fileStack.</span> -352: <span class="ruby-ivar">@finishLastFile</span> = <span class="ruby-keyword kw">false</span> -353: <span class="ruby-comment cmt">#Log &lt;&lt; &quot;Completed file #{@cf.fileName}&quot;</span> -354: <span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">close</span> -355: <span class="ruby-ivar">@fileStack</span>.<span class="ruby-identifier">pop</span> -356: -357: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@fileStack</span>.<span class="ruby-identifier">empty?</span> -358: <span class="ruby-comment cmt"># We are done with the top-level file now.</span> -359: <span class="ruby-ivar">@cf</span> = <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-keyword kw">nil</span> -360: <span class="ruby-ivar">@finishLastFile</span> = <span class="ruby-keyword kw">true</span> -361: <span class="ruby-keyword kw">return</span> [ <span class="ruby-value str">'.'</span>, <span class="ruby-value str">'&lt;END&gt;'</span>, <span class="ruby-ivar">@startOfToken</span> ] -362: <span class="ruby-keyword kw">else</span> -363: <span class="ruby-comment cmt"># Continue parsing the file that included the current file.</span> -364: <span class="ruby-ivar">@cf</span>, <span class="ruby-identifier">tokenBuffer</span> = <span class="ruby-ivar">@fileStack</span>.<span class="ruby-identifier">last</span> -365: <span class="ruby-constant">Log</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;Parsing file #{@cf.fileName} ...&quot;</span> -366: <span class="ruby-comment cmt"># If we have a left over token from previously processing this file,</span> -367: <span class="ruby-comment cmt"># return it now.</span> -368: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">tokenBuffer</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tokenBuffer</span> -369: <span class="ruby-keyword kw">end</span> -370: <span class="ruby-keyword kw">end</span> -371: -372: <span class="ruby-comment cmt"># Start processing characters from the input.</span> -373: <span class="ruby-ivar">@startOfToken</span> = <span class="ruby-identifier">sourceFileInfo</span> -374: <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span> -375: <span class="ruby-identifier">match</span> = <span class="ruby-keyword kw">nil</span> -376: <span class="ruby-keyword kw">begin</span> -377: <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> -378: <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>)) -379: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">match</span> <span class="ruby-operator">==</span> <span class="ruby-value">:scannerEOF</span> -380: <span class="ruby-comment cmt"># We've found the end of an input file. Return a special token</span> -381: <span class="ruby-comment cmt"># that describes the end of a file.</span> -382: <span class="ruby-ivar">@finishLastFile</span> = <span class="ruby-keyword kw">true</span> -383: <span class="ruby-keyword kw">return</span> [ <span class="ruby-value str">'.'</span>, <span class="ruby-value str">'&lt;END&gt;'</span>, <span class="ruby-ivar">@startOfToken</span> ] -384: <span class="ruby-keyword kw">end</span> -385: -386: <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> -387: <span class="ruby-comment cmt"># If we have a post processing method, call it now. It may modify</span> -388: <span class="ruby-comment cmt"># the type or the found token String.</span> -389: <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> -390: -391: <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> -392: -393: <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> ] -394: <span class="ruby-keyword kw">end</span> -395: <span class="ruby-keyword kw">end</span> -396: <span class="ruby-keyword kw">rescue</span> -397: <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>) -398: <span class="ruby-keyword kw">end</span> -399: -400: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">match</span>.<span class="ruby-identifier">nil?</span> -401: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">eof?</span> -402: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'unexpected_eof'</span>, -403: <span class="ruby-value str">&quot;Unexpected end of file found&quot;</span>) -404: <span class="ruby-keyword kw">else</span> -405: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'no_token_match'</span>, -406: <span class="ruby-node">&quot;Unexpected characters found: '#{@cf.peek(10)}...'&quot;</span>) + <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 351</span> +351: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nextToken</span> +352: <span class="ruby-comment cmt"># If we have a pushed-back token, return that first.</span> +353: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@tokenBuffer</span>.<span class="ruby-identifier">nil?</span> +354: <span class="ruby-identifier">res</span> = <span class="ruby-ivar">@tokenBuffer</span> +355: <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-keyword kw">nil</span> +356: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">res</span> +357: <span class="ruby-keyword kw">end</span> +358: +359: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@finishLastFile</span> +360: <span class="ruby-comment cmt"># The previously processed file has now really been processed to</span> +361: <span class="ruby-comment cmt"># completion. Close it and remove the corresponding entry from the</span> +362: <span class="ruby-comment cmt"># @fileStack.</span> +363: <span class="ruby-ivar">@finishLastFile</span> = <span class="ruby-keyword kw">false</span> +364: <span class="ruby-comment cmt">#Log &lt;&lt; &quot;Completed file #{@cf.fileName}&quot;</span> +365: <span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">close</span> +366: <span class="ruby-ivar">@fileStack</span>.<span class="ruby-identifier">pop</span> +367: +368: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@fileStack</span>.<span class="ruby-identifier">empty?</span> +369: <span class="ruby-comment cmt"># We are done with the top-level file now.</span> +370: <span class="ruby-ivar">@cf</span> = <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-keyword kw">nil</span> +371: <span class="ruby-ivar">@finishLastFile</span> = <span class="ruby-keyword kw">true</span> +372: <span class="ruby-keyword kw">return</span> [ <span class="ruby-value str">'.'</span>, <span class="ruby-value str">'&lt;END&gt;'</span>, <span class="ruby-ivar">@startOfToken</span> ] +373: <span class="ruby-keyword kw">else</span> +374: <span class="ruby-comment cmt"># Continue parsing the file that included the current file.</span> +375: <span class="ruby-ivar">@cf</span>, <span class="ruby-identifier">tokenBuffer</span> = <span class="ruby-ivar">@fileStack</span>.<span class="ruby-identifier">last</span> +376: <span class="ruby-constant">Log</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;Parsing file #{@cf.fileName} ...&quot;</span> +377: <span class="ruby-comment cmt"># If we have a left over token from previously processing this file,</span> +378: <span class="ruby-comment cmt"># return it now.</span> +379: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">tokenBuffer</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tokenBuffer</span> +380: <span class="ruby-keyword kw">end</span> +381: <span class="ruby-keyword kw">end</span> +382: +383: <span class="ruby-comment cmt"># Start processing characters from the input.</span> +384: <span class="ruby-ivar">@startOfToken</span> = <span class="ruby-identifier">sourceFileInfo</span> +385: <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span> +386: <span class="ruby-identifier">match</span> = <span class="ruby-keyword kw">nil</span> +387: <span class="ruby-keyword kw">begin</span> +388: <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> +389: <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>)) +390: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">match</span> <span class="ruby-operator">==</span> <span class="ruby-value">:scannerEOF</span> +391: <span class="ruby-comment cmt"># We've found the end of an input file. Return a special token</span> +392: <span class="ruby-comment cmt"># that describes the end of a file.</span> +393: <span class="ruby-ivar">@finishLastFile</span> = <span class="ruby-keyword kw">true</span> +394: <span class="ruby-keyword kw">return</span> [ <span class="ruby-value str">'.'</span>, <span class="ruby-value str">'&lt;END&gt;'</span>, <span class="ruby-ivar">@startOfToken</span> ] +395: <span class="ruby-keyword kw">end</span> +396: +397: <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> +398: <span class="ruby-comment cmt"># If we have a post processing method, call it now. It may modify</span> +399: <span class="ruby-comment cmt"># the type or the found token String.</span> +400: <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> +401: +402: <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> +403: +404: <span class="ruby-comment cmt">#puts &quot;type: #{type} match: [#{match}]&quot;</span> +405: <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> ] +406: <span class="ruby-keyword kw">end</span> 407: <span class="ruby-keyword kw">end</span> -408: <span class="ruby-keyword kw">end</span> -409: <span class="ruby-keyword kw">end</span> -410: <span class="ruby-keyword kw">end</span></pre> +408: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ArgumentError</span> +409: <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>) +410: <span class="ruby-keyword kw">end</span> +411: +412: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">match</span>.<span class="ruby-identifier">nil?</span> +413: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@cf</span>.<span class="ruby-identifier">eof?</span> +414: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'unexpected_eof'</span>, +415: <span class="ruby-value str">&quot;Unexpected end of file found&quot;</span>) +416: <span class="ruby-keyword kw">else</span> +417: <span class="ruby-identifier">error</span>(<span class="ruby-value str">'no_token_match'</span>, +418: <span class="ruby-node">&quot;Unexpected characters found: '#{@cf.peek(10)}...'&quot;</span>) +419: <span class="ruby-keyword kw">end</span> +420: <span class="ruby-keyword kw">end</span> +421: <span class="ruby-keyword kw">end</span> +422: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1262,25 +1229,25 @@ <div class="method-source-code" id="open-source"> <pre> - <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 252</span> -252: <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>) -253: <span class="ruby-ivar">@fileNameIsBuffer</span> = <span class="ruby-identifier">fileNameIsBuffer</span> -254: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fileNameIsBuffer</span> -255: <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-keyword kw">nil</span> ] ] -256: <span class="ruby-keyword kw">else</span> -257: <span class="ruby-keyword kw">begin</span> -258: <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-keyword kw">nil</span> ] ] -259: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StandardError</span> -260: <span class="ruby-identifier">raise</span> <span class="ruby-constant">TjException</span>.<span class="ruby-identifier">new</span>, <span class="ruby-node">&quot;Cannot open file #{@masterFile}&quot;</span> -261: <span class="ruby-keyword kw">end</span> -262: <span class="ruby-keyword kw">end</span> -263: <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> -264: <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-keyword kw">nil</span> -265: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 260</span> +260: <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>) +261: <span class="ruby-ivar">@fileNameIsBuffer</span> = <span class="ruby-identifier">fileNameIsBuffer</span> +262: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fileNameIsBuffer</span> +263: <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-keyword kw">nil</span> ] ] +264: <span class="ruby-keyword kw">else</span> +265: <span class="ruby-keyword kw">begin</span> +266: <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-keyword kw">nil</span> ] ] +267: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StandardError</span> +268: <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>) +269: <span class="ruby-keyword kw">end</span> +270: <span class="ruby-keyword kw">end</span> +271: <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> +272: <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-keyword kw">nil</span> +273: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1310,19 +1277,19 @@ <div class="method-source-code" id="return-oken-source"> <pre> - <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 414</span> -414: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">returnToken</span>(<span class="ruby-identifier">token</span>) -415: <span class="ruby-comment cmt">#Log &lt;&lt; &quot;-&gt; Returning Token: [#{token[0]}][#{token[1]}]&quot;</span> -416: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@tokenBuffer</span>.<span class="ruby-identifier">nil?</span> -417: <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-ivar">@tokenBuffer</span> -418: <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> -419: <span class="ruby-keyword kw">end</span> -420: <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-identifier">token</span> -421: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 426</span> +426: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">returnToken</span>(<span class="ruby-identifier">token</span>) +427: <span class="ruby-comment cmt">#Log &lt;&lt; &quot;-&gt; Returning Token: [#{token[0]}][#{token[1]}]&quot;</span> +428: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@tokenBuffer</span>.<span class="ruby-identifier">nil?</span> +429: <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-ivar">@tokenBuffer</span> +430: <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> +431: <span class="ruby-keyword kw">end</span> +432: <span class="ruby-ivar">@tokenBuffer</span> = <span class="ruby-identifier">token</span> +433: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1352,15 +1319,15 @@ <div class="method-source-code" id="source-ile-nfo-source"> <pre> - <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 314</span> -314: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sourceFileInfo</span> -315: <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> -316: <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>) -317: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 325</span> +325: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sourceFileInfo</span> +326: <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> +327: <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>) +328: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1373,11 +1340,11 @@ <a name="method-i-warning"></a> <div class="method-heading"> <span class="method-name">warning</span><span - class="method-args">(id, text, property = nil, sfi = nil)</span> + class="method-args">(id, text, sfi = nil, data = nil)</span> <span class="method-click-advice">click to toggle source</span> </div> <div class="method-description"> @@ -1387,13 +1354,78 @@ <div class="method-source-code" id="warning-source"> <pre> - <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 453</span> -453: <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">property</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">sfi</span> = <span class="ruby-keyword kw">nil</span>) -454: <span class="ruby-identifier">message</span>(<span class="ruby-value str">'warning'</span>, <span class="ruby-identifier">id</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">property</span>, <span class="ruby-identifier">sfi</span>) -455: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 469</span> +469: <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>) +470: <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-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>, <span class="ruby-identifier">data</span>) +471: <span class="ruby-keyword kw">end</span></pre> + </div> + + </div> + + + + + </div> + + + </div> + + <div id="private-instance-method-details" class="method-section section"> + <h3 class="section-header">Private Instance Methods</h3> + + + <div id="message-method" class="method-detail "> + <a name="method-i-message"></a> + + <div class="method-heading"> + + <span class="method-name">message</span><span + class="method-args">(type, id, text, sfi, data)</span> + <span class="method-click-advice">click to toggle source</span> + + </div> + + <div class="method-description"> + + + + + + <div class="method-source-code" + id="message-source"> +<pre> + <span class="ruby-comment cmt"># File lib/TextScanner.rb, line 475</span> +475: <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>) +476: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">empty?</span> +477: <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> +478: <span class="ruby-identifier">sfi</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">sourceFileInfo</span> +479: +480: <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> +481: <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>) +482: +483: <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> +484: <span class="ruby-identifier">macro</span> = <span class="ruby-identifier">entry</span>.<span class="ruby-identifier">macro</span> +485: <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>] +486: <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> } +487: <span class="ruby-ivar">@messageHandler</span>.<span class="ruby-identifier">info</span>(<span class="ruby-value str">'macro_stack'</span>, +488: <span class="ruby-node">&quot; ${#{macro.name} #{args.join(' ')}}&quot;</span>, +489: <span class="ruby-identifier">macro</span>.<span class="ruby-identifier">sourceFileInfo</span>) +490: <span class="ruby-keyword kw">end</span> +491: <span class="ruby-keyword kw">end</span> +492: +493: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span> +494: <span class="ruby-keyword kw">when</span> <span class="ruby-value">:error</span> +495: <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>) +496: <span class="ruby-keyword kw">when</span> <span class="ruby-value">:warning</span> +497: <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>) +498: <span class="ruby-keyword kw">else</span> +499: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Unknown message type #{type}&quot;</span> +500: <span class="ruby-keyword kw">end</span> +501: <span class="ruby-keyword kw">end</span> +502: <span class="ruby-keyword kw">end</span></pre> </div> </div>