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

- old
+ new

@@ -179,10 +179,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> @@ -251,12 +255,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> @@ -317,10 +319,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> @@ -363,12 +367,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> @@ -405,10 +407,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> @@ -515,10 +519,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> @@ -573,11 +579,32 @@ <!-- Constants --> <!-- Attributes --> + <div id="attribute-method-details" class="method-section section"> + <h3 class="section-header">Attributes</h3> + + <div id="keywords-attribute-method" class="method-detail"> + <a name="keywords"></a> + + <div class="method-heading attribute-method-heading"> + <span class="method-name">keywords</span><span + class="attribute-access-type">[R]</span> + </div> + + <div class="method-description"> + + + + </div> + </div> + + </div> + + <!-- Methods --> <div id="public-class-method-details" class="method-section section"> <h3 class="section-header">Public Class Methods</h3> @@ -598,59 +625,61 @@ <p> The constructor is the most important function of this class. It creates a parser object and then traverses all rules and extracts the documented patterns. In a second pass the extracted <a href="KeywordDocumentation.html">KeywordDocumentation</a> objects are then -cross referenced to capture their relationships. +cross referenced to capture their relationships. <em>manual</em> is an +optional reference to the <a href="UserManual.html">UserManual</a> object +that uses this <a href="SyntaxReference.html">SyntaxReference</a>. </p> <div class="method-source-code" id="new-source"> <pre> - <span class="ruby-comment cmt"># File lib/SyntaxReference.rb, line 31</span> -31: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">manual</span> = <span class="ruby-keyword kw">nil</span>) -32: <span class="ruby-ivar">@manual</span> = <span class="ruby-identifier">manual</span> -33: <span class="ruby-ivar">@messageHandler</span> = <span class="ruby-constant">MessageHandler</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">true</span>) -34: <span class="ruby-ivar">@parser</span> = <span class="ruby-constant">ProjectFileParser</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@messageHandler</span>) -35: <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">updateParserTables</span> -36: -37: <span class="ruby-comment cmt"># This hash stores all documented keywords using the keyword as</span> -38: <span class="ruby-comment cmt"># index.</span> -39: <span class="ruby-ivar">@keywords</span> = {} -40: <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">rules</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">rule</span><span class="ruby-operator">|</span> -41: <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">patterns</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pattern</span><span class="ruby-operator">|</span> -42: <span class="ruby-comment cmt"># Only patterns that are documented are of interest.</span> -43: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">doc</span>.<span class="ruby-identifier">nil?</span> -44: -45: <span class="ruby-comment cmt"># Make sure each keyword is unique.</span> -46: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@keywords</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">keyword</span>) -47: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Multiple patterns have the same keyword #{pattern.keyword}&quot;</span> -48: <span class="ruby-keyword kw">end</span> -49: -50: <span class="ruby-identifier">argDocs</span> = [] -51: <span class="ruby-comment cmt"># Create a new KeywordDocumentation object and fill-in all extracted</span> -52: <span class="ruby-comment cmt"># values.</span> -53: <span class="ruby-identifier">kwd</span> = <span class="ruby-constant">KeywordDocumentation</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">rule</span>, <span class="ruby-identifier">pattern</span>, -54: <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">to_syntax</span>(<span class="ruby-identifier">argDocs</span>, <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">rules</span>), <span class="ruby-identifier">argDocs</span>, -55: <span class="ruby-identifier">optionalAttributes</span>(<span class="ruby-identifier">pattern</span>, {}), <span class="ruby-ivar">@manual</span>) -56: <span class="ruby-ivar">@keywords</span>[<span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">keyword</span>] = <span class="ruby-identifier">kwd</span> -57: <span class="ruby-keyword kw">end</span> -58: <span class="ruby-keyword kw">end</span> -59: -60: <span class="ruby-comment cmt"># Make sure all references to other keywords are present.</span> -61: <span class="ruby-ivar">@keywords</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">kwd</span><span class="ruby-operator">|</span> -62: <span class="ruby-identifier">kwd</span>.<span class="ruby-identifier">crossReference</span>(<span class="ruby-ivar">@keywords</span>, <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">rules</span>) -63: <span class="ruby-keyword kw">end</span> -64: -65: <span class="ruby-comment cmt"># Figure out whether the keyword describes an inheritable attribute or</span> -66: <span class="ruby-comment cmt"># not.</span> -67: <span class="ruby-ivar">@keywords</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">kwd</span><span class="ruby-operator">|</span> -68: <span class="ruby-identifier">kwd</span>.<span class="ruby-identifier">computeInheritance</span>(<span class="ruby-ivar">@keywords</span>, <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">rules</span>) -69: <span class="ruby-keyword kw">end</span> -70: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/SyntaxReference.rb, line 35</span> +35: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">manual</span> = <span class="ruby-keyword kw">nil</span>) +36: <span class="ruby-ivar">@manual</span> = <span class="ruby-identifier">manual</span> +37: <span class="ruby-ivar">@messageHandler</span> = <span class="ruby-constant">MessageHandler</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">true</span>) +38: <span class="ruby-ivar">@parser</span> = <span class="ruby-constant">ProjectFileParser</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@messageHandler</span>) +39: <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">updateParserTables</span> +40: +41: <span class="ruby-comment cmt"># This hash stores all documented keywords using the keyword as</span> +42: <span class="ruby-comment cmt"># index.</span> +43: <span class="ruby-ivar">@keywords</span> = {} +44: <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">rules</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">rule</span><span class="ruby-operator">|</span> +45: <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">patterns</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pattern</span><span class="ruby-operator">|</span> +46: <span class="ruby-comment cmt"># Only patterns that are documented are of interest.</span> +47: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">doc</span>.<span class="ruby-identifier">nil?</span> +48: +49: <span class="ruby-comment cmt"># Make sure each keyword is unique.</span> +50: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@keywords</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">keyword</span>) +51: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Multiple patterns have the same keyword #{pattern.keyword}&quot;</span> +52: <span class="ruby-keyword kw">end</span> +53: +54: <span class="ruby-identifier">argDocs</span> = [] +55: <span class="ruby-comment cmt"># Create a new KeywordDocumentation object and fill-in all extracted</span> +56: <span class="ruby-comment cmt"># values.</span> +57: <span class="ruby-identifier">kwd</span> = <span class="ruby-constant">KeywordDocumentation</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">rule</span>, <span class="ruby-identifier">pattern</span>, +58: <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">to_syntax</span>(<span class="ruby-identifier">argDocs</span>, <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">rules</span>), <span class="ruby-identifier">argDocs</span>, +59: <span class="ruby-identifier">optionalAttributes</span>(<span class="ruby-identifier">pattern</span>, {}), <span class="ruby-ivar">@manual</span>) +60: <span class="ruby-ivar">@keywords</span>[<span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">keyword</span>] = <span class="ruby-identifier">kwd</span> +61: <span class="ruby-keyword kw">end</span> +62: <span class="ruby-keyword kw">end</span> +63: +64: <span class="ruby-comment cmt"># Make sure all references to other keywords are present.</span> +65: <span class="ruby-ivar">@keywords</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">kwd</span><span class="ruby-operator">|</span> +66: <span class="ruby-identifier">kwd</span>.<span class="ruby-identifier">crossReference</span>(<span class="ruby-ivar">@keywords</span>, <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">rules</span>) +67: <span class="ruby-keyword kw">end</span> +68: +69: <span class="ruby-comment cmt"># Figure out whether the keyword describes an inheritable attribute or</span> +70: <span class="ruby-comment cmt"># not.</span> +71: <span class="ruby-ivar">@keywords</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">kwd</span><span class="ruby-operator">|</span> +72: <span class="ruby-identifier">kwd</span>.<span class="ruby-identifier">computeInheritance</span>(<span class="ruby-ivar">@keywords</span>, <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">rules</span>) +73: <span class="ruby-keyword kw">end</span> +74: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -677,31 +706,32 @@ </div> <div class="method-description"> <p> -Return a sorted Array with all keywords. +Return a sorted Array with all keywords (as <a +href="../String.html">String</a> objects). </p> <div class="method-source-code" id="all-source"> <pre> - <span class="ruby-comment cmt"># File lib/SyntaxReference.rb, line 73</span> -73: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">all</span> -74: <span class="ruby-identifier">sorted</span> = <span class="ruby-ivar">@keywords</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">sort</span> -75: <span class="ruby-comment cmt"># Register the neighbours with each keyword so we can use this info in</span> -76: <span class="ruby-comment cmt"># navigation bars.</span> -77: <span class="ruby-identifier">pred</span> = <span class="ruby-keyword kw">nil</span> -78: <span class="ruby-identifier">sorted</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">kwd</span><span class="ruby-operator">|</span> -79: <span class="ruby-identifier">keyword</span> = <span class="ruby-ivar">@keywords</span>[<span class="ruby-identifier">kwd</span>] -80: <span class="ruby-identifier">pred</span>.<span class="ruby-identifier">successor</span> = <span class="ruby-identifier">keyword</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pred</span> -81: <span class="ruby-identifier">keyword</span>.<span class="ruby-identifier">predecessor</span> = <span class="ruby-identifier">pred</span> -82: <span class="ruby-identifier">pred</span> = <span class="ruby-identifier">keyword</span> -83: <span class="ruby-keyword kw">end</span> -84: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/SyntaxReference.rb, line 77</span> +77: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">all</span> +78: <span class="ruby-identifier">sorted</span> = <span class="ruby-ivar">@keywords</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">sort</span> +79: <span class="ruby-comment cmt"># Register the neighbours with each keyword so we can use this info in</span> +80: <span class="ruby-comment cmt"># navigation bars.</span> +81: <span class="ruby-identifier">pred</span> = <span class="ruby-keyword kw">nil</span> +82: <span class="ruby-identifier">sorted</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">kwd</span><span class="ruby-operator">|</span> +83: <span class="ruby-identifier">keyword</span> = <span class="ruby-ivar">@keywords</span>[<span class="ruby-identifier">kwd</span>] +84: <span class="ruby-identifier">pred</span>.<span class="ruby-identifier">successor</span> = <span class="ruby-identifier">keyword</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pred</span> +85: <span class="ruby-identifier">keyword</span>.<span class="ruby-identifier">predecessor</span> = <span class="ruby-identifier">pred</span> +86: <span class="ruby-identifier">pred</span> = <span class="ruby-identifier">keyword</span> +87: <span class="ruby-keyword kw">end</span> +88: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -731,53 +761,53 @@ <div class="method-source-code" id="generate-navbar-source"> <pre> - <span class="ruby-comment cmt"># File lib/SyntaxReference.rb, line 137</span> -137: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">generateHTMLnavbar</span>(<span class="ruby-identifier">directory</span>, <span class="ruby-identifier">keywords</span>) -138: <span class="ruby-identifier">html</span> = <span class="ruby-constant">HTMLDocument</span>.<span class="ruby-identifier">new</span> -139: <span class="ruby-identifier">head</span> = <span class="ruby-identifier">html</span>.<span class="ruby-identifier">generateHead</span>(<span class="ruby-value str">'TaskJuggler Syntax Reference Navigator'</span>) -140: <span class="ruby-identifier">head</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XMLElement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'base'</span>, <span class="ruby-value str">'target'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'display'</span>) -141: <span class="ruby-identifier">html</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">body</span> = <span class="ruby-constant">XMLElement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'body'</span>)) -142: -143: <span class="ruby-identifier">body</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XMLNamedText</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'Table Of Contents'</span>, <span class="ruby-value str">'a'</span>, <span class="ruby-value str">'href'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'toc.html'</span>) -144: <span class="ruby-identifier">body</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XMLElement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'br'</span>) -145: -146: <span class="ruby-identifier">normalizedKeywords</span> = {} -147: <span class="ruby-identifier">keywords</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">keyword</span><span class="ruby-operator">|</span> -148: <span class="ruby-identifier">normalizedKeywords</span>[<span class="ruby-ivar">@keywords</span>[<span class="ruby-identifier">keyword</span>].<span class="ruby-identifier">title</span>] = <span class="ruby-identifier">keyword</span> -149: <span class="ruby-keyword kw">end</span> -150: <span class="ruby-identifier">letter</span> = <span class="ruby-keyword kw">nil</span> -151: <span class="ruby-identifier">letters</span> = [] -152: <span class="ruby-identifier">normalizedKeywords</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">sort!</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">normalized</span><span class="ruby-operator">|</span> -153: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized</span>[<span class="ruby-value">0</span>, <span class="ruby-value">1</span>] <span class="ruby-operator">!=</span> <span class="ruby-identifier">letter</span> -154: <span class="ruby-identifier">letter</span> = <span class="ruby-identifier">normalized</span>[<span class="ruby-value">0</span>, <span class="ruby-value">1</span>] -155: <span class="ruby-identifier">letters</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">letter</span> -156: <span class="ruby-identifier">body</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">h</span> = <span class="ruby-constant">XMLElement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'h3'</span>)) -157: <span class="ruby-identifier">h</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XMLNamedText</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">letter</span>.<span class="ruby-identifier">upcase</span>, <span class="ruby-value str">'a'</span>, <span class="ruby-value str">'name'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">letter</span>) -158: <span class="ruby-keyword kw">end</span> -159: <span class="ruby-identifier">keyword</span> = <span class="ruby-identifier">normalizedKeywords</span>[<span class="ruby-identifier">normalized</span>] -160: <span class="ruby-identifier">body</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XMLNamedText</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{normalized}&quot;</span>, <span class="ruby-value str">'a'</span>, -161: <span class="ruby-value str">'href'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;#{keyword}.html&quot;</span>) -162: <span class="ruby-identifier">body</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XMLElement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'br'</span>) -163: <span class="ruby-keyword kw">end</span> -164: -165: <span class="ruby-identifier">html</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">directory</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'navbar.html'</span>) -166: -167: <span class="ruby-identifier">html</span> = <span class="ruby-constant">HTMLDocument</span>.<span class="ruby-identifier">new</span> -168: <span class="ruby-identifier">head</span> = <span class="ruby-identifier">html</span>.<span class="ruby-identifier">generateHead</span>(<span class="ruby-value str">'TaskJuggler Syntax Reference Navigator'</span>) -169: <span class="ruby-identifier">head</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XMLElement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'base'</span>, <span class="ruby-value str">'target'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'navigator'</span>) -170: <span class="ruby-identifier">html</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">body</span> = <span class="ruby-constant">XMLElement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'body'</span>)) -171: -172: <span class="ruby-identifier">body</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">h3</span> = <span class="ruby-constant">XMLElement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'h3'</span>)) -173: <span class="ruby-identifier">letters</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span> -174: <span class="ruby-identifier">h3</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XMLNamedText</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">l</span>.<span class="ruby-identifier">upcase</span>, <span class="ruby-value str">'a'</span>, -175: <span class="ruby-value str">'href'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;navbar.html##{l}&quot;</span>) -176: <span class="ruby-keyword kw">end</span> -177: <span class="ruby-identifier">html</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">directory</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'alphabet.html'</span>) -178: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/SyntaxReference.rb, line 141</span> +141: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">generateHTMLnavbar</span>(<span class="ruby-identifier">directory</span>, <span class="ruby-identifier">keywords</span>) +142: <span class="ruby-identifier">html</span> = <span class="ruby-constant">HTMLDocument</span>.<span class="ruby-identifier">new</span> +143: <span class="ruby-identifier">head</span> = <span class="ruby-identifier">html</span>.<span class="ruby-identifier">generateHead</span>(<span class="ruby-value str">'TaskJuggler Syntax Reference Navigator'</span>) +144: <span class="ruby-identifier">head</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XMLElement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'base'</span>, <span class="ruby-value str">'target'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'display'</span>) +145: <span class="ruby-identifier">html</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">body</span> = <span class="ruby-constant">XMLElement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'body'</span>)) +146: +147: <span class="ruby-identifier">body</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XMLNamedText</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'Table Of Contents'</span>, <span class="ruby-value str">'a'</span>, <span class="ruby-value str">'href'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'toc.html'</span>) +148: <span class="ruby-identifier">body</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XMLElement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'br'</span>) +149: +150: <span class="ruby-identifier">normalizedKeywords</span> = {} +151: <span class="ruby-identifier">keywords</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">keyword</span><span class="ruby-operator">|</span> +152: <span class="ruby-identifier">normalizedKeywords</span>[<span class="ruby-ivar">@keywords</span>[<span class="ruby-identifier">keyword</span>].<span class="ruby-identifier">title</span>] = <span class="ruby-identifier">keyword</span> +153: <span class="ruby-keyword kw">end</span> +154: <span class="ruby-identifier">letter</span> = <span class="ruby-keyword kw">nil</span> +155: <span class="ruby-identifier">letters</span> = [] +156: <span class="ruby-identifier">normalizedKeywords</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">sort!</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">normalized</span><span class="ruby-operator">|</span> +157: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">normalized</span>[<span class="ruby-value">0</span>, <span class="ruby-value">1</span>] <span class="ruby-operator">!=</span> <span class="ruby-identifier">letter</span> +158: <span class="ruby-identifier">letter</span> = <span class="ruby-identifier">normalized</span>[<span class="ruby-value">0</span>, <span class="ruby-value">1</span>] +159: <span class="ruby-identifier">letters</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">letter</span> +160: <span class="ruby-identifier">body</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">h</span> = <span class="ruby-constant">XMLElement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'h3'</span>)) +161: <span class="ruby-identifier">h</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XMLNamedText</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">letter</span>.<span class="ruby-identifier">upcase</span>, <span class="ruby-value str">'a'</span>, <span class="ruby-value str">'name'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">letter</span>) +162: <span class="ruby-keyword kw">end</span> +163: <span class="ruby-identifier">keyword</span> = <span class="ruby-identifier">normalizedKeywords</span>[<span class="ruby-identifier">normalized</span>] +164: <span class="ruby-identifier">body</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XMLNamedText</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{normalized}&quot;</span>, <span class="ruby-value str">'a'</span>, +165: <span class="ruby-value str">'href'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;#{keyword}.html&quot;</span>) +166: <span class="ruby-identifier">body</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XMLElement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'br'</span>) +167: <span class="ruby-keyword kw">end</span> +168: +169: <span class="ruby-identifier">html</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">directory</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'navbar.html'</span>) +170: +171: <span class="ruby-identifier">html</span> = <span class="ruby-constant">HTMLDocument</span>.<span class="ruby-identifier">new</span> +172: <span class="ruby-identifier">head</span> = <span class="ruby-identifier">html</span>.<span class="ruby-identifier">generateHead</span>(<span class="ruby-value str">'TaskJuggler Syntax Reference Navigator'</span>) +173: <span class="ruby-identifier">head</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XMLElement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'base'</span>, <span class="ruby-value str">'target'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'navigator'</span>) +174: <span class="ruby-identifier">html</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">body</span> = <span class="ruby-constant">XMLElement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'body'</span>)) +175: +176: <span class="ruby-identifier">body</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">h3</span> = <span class="ruby-constant">XMLElement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'h3'</span>)) +177: <span class="ruby-identifier">letters</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span> +178: <span class="ruby-identifier">h3</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XMLNamedText</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">l</span>.<span class="ruby-identifier">upcase</span>, <span class="ruby-value str">'a'</span>, +179: <span class="ruby-value str">'href'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;navbar.html##{l}&quot;</span>) +180: <span class="ruby-keyword kw">end</span> +181: <span class="ruby-identifier">html</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">directory</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'alphabet.html'</span>) +182: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -808,18 +838,18 @@ <div class="method-source-code" id="generate-reference-source"> <pre> - <span class="ruby-comment cmt"># File lib/SyntaxReference.rb, line 127</span> -127: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">generateHTMLreference</span>(<span class="ruby-identifier">directory</span>, <span class="ruby-identifier">keyword</span>) -128: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">checkKeyword</span>(<span class="ruby-identifier">keyword</span>) -129: <span class="ruby-ivar">@keywords</span>[<span class="ruby-identifier">keyword</span>].<span class="ruby-identifier">generateHTML</span>(<span class="ruby-identifier">directory</span>) -130: <span class="ruby-keyword kw">else</span> -131: <span class="ruby-value str">''</span> -132: <span class="ruby-keyword kw">end</span> -133: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/SyntaxReference.rb, line 131</span> +131: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">generateHTMLreference</span>(<span class="ruby-identifier">directory</span>, <span class="ruby-identifier">keyword</span>) +132: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">checkKeyword</span>(<span class="ruby-identifier">keyword</span>) +133: <span class="ruby-ivar">@keywords</span>[<span class="ruby-identifier">keyword</span>].<span class="ruby-identifier">generateHTML</span>(<span class="ruby-identifier">directory</span>) +134: <span class="ruby-keyword kw">else</span> +135: <span class="ruby-value str">''</span> +136: <span class="ruby-keyword kw">end</span> +137: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -846,19 +876,19 @@ <div class="method-source-code" id="internal-eferences-source"> <pre> - <span class="ruby-comment cmt"># File lib/SyntaxReference.rb, line 104</span> -104: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">internalReferences</span> -105: <span class="ruby-identifier">references</span> = {} -106: <span class="ruby-ivar">@keywords</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">keyword</span><span class="ruby-operator">|</span> -107: (<span class="ruby-identifier">refs</span> = <span class="ruby-identifier">keyword</span>.<span class="ruby-identifier">references</span>.<span class="ruby-identifier">uniq</span>).<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> -108: <span class="ruby-identifier">references</span>[<span class="ruby-identifier">keyword</span>.<span class="ruby-identifier">keyword</span>] = <span class="ruby-identifier">refs</span> -109: <span class="ruby-keyword kw">end</span> -110: <span class="ruby-identifier">references</span> -111: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/SyntaxReference.rb, line 108</span> +108: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">internalReferences</span> +109: <span class="ruby-identifier">references</span> = {} +110: <span class="ruby-ivar">@keywords</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">keyword</span><span class="ruby-operator">|</span> +111: (<span class="ruby-identifier">refs</span> = <span class="ruby-identifier">keyword</span>.<span class="ruby-identifier">references</span>.<span class="ruby-identifier">uniq</span>).<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> +112: <span class="ruby-identifier">references</span>[<span class="ruby-identifier">keyword</span>.<span class="ruby-identifier">keyword</span>] = <span class="ruby-identifier">refs</span> +113: <span class="ruby-keyword kw">end</span> +114: <span class="ruby-identifier">references</span> +115: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -892,23 +922,23 @@ <div class="method-source-code" id="table-f-ontents-source"> <pre> - <span class="ruby-comment cmt"># File lib/SyntaxReference.rb, line 91</span> - 91: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tableOfContents</span>(<span class="ruby-identifier">toc</span>, <span class="ruby-identifier">sectionPrefix</span>) - 92: <span class="ruby-identifier">keywords</span> = <span class="ruby-identifier">all</span> - 93: <span class="ruby-comment cmt"># Set the chapter name to 'Syntax Reference' with a link to the first</span> - 94: <span class="ruby-comment cmt"># keyword.</span> - 95: <span class="ruby-identifier">toc</span>.<span class="ruby-identifier">addEntry</span>(<span class="ruby-constant">TOCEntry</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">sectionPrefix</span>, <span class="ruby-value str">'Syntax Reference'</span>, <span class="ruby-identifier">keywords</span>[<span class="ruby-value">0</span>])) - 96: <span class="ruby-identifier">i</span> = <span class="ruby-value">1</span> - 97: <span class="ruby-identifier">keywords</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">keyword</span><span class="ruby-operator">|</span> - 98: <span class="ruby-identifier">title</span> = <span class="ruby-ivar">@keywords</span>[<span class="ruby-identifier">keyword</span>].<span class="ruby-identifier">title</span> - 99: <span class="ruby-identifier">toc</span>.<span class="ruby-identifier">addEntry</span>(<span class="ruby-constant">TOCEntry</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{sectionPrefix}.#{i}&quot;</span>, <span class="ruby-identifier">title</span>, <span class="ruby-identifier">keyword</span>)) -100: <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> -101: <span class="ruby-keyword kw">end</span> -102: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/SyntaxReference.rb, line 95</span> + 95: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tableOfContents</span>(<span class="ruby-identifier">toc</span>, <span class="ruby-identifier">sectionPrefix</span>) + 96: <span class="ruby-identifier">keywords</span> = <span class="ruby-identifier">all</span> + 97: <span class="ruby-comment cmt"># Set the chapter name to 'Syntax Reference' with a link to the first</span> + 98: <span class="ruby-comment cmt"># keyword.</span> + 99: <span class="ruby-identifier">toc</span>.<span class="ruby-identifier">addEntry</span>(<span class="ruby-constant">TOCEntry</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">sectionPrefix</span>, <span class="ruby-value str">'Syntax Reference'</span>, <span class="ruby-identifier">keywords</span>[<span class="ruby-value">0</span>])) +100: <span class="ruby-identifier">i</span> = <span class="ruby-value">1</span> +101: <span class="ruby-identifier">keywords</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">keyword</span><span class="ruby-operator">|</span> +102: <span class="ruby-identifier">title</span> = <span class="ruby-ivar">@keywords</span>[<span class="ruby-identifier">keyword</span>].<span class="ruby-identifier">title</span> +103: <span class="ruby-identifier">toc</span>.<span class="ruby-identifier">addEntry</span>(<span class="ruby-constant">TOCEntry</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;#{sectionPrefix}.#{i}&quot;</span>, <span class="ruby-identifier">title</span>, <span class="ruby-identifier">keyword</span>)) +104: <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> +105: <span class="ruby-keyword kw">end</span> +106: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -940,18 +970,18 @@ <div class="method-source-code" id="to-s-source"> <pre> - <span class="ruby-comment cmt"># File lib/SyntaxReference.rb, line 116</span> -116: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>(<span class="ruby-identifier">keyword</span>) -117: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">checkKeyword</span>(<span class="ruby-identifier">keyword</span>) -118: <span class="ruby-ivar">@keywords</span>[<span class="ruby-identifier">keyword</span>].<span class="ruby-identifier">to_s</span> -119: <span class="ruby-keyword kw">else</span> -120: <span class="ruby-value str">''</span> -121: <span class="ruby-keyword kw">end</span> -122: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/SyntaxReference.rb, line 120</span> +120: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>(<span class="ruby-identifier">keyword</span>) +121: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">checkKeyword</span>(<span class="ruby-identifier">keyword</span>) +122: <span class="ruby-ivar">@keywords</span>[<span class="ruby-identifier">keyword</span>].<span class="ruby-identifier">to_s</span> +123: <span class="ruby-keyword kw">else</span> +124: <span class="ruby-value str">''</span> +125: <span class="ruby-keyword kw">end</span> +126: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -989,43 +1019,43 @@ <div class="method-source-code" id="attributes-source"> <pre> - <span class="ruby-comment cmt"># File lib/SyntaxReference.rb, line 220</span> -220: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">attributes</span>(<span class="ruby-identifier">token</span>, <span class="ruby-identifier">scenarioSpecific</span>) -221: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Token #{token} must reference a rule&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">token</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">!!</span> -222: <span class="ruby-identifier">token</span> = <span class="ruby-identifier">token</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-value">1</span>, <span class="ruby-identifier">token</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>) -223: <span class="ruby-comment cmt"># Find the matching rule.</span> -224: <span class="ruby-identifier">rule</span> = <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">rules</span>[<span class="ruby-identifier">token</span>] -225: <span class="ruby-identifier">attrs</span> = {} -226: <span class="ruby-comment cmt"># Now we look at the first token of each pattern.</span> -227: <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">patterns</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pattern</span><span class="ruby-operator">|</span> -228: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pattern</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">__</span> -229: <span class="ruby-comment cmt"># If it's a terminal symbol, we found what we are looking for. We add</span> -230: <span class="ruby-comment cmt"># it to the attrs hash and mark it as non scenario specific.</span> -231: <span class="ruby-identifier">attrs</span>[<span class="ruby-identifier">pattern</span>] = <span class="ruby-identifier">scenarioSpecific</span> -232: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">pattern</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'!scenarioIdCol'</span> -233: <span class="ruby-comment cmt"># A reference to the !scenarioId rule marks the next token of the</span> -234: <span class="ruby-comment cmt"># pattern as a reference to a rule with all scenario specific</span> -235: <span class="ruby-comment cmt"># attributes.</span> -236: <span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">attributes</span>(<span class="ruby-identifier">pattern</span>[<span class="ruby-value">1</span>], <span class="ruby-keyword kw">true</span>)) -237: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">pattern</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">!!</span> -238: <span class="ruby-comment cmt"># In case we have a reference to another rule, we just follow the</span> -239: <span class="ruby-comment cmt"># reference. If the pattern is documented we don't have to follow the</span> -240: <span class="ruby-comment cmt"># reference. We can use the pattern instead.</span> -241: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">doc</span>.<span class="ruby-identifier">nil?</span> -242: <span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">attributes</span>(<span class="ruby-identifier">pattern</span>[<span class="ruby-value">0</span>], <span class="ruby-identifier">scenarioSpecific</span>)) -243: <span class="ruby-keyword kw">else</span> -244: <span class="ruby-identifier">attrs</span>[<span class="ruby-identifier">pattern</span>] = <span class="ruby-identifier">scenarioSpecific</span> -245: <span class="ruby-keyword kw">end</span> -246: <span class="ruby-keyword kw">else</span> -247: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Hit unknown token #{token}&quot;</span> -248: <span class="ruby-keyword kw">end</span> -249: <span class="ruby-keyword kw">end</span> -250: <span class="ruby-identifier">attrs</span> -251: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/SyntaxReference.rb, line 224</span> +224: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">attributes</span>(<span class="ruby-identifier">token</span>, <span class="ruby-identifier">scenarioSpecific</span>) +225: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Token #{token} must reference a rule&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">token</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">!!</span> +226: <span class="ruby-identifier">token</span> = <span class="ruby-identifier">token</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-value">1</span>, <span class="ruby-identifier">token</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>) +227: <span class="ruby-comment cmt"># Find the matching rule.</span> +228: <span class="ruby-identifier">rule</span> = <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">rules</span>[<span class="ruby-identifier">token</span>] +229: <span class="ruby-identifier">attrs</span> = {} +230: <span class="ruby-comment cmt"># Now we look at the first token of each pattern.</span> +231: <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">patterns</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pattern</span><span class="ruby-operator">|</span> +232: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pattern</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">__</span> +233: <span class="ruby-comment cmt"># If it's a terminal symbol, we found what we are looking for. We add</span> +234: <span class="ruby-comment cmt"># it to the attrs hash and mark it as non scenario specific.</span> +235: <span class="ruby-identifier">attrs</span>[<span class="ruby-identifier">pattern</span>] = <span class="ruby-identifier">scenarioSpecific</span> +236: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">pattern</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'!scenarioIdCol'</span> +237: <span class="ruby-comment cmt"># A reference to the !scenarioId rule marks the next token of the</span> +238: <span class="ruby-comment cmt"># pattern as a reference to a rule with all scenario specific</span> +239: <span class="ruby-comment cmt"># attributes.</span> +240: <span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">attributes</span>(<span class="ruby-identifier">pattern</span>[<span class="ruby-value">1</span>], <span class="ruby-keyword kw">true</span>)) +241: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">pattern</span>[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">!!</span> +242: <span class="ruby-comment cmt"># In case we have a reference to another rule, we just follow the</span> +243: <span class="ruby-comment cmt"># reference. If the pattern is documented we don't have to follow the</span> +244: <span class="ruby-comment cmt"># reference. We can use the pattern instead.</span> +245: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">doc</span>.<span class="ruby-identifier">nil?</span> +246: <span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">attributes</span>(<span class="ruby-identifier">pattern</span>[<span class="ruby-value">0</span>], <span class="ruby-identifier">scenarioSpecific</span>)) +247: <span class="ruby-keyword kw">else</span> +248: <span class="ruby-identifier">attrs</span>[<span class="ruby-identifier">pattern</span>] = <span class="ruby-identifier">scenarioSpecific</span> +249: <span class="ruby-keyword kw">end</span> +250: <span class="ruby-keyword kw">else</span> +251: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Hit unknown token #{token}&quot;</span> +252: <span class="ruby-keyword kw">end</span> +253: <span class="ruby-keyword kw">end</span> +254: <span class="ruby-identifier">attrs</span> +255: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1052,33 +1082,33 @@ <div class="method-source-code" id="check-eyword-source"> <pre> - <span class="ruby-comment cmt"># File lib/SyntaxReference.rb, line 253</span> -253: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">checkKeyword</span>(<span class="ruby-identifier">keyword</span>) -254: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">keyword</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@keywords</span>[<span class="ruby-identifier">keyword</span>].<span class="ruby-identifier">nil?</span> -255: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">keyword</span>.<span class="ruby-identifier">nil?</span> -256: <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;ERROR: #{keyword} is not a known keyword.\n\n&quot;</span> -257: <span class="ruby-keyword kw">end</span> -258: <span class="ruby-comment cmt"># Create list of top-level keywords.</span> -259: <span class="ruby-identifier">kwdStr</span> = <span class="ruby-value str">''</span> -260: <span class="ruby-ivar">@keywords</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">kwd</span><span class="ruby-operator">|</span> -261: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">kwd</span>.<span class="ruby-identifier">contexts</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> -262: (<span class="ruby-identifier">kwd</span>.<span class="ruby-identifier">contexts</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">kwd</span>.<span class="ruby-identifier">contexts</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">kwd</span>) -263: <span class="ruby-identifier">kwdStr</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">', '</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">kwdStr</span>.<span class="ruby-identifier">empty?</span> -264: <span class="ruby-identifier">kwdStr</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">kwd</span>.<span class="ruby-identifier">keyword</span> -265: <span class="ruby-keyword kw">end</span> -266: <span class="ruby-keyword kw">end</span> -267: <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;Try one of the following keywords as argument to this &quot;</span> <span class="ruby-operator">+</span> -268: <span class="ruby-value str">&quot;program:\n&quot;</span> -269: <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{kwdStr}&quot;</span> -270: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> -271: <span class="ruby-keyword kw">end</span> -272: -273: <span class="ruby-keyword kw">true</span> -274: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/SyntaxReference.rb, line 257</span> +257: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">checkKeyword</span>(<span class="ruby-identifier">keyword</span>) +258: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">keyword</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@keywords</span>[<span class="ruby-identifier">keyword</span>].<span class="ruby-identifier">nil?</span> +259: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">keyword</span>.<span class="ruby-identifier">nil?</span> +260: <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;ERROR: #{keyword} is not a known keyword.\n\n&quot;</span> +261: <span class="ruby-keyword kw">end</span> +262: <span class="ruby-comment cmt"># Create list of top-level keywords.</span> +263: <span class="ruby-identifier">kwdStr</span> = <span class="ruby-value str">''</span> +264: <span class="ruby-ivar">@keywords</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">kwd</span><span class="ruby-operator">|</span> +265: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">kwd</span>.<span class="ruby-identifier">contexts</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> +266: (<span class="ruby-identifier">kwd</span>.<span class="ruby-identifier">contexts</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">kwd</span>.<span class="ruby-identifier">contexts</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">kwd</span>) +267: <span class="ruby-identifier">kwdStr</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">', '</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">kwdStr</span>.<span class="ruby-identifier">empty?</span> +268: <span class="ruby-identifier">kwdStr</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">kwd</span>.<span class="ruby-identifier">keyword</span> +269: <span class="ruby-keyword kw">end</span> +270: <span class="ruby-keyword kw">end</span> +271: <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;Try one of the following keywords as argument to this &quot;</span> <span class="ruby-operator">+</span> +272: <span class="ruby-value str">&quot;program:\n&quot;</span> +273: <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{kwdStr}&quot;</span> +274: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> +275: <span class="ruby-keyword kw">end</span> +276: +277: <span class="ruby-keyword kw">true</span> +278: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -1107,42 +1137,42 @@ <div class="method-source-code" id="optional-ttributes-source"> <pre> - <span class="ruby-comment cmt"># File lib/SyntaxReference.rb, line 183</span> -183: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">optionalAttributes</span>(<span class="ruby-identifier">pattern</span>, <span class="ruby-identifier">stack</span>) -184: <span class="ruby-comment cmt"># If we hit an endless recursion we won't find any attributes. So we push</span> -185: <span class="ruby-comment cmt"># each pattern we process on the 'stack'. If we hit it again, we just</span> -186: <span class="ruby-comment cmt"># return an empty hash.</span> -187: <span class="ruby-keyword kw">return</span> {} <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">stack</span>[<span class="ruby-identifier">pattern</span>] -188: -189: <span class="ruby-comment cmt"># If we hit a pattern that is documented, we ignore it.</span> -190: <span class="ruby-keyword kw">return</span> {} <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">stack</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">doc</span> -191: -192: <span class="ruby-comment cmt"># Push pattern onto 'stack'.</span> -193: <span class="ruby-identifier">stack</span>[<span class="ruby-identifier">pattern</span>] = <span class="ruby-keyword kw">true</span> -194: -195: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pattern</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'_{'</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">pattern</span>[<span class="ruby-value">2</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'_}'</span> -196: <span class="ruby-comment cmt"># We have found an optional attribute pattern!</span> -197: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">attributes</span>(<span class="ruby-identifier">pattern</span>[<span class="ruby-value">1</span>], <span class="ruby-keyword kw">false</span>) -198: <span class="ruby-keyword kw">end</span> -199: -200: <span class="ruby-comment cmt"># If a token of the pattern is a reference, we recursively</span> -201: <span class="ruby-comment cmt"># follow the reference to the next pattern.</span> -202: <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">token</span><span class="ruby-operator">|</span> -203: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">token</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">!!</span> -204: <span class="ruby-identifier">token</span> = <span class="ruby-identifier">token</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-value">1</span>, <span class="ruby-identifier">token</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>) -205: <span class="ruby-identifier">rule</span> = <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">rules</span>[<span class="ruby-identifier">token</span>] -206: <span class="ruby-comment cmt"># Rules with multiple patterns won't lead to attributes.</span> -207: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">patterns</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span> -208: -209: <span class="ruby-identifier">attrs</span> = <span class="ruby-identifier">optionalAttributes</span>(<span class="ruby-identifier">rule</span>.<span class="ruby-identifier">patterns</span>[<span class="ruby-value">0</span>], <span class="ruby-identifier">stack</span>) -210: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">attrs</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">empty?</span> -211: <span class="ruby-keyword kw">end</span> -212: <span class="ruby-keyword kw">end</span> -213: {} -214: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/SyntaxReference.rb, line 187</span> +187: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">optionalAttributes</span>(<span class="ruby-identifier">pattern</span>, <span class="ruby-identifier">stack</span>) +188: <span class="ruby-comment cmt"># If we hit an endless recursion we won't find any attributes. So we push</span> +189: <span class="ruby-comment cmt"># each pattern we process on the 'stack'. If we hit it again, we just</span> +190: <span class="ruby-comment cmt"># return an empty hash.</span> +191: <span class="ruby-keyword kw">return</span> {} <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">stack</span>[<span class="ruby-identifier">pattern</span>] +192: +193: <span class="ruby-comment cmt"># If we hit a pattern that is documented, we ignore it.</span> +194: <span class="ruby-keyword kw">return</span> {} <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">stack</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">doc</span> +195: +196: <span class="ruby-comment cmt"># Push pattern onto 'stack'.</span> +197: <span class="ruby-identifier">stack</span>[<span class="ruby-identifier">pattern</span>] = <span class="ruby-keyword kw">true</span> +198: +199: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pattern</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'_{'</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">pattern</span>[<span class="ruby-value">2</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'_}'</span> +200: <span class="ruby-comment cmt"># We have found an optional attribute pattern!</span> +201: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">attributes</span>(<span class="ruby-identifier">pattern</span>[<span class="ruby-value">1</span>], <span class="ruby-keyword kw">false</span>) +202: <span class="ruby-keyword kw">end</span> +203: +204: <span class="ruby-comment cmt"># If a token of the pattern is a reference, we recursively</span> +205: <span class="ruby-comment cmt"># follow the reference to the next pattern.</span> +206: <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">token</span><span class="ruby-operator">|</span> +207: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">token</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">!!</span> +208: <span class="ruby-identifier">token</span> = <span class="ruby-identifier">token</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-value">1</span>, <span class="ruby-identifier">token</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>) +209: <span class="ruby-identifier">rule</span> = <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">rules</span>[<span class="ruby-identifier">token</span>] +210: <span class="ruby-comment cmt"># Rules with multiple patterns won't lead to attributes.</span> +211: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">patterns</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span> +212: +213: <span class="ruby-identifier">attrs</span> = <span class="ruby-identifier">optionalAttributes</span>(<span class="ruby-identifier">rule</span>.<span class="ruby-identifier">patterns</span>[<span class="ruby-value">0</span>], <span class="ruby-identifier">stack</span>) +214: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">attrs</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">empty?</span> +215: <span class="ruby-keyword kw">end</span> +216: <span class="ruby-keyword kw">end</span> +217: {} +218: <span class="ruby-keyword kw">end</span></pre> </div> </div>