Compare commits
10 Commits
0cf91fb51b
...
9a46e0c3b5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a46e0c3b5 | ||
|
|
c2f666762a | ||
|
|
2286ce7e18 | ||
|
|
a940048a0f | ||
|
|
898d602d36 | ||
|
|
5afce42eac | ||
|
|
289f2d5cf6 | ||
|
|
4c4edacd53 | ||
|
|
94554b3770 | ||
|
|
7e5bcd2b87 |
543
0001-Fix-do-concurrent-and-go-to-keywords-in-the-Fortran-.patch
Normal file
543
0001-Fix-do-concurrent-and-go-to-keywords-in-the-Fortran-.patch
Normal file
@ -0,0 +1,543 @@
|
||||
From a049b539113d20be25df41b65aa0c8981d835511 Mon Sep 17 00:00:00 2001
|
||||
From: ecasglez <29178639+ecasglez@users.noreply.github.com>
|
||||
Date: Sat, 2 Oct 2021 13:16:49 +0200
|
||||
Subject: [PATCH] Fix "do concurrent" and "go to" keywords in the Fortran
|
||||
lexer. (#1877)
|
||||
|
||||
* Fix "do concurrent" and "go to" keywords in the Fortran lexer.
|
||||
|
||||
* "Go to" statement was only highlighted if there was no space between "go" and "to".
|
||||
* "Concurrent" keyword in the "Do Concurrent" statement was never highlighted because of a typo. It has been fixed. In addition, it now highlights them only if "Concurrent" is right after the "Do" keyword.
|
||||
* I had to put the "do concurrent" changes before the already available list of keywords. Otherwise it won't highlight "Concurrent" because it finds first the "Do" keyword in the other list and stops searching for more keywords.
|
||||
|
||||
* Fix a bug while parsing Fortran files with go to and do concurrent statements causing wrong highlighting.
|
||||
|
||||
* For example, in the variable name "gotoErr", "goto" was highlighted but it shouldn't.
|
||||
|
||||
* Update Fortran tests to the changes for the "go to statements"
|
||||
|
||||
* Use Text.Whitespace to distinguish Fortran multiword keywords
|
||||
|
||||
Co-authored-by: ecasglez <ecasglez@protonmail.com>
|
||||
---
|
||||
pygments/lexers/fortran.py | 8 +-
|
||||
tests/examplefiles/fortran/zmlrpc.f90.output | 168 +++++++++++++-----
|
||||
.../examplefiles/fortranfixed/ahcon.f.output | 6 +-
|
||||
3 files changed, 135 insertions(+), 47 deletions(-)
|
||||
|
||||
diff --git a/pygments/lexers/fortran.py b/pygments/lexers/fortran.py
|
||||
index 6c6b8f8c..049a57cd 100644
|
||||
--- a/pygments/lexers/fortran.py
|
||||
+++ b/pygments/lexers/fortran.py
|
||||
@@ -48,11 +48,15 @@ class FortranLexer(RegexLexer):
|
||||
],
|
||||
'core': [
|
||||
# Statements
|
||||
+
|
||||
+ (r'\b(DO)(\s+)(CONCURRENT)\b', bygroups(Keyword, Text.Whitespace, Keyword)),
|
||||
+ (r'\b(GO)(\s*)(TO)\b', bygroups(Keyword, Text.Whitespace, Keyword)),
|
||||
+
|
||||
(words((
|
||||
'ABSTRACT', 'ACCEPT', 'ALL', 'ALLSTOP', 'ALLOCATABLE', 'ALLOCATE',
|
||||
'ARRAY', 'ASSIGN', 'ASSOCIATE', 'ASYNCHRONOUS', 'BACKSPACE', 'BIND',
|
||||
'BLOCK', 'BLOCKDATA', 'BYTE', 'CALL', 'CASE', 'CLASS', 'CLOSE',
|
||||
- 'CODIMENSION', 'COMMON', 'CONCURRRENT', 'CONTIGUOUS', 'CONTAINS',
|
||||
+ 'CODIMENSION', 'COMMON', 'CONTIGUOUS', 'CONTAINS',
|
||||
'CONTINUE', 'CRITICAL', 'CYCLE', 'DATA', 'DEALLOCATE', 'DECODE',
|
||||
'DEFERRED', 'DIMENSION', 'DO', 'ELEMENTAL', 'ELSE', 'ENCODE', 'END',
|
||||
'ENDASSOCIATE', 'ENDBLOCK', 'ENDDO', 'ENDENUM', 'ENDFORALL',
|
||||
@@ -60,7 +64,7 @@ class FortranLexer(RegexLexer):
|
||||
'ENDSELECT', 'ENDSUBMODULE', 'ENDSUBROUTINE', 'ENDTYPE', 'ENDWHERE',
|
||||
'ENTRY', 'ENUM', 'ENUMERATOR', 'EQUIVALENCE', 'ERROR STOP', 'EXIT',
|
||||
'EXTENDS', 'EXTERNAL', 'EXTRINSIC', 'FILE', 'FINAL', 'FORALL', 'FORMAT',
|
||||
- 'FUNCTION', 'GENERIC', 'GOTO', 'IF', 'IMAGES', 'IMPLICIT',
|
||||
+ 'FUNCTION', 'GENERIC', 'IF', 'IMAGES', 'IMPLICIT',
|
||||
'IMPORT', 'IMPURE', 'INCLUDE', 'INQUIRE', 'INTENT', 'INTERFACE',
|
||||
'INTRINSIC', 'IS', 'LOCK', 'MEMORY', 'MODULE', 'NAMELIST', 'NULLIFY',
|
||||
'NONE', 'NON_INTRINSIC', 'NON_OVERRIDABLE', 'NOPASS', 'ONLY', 'OPEN',
|
||||
diff --git a/tests/examplefiles/fortran/zmlrpc.f90.output b/tests/examplefiles/fortran/zmlrpc.f90.output
|
||||
index ff27ddb2..64daf0c0 100644
|
||||
--- a/tests/examplefiles/fortran/zmlrpc.f90.output
|
||||
+++ b/tests/examplefiles/fortran/zmlrpc.f90.output
|
||||
@@ -908,7 +908,9 @@
|
||||
"'Allocate'" Literal.String.Single
|
||||
')' Punctuation
|
||||
'\n ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n ' Text
|
||||
'end ' Keyword
|
||||
@@ -947,7 +949,9 @@
|
||||
"'no_ml_ in mlprc_aply?'" Literal.String.Single
|
||||
')' Punctuation
|
||||
'\n ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n\n ' Text
|
||||
'case' Keyword
|
||||
@@ -1034,7 +1038,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n ' Text
|
||||
'allocate' Keyword
|
||||
@@ -1251,7 +1257,9 @@
|
||||
"'Allocate'" Literal.String.Single
|
||||
')' Punctuation
|
||||
'\n ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n ' Text
|
||||
'end ' Keyword
|
||||
@@ -1442,7 +1450,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n ' Text
|
||||
'else\n ' Keyword
|
||||
@@ -1522,7 +1532,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n ' Text
|
||||
'else' Keyword
|
||||
@@ -1889,7 +1901,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n ' Text
|
||||
'else\n\n ' Keyword
|
||||
@@ -1991,7 +2005,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n\n ' Text
|
||||
'case' Keyword
|
||||
@@ -2409,7 +2425,9 @@
|
||||
"'Allocate'" Literal.String.Single
|
||||
')' Punctuation
|
||||
'\n ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n ' Text
|
||||
'end ' Keyword
|
||||
@@ -2537,7 +2555,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n ' Text
|
||||
'else\n ' Keyword
|
||||
@@ -2618,7 +2638,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n ' Text
|
||||
'else' Keyword
|
||||
@@ -2827,7 +2849,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n ' Text
|
||||
'enddo\n\n\n ' Keyword
|
||||
@@ -2886,7 +2910,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n\n ' Text
|
||||
'do ' Keyword
|
||||
@@ -3028,7 +3054,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n ' Text
|
||||
'else\n ' Keyword
|
||||
@@ -3179,7 +3207,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n ' Text
|
||||
'call ' Keyword
|
||||
@@ -3237,7 +3267,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n ' Text
|
||||
'enddo\n\n ' Keyword
|
||||
@@ -3276,7 +3308,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n\n ' Text
|
||||
'case' Keyword
|
||||
@@ -3429,7 +3463,9 @@
|
||||
"'Allocate'" Literal.String.Single
|
||||
')' Punctuation
|
||||
'\n ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n ' Text
|
||||
'end ' Keyword
|
||||
@@ -3523,7 +3559,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n ' Text
|
||||
'mlprec_wrk' Name
|
||||
@@ -3598,7 +3636,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n ' Text
|
||||
'do ' Keyword
|
||||
@@ -3759,7 +3799,9 @@
|
||||
"'Allocate'" Literal.String.Single
|
||||
')' Punctuation
|
||||
'\n ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n ' Text
|
||||
'end ' Keyword
|
||||
@@ -3887,7 +3929,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n ' Text
|
||||
'else\n ' Keyword
|
||||
@@ -3967,7 +4011,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n ' Text
|
||||
'else' Keyword
|
||||
@@ -4197,7 +4243,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n ' Text
|
||||
'if' Keyword
|
||||
@@ -4282,7 +4330,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n ' Text
|
||||
'endif\n\n ' Keyword
|
||||
@@ -4426,7 +4476,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n ' Text
|
||||
'else\n\n ' Keyword
|
||||
@@ -4549,7 +4601,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n\n\n ' Text
|
||||
'case' Keyword
|
||||
@@ -4772,7 +4826,9 @@
|
||||
"'Allocate'" Literal.String.Single
|
||||
')' Punctuation
|
||||
'\n ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n ' Text
|
||||
'end ' Keyword
|
||||
@@ -4898,7 +4954,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n ' Text
|
||||
'mlprec_wrk' Name
|
||||
@@ -4973,7 +5031,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n ' Text
|
||||
'do ' Keyword
|
||||
@@ -5188,7 +5248,9 @@
|
||||
"'Allocate'" Literal.String.Single
|
||||
')' Punctuation
|
||||
'\n ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n ' Text
|
||||
'end ' Keyword
|
||||
@@ -5274,7 +5336,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n ' Text
|
||||
'else\n ' Keyword
|
||||
@@ -5354,7 +5418,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n ' Text
|
||||
'else' Keyword
|
||||
@@ -5574,7 +5640,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n ' Text
|
||||
'call ' Keyword
|
||||
@@ -5631,7 +5699,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n ' Text
|
||||
'if' Keyword
|
||||
@@ -5716,7 +5786,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n ' Text
|
||||
'endif\n\n ' Keyword
|
||||
@@ -5858,7 +5930,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n ' Text
|
||||
'else\n ' Keyword
|
||||
@@ -5995,7 +6069,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n ' Text
|
||||
'call ' Keyword
|
||||
@@ -6053,7 +6129,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n ' Text
|
||||
'enddo\n\n ' Keyword
|
||||
@@ -6096,7 +6174,9 @@
|
||||
'0' Literal.Number.Integer
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n\n ' Text
|
||||
'case ' Keyword
|
||||
@@ -6142,7 +6222,9 @@
|
||||
')' Punctuation
|
||||
')' Punctuation
|
||||
'\n ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n ' Text
|
||||
'end ' Keyword
|
||||
@@ -6190,7 +6272,9 @@
|
||||
')' Punctuation
|
||||
')' Punctuation
|
||||
'\n ' Text
|
||||
-'goto ' Keyword
|
||||
+'go' Keyword
|
||||
+'to' Keyword
|
||||
+' ' Text
|
||||
'9999' Literal.Number.Integer
|
||||
'\n\n ' Text
|
||||
'end ' Keyword
|
||||
diff --git a/tests/examplefiles/fortranfixed/ahcon.f.output b/tests/examplefiles/fortranfixed/ahcon.f.output
|
||||
index bb1e3839..26a015a8 100644
|
||||
--- a/tests/examplefiles/fortranfixed/ahcon.f.output
|
||||
+++ b/tests/examplefiles/fortranfixed/ahcon.f.output
|
||||
@@ -681,9 +681,9 @@
|
||||
'1.D0' Literal.Number.Float
|
||||
')' Punctuation
|
||||
' ' Text
|
||||
-'GO' Name
|
||||
-' ' Text
|
||||
-'TO' Name
|
||||
+'GO' Keyword
|
||||
+' ' Text.Whitespace
|
||||
+'TO' Keyword
|
||||
' ' Text
|
||||
'100' Literal.Number.Integer
|
||||
'\n' Text
|
||||
--
|
||||
2.33.0
|
||||
|
||||
25
0001-fixed-typo.patch
Normal file
25
0001-fixed-typo.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From 8eb17ae0541cfaa1140f75358251450bd41c8dfb Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Cl=C3=A9ment=20Saccoccio?= <clem.saccoccio@protonmail.com>
|
||||
Date: Thu, 13 May 2021 12:08:41 +0200
|
||||
Subject: [PATCH] fixed typo
|
||||
|
||||
---
|
||||
pygments/lexers/grammar_notation.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/pygments/lexers/grammar_notation.py b/pygments/lexers/grammar_notation.py
|
||||
index 79c02e38..910201cd 100644
|
||||
--- a/pygments/lexers/grammar_notation.py
|
||||
+++ b/pygments/lexers/grammar_notation.py
|
||||
@@ -117,7 +117,7 @@ class AbnfLexer(RegexLexer):
|
||||
(words(_core_rules, suffix=r'\b'), Keyword),
|
||||
|
||||
# nonterminals (ALPHA *(ALPHA / DIGIT / "-"))
|
||||
- (r'[a-zA-Z][a-zA-Z0-9-]+\b', Name.Class),
|
||||
+ (r'[a-zA-Z][a-zA-Z0-9-]*\b', Name.Class),
|
||||
|
||||
# operators
|
||||
(r'(=/|=|/)', Operator),
|
||||
--
|
||||
2.33.0
|
||||
|
||||
BIN
Pygments-2.10.0.tar.gz
Normal file
BIN
Pygments-2.10.0.tar.gz
Normal file
Binary file not shown.
Binary file not shown.
119
backport-CVE-2022-40896.patch
Normal file
119
backport-CVE-2022-40896.patch
Normal file
@ -0,0 +1,119 @@
|
||||
From dd52102c38ebe78cd57748e09f38929fd283ad04 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Matth=C3=A4us=20G=2E=20Chajdas?= <dev@anteru.net>
|
||||
Date: Sat, 31 Dec 2022 16:29:56 +0100
|
||||
Subject: [PATCH] Improve the Smithy metadata matcher.
|
||||
|
||||
Previously, metadata foo bar baz = 23 was accepted, but according to
|
||||
the definition https://smithy.io/2.0/spec/idl.html#grammar-token-smithy-MetadataSection
|
||||
it should be "metadata"<whitespace>Identifier/String<optional whitespace>.
|
||||
---
|
||||
pygments/lexers/smithy.py | 5 +-
|
||||
tests/examplefiles/smithy/test.smithy | 12 +++++
|
||||
tests/examplefiles/smithy/test.smithy.output | 52 ++++++++++++++++++++
|
||||
3 files changed, 67 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/pygments/lexers/smithy.py b/pygments/lexers/smithy.py
|
||||
index 5f2f76cd..69b576e4 100644
|
||||
--- a/pygments/lexers/smithy.py
|
||||
+++ b/pygments/lexers/smithy.py
|
||||
@@ -56,8 +56,9 @@ class SmithyLexer(RegexLexer):
|
||||
(words(aggregate_shapes,
|
||||
prefix=r'^', suffix=r'(\s+' + identifier + r')'),
|
||||
bygroups(Keyword.Declaration, Name.Class)),
|
||||
- (r'^(metadata)(\s+.+)(\s*)(=)',
|
||||
- bygroups(Keyword.Declaration, Name.Class, Whitespace, Name.Decorator)),
|
||||
+ (r'^(metadata)(\s+)((?:\S+)|(?:\"[^"]+\"))(\s*)(=)',
|
||||
+ bygroups(Keyword.Declaration, Whitespace, Name.Class,
|
||||
+ Whitespace, Name.Decorator)),
|
||||
(r"(true|false|null)", Keyword.Constant),
|
||||
(r"(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)", Number),
|
||||
(identifier + ":", Name.Label),
|
||||
diff --git a/tests/examplefiles/smithy/test.smithy b/tests/examplefiles/smithy/test.smithy
|
||||
index 3d20f064..9317fee9 100644
|
||||
--- a/tests/examplefiles/smithy/test.smithy
|
||||
+++ b/tests/examplefiles/smithy/test.smithy
|
||||
@@ -2,6 +2,18 @@ $version: "1.0"
|
||||
|
||||
namespace test
|
||||
|
||||
+metadata "foo" = ["bar", "baz"]
|
||||
+metadata validators = [
|
||||
+ {
|
||||
+ name: "ValidatorName"
|
||||
+ id: "ValidatorId"
|
||||
+ message: "Some string"
|
||||
+ configuration: {
|
||||
+ selector: "operation"
|
||||
+ }
|
||||
+ }
|
||||
+]
|
||||
+
|
||||
/// Define how an HTTP request is serialized given a specific protocol,
|
||||
/// authentication scheme, and set of input parameters.
|
||||
@trait(selector: "operation")
|
||||
diff --git a/tests/examplefiles/smithy/test.smithy.output b/tests/examplefiles/smithy/test.smithy.output
|
||||
index 1f224897..db44a381 100644
|
||||
--- a/tests/examplefiles/smithy/test.smithy.output
|
||||
+++ b/tests/examplefiles/smithy/test.smithy.output
|
||||
@@ -7,6 +7,58 @@
|
||||
' test' Name.Class
|
||||
'\n\n' Text.Whitespace
|
||||
|
||||
+'metadata' Keyword.Declaration
|
||||
+' ' Text.Whitespace
|
||||
+'"foo"' Name.Class
|
||||
+' ' Text.Whitespace
|
||||
+'=' Name.Decorator
|
||||
+' ' Text.Whitespace
|
||||
+'[' Text
|
||||
+'"bar"' Literal.String.Double
|
||||
+',' Punctuation
|
||||
+' ' Text.Whitespace
|
||||
+'"baz"' Literal.String.Double
|
||||
+']' Text
|
||||
+'\n' Text.Whitespace
|
||||
+
|
||||
+'metadata' Keyword.Declaration
|
||||
+' ' Text.Whitespace
|
||||
+'validators' Name.Class
|
||||
+' ' Text.Whitespace
|
||||
+'=' Name.Decorator
|
||||
+' ' Text.Whitespace
|
||||
+'[' Text
|
||||
+'\n ' Text.Whitespace
|
||||
+'{' Text
|
||||
+'\n ' Text.Whitespace
|
||||
+'name:' Name.Label
|
||||
+' ' Text.Whitespace
|
||||
+'"ValidatorName"' Literal.String.Double
|
||||
+'\n ' Text.Whitespace
|
||||
+'id:' Name.Label
|
||||
+' ' Text.Whitespace
|
||||
+'"ValidatorId"' Literal.String.Double
|
||||
+'\n ' Text.Whitespace
|
||||
+'message:' Name.Label
|
||||
+' ' Text.Whitespace
|
||||
+'"Some string"' Literal.String.Double
|
||||
+'\n ' Text.Whitespace
|
||||
+'configuration:' Name.Label
|
||||
+' ' Text.Whitespace
|
||||
+'{' Text
|
||||
+'\n ' Text.Whitespace
|
||||
+'selector:' Name.Label
|
||||
+' ' Text.Whitespace
|
||||
+'"operation"' Literal.String.Double
|
||||
+'\n ' Text.Whitespace
|
||||
+'}' Text
|
||||
+'\n ' Text.Whitespace
|
||||
+'}' Text
|
||||
+'\n' Text.Whitespace
|
||||
+
|
||||
+']' Text
|
||||
+'\n\n' Text.Whitespace
|
||||
+
|
||||
'/// Define how an HTTP request is serialized given a specific protocol,' Comment.Multiline
|
||||
'\n' Text.Whitespace
|
||||
|
||||
--
|
||||
2.39.1
|
||||
|
||||
@ -12,15 +12,21 @@ need to prettify source code. Highlights are: \
|
||||
RTF, LaTeX and ANSI sequences \
|
||||
* it is usable as a command-line tool and as a library \
|
||||
* … and it highlights even Perl 6!
|
||||
|
||||
%bcond_without docs
|
||||
%bcond_without tests
|
||||
Name: python-pygments
|
||||
Summary: Syntax highlighting engine written in Python
|
||||
Version: 2.7.4
|
||||
Release: 1
|
||||
Version: 2.10.0
|
||||
Release: 4
|
||||
License: BSD
|
||||
URL: http://pygments.org/
|
||||
Source0: https://pypi.org/packages/source/P/Pygments/Pygments-%{version}.tar.gz
|
||||
|
||||
Patch0: 0001-fixed-typo.patch
|
||||
Patch1: 0001-Fix-do-concurrent-and-go-to-keywords-in-the-Fortran-.patch
|
||||
|
||||
Patch6000: backport-CVE-2022-40896.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
%description
|
||||
@ -32,7 +38,7 @@ BuildRequires: python3-devel, python3-setuptools
|
||||
BuildRequires: python3-pytest
|
||||
%endif
|
||||
%if %{with docs}
|
||||
BuildRequires: python3-sphinx
|
||||
BuildRequires: python3-sphinx python3-pip
|
||||
%endif
|
||||
Summary: Syntax highlighting engine written in Python
|
||||
%{?python_provide:%python_provide python3-pygments}
|
||||
@ -60,7 +66,7 @@ chmod -x %{buildroot}%{_mandir}/man1/*.1
|
||||
cp -r doc/docs doc/reST
|
||||
%if %{with tests}
|
||||
%check
|
||||
make test PYTHON=%{python3}
|
||||
make test
|
||||
%endif
|
||||
|
||||
|
||||
@ -77,6 +83,24 @@ make test PYTHON=%{python3}
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed Jul 26 2023 zhuofeng <zhuofeng2@huawei.com> - 2.10.0-4
|
||||
- Type:CVE
|
||||
- CVE:CVE-2022-40896
|
||||
- SUG:NA
|
||||
- DESC:fix CVE-2022-40896
|
||||
|
||||
* Wed Jan 18 2023 caofei <caofei@xfusion.com> - 2.10.0-3
|
||||
- Fix "do concurrent" and "go to" keywords in the Fortran
|
||||
|
||||
* Mon Jan 16 2023 caofei <caofei@xfusion.com> - 2.10.0-2
|
||||
- fixed typo
|
||||
|
||||
* Mon Dec 20 2021 renhongxun <renhongxun@huawei.com> - 2.10.0-1
|
||||
- Upgrade version to 2.10.0
|
||||
|
||||
* Fri Aug 06 2021 OpenStack_SIG <openstack@openeuler.org> - 2.8.1-1
|
||||
- Update version to 2.8.1
|
||||
|
||||
* Wed Jan 13 2021 SimpleUpdate Robot <tc@openeuler.org> - 2.7.4-1
|
||||
- Upgrade to version 2.7.4
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user