Skip to content

Commit

Permalink
BBj: fix strings regex does not match single quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
hyyan committed Jul 30, 2022
1 parent ca5e6a8 commit f069d10
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion components/prism-bbj.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
greedy: true
},
'string': {
pattern: /"(?:""|[!#$%&'()*,\/:;<=>?^\w +\-.])*"/,
pattern: /(['"])(?:(?!\1|\\).|\\.)*\1/,
greedy: true
},
'number': /(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,
Expand Down
2 changes: 1 addition & 1 deletion components/prism-bbj.min.js

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

20 changes: 17 additions & 3 deletions tests/languages/bbj/string_feature.test
Original file line number Diff line number Diff line change
@@ -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.
Checks for strings.

0 comments on commit f069d10

Please sign in to comment.