@@ -70,28 +70,28 @@ class XmlCommentLine extends CommentLine, @xmldoccomment {
7070 override string toString ( ) { result = "/// ..." }
7171
7272 private string xmlAttributeRegex ( ) {
73- result = "(" + xmlIdentifierRegex ( ) + ")(?:\\s*=\\s*[\"']([^\"']*)[\"'])"
73+ result = "(" + this . xmlIdentifierRegex ( ) + ")(?:\\s*=\\s*[\"']([^\"']*)[\"'])"
7474 }
7575
7676 private string xmlIdentifierRegex ( ) { result = "\\w+" }
7777
78- private string xmlTagOpenRegex ( ) { result = "<\\s*" + xmlIdentifierRegex ( ) }
78+ private string xmlTagOpenRegex ( ) { result = "<\\s*" + this . xmlIdentifierRegex ( ) }
7979
8080 private string xmlTagIntroRegex ( ) {
81- result = xmlTagOpenRegex ( ) + "(?:\\s*" + xmlAttributeRegex ( ) + ")*"
81+ result = this . xmlTagOpenRegex ( ) + "(?:\\s*" + this . xmlAttributeRegex ( ) + ")*"
8282 }
8383
84- private string xmlTagCloseRegex ( ) { result = "</\\s*" + xmlIdentifierRegex ( ) + "\\s*>" }
84+ private string xmlTagCloseRegex ( ) { result = "</\\s*" + this . xmlIdentifierRegex ( ) + "\\s*>" }
8585
8686 /** Gets the text inside the XML element at character offset `offset`. */
8787 private string getElement ( int offset ) {
88- result = getText ( ) .regexpFind ( xmlTagIntroRegex ( ) , _, offset )
88+ result = this . getText ( ) .regexpFind ( this . xmlTagIntroRegex ( ) , _, offset )
8989 }
9090
9191 /** Gets the name of the opening tag at offset `offset`. */
9292 string getOpenTag ( int offset ) {
9393 exists ( int offset1 , int offset2 |
94- result = getElement ( offset1 ) .regexpFind ( xmlIdentifierRegex ( ) , 0 , offset2 ) and
94+ result = this . getElement ( offset1 ) .regexpFind ( this . xmlIdentifierRegex ( ) , 0 , offset2 ) and
9595 offset = offset1 + offset2
9696 )
9797 }
@@ -100,9 +100,9 @@ class XmlCommentLine extends CommentLine, @xmldoccomment {
100100 string getCloseTag ( int offset ) {
101101 exists ( int offset1 , int offset2 |
102102 result =
103- getText ( )
104- .regexpFind ( xmlTagCloseRegex ( ) , _, offset1 )
105- .regexpFind ( xmlIdentifierRegex ( ) , 0 , offset2 ) and
103+ this . getText ( )
104+ .regexpFind ( this . xmlTagCloseRegex ( ) , _, offset1 )
105+ .regexpFind ( this . xmlIdentifierRegex ( ) , 0 , offset2 ) and
106106 offset = offset1 + offset2
107107 )
108108 }
@@ -112,14 +112,14 @@ class XmlCommentLine extends CommentLine, @xmldoccomment {
112112 exists ( int offset1 , int offset2 |
113113 (
114114 result =
115- getText ( )
116- .regexpFind ( xmlTagIntroRegex ( ) + "\\s*/>" , _, offset1 )
117- .regexpFind ( xmlIdentifierRegex ( ) , 0 , offset2 ) or
115+ this . getText ( )
116+ .regexpFind ( this . xmlTagIntroRegex ( ) + "\\s*/>" , _, offset1 )
117+ .regexpFind ( this . xmlIdentifierRegex ( ) , 0 , offset2 ) or
118118 result =
119- getText ( )
120- .regexpFind ( xmlTagIntroRegex ( ) + "\\s*>\\s*</" + xmlIdentifierRegex ( ) + "\\s*>" , _ ,
121- offset1 )
122- .regexpFind ( xmlIdentifierRegex ( ) , 0 , offset2 )
119+ this . getText ( )
120+ .regexpFind ( this . xmlTagIntroRegex ( ) + "\\s*>\\s*</" + this . xmlIdentifierRegex ( ) +
121+ "\\s*>" , _ , offset1 )
122+ .regexpFind ( this . xmlIdentifierRegex ( ) , 0 , offset2 )
123123 ) and
124124 offset = offset1 + offset2
125125 )
@@ -130,18 +130,18 @@ class XmlCommentLine extends CommentLine, @xmldoccomment {
130130 * for a given XML attribute name `key` and element offset `offset`.
131131 */
132132 string getAttribute ( string element , string key , int offset ) {
133- exists ( int offset1 , int offset2 , string elt , string pair | elt = getElement ( offset1 ) |
134- element = elt .regexpFind ( xmlIdentifierRegex ( ) , 0 , offset2 ) and
133+ exists ( int offset1 , int offset2 , string elt , string pair | elt = this . getElement ( offset1 ) |
134+ element = elt .regexpFind ( this . xmlIdentifierRegex ( ) , 0 , offset2 ) and
135135 offset = offset1 + offset2 and
136- pair = elt .regexpFind ( xmlAttributeRegex ( ) , _, _) and
137- key = pair .regexpCapture ( xmlAttributeRegex ( ) , 1 ) and
138- result = pair .regexpCapture ( xmlAttributeRegex ( ) , 2 )
136+ pair = elt .regexpFind ( this . xmlAttributeRegex ( ) , _, _) and
137+ key = pair .regexpCapture ( this . xmlAttributeRegex ( ) , 1 ) and
138+ result = pair .regexpCapture ( this . xmlAttributeRegex ( ) , 2 )
139139 )
140140 }
141141
142142 /** Holds if the XML element at the given offset is not empty. */
143143 predicate hasBody ( string element , int offset ) {
144- element = getOpenTag ( offset ) and not element = getEmptyTag ( offset )
144+ element = this . getOpenTag ( offset ) and not element = this . getEmptyTag ( offset )
145145 }
146146}
147147
@@ -156,13 +156,13 @@ class XmlCommentLine extends CommentLine, @xmldoccomment {
156156 */
157157class CommentBlock extends @commentblock {
158158 /** Gets a textual representation of this comment block. */
159- string toString ( ) { result = getChild ( 0 ) .toString ( ) }
159+ string toString ( ) { result = this . getChild ( 0 ) .toString ( ) }
160160
161161 /** Gets the location of this comment block */
162162 Location getLocation ( ) { commentblock_location ( this , result ) }
163163
164164 /** Gets the number of lines in this comment block. */
165- int getNumLines ( ) { result = count ( getAChild ( ) ) }
165+ int getNumLines ( ) { result = count ( this . getAChild ( ) ) }
166166
167167 /** Gets the `c`th child of this comment block (numbered from 0). */
168168 CommentLine getChild ( int c ) { commentblock_child ( this , result , c ) }
@@ -189,23 +189,23 @@ class CommentBlock extends @commentblock {
189189 Element getAnElement ( ) { commentblock_binding ( this , result , _) }
190190
191191 /** Gets a line of text in this comment block. */
192- string getALine ( ) { result = getAChild ( ) .getText ( ) }
192+ string getALine ( ) { result = this . getAChild ( ) .getText ( ) }
193193
194194 /** Holds if the comment has no associated `Element`. */
195- predicate isOrphan ( ) { not exists ( getElement ( ) ) }
195+ predicate isOrphan ( ) { not exists ( this . getElement ( ) ) }
196196
197197 /** Holds if this block consists entirely of XML comments. */
198198 predicate isXmlCommentBlock ( ) {
199- forall ( CommentLine l | l = getAChild ( ) | l instanceof XmlCommentLine )
199+ forall ( CommentLine l | l = this . getAChild ( ) | l instanceof XmlCommentLine )
200200 }
201201
202202 /** Gets a `CommentLine` containing text. */
203- CommentLine getANonEmptyLine ( ) { result = getAChild ( ) and result .getText ( ) .length ( ) != 0 }
203+ CommentLine getANonEmptyLine ( ) { result = this . getAChild ( ) and result .getText ( ) .length ( ) != 0 }
204204
205205 /** Gets a `CommentLine` that might contain code. */
206206 CommentLine getAProbableCodeLine ( ) {
207207 // Logic taken verbatim from Java query CommentedCode.qll
208- result = getAChild ( ) and
208+ result = this . getAChild ( ) and
209209 exists ( string trimmed | trimmed = result .getText ( ) .regexpReplaceAll ( "\\s*//.*$" , "" ) |
210210 trimmed .matches ( "%;" ) or trimmed .matches ( "%{" ) or trimmed .matches ( "%}" )
211211 )
0 commit comments