Skip to content

Commit 9bda9f1

Browse files
committed
Merge pull request #412 from dsyme/fix-405
Address issues from making Parser and Lexer internal
2 parents b6bd963 + 701947a commit 9bda9f1

File tree

5 files changed

+57
-1
lines changed

5 files changed

+57
-1
lines changed

RELEASE_NOTES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
#### 1.4.0.4 -
2+
* add more entries to FSharpTokenTag
3+
* add PrettyNaming.QuoteIdentifierIfNeeded and PrettyNaming.KeywordNames
4+
15
#### 1.4.0.3 -
26
* integrate Microsoft/visualfsharp OOB cleanup via fsharp/fsharp
7+
* Make Parser and Lexer private
38

49
#### 1.4.0.2 -
510
* #387 - types and arrays in F# attribute contructor arguments
@@ -372,3 +377,4 @@
372377
#### 0.0.2-alpha -
373378
* Integrate hosted FSI configuration, SimpleSourceCodeServices, cleanup to SourceCodeServices API
374379

380+

src/fsharp/vs/ServiceLexing.fs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,21 @@ type Range = Position * Position
2727
module FSharpTokenTag =
2828
let Identifier = tagOfToken (IDENT "a")
2929
let String = tagOfToken (STRING "a")
30+
31+
let IDENT = tagOfToken (IDENT "a")
32+
let STRING = tagOfToken (STRING "a")
33+
let LPAREN = tagOfToken LPAREN
34+
let RPAREN = tagOfToken RPAREN
35+
let LBRACK = tagOfToken LBRACK
36+
let RBRACK = tagOfToken RBRACK
37+
let LBRACE = tagOfToken LBRACE
38+
let RBRACE = tagOfToken RBRACE
39+
let LBRACK_LESS = tagOfToken LBRACK_LESS
40+
let GREATER_RBRACK = tagOfToken GREATER_RBRACK
41+
let LESS = tagOfToken (LESS true)
42+
let GREATER = tagOfToken (GREATER true)
43+
let LBRACK_BAR = tagOfToken LBRACK_BAR
44+
let BAR_RBRACK = tagOfToken BAR_RBRACK
3045

3146
/// This corresponds to a token categorization originally used in Visual Studio 2003.
3247
///

src/fsharp/vs/ServiceLexing.fsi

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,34 @@ module FSharpTokenTag =
7979
val Identifier: int
8080
/// Indicates the token is a string
8181
val String : int
82+
/// Indicates the token is an identifier (synonym for FSharpTokenTag.Identifer)
83+
val IDENT : int
84+
/// Indicates the token is an string (synonym for FSharpTokenTag.String)
85+
val STRING : int
86+
/// Indicates the token is a `(`
87+
val LPAREN : int
88+
/// Indicates the token is a `)`
89+
val RPAREN : int
90+
/// Indicates the token is a `[`
91+
val LBRACK : int
92+
/// Indicates the token is a `]`
93+
val RBRACK : int
94+
/// Indicates the token is a `{`
95+
val LBRACE : int
96+
/// Indicates the token is a `}`
97+
val RBRACE : int
98+
/// Indicates the token is a `[<`
99+
val LBRACK_LESS : int
100+
/// Indicates the token is a `>]`
101+
val GREATER_RBRACK : int
102+
/// Indicates the token is a `<`
103+
val LESS : int
104+
/// Indicates the token is a `>`
105+
val GREATER : int
106+
/// Indicates the token is a `[|`
107+
val LBRACK_BAR : int
108+
/// Indicates the token is a `|]`
109+
val BAR_RBRACK : int
82110

83111
/// Information about a particular token from the tokenizer
84112
type FSharpTokenInfo =

src/fsharp/vs/service.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3225,6 +3225,8 @@ module PrettyNaming =
32253225
let IsLongIdentifierPartCharacter x = Microsoft.FSharp.Compiler.PrettyNaming.IsLongIdentifierPartCharacter x
32263226
let GetLongNameFromString x = Microsoft.FSharp.Compiler.PrettyNaming.SplitNamesForILPath x
32273227
let FormatAndOtherOverloadsString remainingOverloads = FSComp.SR.typeInfoOtherOverloads(remainingOverloads)
3228+
let QuoteIdentifierIfNeeded id = Lexhelp.Keywords.QuoteIdentifierIfNeeded id
3229+
let KeywordNames = Lexhelp.Keywords.keywordNames
32283230

32293231
//----------------------------------------------------------------------------
32303232
// Obsolete

src/fsharp/vs/service.fsi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,9 +729,14 @@ module PrettyNaming =
729729
val IsIdentifierPartCharacter : char -> bool
730730
val IsLongIdentifierPartCharacter : char -> bool
731731
val GetLongNameFromString : string -> string list
732-
// Temporary workaround for no localized resources in FSharp.LanguageService.dll
732+
733733
val FormatAndOtherOverloadsString : int -> string
734734

735+
/// A utility to help determine if an identifier needs to be quoted
736+
val QuoteIdentifierIfNeeded : string -> string
737+
738+
/// All the keywords in the F# langauge
739+
val KeywordNames : string list
735740

736741
[<Obsolete("This type has been renamed to FSharpMethodGroupItemParameter")>]
737742
/// Renamed to FSharpMethodGroupItemParameter

0 commit comments

Comments
 (0)