Skip to content

Commit 6a648d8

Browse files
auduchinokKevinRansom
authored andcommitted
Make DoesIdentifierNeedQuotation public (#7365)
1 parent ea48507 commit 6a648d8

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

src/fsharp/lexhelp.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ module Keywords =
351351
| _ ->
352352
IdentifierToken args lexbuf s
353353

354-
let inline private DoesIdentifierNeedQuotation (s : string) : bool =
354+
let DoesIdentifierNeedQuotation (s : string) : bool =
355355
not (String.forall IsIdentifierPartCharacter s) // if it has funky chars
356356
|| s.Length > 0 && (not(IsIdentifierFirstCharacter s.[0])) // or if it starts with a non-(letter-or-underscore)
357357
|| keywordTable.ContainsKey s // or if it's a language keyword like "type"

src/fsharp/lexhelp.fsi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ exception IndentationProblem of string * Range.range
6969
module Keywords =
7070
val KeywordOrIdentifierToken : lexargs -> UnicodeLexing.Lexbuf -> string -> Parser.token
7171
val IdentifierToken : lexargs -> UnicodeLexing.Lexbuf -> string -> Parser.token
72+
val DoesIdentifierNeedQuotation : string -> bool
7273
val QuoteIdentifierIfNeeded : string -> string
7374
val NormalizeIdentifierBackticks : string -> string
7475
val keywordNames : string list

src/fsharp/service/ServiceLexing.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,7 @@ type FSharpSourceTokenizer(defineConstants: string list, filename: string option
784784
module Keywords =
785785
open FSharp.Compiler.Lexhelp.Keywords
786786

787+
let DoesIdentifierNeedQuotation s = DoesIdentifierNeedQuotation s
787788
let QuoteIdentifierIfNeeded s = QuoteIdentifierIfNeeded s
788789
let NormalizeIdentifierBackticks s = NormalizeIdentifierBackticks s
789790
let KeywordsWithDescription = keywordsWithDescription

src/fsharp/service/ServiceLexing.fsi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,9 @@ module internal TestExpose =
243243
val TokenInfo : Parser.token -> (FSharpTokenColorKind * FSharpTokenCharKind * FSharpTokenTriggerClass)
244244

245245
module Keywords =
246+
/// Checks if adding backticks to identifier is needed.
247+
val DoesIdentifierNeedQuotation : string -> bool
248+
246249
/// Add backticks if the identifier is a keyword.
247250
val QuoteIdentifierIfNeeded : string -> string
248251

0 commit comments

Comments
 (0)