@@ -93,18 +93,30 @@ export class YaraReferenceProvider implements vscode.ReferenceProvider {
93
93
let possibleVarRange : vscode . Range = new vscode . Range ( possibleVarStart , range . end ) ;
94
94
let possibleVar : string = doc . getText ( possibleVarRange ) ;
95
95
if ( varFirstChar . has ( possibleVar . charAt ( 0 ) ) ) {
96
- // console.log(`Identified symbol as a variable: ${symbol}`);
97
- let lineNo = 0 ;
98
- lines . forEach ( line => {
99
- let character : number = line . search ( `[\$#@!]${ symbol } [^a-zA-Z0-9_]` ) ;
96
+ let varRegexp : string ;
97
+ console . log ( `Identified symbol as a variable: ${ symbol } ` ) ;
98
+ let possibleWildcardEnd : vscode . Position = new vscode . Position ( range . end . line , range . end . character + 1 ) ;
99
+ let possibleWildcardRange : vscode . Range = new vscode . Range ( possibleVarStart , possibleWildcardEnd ) ;
100
+ let possibleWildcard : string = doc . getText ( possibleWildcardRange ) ;
101
+ // treat like a wildcard
102
+ if ( possibleWildcard . slice ( - 1 ) == "*" ) {
103
+ console . log ( `possibleWildcard: ${ JSON . stringify ( possibleWildcard ) } ` ) ;
104
+ varRegexp = `[\$#@!]${ symbol } [a-zA-Z0-9_]+` ;
105
+ }
106
+ // treat like a normal variable reference
107
+ else {
108
+ varRegexp = `[\$#@!]${ symbol } [^a-zA-Z0-9_]` ;
109
+ }
110
+ for ( let lineNo = 0 ; lineNo < lines . length ; lineNo ++ ) {
111
+ let character : number = lines [ lineNo ] . search ( varRegexp ) ;
100
112
if ( character != - 1 ) {
101
113
// console.log(`Found ${symbol} on line ${lineNo} at character ${character}`);
102
114
// have to readjust the character index
103
115
let refPosition : vscode . Position = new vscode . Position ( lineNo , character + 1 ) ;
104
116
references . push ( new vscode . Location ( fileUri , refPosition ) ) ;
105
117
}
106
- lineNo ++ ;
107
- } ) ;
118
+
119
+ }
108
120
}
109
121
else {
110
122
let lineNo = 0 ;
0 commit comments