From 4b9174ce07c5365424ed25c223e484fc35427dec Mon Sep 17 00:00:00 2001 From: Mauricio Caceres Bravo Date: Tue, 19 Feb 2019 11:40:43 -0500 Subject: Fix StataLexer format highlight error (change Name.Format to Name.Other) StataLexer defined Name.Format for variable and print format highlighting; Name.Format is not a built-in token, which caused issues downstream in certain applications (e.g. [here](https://github.com/kylebarron/stata_kernel/issues/295)). This commit changes Name.Format to Name.Other. --- pygments/lexers/stata.py | 8 ++++---- pygments/styles/stata_dark.py | 2 +- pygments/styles/stata_light.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pygments/lexers/stata.py b/pygments/lexers/stata.py index 8955a05c..9566d12a 100644 --- a/pygments/lexers/stata.py +++ b/pygments/lexers/stata.py @@ -163,9 +163,9 @@ class StataLexer(RegexLexer): ], # Stata formats 'format': [ - (r'%-?\d{1,2}(\.\d{1,2})?[gfe]c?', Name.Format), - (r'%(21x|16H|16L|8H|8L)', Name.Format), - (r'%-?(tc|tC|td|tw|tm|tq|th|ty|tg).{0,32}', Name.Format), - (r'%[-~]?\d{1,4}s', Name.Format), + (r'%-?\d{1,2}(\.\d{1,2})?[gfe]c?', Name.Other), + (r'%(21x|16H|16L|8H|8L)', Name.Other), + (r'%-?(tc|tC|td|tw|tm|tq|th|ty|tg)\S{0,32}', Name.Other), + (r'%[-~]?\d{1,4}s', Name.Other), ] } diff --git a/pygments/styles/stata_dark.py b/pygments/styles/stata_dark.py index 7610ba0f..851a9a8d 100644 --- a/pygments/styles/stata_dark.py +++ b/pygments/styles/stata_dark.py @@ -31,7 +31,7 @@ class StataDarkStyle(Style): Number: '#4FB8CC', Operator: '', Name.Function: '#6a6aff', - Name.Format: '#e2828e', + Name.Other: '#e2828e', Keyword: 'bold #7686bb', Keyword.Constant: '', Comment: 'italic #777777', diff --git a/pygments/styles/stata_light.py b/pygments/styles/stata_light.py index 86802ef7..fcca85e5 100644 --- a/pygments/styles/stata_light.py +++ b/pygments/styles/stata_light.py @@ -30,7 +30,7 @@ class StataLightStyle(Style): Number: '#2c2cff', Operator: '', Name.Function: '#2c2cff', - Name.Format: '#be646c', + Name.Other: '#be646c', Keyword: 'bold #353580', Keyword.Constant: '', Comment: 'italic #008800', -- cgit v1.2.1