1 people like it.
Like the snippet!
CodeGen example for F#
This example shows how to add attribute in F# codebase.
We use FSharp compiler to get AST, then analyze what we want to change, change it and then combine it back to source code.
Example is a little bit naive, it doesn't cover all cases.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
|
open System.Text
open Microsoft.FSharp.Compiler.Ast
open Microsoft.FSharp.Compiler.Range
open Microsoft.FSharp.Compiler.SourceCodeServices
//PARSING
let parse text =
let fileName = "whatever.fs"
let checker = FSharpChecker.Create()
let opts =
{ FSharpParsingOptions.Default with
SourceFiles = [|fileName|] }
let res = checker.ParseFile(fileName, text, opts) |> Async.RunSynchronously
let fileAst =
match res.ParseTree.Value with
| ParsedInput.ImplFile x -> x
| ParsedInput.SigFile _ -> failwith "give me fs, not fsi"
let (ParsedImplFileInput.ParsedImplFileInput(_, _, _, _, _, modules, _)) = fileAst
let (SynModuleOrNamespace.SynModuleOrNamespace(_, _, _, moduleDeclarations, _, _, _, _)) = modules.[0]
moduleDeclarations
//ANALYZING PATTERNS
let (|NotAttributesLetBinding|_|) (Binding(_, _, _, _, attrs, _, _, _, _, _, _, _) as binding) =
if attrs.IsEmpty then Some binding else None
//TRANSFORMING AST FUNCTIONS
let addObsoleteToBinding =
let obsoleteAst =
{ SynAttribute.AppliesToGetterAndSetter = false
SynAttribute.ArgExpr = SynExpr.Const(SynConst.Unit, range.Zero)
SynAttribute.Range = range.Zero
SynAttribute.Target = None
SynAttribute.TypeName = LongIdentWithDots([Ident("System",range.Zero);Ident("Obsolete",range.Zero)],[]) }
fun (Binding(ao, bindKind, isInline, isMutable, attrs, px, valData, pat, retInfo, expr, range, seqInfo)) ->
Binding (ao, bindKind, isInline, isMutable, obsoleteAst::attrs, px, valData, pat, retInfo, expr, range, seqInfo)
let rec addObsolete = function
| SynModuleDecl.Let(_isRecursive, [NotAttributesLetBinding binding], _range) ->
SynModuleDecl.Let(_isRecursive, [addObsoleteToBinding binding], _range)
| x -> x
//PRINTING TO TEXT HELPERs FUNCTIONS
type StringBuilder with
member x.Add (text: string) = x.Append text |> ignore
let identToString (LongIdentWithDots(ids, _)) =
ids
|> Seq.map (fun id -> id.idText)
|> String.concat "."
let printIdent (sb: StringBuilder) ident =
let name = identToString ident
sb.Add (name + " ")
let rec exprToString (valData: SynExpr) =
match valData with
| SynExpr.Const (SynConst.Unit,_) -> "()"
| SynExpr.App (_,isInfix,funcExpr,argExpr,_) ->
if isInfix then
exprToString argExpr + " " + exprToString funcExpr
else
exprToString funcExpr + " " + exprToString argExpr
| SynExpr.Ident x when x.idText = "op_Addition" -> "+"
| SynExpr.Ident id -> id.idText
| _ -> failwith "not implemented"
let printAttributes (sb: StringBuilder) (attrs: SynAttributes) =
if not attrs.IsEmpty then
sb.Add "[<"
attrs
|> Seq.map (fun attr -> identToString attr.TypeName + exprToString attr.ArgExpr)
|> String.concat ";"
|> sb.Add
sb.Add ">] "
let printInline (sb: StringBuilder) isInline =
if isInline then sb.Add "inline "
let printText (sb: StringBuilder) text =
sb.Add (text + " ")
let printAccess (sb: StringBuilder) = function
| Some SynAccess.Internal -> sb.Add "internal "
| Some SynAccess.Private -> sb.Add "private "
| Some SynAccess.Public -> sb.Add "public "
| _ -> ()
let rec printConsctructorArgs (sb: StringBuilder) = function
| SynConstructorArgs.Pats pats ->
for pat in pats do
printPattern sb pat
| SynConstructorArgs.NamePatPairs _ -> failwith "unsupported"
and printPattern (sb: StringBuilder) = function
| SynPat.LongIdent (identWithDots, _, _, pats,access,_) ->
printAccess sb access
printIdent sb identWithDots
printConsctructorArgs sb pats
| SynPat.Paren (pat,_) ->
sb.Add "("
printPattern sb pat
sb.Add ") "
| SynPat.Tuple (pats,_) ->
let pats = Array.ofList pats
for i = 0 to pats.Length-1 do
printPattern sb (pats.[i])
if i < (pats.Length-1) then
sb.Add ","
sb.Add " "
| SynPat.Named (SynPat.Wild _, ident, _, _, _) ->
printText sb ident.idText
| SynPat.Named (pat, ident, _, _, _) ->
printPattern sb pat
printText sb ("as " + ident.idText)
| SynPat.Typed (pat, SynType.LongIdent ident, _) ->
printPattern sb pat
printText sb (": " + identToString ident)
| _ -> failwith "unsupported"
let printBind (sb: StringBuilder) (Binding(_, _, isInline, _, attrs, _, _, pat, _, expr, _, _)) =
printAttributes sb attrs
printInline sb isInline
printPattern sb pat
sb.Add "= "
printText sb (exprToString expr)
let rec astToText = function
| SynModuleDecl.Let(_isRecursive, [binding], _range) ->
let sb = new StringBuilder()
sb.Add "let "
if _isRecursive then sb.Add "rec "
printBind sb binding
sb.ToString()
| _ -> failwith "not implemented"
//COMBINING ALL TOGETHER
let workFlow =
parse
>> List.map addObsolete
>> List.map astToText
>> String.concat "\n"
let functionText = "let internal sum (a as d,c:string) b = a + b + c"
workFlow functionText //let [<System.Obsolete()>] internal sum (a as d , c : string ) b = a + b + c
|
namespace System
namespace System.Text
namespace Microsoft
namespace Microsoft.FSharp
namespace Microsoft.FSharp.Compiler
module Ast
from Microsoft.FSharp.Compiler
module Range
from Microsoft.FSharp.Compiler
namespace Microsoft.FSharp.Compiler.SourceCodeServices
val parse : text:string -> SynModuleDecls
Full name: Script.parse
val text : string
val fileName : string
val checker : FSharpChecker
type FSharpChecker
member CheckFileInProject : parsed:FSharpParseFileResults * filename:string * fileversion:int * source:string * options:FSharpProjectOptions * ?textSnapshotInfo:obj * ?userOpName:string -> Async<FSharpCheckFileAnswer>
member CheckProjectInBackground : options:FSharpProjectOptions * ?userOpName:string -> unit
member ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients : unit -> unit
member Compile : argv:string [] * ?userOpName:string -> Async<FSharpErrorInfo [] * int>
member Compile : ast:ParsedInput list * assemblyName:string * outFile:string * dependencies:string list * ?pdbFile:string * ?executable:bool * ?noframework:bool * ?userOpName:string -> Async<FSharpErrorInfo [] * int>
member CompileToDynamicAssembly : otherFlags:string [] * execute:(TextWriter * TextWriter) option * ?userOpName:string -> Async<FSharpErrorInfo [] * int * Assembly option>
member CompileToDynamicAssembly : ast:ParsedInput list * assemblyName:string * dependencies:string list * execute:(TextWriter * TextWriter) option * ?debug:bool * ?noframework:bool * ?userOpName:string -> Async<FSharpErrorInfo [] * int * Assembly option>
member GetBackgroundCheckResultsForFileInProject : filename:string * options:FSharpProjectOptions * ?userOpName:string -> Async<FSharpParseFileResults * FSharpCheckFileResults>
member GetBackgroundParseResultsForFileInProject : filename:string * options:FSharpProjectOptions * ?userOpName:string -> Async<FSharpParseFileResults>
member GetParsingOptionsFromCommandLineArgs : argv:string list * ?isInteractive:bool -> FSharpParsingOptions * FSharpErrorInfo list
member GetParsingOptionsFromCommandLineArgs : sourceFiles:string list * argv:string list * ?isInteractive:bool -> FSharpParsingOptions * FSharpErrorInfo list
member GetParsingOptionsFromProjectOptions : FSharpProjectOptions -> FSharpParsingOptions * FSharpErrorInfo list
member GetProjectOptionsFromCommandLineArgs : projectFileName:string * argv:string [] * ?loadedTimeStamp:DateTime * ?extraProjectInfo:obj -> FSharpProjectOptions
member GetProjectOptionsFromScript : filename:string * source:string * ?loadedTimeStamp:DateTime * ?otherFlags:string [] * ?useFsiAuxLib:bool * ?assumeDotNetFramework:bool * ?extraProjectInfo:obj * ?optionsStamp:int64 * ?userOpName:string -> Async<FSharpProjectOptions * FSharpErrorInfo list>
member InvalidateAll : unit -> unit
member InvalidateConfiguration : options:FSharpProjectOptions * ?startBackgroundCompileIfAlreadySeen:bool * ?userOpName:string -> unit
member KeepProjectAlive : options:FSharpProjectOptions * ?userOpName:string -> Async<IDisposable>
member MatchBraces : filename:string * source:string * options:FSharpParsingOptions * ?userOpName:string -> Async<(range * range) []>
member NotifyProjectCleaned : options:FSharpProjectOptions * ?userOpName:string -> Async<unit>
member ParseAndCheckFileInProject : filename:string * fileversion:int * source:string * options:FSharpProjectOptions * ?textSnapshotInfo:obj * ?userOpName:string -> Async<FSharpParseFileResults * FSharpCheckFileAnswer>
member ParseAndCheckProject : options:FSharpProjectOptions * ?userOpName:string -> Async<FSharpCheckProjectResults>
member ParseFile : filename:string * source:string * options:FSharpParsingOptions * ?userOpName:string -> Async<FSharpParseFileResults>
member StopBackgroundCompile : unit -> unit
member TokenizeFile : source:string -> FSharpTokenInfo [] []
member TokenizeLine : line:string * state:FSharpTokenizerLexState -> FSharpTokenInfo [] * FSharpTokenizerLexState
member TryGetRecentCheckResultsForFile : filename:string * options:FSharpProjectOptions * ?source:string * ?userOpName:string -> (FSharpParseFileResults * FSharpCheckFileResults * int) option
member WaitForBackgroundCompile : unit -> unit
member BeforeBackgroundFileCheck : IEvent<string * obj option>
member CurrentQueueLength : int
member FileChecked : IEvent<string * obj option>
member FileParsed : IEvent<string * obj option>
member private FrameworkImportsCache : FrameworkImportsCache
member ImplicitlyStartBackgroundWork : bool
member MaxMemory : int
member MaxMemoryReached : IEvent<unit>
member PauseBeforeBackgroundWork : int
member ProjectChecked : IEvent<string * obj option>
member private ReactorOps : IReactorOperations
member private ReferenceResolver : Resolver
member ImplicitlyStartBackgroundWork : bool with set
member MaxMemory : int with set
member PauseBeforeBackgroundWork : int with set
static member Create : ?projectCacheSize:int * ?keepAssemblyContents:bool * ?keepAllBackgroundResolutions:bool * ?legacyReferenceResolver:Resolver * ?tryGetMetadataSnapshot:ILReaderTryGetMetadataSnapshot -> FSharpChecker
static member GlobalForegroundParseCountStatistic : int
static member GlobalForegroundTypeCheckCountStatistic : int
Full name: Microsoft.FSharp.Compiler.SourceCodeServices.FSharpChecker
static member FSharpChecker.Create : ?projectCacheSize:int * ?keepAssemblyContents:bool * ?keepAllBackgroundResolutions:bool * ?legacyReferenceResolver:Compiler.ReferenceResolver.Resolver * ?tryGetMetadataSnapshot:Compiler.AbstractIL.ILBinaryReader.ILReaderTryGetMetadataSnapshot -> FSharpChecker
val opts : FSharpParsingOptions
type FSharpParsingOptions =
{SourceFiles: string [];
ConditionalCompilationDefines: string list;
ErrorSeverityOptions: FSharpErrorSeverityOptions;
IsInteractive: bool;
LightSyntax: bool option;
CompilingFsLib: bool;
IsExe: bool;}
static member Default : FSharpParsingOptions
Full name: Microsoft.FSharp.Compiler.SourceCodeServices.FSharpParsingOptions
property FSharpParsingOptions.Default: FSharpParsingOptions
val res : FSharpParseFileResults
member FSharpChecker.ParseFile : filename:string * source:string * options:FSharpParsingOptions * ?userOpName:string -> Async<FSharpParseFileResults>
Multiple items
type Async
static member AsBeginEnd : computation:('Arg -> Async<'T>) -> ('Arg * AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * (IAsyncResult -> unit)
static member AwaitEvent : event:IEvent<'Del,'T> * ?cancelAction:(unit -> unit) -> Async<'T> (requires delegate and 'Del :> Delegate)
static member AwaitIAsyncResult : iar:IAsyncResult * ?millisecondsTimeout:int -> Async<bool>
static member AwaitTask : task:Task -> Async<unit>
static member AwaitTask : task:Task<'T> -> Async<'T>
static member AwaitWaitHandle : waitHandle:WaitHandle * ?millisecondsTimeout:int -> Async<bool>
static member CancelDefaultToken : unit -> unit
static member Catch : computation:Async<'T> -> Async<Choice<'T,exn>>
static member FromBeginEnd : beginAction:(AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg:'Arg1 * beginAction:('Arg1 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * beginAction:('Arg1 * 'Arg2 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * arg3:'Arg3 * beginAction:('Arg1 * 'Arg2 * 'Arg3 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromContinuations : callback:(('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async<'T>
static member Ignore : computation:Async<'T> -> Async<unit>
static member OnCancel : interruption:(unit -> unit) -> Async<IDisposable>
static member Parallel : computations:seq<Async<'T>> -> Async<'T []>
static member RunSynchronously : computation:Async<'T> * ?timeout:int * ?cancellationToken:CancellationToken -> 'T
static member Sleep : millisecondsDueTime:int -> Async<unit>
static member Start : computation:Async<unit> * ?cancellationToken:CancellationToken -> unit
static member StartAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions * ?cancellationToken:CancellationToken -> Task<'T>
static member StartChild : computation:Async<'T> * ?millisecondsTimeout:int -> Async<Async<'T>>
static member StartChildAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions -> Async<Task<'T>>
static member StartImmediate : computation:Async<unit> * ?cancellationToken:CancellationToken -> unit
static member StartWithContinuations : computation:Async<'T> * continuation:('T -> unit) * exceptionContinuation:(exn -> unit) * cancellationContinuation:(OperationCanceledException -> unit) * ?cancellationToken:CancellationToken -> unit
static member SwitchToContext : syncContext:SynchronizationContext -> Async<unit>
static member SwitchToNewThread : unit -> Async<unit>
static member SwitchToThreadPool : unit -> Async<unit>
static member TryCancelled : computation:Async<'T> * compensation:(OperationCanceledException -> unit) -> Async<'T>
static member CancellationToken : Async<CancellationToken>
static member DefaultCancellationToken : CancellationToken
Full name: Microsoft.FSharp.Control.Async
--------------------
type Async<'T>
Full name: Microsoft.FSharp.Control.Async<_>
static member Async.RunSynchronously : computation:Async<'T> * ?timeout:int * ?cancellationToken:System.Threading.CancellationToken -> 'T
val fileAst : ParsedImplFileInput
property FSharpParseFileResults.ParseTree: ParsedInput option
property Option.Value: ParsedInput
Multiple items
module ParsedInput
from Microsoft.FSharp.Compiler.SourceCodeServices
--------------------
type ParsedInput =
| ImplFile of ParsedImplFileInput
| SigFile of ParsedSigFileInput
member Range : range
Full name: Microsoft.FSharp.Compiler.Ast.ParsedInput
union case ParsedInput.ImplFile: ParsedImplFileInput -> ParsedInput
val x : ParsedImplFileInput
union case ParsedInput.SigFile: ParsedSigFileInput -> ParsedInput
val failwith : message:string -> 'T
Full name: Microsoft.FSharp.Core.Operators.failwith
Multiple items
union case ParsedImplFileInput.ParsedImplFileInput: fileName: string * isScript: bool * qualifiedNameOfFile: QualifiedNameOfFile * scopedPragmas: ScopedPragma list * hashDirectives: ParsedHashDirective list * modules: SynModuleOrNamespace list * (bool * bool) -> ParsedImplFileInput
--------------------
type ParsedImplFileInput = | ParsedImplFileInput of fileName: string * isScript: bool * qualifiedNameOfFile: QualifiedNameOfFile * scopedPragmas: ScopedPragma list * hashDirectives: ParsedHashDirective list * modules: SynModuleOrNamespace list * (bool * bool)
Full name: Microsoft.FSharp.Compiler.Ast.ParsedImplFileInput
union case ParsedImplFileInput.ParsedImplFileInput: fileName: string * isScript: bool * qualifiedNameOfFile: QualifiedNameOfFile * scopedPragmas: ScopedPragma list * hashDirectives: ParsedHashDirective list * modules: SynModuleOrNamespace list * (bool * bool) -> ParsedImplFileInput
val modules : SynModuleOrNamespace list
Multiple items
union case SynModuleOrNamespace.SynModuleOrNamespace: longId: LongIdent * isRecursive: bool * kind: SynModuleOrNamespaceKind * decls: SynModuleDecls * xmlDoc: PreXmlDoc * attribs: SynAttributes * accessibility: SynAccess option * range: range -> SynModuleOrNamespace
--------------------
type SynModuleOrNamespace =
| SynModuleOrNamespace of longId: LongIdent * isRecursive: bool * kind: SynModuleOrNamespaceKind * decls: SynModuleDecls * xmlDoc: PreXmlDoc * attribs: SynAttributes * accessibility: SynAccess option * range: range
member Range : range
Full name: Microsoft.FSharp.Compiler.Ast.SynModuleOrNamespace
union case SynModuleOrNamespace.SynModuleOrNamespace: longId: LongIdent * isRecursive: bool * kind: SynModuleOrNamespaceKind * decls: SynModuleDecls * xmlDoc: PreXmlDoc * attribs: SynAttributes * accessibility: SynAccess option * range: range -> SynModuleOrNamespace
val moduleDeclarations : SynModuleDecls
union case SynBinding.Binding: accessibility: SynAccess option * kind: SynBindingKind * mustInline: bool * isMutable: bool * attrs: SynAttributes * xmlDoc: PreXmlDoc * valData: SynValData * headPat: SynPat * returnInfo: SynBindingReturnInfo option * expr: SynExpr * range: range * seqPoint: SequencePointInfoForBinding -> SynBinding
val attrs : SynAttributes
val binding : SynBinding
union case Option.Some: Value: 'T -> Option<'T>
union case Option.None: Option<'T>
val addObsoleteToBinding : (SynBinding -> SynBinding)
Full name: Script.addObsoleteToBinding
val obsoleteAst : SynAttribute
type SynAttribute =
{TypeName: LongIdentWithDots;
ArgExpr: SynExpr;
Target: Ident option;
AppliesToGetterAndSetter: bool;
Range: range;}
Full name: Microsoft.FSharp.Compiler.Ast.SynAttribute
type SynExpr =
| Paren of expr: SynExpr * leftParenRange: range * rightParenRange: range option * range: range
| Quote of operator: SynExpr * isRaw: bool * quotedSynExpr: SynExpr * isFromQueryExpression: bool * range: range
| Const of constant: SynConst * range: range
| Typed of expr: SynExpr * typeName: SynType * range: range
| Tuple of isStruct: bool * exprs: SynExpr list * commaRanges: range list * range: range
| AnonRecd of isStruct: bool * copyInfo: (SynExpr * BlockSeparator) option * recordFields: (Ident * SynExpr) list * range: range
| ArrayOrList of isList: bool * exprs: SynExpr list * range: range
| Record of baseInfo: (SynType * SynExpr * range * BlockSeparator option * range) option * copyInfo: (SynExpr * BlockSeparator) option * recordFields: (RecordFieldName * SynExpr option * BlockSeparator option) list * range: range
| New of isProtected: bool * typeName: SynType * expr: SynExpr * range: range
| ObjExpr of objType: SynType * argOptions: (SynExpr * Ident option) option * bindings: SynBinding list * extraImpls: SynInterfaceImpl list * newExprRange: range * range: range
...
member IsArbExprAndThusAlreadyReportedError : bool
member Range : range
member RangeOfFirstPortion : range
member RangeSansAnyExtraDot : range
Full name: Microsoft.FSharp.Compiler.Ast.SynExpr
union case SynExpr.Const: constant: SynConst * range: range -> SynExpr
type SynConst =
| Unit
| Bool of bool
| SByte of sbyte
| Byte of byte
| Int16 of int16
| UInt16 of uint16
| Int32 of int32
| UInt32 of uint32
| Int64 of int64
| UInt64 of uint64
...
member Range : dflt:range -> range
Full name: Microsoft.FSharp.Compiler.Ast.SynConst
union case SynConst.Unit: SynConst
type range =
struct
member MakeSynthetic : unit -> range
member ToShortString : unit -> string
member End : pos
member EndColumn : int
member EndLine : int
member EndRange : range
member FileIndex : int
member FileName : string
member IsSynthetic : bool
member Start : pos
...
end
Full name: Microsoft.FSharp.Compiler.Range.range
property range.Zero: range
Multiple items
module Range
from Microsoft.FSharp.Compiler.Range
--------------------
type Range = Position * Position
Full name: Microsoft.FSharp.Compiler.SourceCodeServices.Range
Multiple items
union case LongIdentWithDots.LongIdentWithDots: id: LongIdent * dotms: range list -> LongIdentWithDots
--------------------
type LongIdentWithDots =
| LongIdentWithDots of id: LongIdent * dotms: range list
member Lid : LongIdent
member Range : range
member RangeSansAnyExtraDot : range
member ThereIsAnExtraDotAtTheEnd : bool
Full name: Microsoft.FSharp.Compiler.Ast.LongIdentWithDots
Multiple items
type Ident =
struct
new : text:string * range:range -> Ident
override ToString : unit -> string
member idRange : range
member idText : string
end
Full name: Microsoft.FSharp.Compiler.Ast.Ident
--------------------
Ident()
new : text:string * range:range -> Ident
val ao : SynAccess option
val bindKind : SynBindingKind
val isInline : bool
val isMutable : bool
val px : PreXmlDoc
val valData : SynValData
val pat : SynPat
val retInfo : SynBindingReturnInfo option
val expr : SynExpr
Multiple items
val range : range
--------------------
type range =
struct
member MakeSynthetic : unit -> range
member ToShortString : unit -> string
member End : pos
member EndColumn : int
member EndLine : int
member EndRange : range
member FileIndex : int
member FileName : string
member IsSynthetic : bool
member Start : pos
...
end
Full name: Microsoft.FSharp.Compiler.Range.range
val seqInfo : SequencePointInfoForBinding
val addObsolete : _arg1:SynModuleDecl -> SynModuleDecl
Full name: Script.addObsolete
type SynModuleDecl =
| ModuleAbbrev of ident: Ident * longId: LongIdent * range: range
| NestedModule of SynComponentInfo * isRecursive: bool * SynModuleDecls * bool * range: range
| Let of isRecursive: bool * SynBinding list * range: range
| DoExpr of SequencePointInfoForBinding * SynExpr * range: range
| Types of SynTypeDefn list * range: range
| Exception of SynExceptionDefn * range: range
| Open of longDotId: LongIdentWithDots * range: range
| Attributes of SynAttributes * range: range
| HashDirective of ParsedHashDirective * range: range
| NamespaceFragment of SynModuleOrNamespace
member Range : range
Full name: Microsoft.FSharp.Compiler.Ast.SynModuleDecl
union case SynModuleDecl.Let: isRecursive: bool * SynBinding list * range: range -> SynModuleDecl
val _isRecursive : bool
active recognizer NotAttributesLetBinding: SynBinding -> SynBinding option
Full name: Script.( |NotAttributesLetBinding|_| )
val _range : range
val x : SynModuleDecl
Multiple items
type StringBuilder =
new : unit -> StringBuilder + 5 overloads
member Append : value:string -> StringBuilder + 18 overloads
member AppendFormat : format:string * arg0:obj -> StringBuilder + 4 overloads
member AppendLine : unit -> StringBuilder + 1 overload
member Capacity : int with get, set
member Chars : int -> char with get, set
member Clear : unit -> StringBuilder
member CopyTo : sourceIndex:int * destination:char[] * destinationIndex:int * count:int -> unit
member EnsureCapacity : capacity:int -> int
member Equals : sb:StringBuilder -> bool
...
Full name: System.Text.StringBuilder
--------------------
StringBuilder() : unit
StringBuilder(capacity: int) : unit
StringBuilder(value: string) : unit
StringBuilder(value: string, capacity: int) : unit
StringBuilder(capacity: int, maxCapacity: int) : unit
StringBuilder(value: string, startIndex: int, length: int, capacity: int) : unit
val x : StringBuilder
member StringBuilder.Add : text:string -> unit
Full name: Script.Add
Multiple items
val string : value:'T -> string
Full name: Microsoft.FSharp.Core.Operators.string
--------------------
type string = System.String
Full name: Microsoft.FSharp.Core.string
StringBuilder.Append(value: char []) : StringBuilder
(+0 other overloads)
StringBuilder.Append(value: obj) : StringBuilder
(+0 other overloads)
StringBuilder.Append(value: uint64) : StringBuilder
(+0 other overloads)
StringBuilder.Append(value: uint32) : StringBuilder
(+0 other overloads)
StringBuilder.Append(value: uint16) : StringBuilder
(+0 other overloads)
StringBuilder.Append(value: decimal) : StringBuilder
(+0 other overloads)
StringBuilder.Append(value: float) : StringBuilder
(+0 other overloads)
StringBuilder.Append(value: float32) : StringBuilder
(+0 other overloads)
StringBuilder.Append(value: int64) : StringBuilder
(+0 other overloads)
StringBuilder.Append(value: int) : StringBuilder
(+0 other overloads)
val ignore : value:'T -> unit
Full name: Microsoft.FSharp.Core.Operators.ignore
val identToString : LongIdentWithDots -> string
Full name: Script.identToString
val ids : LongIdent
module Seq
from Microsoft.FSharp.Collections
val map : mapping:('T -> 'U) -> source:seq<'T> -> seq<'U>
Full name: Microsoft.FSharp.Collections.Seq.map
val id : Ident
property Ident.idText: string
module String
from Microsoft.FSharp.Core
val concat : sep:string -> strings:seq<string> -> string
Full name: Microsoft.FSharp.Core.String.concat
val printIdent : sb:StringBuilder -> ident:LongIdentWithDots -> unit
Full name: Script.printIdent
val sb : StringBuilder
val ident : LongIdentWithDots
val name : string
member StringBuilder.Add : text:string -> unit
val exprToString : valData:SynExpr -> string
Full name: Script.exprToString
val valData : SynExpr
union case SynExpr.App: ExprAtomicFlag * isInfix: bool * funcExpr: SynExpr * argExpr: SynExpr * range: range -> SynExpr
val isInfix : bool
val funcExpr : SynExpr
val argExpr : SynExpr
union case SynExpr.Ident: Ident -> SynExpr
val x : Ident
val printAttributes : sb:StringBuilder -> attrs:SynAttributes -> unit
Full name: Script.printAttributes
type SynAttributes = SynAttribute list
Full name: Microsoft.FSharp.Compiler.Ast.SynAttributes
val not : value:bool -> bool
Full name: Microsoft.FSharp.Core.Operators.not
property List.IsEmpty: bool
val attr : SynAttribute
SynAttribute.TypeName: LongIdentWithDots
SynAttribute.ArgExpr: SynExpr
val printInline : sb:StringBuilder -> isInline:bool -> unit
Full name: Script.printInline
val printText : sb:StringBuilder -> text:string -> unit
Full name: Script.printText
val printAccess : sb:StringBuilder -> _arg1:SynAccess option -> unit
Full name: Script.printAccess
type SynAccess =
| Public
| Internal
| Private
Full name: Microsoft.FSharp.Compiler.Ast.SynAccess
union case SynAccess.Internal: SynAccess
union case SynAccess.Private: SynAccess
union case SynAccess.Public: SynAccess
val printConsctructorArgs : sb:StringBuilder -> _arg1:SynConstructorArgs -> unit
Full name: Script.printConsctructorArgs
type SynConstructorArgs =
| Pats of SynPat list
| NamePatPairs of (Ident * SynPat) list * range: range
Full name: Microsoft.FSharp.Compiler.Ast.SynConstructorArgs
union case SynConstructorArgs.Pats: SynPat list -> SynConstructorArgs
val pats : SynPat list
val printPattern : sb:StringBuilder -> (SynPat -> unit)
Full name: Script.printPattern
union case SynConstructorArgs.NamePatPairs: (Ident * SynPat) list * range: range -> SynConstructorArgs
type SynPat =
| Const of SynConst * range: range
| Wild of range: range
| Named of SynPat * Ident * isSelfIdentifier: bool * accessibility: SynAccess option * range: range
| Typed of SynPat * SynType * range: range
| Attrib of SynPat * SynAttributes * range: range
| Or of SynPat * SynPat * range: range
| Ands of SynPat list * range: range
| LongIdent of longDotId: LongIdentWithDots * Ident option * SynValTyparDecls option * SynConstructorArgs * accessibility: SynAccess option * range: range
| Tuple of isStruct: bool * SynPat list * range: range
| Paren of SynPat * range: range
...
member Range : range
Full name: Microsoft.FSharp.Compiler.Ast.SynPat
union case SynPat.LongIdent: longDotId: LongIdentWithDots * Ident option * SynValTyparDecls option * SynConstructorArgs * accessibility: SynAccess option * range: range -> SynPat
val identWithDots : LongIdentWithDots
val pats : SynConstructorArgs
val access : SynAccess option
union case SynPat.Paren: SynPat * range: range -> SynPat
union case SynPat.Tuple: isStruct: bool * SynPat list * range: range -> SynPat
module Array
from Microsoft.FSharp.Collections
val ofList : list:'T list -> 'T []
Full name: Microsoft.FSharp.Collections.Array.ofList
union case SynPat.Named: SynPat * Ident * isSelfIdentifier: bool * accessibility: SynAccess option * range: range -> SynPat
union case SynPat.Wild: range: range -> SynPat
val ident : s:string * r:range -> Ident
Full name: Microsoft.FSharp.Compiler.Ast.ident
union case SynPat.Typed: SynPat * SynType * range: range -> SynPat
type SynType =
| LongIdent of longDotId: LongIdentWithDots
| App of typeName: SynType * LESSrange: range option * typeArgs: SynType list * commaRanges: range list * GREATERrange: range option * isPostfix: bool * range: range
| LongIdentApp of typeName: SynType * longDotId: LongIdentWithDots * LESSRange: range option * typeArgs: SynType list * commaRanges: range list * GREATERrange: range option * range: range
| Tuple of isStruct: bool * typeNames: (bool * SynType) list * range: range
| AnonRecd of isStruct: bool * typeNames: (Ident * SynType) list * range: range
| Array of int * elementType: SynType * range: range
| Fun of argType: SynType * returnType: SynType * range: range
| Var of genericName: SynTypar * range: range
| Anon of range: range
| WithGlobalConstraints of typeName: SynType * constraints: SynTypeConstraint list * range: range
...
member Range : range
Full name: Microsoft.FSharp.Compiler.Ast.SynType
union case SynType.LongIdent: longDotId: LongIdentWithDots -> SynType
val printBind : sb:StringBuilder -> SynBinding -> unit
Full name: Script.printBind
val astToText : _arg1:SynModuleDecl -> string
Full name: Script.astToText
StringBuilder.ToString() : string
StringBuilder.ToString(startIndex: int, length: int) : string
val workFlow : (string -> string)
Full name: Script.workFlow
Multiple items
module List
from Microsoft.FSharp.Collections
--------------------
type List<'T> =
| ( [] )
| ( :: ) of Head: 'T * Tail: 'T list
interface IEnumerable
interface IEnumerable<'T>
member GetSlice : startIndex:int option * endIndex:int option -> 'T list
member Head : 'T
member IsEmpty : bool
member Item : index:int -> 'T with get
member Length : int
member Tail : 'T list
static member Cons : head:'T * tail:'T list -> 'T list
static member Empty : 'T list
Full name: Microsoft.FSharp.Collections.List<_>
val map : mapping:('T -> 'U) -> list:'T list -> 'U list
Full name: Microsoft.FSharp.Collections.List.map
val functionText : string
Full name: Script.functionText
More information