ThirdParty/Pygments/pygments/lexers/robotframework.py

changeset 4697
c2e9bf425554
parent 4172
4f20dba37ab6
child 5713
6762afd9f963
--- a/ThirdParty/Pygments/pygments/lexers/robotframework.py	Sun Jan 24 16:15:58 2016 +0100
+++ b/ThirdParty/Pygments/pygments/lexers/robotframework.py	Sun Jan 24 19:28:37 2016 +0100
@@ -5,7 +5,7 @@
 
     Lexer for Robot Framework.
 
-    :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
+    :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
     :license: BSD, see LICENSE for details.
 """
 
@@ -87,7 +87,7 @@
 class VariableTokenizer(object):
 
     def tokenize(self, string, token):
-        var = VariableSplitter(string, identifiers='$@%')
+        var = VariableSplitter(string, identifiers='$@%&')
         if var.start < 0 or token in (COMMENT, ERROR):
             yield string, token
             return
@@ -205,7 +205,7 @@
     def _is_assign(self, value):
         if value.endswith('='):
             value = value[:-1].strip()
-        var = VariableSplitter(value, identifiers='$@')
+        var = VariableSplitter(value, identifiers='$@&')
         return var.start == 0 and var.end == len(value)
 
 
@@ -262,7 +262,7 @@
 
 class KeywordSetting(TestCaseSetting):
     _keyword_settings = ('teardown',)
-    _other_settings = ('documentation', 'arguments', 'return', 'timeout')
+    _other_settings = ('documentation', 'arguments', 'return', 'timeout', 'tags')
 
 
 class Variable(Tokenizer):
@@ -465,13 +465,13 @@
         self.identifier = self._variable_chars[0]
         self.base = ''.join(self._variable_chars[2:-1])
         self.end = self.start + len(self._variable_chars)
-        if self._has_list_variable_index():
-            self.index = ''.join(self._list_variable_index_chars[1:-1])
-            self.end += len(self._list_variable_index_chars)
+        if self._has_list_or_dict_variable_index():
+            self.index = ''.join(self._list_and_dict_variable_index_chars[1:-1])
+            self.end += len(self._list_and_dict_variable_index_chars)
 
-    def _has_list_variable_index(self):
-        return self._list_variable_index_chars\
-        and self._list_variable_index_chars[-1] == ']'
+    def _has_list_or_dict_variable_index(self):
+        return self._list_and_dict_variable_index_chars\
+        and self._list_and_dict_variable_index_chars[-1] == ']'
 
     def _split(self, string):
         start_index, max_index = self._find_variable(string)
@@ -479,7 +479,7 @@
         self._open_curly = 1
         self._state = self._variable_state
         self._variable_chars = [string[start_index], '{']
-        self._list_variable_index_chars = []
+        self._list_and_dict_variable_index_chars = []
         self._string = string
         start_index += 2
         for index, char in enumerate(string[start_index:]):
@@ -530,14 +530,14 @@
         if char == '}' and not self._is_escaped(self._string, index):
             self._open_curly -= 1
             if self._open_curly == 0:
-                if not self._is_list_variable():
+                if not self._is_list_or_dict_variable():
                     raise StopIteration
                 self._state = self._waiting_list_variable_index_state
         elif char in self._identifiers:
             self._state = self._internal_variable_start_state
 
-    def _is_list_variable(self):
-        return self._variable_chars[0] == '@'
+    def _is_list_or_dict_variable(self):
+        return self._variable_chars[0] in ('@','&')
 
     def _internal_variable_start_state(self, char, index):
         self._state = self._variable_state
@@ -551,10 +551,10 @@
     def _waiting_list_variable_index_state(self, char, index):
         if char != '[':
             raise StopIteration
-        self._list_variable_index_chars.append(char)
+        self._list_and_dict_variable_index_chars.append(char)
         self._state = self._list_variable_index_state
 
     def _list_variable_index_state(self, char, index):
-        self._list_variable_index_chars.append(char)
+        self._list_and_dict_variable_index_chars.append(char)
         if char == ']':
             raise StopIteration

eric ide

mercurial