diff --git a/components/prism-bbj.js b/components/prism-bbj.js index d2730b72a8..ff7265ce22 100644 --- a/components/prism-bbj.js +++ b/components/prism-bbj.js @@ -6,7 +6,7 @@ greedy: true }, 'string': { - pattern: /"(?:""|[!#$%&'()*,\/:;<=>?^\w +\-.])*"/, + pattern: /(['"])(?:(?!\1|\\).|\\.)*\1/, greedy: true }, 'number': /(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i, diff --git a/components/prism-bbj.min.js b/components/prism-bbj.min.js index 0ac3642504..10f1c9e24f 100644 --- a/components/prism-bbj.min.js +++ b/components/prism-bbj.min.js @@ -1 +1 @@ -!function(e){e.languages.bbj={comment:{pattern:/(^|[^\\:])rem\s+.*/i,lookbehind:!0,greedy:!0},string:{pattern:/"(?:""|[!#$%&'()*,\/:;<=>?^\w +\-.])*"/,greedy:!0},number:/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,keyword:/\b(?:abstract|all|argc|begin|bye|callback|case|chn|class|classend|ctl|day|delete|dim|dom|dread|dsz|else|end|endif|err|exitto|extends|fi|field|for|from|gosub|goto|if|implements|interface|interfaceend|iol|iolist|let|list|load|method|methodend|methodret|on|opts|pfx|print|private|process_events|protected|psz|public|read|read_resource|release|remove_callback|repeat|restore|return|rev|seterr|setesc|sqlchn|sqlunt|ssn|start|static|swend|switch|sys|then|tim|unt|until|use|void|wend|where|while)\b/i,function:/\b\w+(?=\()/,boolean:/\b(?:BBjAPI\.TRUE|BBjAPI\.FALSE)\b/i,operator:/<[=>]?|>=?|[+\-*\/^=&]|\b(?:and|not|or|xor)\b/i,punctuation:/[.,;:()]/}}(Prism); \ No newline at end of file +!function(e){e.languages.bbj={comment:{pattern:/(^|[^\\:])rem\s+.*/i,lookbehind:!0,greedy:!0},string:{pattern:/(['"])(?:(?!\1|\\).|\\.)*\1/,greedy:!0},number:/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,keyword:/\b(?:abstract|all|argc|begin|bye|callback|case|chn|class|classend|ctl|day|delete|dim|dom|dread|dsz|else|end|endif|err|exitto|extends|fi|field|for|from|gosub|goto|if|implements|interface|interfaceend|iol|iolist|let|list|load|method|methodend|methodret|on|opts|pfx|print|private|process_events|protected|psz|public|read|read_resource|release|remove_callback|repeat|restore|return|rev|seterr|setesc|sqlchn|sqlunt|ssn|start|static|swend|switch|sys|then|tim|unt|until|use|void|wend|where|while)\b/i,function:/\b\w+(?=\()/,boolean:/\b(?:BBjAPI\.TRUE|BBjAPI\.FALSE)\b/i,operator:/<[=>]?|>=?|[+\-*\/^=&]|\b(?:and|not|or|xor)\b/i,punctuation:/[.,;:()]/}}(Prism); \ No newline at end of file diff --git a/tests/languages/bbj/string_feature.test b/tests/languages/bbj/string_feature.test index 101e1b3c60..1d635e704f 100644 --- a/tests/languages/bbj/string_feature.test +++ b/tests/languages/bbj/string_feature.test @@ -1,13 +1,27 @@ "" -"fo""obar" +'' +"f\"oo" +'b\'ar' + +"foo rem comment bar" +"foo ""rem"" comment bar" +"foo rem /* *rem comment bar" ---------------------------------------------------- [ ["string", "\"\""], - ["string", "\"fo\"\"obar\""] + ["string", "''"], + ["string", "\"f\\\"oo\""], + ["string", "'b\\'ar'"], + + ["string", "\"foo rem comment bar\""], + ["string", "\"foo \""], + ["string", "\"rem\""], + ["string", "\" comment bar\""], + ["string", "\"foo rem /* *rem comment bar\""] ] ---------------------------------------------------- -Checks for strings. \ No newline at end of file +Checks for strings.