Skip to content

Commit

Permalink
Support dictionary indexers on nested properties in F# lexer (#1482)
Browse files Browse the repository at this point in the history
A dictionary indexer on a nested property currently breaks the F#
lexer. This commit adds support for these indexers by treating the `[`
as a character that triggers the `:dotted` state to be popped.
  • Loading branch information
pyrmont committed Apr 9, 2020
1 parent 2f16c1c commit 9def927
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/rouge/lexers/fsharp.rb
Expand Up @@ -113,6 +113,7 @@ def self.primitives
rule %r/#{upper_id}(?=\s*[.])/, Name::Namespace
rule upper_id, Name::Class, :pop!
rule id, Name, :pop!
rule %r/\[/, Punctuation, :pop!
end
end
end
Expand Down
6 changes: 6 additions & 0 deletions spec/visual/samples/fsharp
Expand Up @@ -198,3 +198,9 @@ finally
traceEndBuild()
if !TargetHelper.ExitCode.exitCode <> 0 then exit !TargetHelper.ExitCode.exitCode
if Environment.ExitCode <> 0 then exit Environment.ExitCode

let value = array.[0]
let value = dict.Test.["key"]

// syntax highlighting
let number = 123

0 comments on commit 9def927

Please sign in to comment.