Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F#: Chars only contain one character #1570

Merged
merged 1 commit into from
Sep 23, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
F#: Chars can only contain one character
RunDevelopment committed Sep 23, 2018
commit 1e439bbea983dbc697dd94e696987c523f4e2143
2 changes: 1 addition & 1 deletion components/prism-fsharp.js
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ Prism.languages.fsharp = Prism.languages.extend('clike', {
],
'keyword': /\b(?:let|return|use|yield)(?:!\B|\b)|\b(abstract|and|as|assert|base|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|global|if|in|inherit|inline|interface|internal|lazy|match|member|module|mutable|namespace|new|not|null|of|open|or|override|private|public|rec|select|static|struct|then|to|true|try|type|upcast|val|void|when|while|with|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|include|method|mixin|object|parallel|process|protected|pure|sealed|tailcall|trait|virtual|volatile)\b/,
'string': {
pattern: /(?:"""[\s\S]*?"""|@"(?:""|[^"])*"|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1)B?/,
pattern: /(?:"""[\s\S]*?"""|@"(?:""|[^"])*"|"(?:\\[\s\S]|[^\\"])*")B?|'(?:[^\\']|\\.)'B?/,
greedy: true
},
'number': [
2 changes: 1 addition & 1 deletion components/prism-fsharp.min.js

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

37 changes: 37 additions & 0 deletions tests/languages/fsharp/issue1480.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
let foo' = failWith "foo"

let bar' = failWith "bar"

let map (f: 'a -> 'b) (xs: 'a list): 'b list = failWith "not implemented"

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

[
["keyword", "let"], " foo' ", ["operator", "="], " failWith ", ["string", "\"foo\""],
["keyword", "let"], " bar' ", ["operator", "="], " failWith ", ["string", "\"bar\""],

["keyword", "let"],
" map ",
["punctuation", "("],
"f",
["punctuation", ":"],
" 'a ",
["operator", "-"],
["operator", ">"],
" 'b",
["punctuation", ")"],
["punctuation", "("],
"xs",
["punctuation", ":"],
" 'a list",
["punctuation", ")"],
["punctuation", ":"],
" 'b list ",
["operator", "="],
" failWith ",
["string", "\"not implemented\""]
]

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

Checks for apostrophes in names. See #1480.
2 changes: 2 additions & 0 deletions tests/languages/fsharp/string_feature.test
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ bar"""
"""foo"""B

'a'
'a'B
'\''
'\\'

@@ -36,6 +37,7 @@ bar"""
["string", "\"\"\"foo\"\"\"B"],

["string", "'a'"],
["string", "'a'B"],
["string", "'\\''"],
["string", "'\\\\'"]
]