Robot Framework Integrated Development Environment (RIDE)
highlightmatcher.py
Go to the documentation of this file.
1 # Copyright 2008-2015 Nokia Networks
2 # Copyright 2016- Robot Framework Foundation
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 
16 from .. import utils
17 from . import variablematcher
18 
19 
20 def highlight_matcher(value, content):
21  if not value or not content:
22  return False
23  selection = utils.normalize(value, ignore=['_'])
24  if not selection:
25  return False
26  target = utils.normalize(content, ignore=['_'])
27  if not target:
28  return False
29  if selection == target:
30  return True
31  return _variable_matches(selection, target)
32 
33 
34 def _variable_matches(selection, target):
35  variable = variablematcher.get_variable_basename(selection)
36  if not variable:
37  return False
38  variables = variablematcher.find_variable_basenames(target)
39  if variable in variables:
40  return True
41  return _list_variable_used_as_scalar(variable, variables)
42 
43 
44 def _list_variable_used_as_scalar(variable, variables):
45  return '$%s' % variable[1:] in variables
def _list_variable_used_as_scalar(variable, variables)
def highlight_matcher(value, content)
def _variable_matches(selection, target)