summaryrefslogtreecommitdiff
path: root/pygments
diff options
context:
space:
mode:
authorTim Hatch <tim@timhatch.com>2014-11-06 19:42:20 -0800
committerTim Hatch <tim@timhatch.com>2014-11-06 19:42:20 -0800
commit1fc9916d5c74ca7a8d9b8ca19d899be135a7b2b3 (patch)
treec917ecd47bd428151aff2a8f0305cf8382cfd8b5 /pygments
parent348b35f182e85f950e65a68d69d0f130912e8370 (diff)
downloadpygments-1fc9916d5c74ca7a8d9b8ca19d899be135a7b2b3.tar.gz
Fix SciLab builtins to only be a single type each (script).
Diffstat (limited to 'pygments')
-rw-r--r--pygments/lexers/_scilab_builtins.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/pygments/lexers/_scilab_builtins.py b/pygments/lexers/_scilab_builtins.py
index 456edc48..d4c02a1a 100644
--- a/pygments/lexers/_scilab_builtins.py
+++ b/pygments/lexers/_scilab_builtins.py
@@ -3064,7 +3064,7 @@ variables_kw = (
if __name__ == '__main__':
import subprocess
- from pygments.util import format_lines
+ from pygments.util import format_lines, duplicates_removed
mapping = {'variables': 'builtin'}
@@ -3077,11 +3077,18 @@ mputl(strcat(completion("", "%s"), "||"), fd);
mclose(fd)\n''' % var_type)
if '||' not in output[1]:
raise Exception(output[0])
- return output[1].strip().split('||')
+ # Invalid DISPLAY causes this to be output:
+ text = output[1].strip()
+ if text.startswith('Error: unable to open display \n'):
+ text = text[len('Error: unable to open display \n'):]
+ return text.split('||')
new_data = {}
+ seen = set() # only keep first type for a given word
for t in ('functions', 'commands', 'macros', 'variables'):
- new_data[t] = extract_completion(t)
+ new_data[t] = duplicates_removed(extract_completion(t), seen)
+ seen.update(set(new_data[t]))
+
with open(__file__) as f:
content = f.read()