Skip to content

Commit

Permalink
Turtle: Minor improvements (#2038)
Browse files Browse the repository at this point in the history
This makes a few minor improvements to Turtle:

- Multiline strings were too greedy and matched `"""a"""""` whole.
- URLs (IRI) were too accepting.
- The keyword patterns are now disjoint.
  • Loading branch information
RunDevelopment committed Sep 2, 2019
1 parent 2d858e0 commit 8ccd258
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions components/prism-turtle.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Prism.languages.turtle = {
greedy: true
},
'multiline-string': {
pattern: /"""(?:[^"]"?"?)*"""|'''(?:[^']'?'?)*'''/,
pattern: /"""(?:(?:""?)?(?:[^"\\]|\\.))*"""|'''(?:(?:''?)?(?:[^'\\]|\\.))*'''/,
greedy: true,
alias: 'string',
inside: {
Expand All @@ -16,7 +16,7 @@ Prism.languages.turtle = {
greedy: true
},
'url': {
pattern: /<[^\s<>]*>/,
pattern: /<(?:[^\x00-\x20<>"{}|^`\\]|\\(?:u[\da-f]{4}|U[\da-f]{8}))*>/i,
greedy: true,
inside: {
'punctuation': /[<>]/
Expand All @@ -42,10 +42,10 @@ Prism.languages.turtle = {
'boolean': /\b(?:true|false)\b/,
'keyword': [
/(?:\ba|@prefix|@base)\b|=/,
/\b(?:graph|base|prefix)\b|=/i
/\b(?:graph|base|prefix)\b/i
],
'tag': {
'pattern': /@[a-z]+(?:-[a-z\d]+)*/i,
pattern: /@[a-z]+(?:-[a-z\d]+)*/i,
inside: {
'punctuation': /@/
}
Expand Down
2 changes: 1 addition & 1 deletion components/prism-turtle.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8ccd258

Please sign in to comment.