Skip to content

Commit

Permalink
Smalltalk: Fixed single quote character literal (#2041)
Browse files Browse the repository at this point in the history
This fixes the incorrect tokenization of the character literals of single quotes which were recognized as string delimiters.
  • Loading branch information
bencoman authored and RunDevelopment committed Sep 4, 2019
1 parent 365faad commit 1aabcd1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
8 changes: 4 additions & 4 deletions components/prism-smalltalk.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Prism.languages.smalltalk = {
'comment': /"(?:""|[^"])*"/,
'character': {
pattern: /\$./,
alias: 'string'
},
'string': /'(?:''|[^'])*'/,
'symbol': /#[\da-z]+|#(?:-|([+\/\\*~<>=@%|&?!])\1?)|#(?=\()/i,
'block-arguments': {
Expand All @@ -18,10 +22,6 @@ Prism.languages.smalltalk = {
}
},
'keyword': /\b(?:nil|true|false|self|super|new)\b/,
'character': {
pattern: /\$./,
alias: 'string'
},
'number': [
/\d+r-?[\dA-Z]+(?:\.[\dA-Z]+)?(?:e-?\d+)?/,
/\b\d+(?:\.\d+)?(?:e-?\d+)?/
Expand Down
2 changes: 1 addition & 1 deletion components/prism-smalltalk.min.js

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

13 changes: 13 additions & 0 deletions tests/languages/smalltalk/string_character_feature.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$'
'foobar'

----------------------------------------------------

[
["character", "$'"],
["string", "'foobar'"]
]

----------------------------------------------------

Checks a single-quote-character doesn't confuse string parsing.

0 comments on commit 1aabcd1

Please sign in to comment.