GraphQL: Regexp optimisation and simplification
diff --git a/components/prism-graphql.js b/components/prism-graphql.js
index 6fbe93b..ad7ef7a 100644
--- a/components/prism-graphql.js
+++ b/components/prism-graphql.js
@@ -1,7 +1,7 @@
Prism.languages.graphql = {
'comment': /#.*/,
'string': {
- pattern: /"(?:\\.|[^\\"])*"/,
+ pattern: /"(?:\\.|[^\\"\r\n])*"/,
greedy: true
},
'number': /(?:\B-|\b)\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b/,
@@ -14,7 +14,7 @@ Prism.languages.graphql = {
'attr-name': /[a-z_]\w*(?=\s*:)/i,
'keyword': [
{
- pattern: /(fragment\s+(?!on)[a-z_]\w*\s+|\.\.\.\s*)on\b/,
+ pattern: /(fragment\s+(?!on)[a-z_]\w*\s+|\.{3}\s*)on\b/,
lookbehind: true
},
/\b(?:query|fragment|mutation)\b/
diff --git a/components/prism-graphql.min.js b/components/prism-graphql.min.js
index 2658c23..368c71b 100644
--- a/components/prism-graphql.min.js
+++ b/components/prism-graphql.min.js
@@ -1 +1 @@
-Prism.languages.graphql={comment:/#.*/,string:{pattern:/"(?:\\.|[^\\"])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b/,"boolean":/\b(?:true|false)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":/[a-z_]\w*(?=\s*:)/i,keyword:[{pattern:/(fragment\s+(?!on)[a-z_]\w*\s+|\.\.\.\s*)on\b/,lookbehind:!0},/\b(?:query|fragment|mutation)\b/],operator:/!|=|\.{3}/,punctuation:/[!(){}\[\]:=,]/};
\ No newline at end of file
+Prism.languages.graphql={comment:/#.*/,string:{pattern:/"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b/,"boolean":/\b(?:true|false)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":/[a-z_]\w*(?=\s*:)/i,keyword:[{pattern:/(fragment\s+(?!on)[a-z_]\w*\s+|\.{3}\s*)on\b/,lookbehind:!0},/\b(?:query|fragment|mutation)\b/],operator:/!|=|\.{3}/,punctuation:/[!(){}\[\]:=,]/};
\ No newline at end of file