Skip to content

Commit 40ae215

Browse files
committed
Fortran: more bullet-proof pattern for comments inside strings.
1 parent fa286aa commit 40ae215

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

components/prism-fortran.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ Prism.languages.fortran = {
44
alias: 'number'
55
},
66
'string': {
7-
pattern: /(?:\w+_)?(['"])(?:\1\1|&\n(?:\s*!.+\n)?|(?!\1).)*(?:\1|&)/,
7+
pattern: /(?:\w+_)?(['"])(?:\1\1|&(?:\r\n?|\n)(?:\s*!.+(?:\r\n?|\n))?|(?!\1).)*(?:\1|&)/,
88
inside: {
9-
'comment': /!.*/
9+
'comment': {
10+
pattern: /(&(?:\r\n?|\n)\s*)!.*/,
11+
lookbehind: true
12+
}
1013
}
1114
},
1215
'comment': /!.*/,

components/prism-fortran.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)