├── .github └── workflows │ └── build.yml ├── .gitignore ├── Directory.Build.props ├── LICENSE ├── Microsoft.CodeAnalysis.ActivePatterns.Generator ├── Microsoft.CodeAnalysis.ActivePatterns.Generator.fsproj └── Program.fs ├── Microsoft.CodeAnalysis.ActivePatterns.sln ├── Microsoft.CodeAnalysis.ActivePatterns ├── ActivePatterns.fs ├── Additionals.fs ├── AssemblyInfo.fs ├── Loose │ ├── ActivePatterns.fs │ └── Additionals.fs ├── Microsoft.CodeAnalysis.ActivePatterns.fsproj └── Strict │ ├── CSharpActivePatterns.fs │ ├── CSharpAdditionals.fs │ ├── VisualBasicActivePatterns.fs │ └── VisualBasicAdditionals.fs ├── README.md ├── artifacts └── .gitkeep ├── build-nupkg.bat ├── build-nupkg.sh ├── csharp_standard_usage_sample ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── Sample.cs └── csharp_standard_usage_sample.csproj ├── nuget.config └── test ├── Program.fs ├── Sample.cs └── test.fsproj /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: .NET 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | steps: 9 | 10 | #----------------------------------------------------------------------- 11 | # Checkout 12 | 13 | - uses: actions/checkout@v2 14 | with: 15 | fetch-depth: 0 16 | # lfs: true 17 | #- name: Checkout LFS objects 18 | # run: git lfs checkout 19 | 20 | - name: Extract branch name 21 | id: extract_branch_name 22 | # if: startsWith( github.ref, 'refs/tags/' ) 23 | run: | 24 | export branch_name=`git name-rev --name-only --exclude=tags/* HEAD` 25 | echo "Detected current branch: ${branch_name}" 26 | echo "branch_name=${branch_name}" >> $GITHUB_OUTPUT 27 | 28 | #----------------------------------------------------------------------- 29 | # Setup environments 30 | 31 | - name: Setup .NET 3.1 32 | uses: actions/setup-dotnet@v1 33 | with: 34 | dotnet-version: 3.1.* 35 | - name: Setup .NET 5 36 | uses: actions/setup-dotnet@v1 37 | with: 38 | dotnet-version: 5.0.* 39 | - name: Setup .NET 6 40 | uses: actions/setup-dotnet@v1 41 | with: 42 | dotnet-version: 6.0.* 43 | - name: Setup .NET 7 44 | uses: actions/setup-dotnet@v1 45 | with: 46 | dotnet-version: 7.0.* 47 | 48 | #- name: Setup NuGet package reference 49 | # run: | 50 | # dotnet nuget add source ${{secrets.GH_LOCAL_NUGET_URL}} -n ref1 -u ${{secrets.GH_LOCAL_NUGET_USER}} -p ${{secrets.GH_LOCAL_NUGET_PASSWORD}} --store-password-in-clear-text --configfile nuget.config 51 | # dotnet nuget add source ${{secrets.GH_NUGET_URL}} -n ref2 -u ${{secrets.GH_NUGET_USER}} -p ${{secrets.GH_NUGET_PASSWORD}} --store-password-in-clear-text --configfile nuget.config 52 | 53 | #----------------------------------------------------------------------- 54 | # Build 55 | 56 | - name: Build 57 | run: dotnet build -p:Configuration=Release -p:BuildIdentifier=${GITHUB_RUN_NUMBER} 58 | 59 | - name: Build NuGet packages 60 | run: dotnet pack -p:Configuration=Release -p:BuildIdentifier=${GITHUB_RUN_NUMBER} -o artifacts 61 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | .idea/ 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | 26 | # Visual Studio 2015 cache/options directory 27 | .vs/ 28 | # Uncomment if you have tasks that create the project's static files in wwwroot 29 | #wwwroot/ 30 | 31 | # MSTest test Results 32 | [Tt]est[Rr]esult*/ 33 | [Bb]uild[Ll]og.* 34 | 35 | # NUNIT 36 | *.VisualState.xml 37 | TestResult.xml 38 | 39 | # Build Results of an ATL Project 40 | [Dd]ebugPS/ 41 | [Rr]eleasePS/ 42 | dlldata.c 43 | 44 | # DNX 45 | project.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | 85 | # Visual Studio profiler 86 | *.psess 87 | *.vsp 88 | *.vspx 89 | *.sap 90 | 91 | # TFS 2012 Local Workspace 92 | $tf/ 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | *.DotSettings.user 101 | 102 | # JustCode is a .NET coding add-in 103 | .JustCode 104 | 105 | # TeamCity is a build add-in 106 | _TeamCity* 107 | 108 | # DotCover is a Code Coverage Tool 109 | *.dotCover 110 | 111 | # NCrunch 112 | _NCrunch_* 113 | .*crunch*.local.xml 114 | nCrunchTemp_* 115 | 116 | # MightyMoose 117 | *.mm.* 118 | AutoTest.Net/ 119 | 120 | # Web workbench (sass) 121 | .sass-cache/ 122 | 123 | # Installshield output folder 124 | [Ee]xpress/ 125 | 126 | # DocProject is a documentation generator add-in 127 | DocProject/buildhelp/ 128 | DocProject/Help/*.HxT 129 | DocProject/Help/*.HxC 130 | DocProject/Help/*.hhc 131 | DocProject/Help/*.hhk 132 | DocProject/Help/*.hhp 133 | DocProject/Help/Html2 134 | DocProject/Help/html 135 | 136 | # Click-Once directory 137 | publish/ 138 | 139 | # Publish Web Output 140 | *.[Pp]ublish.xml 141 | *.azurePubxml 142 | # TODO: Comment the next line if you want to checkin your web deploy settings 143 | # but database connection strings (with potential passwords) will be unencrypted 144 | *.pubxml 145 | *.publishproj 146 | 147 | # NuGet Packages 148 | *.nupkg 149 | # The packages folder can be ignored because of Package Restore 150 | **/packages/* 151 | # except build/, which is used as an MSBuild target. 152 | !**/packages/build/ 153 | # Uncomment if necessary however generally it will be regenerated when needed 154 | #!**/packages/repositories.config 155 | 156 | # Microsoft Azure Build Output 157 | csx/ 158 | *.build.csdef 159 | 160 | # Microsoft Azure Emulator 161 | ecf/ 162 | rcf/ 163 | 164 | # Microsoft Azure ApplicationInsights config file 165 | ApplicationInsights.config 166 | 167 | # Windows Store app package directory 168 | AppPackages/ 169 | BundleArtifacts/ 170 | 171 | # Visual Studio cache files 172 | # files ending in .cache can be ignored 173 | *.[Cc]ache 174 | # but keep track of directories ending in .cache 175 | !*.[Cc]ache/ 176 | 177 | # Others 178 | ClientBin/ 179 | ~$* 180 | *~ 181 | *.dbmdl 182 | *.dbproj.schemaview 183 | *.pfx 184 | *.publishsettings 185 | node_modules/ 186 | orleans.codegen.cs 187 | 188 | # RIA/Silverlight projects 189 | Generated_Code/ 190 | 191 | # Backup & report files from converting an old project file 192 | # to a newer Visual Studio version. Backup files are not needed, 193 | # because we have git ;-) 194 | _UpgradeReport_Files/ 195 | Backup*/ 196 | UpgradeLog*.XML 197 | UpgradeLog*.htm 198 | 199 | # SQL Server files 200 | *.mdf 201 | *.ldf 202 | 203 | # Business Intelligence projects 204 | *.rdl.data 205 | *.bim.layout 206 | *.bim_*.settings 207 | 208 | # Microsoft Fakes 209 | FakesAssemblies/ 210 | 211 | # GhostDoc plugin setting file 212 | *.GhostDoc.xml 213 | 214 | # Node.js Tools for Visual Studio 215 | .ntvs_analysis.dat 216 | 217 | # Visual Studio 6 build log 218 | *.plg 219 | 220 | # Visual Studio 6 workspace options file 221 | *.opt 222 | 223 | # Visual Studio LightSwitch build output 224 | **/*.HTMLClient/GeneratedArtifacts 225 | **/*.DesktopClient/GeneratedArtifacts 226 | **/*.DesktopClient/ModelManifest.xml 227 | **/*.Server/GeneratedArtifacts 228 | **/*.Server/ModelManifest.xml 229 | _Pvt_Extensions 230 | 231 | # Paket dependency manager 232 | .paket/paket.exe 233 | 234 | # FAKE - F# Make 235 | .fake/ 236 | 237 | .vscode/ 238 | -------------------------------------------------------------------------------- /Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | latest 5 | enable 6 | AnyCPU 7 | 8 | true 9 | true 10 | false 11 | false 12 | true 13 | git 14 | https://github.com/kekyo/Microsoft.CodeAnalysis.ActivePatterns.git 15 | false 16 | 17 | Microsoft.CodeAnalysis 18 | false 19 | true 20 | $(NoWarn);CS1570;CS1591;CA1416;CS8981 21 | 22 | Microsoft.CodeAnalysis.ActivePatterns 23 | Microsoft.CodeAnalysis.ActivePatterns 24 | Copyright (c) Kouji Matsui 25 | F# Active pattern functions for Roslyn Compiler Platform 26 | 27 | Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud) 28 | Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud) 29 | Apache-2.0 30 | https://github.com/kekyo/Microsoft.CodeAnalysis.ActivePatterns 31 | 32 | f#;fsharp;c#;csharp;vb;visual basic;roslyn;code analysis;active pattern 33 | .pdb 34 | $(NoWarn);NU1605;NU1701;NU1803 35 | 36 | 37 | 38 | portable 39 | false 40 | false 41 | false 42 | 43 | 44 | 45 | embedded 46 | true 47 | true 48 | true 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. -------------------------------------------------------------------------------- /Microsoft.CodeAnalysis.ActivePatterns.Generator/Microsoft.CodeAnalysis.ActivePatterns.Generator.fsproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Microsoft.CodeAnalysis.ActivePatterns.Generator/Program.fs: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Microsoft.CodeAnalysis.ActivePatterns - F# Active pattern matching library for Roslyn 4 | // Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | ///////////////////////////////////////////////////////////////////////////// 19 | 20 | module Generator 21 | 22 | open System 23 | open System.IO 24 | open System.Reflection 25 | open System.Diagnostics 26 | 27 | //////////////////////////////////////////// 28 | 29 | let objType = typeof 30 | let seqType = typedefof> 31 | 32 | let baseNodeType = typeof 33 | let csharpNodeType = typeof 34 | let visualBasicNodeType = typeof 35 | 36 | let syntaxListType = typedefof> 37 | let syntaxTokenType = typeof 38 | 39 | //////////////////////////////////////////// 40 | 41 | let getSyntaxListElementType (t:Type) = 42 | if t.IsGenericType && (t.GetGenericTypeDefinition() = syntaxListType) then 43 | Some (t.GetGenericArguments().[0]) 44 | else 45 | None 46 | 47 | let (|Value|Token|Node|List|Another|) (t:Type) = 48 | if t.IsPrimitive || t.IsEnum || t = typeof then 49 | Value t 50 | else if syntaxTokenType.IsAssignableFrom t then 51 | Token t 52 | else if baseNodeType.IsAssignableFrom t then 53 | Node t 54 | else 55 | match getSyntaxListElementType t with 56 | | Some et -> List et 57 | | _ -> Another 58 | 59 | let (|NotVisible|_|) (m: MethodBase) = 60 | if (m = null) || not m.IsPublic || m.IsStatic then Some m else None 61 | 62 | let obsoleteType = typeof 63 | let isObsoleted (m:MemberInfo) = 64 | if m.IsDefined obsoleteType then 65 | true 66 | else 67 | false 68 | 69 | let targetProperty (p: PropertyInfo) = 70 | match p.CanRead, p.GetIndexParameters().Length >= 1, p.GetGetMethod(), isObsoleted p, p.PropertyType with 71 | | false, _, _, _, _ -> None 72 | | _, true, _, _, _ -> None 73 | | _, _, NotVisible _, _, _ -> None 74 | | _, _, _, true, _ -> None 75 | | _, _, _, _, Value et 76 | | _, _, _, _, Token et 77 | | _, _, _, _, Node et 78 | | _, _, _, _, List et -> Some p 79 | | _ -> None 80 | 81 | let getTupleArgs (t: Type) = 82 | t.GetProperties(BindingFlags.Public ||| BindingFlags.Instance ||| BindingFlags.DeclaredOnly) 83 | |> Seq.choose targetProperty 84 | |> Seq.toArray 85 | 86 | let getTupleArgsString (name: string) (p: PropertyInfo) = 87 | match p.PropertyType with 88 | | Value et 89 | | Token et 90 | | Node et -> 91 | Some (String.Format("{0}.{1}", name, p.Name)) 92 | | List et -> 93 | Some (String.Format("{0}.{1} |> Seq.toList", name, p.Name)) 94 | | Another -> 95 | None 96 | 97 | let getTupleArgsStringWithCast (name: string) (p: PropertyInfo) (ct: Type) = 98 | match p.PropertyType with 99 | | Value et 100 | | Token et 101 | | Node et -> 102 | if p.PropertyType <> ct then 103 | Some (String.Format("{0}.{1} :> {2}", name, p.Name, ct.FullName)) 104 | else 105 | Some (String.Format("{0}.{1}", name, p.Name)) 106 | | List et -> 107 | if p.PropertyType <> ct then 108 | if ct.IsGenericType && ct.GetGenericTypeDefinition() = seqType then 109 | let gt = ct.GetGenericArguments().[0] 110 | Some (String.Format("{0}.{1} |> Seq.cast<{2}> |> Seq.toList", name, p.Name, gt.FullName)) 111 | else 112 | Some (String.Format("{0}.{1} :> {2}", name, p.Name, ct.FullName)) 113 | else 114 | Some (String.Format("{0}.{1} |> Seq.toList", name, p.Name)) 115 | | Another -> 116 | None 117 | 118 | let getPatternName (t: Type) = 119 | let name = t.Name 120 | if name.EndsWith "Syntax" then 121 | name.Substring(0, name.Length - 6) 122 | else 123 | name 124 | 125 | //////////////////////////////////////////// 126 | 127 | let writeHeader (tw: TextWriter) = 128 | tw.WriteLine("// This is auto-generated source code by Microsoft.CodeAnalysis.ActivePatterns, DO NOT EDIT!") 129 | tw.WriteLine() 130 | 131 | let generateActivePatternsForValue path (namespaceName: string) (valueTypes: Type seq) (nodeName: Type -> string) = 132 | use tw = File.CreateText(path) 133 | 134 | writeHeader tw 135 | 136 | tw.WriteLine("namespace {0}", namespaceName) 137 | tw.WriteLine() 138 | tw.WriteLine("[]") 139 | tw.WriteLine("module ActivePatterns =") 140 | tw.WriteLine() 141 | 142 | valueTypes |> Seq.iter (fun t -> 143 | let tupleArgs = 144 | getTupleArgs t 145 | |> Seq.choose (getTupleArgsString "value") 146 | |> Seq.toArray 147 | if not (Array.isEmpty tupleArgs) then 148 | tw.WriteLine( 149 | " let (|{0}|) (value:{1}) =", 150 | t.Name, 151 | nodeName t) 152 | tw.WriteLine(" {0} ({1})", t.Name, String.Join(", ", tupleArgs)) 153 | tw.WriteLine()) 154 | 155 | tw.Flush() 156 | 157 | //////////////////////////////////////////// 158 | 159 | let rec detectCommonType t1 t2 = 160 | // t1: Microsoft.CodeAnalysis.CSharp.Syntax.QualifiedNameSyntax 161 | // t2: Microsoft.CodeAnalysis.VisualBasic.Syntax.QualifiedNameSyntax 162 | // ans: Microsoft.CodeAnalysis.SyntaxNode 163 | 164 | match getSyntaxListElementType t1, getSyntaxListElementType t2 with 165 | | Some(et1), Some(et2) -> 166 | seqType.MakeGenericType([| detectCommonType et1 et2 |]) 167 | | _ -> 168 | let rec derivedTypeList (t: Type) (tl: Type list): Type list = 169 | if t = objType then t :: tl 170 | else derivedTypeList t.BaseType (t :: tl) 171 | let t1List = derivedTypeList t1 [] 172 | let t2List = derivedTypeList t2 [] 173 | Seq.zip t1List t2List |> Seq.filter (fun (t1, t2) -> t1 = t2) |> Seq.toArray |> Seq.last |> fst 174 | 175 | let generateLooseActivePatternsForSyntax path (namespaceName: string) (syntaxTypes: Type seq) (nodeName: Type -> string) = 176 | use tw = File.CreateText(path) 177 | 178 | writeHeader tw 179 | 180 | tw.WriteLine("namespace {0}", namespaceName) 181 | tw.WriteLine() 182 | tw.WriteLine("[]") 183 | tw.WriteLine("module ActivePatterns =") 184 | tw.WriteLine() 185 | 186 | syntaxTypes 187 | // Combined by active pattern name (both C# and VB) 188 | |> Seq.groupBy getPatternName 189 | |> Seq.iter (fun (patternName, types) -> 190 | let argPropertiesByTypesList = 191 | types 192 | |> Seq.map (fun t -> t, getTupleArgs t) 193 | |> Seq.filter (fun (_, ps) -> 194 | // Cannot deconstruct nothing properties 195 | (not (Array.isEmpty ps)) 196 | // Cannot deconstruct contains unknown property types 197 | && (not (ps |> Seq.exists(fun p -> match p.PropertyType with Another -> true | _ -> false)))) 198 | |> Seq.toArray 199 | // 0 ~ [C#; VB] 200 | Debug.Assert(argPropertiesByTypesList.Length <= 2) 201 | 202 | let emitOnlyOne (typesList: (Type * PropertyInfo[])[]) = 203 | // Generate argument expressions 204 | let argStringsByTypesList = 205 | typesList 206 | |> Seq.map (fun (t, ps) -> t, ps |> Seq.choose (getTupleArgsString "node") |> Seq.toArray) 207 | |> Seq.toArray 208 | 209 | tw.WriteLine( 210 | " let (|{0}|_|) (node:{1}) =", 211 | patternName, 212 | nodeName baseNodeType) 213 | tw.WriteLine(" match node with") 214 | 215 | let t, tupleArgs = argStringsByTypesList.[0] 216 | tw.WriteLine(" | :? {0} as node ->", t.FullName) 217 | tw.WriteLine(" Some ({0})", String.Join(", ", tupleArgs)) 218 | tw.WriteLine(" | _ -> None") 219 | tw.WriteLine() 220 | 221 | let emitBothPatterns (typesList: (Type * PropertyInfo[])[]) = 222 | // Generate argument expressions 223 | let argStringsByTypesList = 224 | typesList 225 | |> Seq.map (fun (t, ps) -> t, ps |> Seq.choose (getTupleArgsString "node") |> Seq.toArray) 226 | |> Seq.toArray 227 | 228 | argStringsByTypesList |> Seq.iter(fun (t, tupleArgs) -> 229 | tw.WriteLine( 230 | " let (|{0}{1}|_|) (node:{2}) =", 231 | t.FullName.Split(".").[2], // HACK: Index 2 is language name (CSharp, VisualBasic) 232 | patternName, 233 | nodeName baseNodeType) 234 | tw.WriteLine(" match node with") 235 | tw.WriteLine(" | :? {0} as node ->", t.FullName) 236 | tw.WriteLine(" Some ({0})", String.Join(", ", tupleArgs)) 237 | tw.WriteLine(" | _ -> None") 238 | tw.WriteLine()) 239 | 240 | let emitByCast (typesList: (Type * PropertyInfo[])[]) argCommonTypes = 241 | // Generate argument expressions 242 | let argStringsByTypesList = 243 | argPropertiesByTypesList 244 | |> Seq.map (fun (t, ps) -> 245 | t, 246 | Seq.zip ps argCommonTypes |> Seq.choose (fun (p, ct) -> getTupleArgsStringWithCast "node" p ct) |> Seq.toArray) 247 | |> Seq.toArray 248 | 249 | tw.WriteLine( 250 | " let (|{0}|_|) (node:{1}) =", 251 | patternName, 252 | nodeName baseNodeType) 253 | tw.WriteLine(" match node with") 254 | 255 | argStringsByTypesList |> Seq.iter(fun (t, tupleArgs) -> 256 | tw.WriteLine(" | :? {0} as node ->", t.FullName) 257 | tw.WriteLine(" Some ({0})", String.Join(", ", tupleArgs))) 258 | 259 | tw.WriteLine(" | _ -> None") 260 | tw.WriteLine() 261 | 262 | match argPropertiesByTypesList.Length, argPropertiesByTypesList |> Seq.distinctBy (fun (_, ps) -> ps.Length) |> Seq.length with 263 | // C# only or VB only 264 | | 1, _ -> emitOnlyOne argPropertiesByTypesList 265 | // both C# and VB (argument count is differ) 266 | | 2, 2 -> emitBothPatterns argPropertiesByTypesList 267 | // both C# and VB (argument count is equals) 268 | | 2, 1 -> 269 | // Calculate common types 270 | let argCommonTypes = 271 | Seq.zip (argPropertiesByTypesList.[0] |> snd) (argPropertiesByTypesList.[1] |> snd) 272 | |> Seq.map (fun (ps1, ps2) -> detectCommonType ps1.PropertyType ps2.PropertyType) 273 | |> Seq.toArray 274 | 275 | let isCastable (t: Type) = 276 | (baseNodeType.IsAssignableFrom t) 277 | || (syntaxTokenType.IsAssignableFrom t) 278 | || t.IsInterface 279 | 280 | match argCommonTypes |> Seq.exists (isCastable >> not) with 281 | // Argument contains not castable. 282 | | true -> emitBothPatterns argPropertiesByTypesList 283 | // All arguments castable. 284 | | false -> emitByCast argPropertiesByTypesList argCommonTypes 285 | 286 | | _ -> 287 | ()) 288 | 289 | tw.Flush() 290 | 291 | //////////////////////////////////////////// 292 | 293 | let generateStrictActivePatternsForSyntax path (namespaceName: string) (syntaxTypes: Type seq) (nodeName: Type -> string) = 294 | use tw = File.CreateText(path) 295 | 296 | writeHeader tw 297 | 298 | tw.WriteLine("namespace {0}", namespaceName) 299 | tw.WriteLine() 300 | tw.WriteLine("[]") 301 | tw.WriteLine("module ActivePatterns =") 302 | tw.WriteLine() 303 | 304 | syntaxTypes |> Seq.iter (fun t -> 305 | let tupleArgs = 306 | getTupleArgs t 307 | |> Seq.choose (getTupleArgsString "node") 308 | |> Seq.toArray 309 | if not (Array.isEmpty tupleArgs) then 310 | tw.WriteLine( 311 | " let (|{0}|_|) (node:{1}) =", 312 | getPatternName t, 313 | nodeName t) 314 | tw.WriteLine(" match node with") 315 | tw.WriteLine(" | :? {0} as node ->", t.FullName) 316 | tw.WriteLine(" Some ({0})", String.Join(", ", tupleArgs)) 317 | tw.WriteLine(" | _ -> None") 318 | tw.WriteLine()) 319 | 320 | tw.Flush() 321 | 322 | //////////////////////////////////////////// 323 | 324 | let getTargetPath (prefix: string) fileName = 325 | if prefix.Length >= 1 then 326 | (Path.Combine("..","..","..","..", "Microsoft.CodeAnalysis.ActivePatterns", prefix, fileName)) 327 | else 328 | (Path.Combine("..","..","..","..", "Microsoft.CodeAnalysis.ActivePatterns", fileName)) 329 | 330 | let rec baseAbstractType (bottomType: Type) (t: Type) = 331 | if t = bottomType then 332 | t 333 | else 334 | let baseType = t.BaseType 335 | if not baseType.IsAbstract && t.IsAbstract then 336 | t 337 | else 338 | baseAbstractType bottomType baseType 339 | 340 | let getNodeName bottomType t = 341 | (baseAbstractType bottomType t).FullName 342 | 343 | //////////////////////////////////////////// 344 | 345 | [] 346 | let main argv = 347 | let valueTypes (nodeType: Type) = 348 | nodeType.Assembly.GetTypes() 349 | |> Seq.filter (fun t -> 350 | t.IsPublic && 351 | t.IsValueType && 352 | (not t.IsEnum) && 353 | (not t.IsGenericType) && 354 | (not (isObsoleted t))) 355 | |> Seq.toArray 356 | 357 | generateActivePatternsForValue 358 | (getTargetPath "" "ActivePatterns.fs") 359 | "Microsoft.CodeAnalysis" 360 | (valueTypes baseNodeType) 361 | (fun t -> t.FullName) 362 | 363 | let syntaxTypes (nodeType: Type) = 364 | nodeType.Assembly.GetTypes() 365 | |> Seq.filter (fun t -> 366 | t.IsPublic && 367 | t.IsSealed && 368 | (not t.IsGenericType) && 369 | nodeType.IsAssignableFrom t && 370 | (not (isObsoleted t))) 371 | |> Seq.toArray 372 | 373 | generateLooseActivePatternsForSyntax 374 | (getTargetPath "Loose" "ActivePatterns.fs") 375 | (baseNodeType.Namespace + ".Loose") 376 | (Seq.append (syntaxTypes csharpNodeType) (syntaxTypes visualBasicNodeType)) 377 | (getNodeName baseNodeType) 378 | 379 | generateStrictActivePatternsForSyntax 380 | (getTargetPath "Strict" "CSharpActivePatterns.fs") 381 | (csharpNodeType.Namespace + ".Strict") 382 | (syntaxTypes csharpNodeType) 383 | (getNodeName csharpNodeType) 384 | generateStrictActivePatternsForSyntax 385 | (getTargetPath "Strict" "VisualBasicActivePatterns.fs") 386 | (visualBasicNodeType.Namespace + ".Strict") 387 | (syntaxTypes visualBasicNodeType) 388 | (getNodeName visualBasicNodeType) 389 | 390 | 0 391 | 392 | -------------------------------------------------------------------------------- /Microsoft.CodeAnalysis.ActivePatterns.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.4.33110.190 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Microsoft.CodeAnalysis.ActivePatterns.Generator", "Microsoft.CodeAnalysis.ActivePatterns.Generator\Microsoft.CodeAnalysis.ActivePatterns.Generator.fsproj", "{158409AD-CB76-4ECB-AD20-2A17882A3ADE}" 7 | EndProject 8 | Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "test", "test\test.fsproj", "{572C78F9-B4DE-4B63-AED3-A540E897D672}" 9 | EndProject 10 | Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Microsoft.CodeAnalysis.ActivePatterns", "Microsoft.CodeAnalysis.ActivePatterns\Microsoft.CodeAnalysis.ActivePatterns.fsproj", "{64684914-875D-4B78-86DC-9B7451147138}" 11 | EndProject 12 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D1F9D173-D4A7-4225-A600-32FAB49DA04A}" 13 | ProjectSection(SolutionItems) = preProject 14 | .gitignore = .gitignore 15 | build-nupkg.bat = build-nupkg.bat 16 | build-nupkg.sh = build-nupkg.sh 17 | Directory.Build.props = Directory.Build.props 18 | .github\workflows\dotnet-core.yml = .github\workflows\dotnet-core.yml 19 | LICENSE = LICENSE 20 | nuget.config = nuget.config 21 | README.md = README.md 22 | EndProjectSection 23 | EndProject 24 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "csharp_standard_usage_sample", "csharp_standard_usage_sample\csharp_standard_usage_sample.csproj", "{DB46027E-CD1E-4B52-B1DE-4B85BE0C163D}" 25 | EndProject 26 | Global 27 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 28 | Debug|Any CPU = Debug|Any CPU 29 | Release|Any CPU = Release|Any CPU 30 | EndGlobalSection 31 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 32 | {158409AD-CB76-4ECB-AD20-2A17882A3ADE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {158409AD-CB76-4ECB-AD20-2A17882A3ADE}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {158409AD-CB76-4ECB-AD20-2A17882A3ADE}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {158409AD-CB76-4ECB-AD20-2A17882A3ADE}.Release|Any CPU.Build.0 = Release|Any CPU 36 | {572C78F9-B4DE-4B63-AED3-A540E897D672}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 37 | {572C78F9-B4DE-4B63-AED3-A540E897D672}.Debug|Any CPU.Build.0 = Debug|Any CPU 38 | {572C78F9-B4DE-4B63-AED3-A540E897D672}.Release|Any CPU.ActiveCfg = Release|Any CPU 39 | {572C78F9-B4DE-4B63-AED3-A540E897D672}.Release|Any CPU.Build.0 = Release|Any CPU 40 | {64684914-875D-4B78-86DC-9B7451147138}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 41 | {64684914-875D-4B78-86DC-9B7451147138}.Debug|Any CPU.Build.0 = Debug|Any CPU 42 | {64684914-875D-4B78-86DC-9B7451147138}.Release|Any CPU.ActiveCfg = Release|Any CPU 43 | {64684914-875D-4B78-86DC-9B7451147138}.Release|Any CPU.Build.0 = Release|Any CPU 44 | {DB46027E-CD1E-4B52-B1DE-4B85BE0C163D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 45 | {DB46027E-CD1E-4B52-B1DE-4B85BE0C163D}.Debug|Any CPU.Build.0 = Debug|Any CPU 46 | {DB46027E-CD1E-4B52-B1DE-4B85BE0C163D}.Release|Any CPU.ActiveCfg = Release|Any CPU 47 | {DB46027E-CD1E-4B52-B1DE-4B85BE0C163D}.Release|Any CPU.Build.0 = Release|Any CPU 48 | EndGlobalSection 49 | GlobalSection(SolutionProperties) = preSolution 50 | HideSolutionNode = FALSE 51 | EndGlobalSection 52 | GlobalSection(ExtensibilityGlobals) = postSolution 53 | SolutionGuid = {29D9D788-5BFA-4DB5-98B6-7D424C5C50AA} 54 | EndGlobalSection 55 | EndGlobal 56 | -------------------------------------------------------------------------------- /Microsoft.CodeAnalysis.ActivePatterns/ActivePatterns.fs: -------------------------------------------------------------------------------- 1 | // This is auto-generated source code by Microsoft.CodeAnalysis.ActivePatterns, DO NOT EDIT! 2 | 3 | namespace Microsoft.CodeAnalysis 4 | 5 | [] 6 | module ActivePatterns = 7 | 8 | let (|CommandLineAnalyzerReference|) (value:Microsoft.CodeAnalysis.CommandLineAnalyzerReference) = 9 | CommandLineAnalyzerReference (value.FilePath) 10 | 11 | let (|CommandLineReference|) (value:Microsoft.CodeAnalysis.CommandLineReference) = 12 | CommandLineReference (value.Reference) 13 | 14 | let (|CommandLineSourceFile|) (value:Microsoft.CodeAnalysis.CommandLineSourceFile) = 15 | CommandLineSourceFile (value.Path, value.IsInputRedirected, value.IsScript) 16 | 17 | let (|ImportedXmlNamespace|) (value:Microsoft.CodeAnalysis.ImportedXmlNamespace) = 18 | ImportedXmlNamespace (value.XmlNamespace) 19 | 20 | let (|PreprocessingSymbolInfo|) (value:Microsoft.CodeAnalysis.PreprocessingSymbolInfo) = 21 | PreprocessingSymbolInfo (value.IsDefined) 22 | 23 | let (|SubsystemVersion|) (value:Microsoft.CodeAnalysis.SubsystemVersion) = 24 | SubsystemVersion (value.Major, value.Minor, value.IsValid) 25 | 26 | let (|SymbolInfo|) (value:Microsoft.CodeAnalysis.SymbolInfo) = 27 | SymbolInfo (value.CandidateReason) 28 | 29 | let (|FileLinePositionSpan|) (value:Microsoft.CodeAnalysis.FileLinePositionSpan) = 30 | FileLinePositionSpan (value.Path, value.HasMappedPath, value.IsValid) 31 | 32 | let (|MetadataReferenceProperties|) (value:Microsoft.CodeAnalysis.MetadataReferenceProperties) = 33 | MetadataReferenceProperties (value.Kind, value.EmbedInteropTypes) 34 | 35 | let (|GeneratorSyntaxContext|) (value:Microsoft.CodeAnalysis.GeneratorSyntaxContext) = 36 | GeneratorSyntaxContext (value.Node) 37 | 38 | let (|GeneratorAttributeSyntaxContext|) (value:Microsoft.CodeAnalysis.GeneratorAttributeSyntaxContext) = 39 | GeneratorAttributeSyntaxContext (value.TargetNode) 40 | 41 | let (|GeneratedSourceResult|) (value:Microsoft.CodeAnalysis.GeneratedSourceResult) = 42 | GeneratedSourceResult (value.HintName) 43 | 44 | let (|SymbolDisplayPart|) (value:Microsoft.CodeAnalysis.SymbolDisplayPart) = 45 | SymbolDisplayPart (value.Kind) 46 | 47 | let (|NullabilityInfo|) (value:Microsoft.CodeAnalysis.NullabilityInfo) = 48 | NullabilityInfo (value.Annotation, value.FlowState) 49 | 50 | let (|TypedConstant|) (value:Microsoft.CodeAnalysis.TypedConstant) = 51 | TypedConstant (value.Kind, value.IsNull) 52 | 53 | let (|ChildSyntaxList|) (value:Microsoft.CodeAnalysis.ChildSyntaxList) = 54 | ChildSyntaxList (value.Count) 55 | 56 | let (|LineMapping|) (value:Microsoft.CodeAnalysis.LineMapping) = 57 | LineMapping (value.IsHidden) 58 | 59 | let (|SyntaxNodeOrToken|) (value:Microsoft.CodeAnalysis.SyntaxNodeOrToken) = 60 | SyntaxNodeOrToken (value.RawKind, value.Language, value.IsMissing, value.Parent, value.IsToken, value.IsNode, value.SpanStart, value.HasLeadingTrivia, value.HasTrailingTrivia, value.ContainsDiagnostics, value.ContainsDirectives, value.ContainsAnnotations) 61 | 62 | let (|SyntaxNodeOrTokenList|) (value:Microsoft.CodeAnalysis.SyntaxNodeOrTokenList) = 63 | SyntaxNodeOrTokenList (value.Count) 64 | 65 | let (|SyntaxToken|) (value:Microsoft.CodeAnalysis.SyntaxToken) = 66 | SyntaxToken (value.RawKind, value.Language, value.Parent, value.SpanStart, value.IsMissing, value.ValueText, value.Text, value.HasLeadingTrivia, value.HasTrailingTrivia, value.ContainsDiagnostics, value.ContainsDirectives, value.HasStructuredTrivia, value.ContainsAnnotations) 67 | 68 | let (|SyntaxTokenList|) (value:Microsoft.CodeAnalysis.SyntaxTokenList) = 69 | SyntaxTokenList (value.Count) 70 | 71 | let (|SyntaxTrivia|) (value:Microsoft.CodeAnalysis.SyntaxTrivia) = 72 | SyntaxTrivia (value.RawKind, value.Language, value.Token, value.SpanStart, value.ContainsDiagnostics, value.HasStructure, value.IsDirective) 73 | 74 | let (|SyntaxTriviaList|) (value:Microsoft.CodeAnalysis.SyntaxTriviaList) = 75 | SyntaxTriviaList (value.Count) 76 | 77 | let (|LinePosition|) (value:Microsoft.CodeAnalysis.Text.LinePosition) = 78 | LinePosition (value.Line, value.Character) 79 | 80 | let (|TextChange|) (value:Microsoft.CodeAnalysis.Text.TextChange) = 81 | TextChange (value.NewText) 82 | 83 | let (|TextChangeRange|) (value:Microsoft.CodeAnalysis.Text.TextChangeRange) = 84 | TextChangeRange (value.NewLength) 85 | 86 | let (|TextLine|) (value:Microsoft.CodeAnalysis.Text.TextLine) = 87 | TextLine (value.LineNumber, value.Start, value.End, value.EndIncludingLineBreak) 88 | 89 | let (|TextSpan|) (value:Microsoft.CodeAnalysis.Text.TextSpan) = 90 | TextSpan (value.Start, value.End, value.Length, value.IsEmpty) 91 | 92 | let (|SemanticModelAnalysisContext|) (value:Microsoft.CodeAnalysis.Diagnostics.SemanticModelAnalysisContext) = 93 | SemanticModelAnalysisContext (value.IsGeneratedCode) 94 | 95 | let (|SymbolAnalysisContext|) (value:Microsoft.CodeAnalysis.Diagnostics.SymbolAnalysisContext) = 96 | SymbolAnalysisContext (value.IsGeneratedCode) 97 | 98 | let (|CodeBlockAnalysisContext|) (value:Microsoft.CodeAnalysis.Diagnostics.CodeBlockAnalysisContext) = 99 | CodeBlockAnalysisContext (value.CodeBlock, value.IsGeneratedCode) 100 | 101 | let (|OperationBlockAnalysisContext|) (value:Microsoft.CodeAnalysis.Diagnostics.OperationBlockAnalysisContext) = 102 | OperationBlockAnalysisContext (value.IsGeneratedCode) 103 | 104 | let (|SyntaxTreeAnalysisContext|) (value:Microsoft.CodeAnalysis.Diagnostics.SyntaxTreeAnalysisContext) = 105 | SyntaxTreeAnalysisContext (value.IsGeneratedCode) 106 | 107 | let (|SyntaxNodeAnalysisContext|) (value:Microsoft.CodeAnalysis.Diagnostics.SyntaxNodeAnalysisContext) = 108 | SyntaxNodeAnalysisContext (value.Node, value.IsGeneratedCode) 109 | 110 | let (|OperationAnalysisContext|) (value:Microsoft.CodeAnalysis.Diagnostics.OperationAnalysisContext) = 111 | OperationAnalysisContext (value.IsGeneratedCode) 112 | 113 | let (|CommonConversion|) (value:Microsoft.CodeAnalysis.Operations.CommonConversion) = 114 | CommonConversion (value.Exists, value.IsIdentity, value.IsNullable, value.IsNumeric, value.IsReference, value.IsImplicit, value.IsUserDefined) 115 | 116 | let (|SemanticEdit|) (value:Microsoft.CodeAnalysis.Emit.SemanticEdit) = 117 | SemanticEdit (value.Kind, value.PreserveLocalVariables) 118 | 119 | -------------------------------------------------------------------------------- /Microsoft.CodeAnalysis.ActivePatterns/Additionals.fs: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Microsoft.CodeAnalysis.ActivePatterns - F# Active pattern matching library for Roslyn 4 | // Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | ///////////////////////////////////////////////////////////////////////////// 19 | 20 | namespace Microsoft.CodeAnalysis 21 | 22 | [] 23 | module Additionals = 24 | 25 | let (|Token|_|) (node:SyntaxToken) : string option = 26 | Some node.Text 27 | -------------------------------------------------------------------------------- /Microsoft.CodeAnalysis.ActivePatterns/AssemblyInfo.fs: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Microsoft.CodeAnalysis.ActivePatterns - F# Active pattern matching library for Roslyn 4 | // Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | ///////////////////////////////////////////////////////////////////////////// 19 | 20 | namespace global 21 | 22 | open System.Reflection 23 | open System.Runtime.InteropServices 24 | 25 | [] 26 | [] 27 | 28 | do() 29 | -------------------------------------------------------------------------------- /Microsoft.CodeAnalysis.ActivePatterns/Loose/Additionals.fs: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Microsoft.CodeAnalysis.ActivePatterns - F# Active pattern matching library for Roslyn 4 | // Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | ///////////////////////////////////////////////////////////////////////////// 19 | 20 | namespace Microsoft.CodeAnalysis.Loose 21 | 22 | open Microsoft.CodeAnalysis 23 | open Microsoft.CodeAnalysis.CSharp 24 | 25 | [] 26 | module Additionals = 27 | 28 | let (|Token|_|) (node:SyntaxToken) : string option = 29 | Some node.Text 30 | 31 | let (|Identifier|_|) node : string list option = 32 | let rec matcher (node:SyntaxNode) = 33 | match node with 34 | | IdentifierName(Token(text)) -> 35 | Some [ text ] 36 | | QualifiedName(left, _, right) -> 37 | matcher left |> Option.bind(fun left -> matcher right |> Option.bind(fun right -> Some (List.append left right))) 38 | | _ -> 39 | None 40 | matcher node 41 | -------------------------------------------------------------------------------- /Microsoft.CodeAnalysis.ActivePatterns/Microsoft.CodeAnalysis.ActivePatterns.fsproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net461;net48;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net7.0 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Microsoft.CodeAnalysis.ActivePatterns/Strict/CSharpActivePatterns.fs: -------------------------------------------------------------------------------- 1 | // This is auto-generated source code by Microsoft.CodeAnalysis.ActivePatterns, DO NOT EDIT! 2 | 3 | namespace Microsoft.CodeAnalysis.CSharp.Strict 4 | 5 | [] 6 | module ActivePatterns = 7 | 8 | let (|AliasQualifiedName|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 9 | match node with 10 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.AliasQualifiedNameSyntax as node -> 11 | Some (node.Alias, node.ColonColonToken, node.Name) 12 | | _ -> None 13 | 14 | let (|AnonymousMethodExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 15 | match node with 16 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.AnonymousMethodExpressionSyntax as node -> 17 | Some (node.AsyncKeyword, node.DelegateKeyword, node.ParameterList, node.Block, node.ExpressionBody) 18 | | _ -> None 19 | 20 | let (|Argument|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 21 | match node with 22 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ArgumentSyntax as node -> 23 | Some (node.RefOrOutKeyword, node.NameColon, node.RefKindKeyword, node.Expression) 24 | | _ -> None 25 | 26 | let (|ArrayRankSpecifier|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 27 | match node with 28 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ArrayRankSpecifierSyntax as node -> 29 | Some (node.Rank, node.OpenBracketToken, node.CloseBracketToken) 30 | | _ -> None 31 | 32 | let (|Attribute|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 33 | match node with 34 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.AttributeSyntax as node -> 35 | Some (node.Name, node.ArgumentList) 36 | | _ -> None 37 | 38 | let (|AttributeTargetSpecifier|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 39 | match node with 40 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.AttributeTargetSpecifierSyntax as node -> 41 | Some (node.Identifier, node.ColonToken) 42 | | _ -> None 43 | 44 | let (|Block|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 45 | match node with 46 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax as node -> 47 | Some (node.AttributeLists |> Seq.toList, node.OpenBraceToken, node.Statements |> Seq.toList, node.CloseBraceToken) 48 | | _ -> None 49 | 50 | let (|BreakStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 51 | match node with 52 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.BreakStatementSyntax as node -> 53 | Some (node.AttributeLists |> Seq.toList, node.BreakKeyword, node.SemicolonToken) 54 | | _ -> None 55 | 56 | let (|CheckedStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 57 | match node with 58 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.CheckedStatementSyntax as node -> 59 | Some (node.AttributeLists |> Seq.toList, node.Keyword, node.Block) 60 | | _ -> None 61 | 62 | let (|ClassOrStructConstraint|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 63 | match node with 64 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ClassOrStructConstraintSyntax as node -> 65 | Some (node.ClassOrStructKeyword, node.QuestionToken) 66 | | _ -> None 67 | 68 | let (|CompilationUnit|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 69 | match node with 70 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.CompilationUnitSyntax as node -> 71 | Some (node.Externs |> Seq.toList, node.Usings |> Seq.toList, node.AttributeLists |> Seq.toList, node.Members |> Seq.toList, node.EndOfFileToken) 72 | | _ -> None 73 | 74 | let (|ConstructorDeclaration|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 75 | match node with 76 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ConstructorDeclarationSyntax as node -> 77 | Some (node.AttributeLists |> Seq.toList, node.Identifier, node.ParameterList, node.Initializer, node.Body, node.ExpressionBody, node.SemicolonToken) 78 | | _ -> None 79 | 80 | let (|ContinueStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 81 | match node with 82 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ContinueStatementSyntax as node -> 83 | Some (node.AttributeLists |> Seq.toList, node.ContinueKeyword, node.SemicolonToken) 84 | | _ -> None 85 | 86 | let (|ConversionOperatorDeclaration|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 87 | match node with 88 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ConversionOperatorDeclarationSyntax as node -> 89 | Some (node.AttributeLists |> Seq.toList, node.ImplicitOrExplicitKeyword, node.ExplicitInterfaceSpecifier, node.OperatorKeyword, node.CheckedKeyword, node.Type, node.ParameterList, node.Body, node.ExpressionBody, node.SemicolonToken) 90 | | _ -> None 91 | 92 | let (|ConversionOperatorMemberCref|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 93 | match node with 94 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ConversionOperatorMemberCrefSyntax as node -> 95 | Some (node.ImplicitOrExplicitKeyword, node.OperatorKeyword, node.CheckedKeyword, node.Type, node.Parameters) 96 | | _ -> None 97 | 98 | let (|CrefParameter|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 99 | match node with 100 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax as node -> 101 | Some (node.RefOrOutKeyword, node.RefKindKeyword, node.Type) 102 | | _ -> None 103 | 104 | let (|LocalDeclarationStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 105 | match node with 106 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.LocalDeclarationStatementSyntax as node -> 107 | Some (node.IsConst, node.AttributeLists |> Seq.toList, node.AwaitKeyword, node.UsingKeyword, node.Declaration, node.SemicolonToken) 108 | | _ -> None 109 | 110 | let (|DelegateDeclaration|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 111 | match node with 112 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.DelegateDeclarationSyntax as node -> 113 | Some (node.Arity, node.AttributeLists |> Seq.toList, node.DelegateKeyword, node.ReturnType, node.Identifier, node.TypeParameterList, node.ParameterList, node.ConstraintClauses |> Seq.toList, node.SemicolonToken) 114 | | _ -> None 115 | 116 | let (|DestructorDeclaration|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 117 | match node with 118 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.DestructorDeclarationSyntax as node -> 119 | Some (node.AttributeLists |> Seq.toList, node.TildeToken, node.Identifier, node.ParameterList, node.Body, node.ExpressionBody, node.SemicolonToken) 120 | | _ -> None 121 | 122 | let (|DoStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 123 | match node with 124 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.DoStatementSyntax as node -> 125 | Some (node.AttributeLists |> Seq.toList, node.DoKeyword, node.Statement, node.WhileKeyword, node.OpenParenToken, node.Condition, node.CloseParenToken, node.SemicolonToken) 126 | | _ -> None 127 | 128 | let (|EmptyStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 129 | match node with 130 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.EmptyStatementSyntax as node -> 131 | Some (node.AttributeLists |> Seq.toList, node.SemicolonToken) 132 | | _ -> None 133 | 134 | let (|EnumMemberDeclaration|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 135 | match node with 136 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.EnumMemberDeclarationSyntax as node -> 137 | Some (node.AttributeLists |> Seq.toList, node.Identifier, node.EqualsValue) 138 | | _ -> None 139 | 140 | let (|EventDeclaration|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 141 | match node with 142 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.EventDeclarationSyntax as node -> 143 | Some (node.AttributeLists |> Seq.toList, node.EventKeyword, node.Type, node.ExplicitInterfaceSpecifier, node.Identifier, node.AccessorList, node.SemicolonToken) 144 | | _ -> None 145 | 146 | let (|ExpressionStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 147 | match node with 148 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionStatementSyntax as node -> 149 | Some (node.AllowsAnyExpression, node.AttributeLists |> Seq.toList, node.Expression, node.SemicolonToken) 150 | | _ -> None 151 | 152 | let (|FixedStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 153 | match node with 154 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.FixedStatementSyntax as node -> 155 | Some (node.AttributeLists |> Seq.toList, node.FixedKeyword, node.OpenParenToken, node.Declaration, node.CloseParenToken, node.Statement) 156 | | _ -> None 157 | 158 | let (|ForEachStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 159 | match node with 160 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ForEachStatementSyntax as node -> 161 | Some (node.AttributeLists |> Seq.toList, node.AwaitKeyword, node.ForEachKeyword, node.OpenParenToken, node.Type, node.Identifier, node.InKeyword, node.Expression, node.CloseParenToken, node.Statement) 162 | | _ -> None 163 | 164 | let (|ForEachVariableStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 165 | match node with 166 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ForEachVariableStatementSyntax as node -> 167 | Some (node.AttributeLists |> Seq.toList, node.AwaitKeyword, node.ForEachKeyword, node.OpenParenToken, node.Variable, node.InKeyword, node.Expression, node.CloseParenToken, node.Statement) 168 | | _ -> None 169 | 170 | let (|ForStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 171 | match node with 172 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ForStatementSyntax as node -> 173 | Some (node.AttributeLists |> Seq.toList, node.ForKeyword, node.OpenParenToken, node.Declaration, node.FirstSemicolonToken, node.Condition, node.SecondSemicolonToken, node.CloseParenToken, node.Statement) 174 | | _ -> None 175 | 176 | let (|GenericName|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 177 | match node with 178 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.GenericNameSyntax as node -> 179 | Some (node.IsUnboundGenericName, node.Identifier, node.TypeArgumentList) 180 | | _ -> None 181 | 182 | let (|GlobalStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 183 | match node with 184 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.GlobalStatementSyntax as node -> 185 | Some (node.AttributeLists |> Seq.toList, node.Statement) 186 | | _ -> None 187 | 188 | let (|GotoStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 189 | match node with 190 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.GotoStatementSyntax as node -> 191 | Some (node.AttributeLists |> Seq.toList, node.GotoKeyword, node.CaseOrDefaultKeyword, node.Expression, node.SemicolonToken) 192 | | _ -> None 193 | 194 | let (|IdentifierName|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 195 | match node with 196 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.IdentifierNameSyntax as node -> 197 | Some (node.Identifier) 198 | | _ -> None 199 | 200 | let (|IfStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 201 | match node with 202 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.IfStatementSyntax as node -> 203 | Some (node.AttributeLists |> Seq.toList, node.IfKeyword, node.OpenParenToken, node.Condition, node.CloseParenToken, node.Statement, node.Else) 204 | | _ -> None 205 | 206 | let (|IndexerDeclaration|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 207 | match node with 208 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.IndexerDeclarationSyntax as node -> 209 | Some (node.AttributeLists |> Seq.toList, node.Type, node.ExplicitInterfaceSpecifier, node.ThisKeyword, node.ParameterList, node.AccessorList, node.ExpressionBody, node.SemicolonToken) 210 | | _ -> None 211 | 212 | let (|LabeledStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 213 | match node with 214 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.LabeledStatementSyntax as node -> 215 | Some (node.AttributeLists |> Seq.toList, node.Identifier, node.ColonToken, node.Statement) 216 | | _ -> None 217 | 218 | let (|LocalFunctionStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 219 | match node with 220 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax as node -> 221 | Some (node.AttributeLists |> Seq.toList, node.ReturnType, node.Identifier, node.TypeParameterList, node.ParameterList, node.ConstraintClauses |> Seq.toList, node.Body, node.ExpressionBody, node.SemicolonToken) 222 | | _ -> None 223 | 224 | let (|LockStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 225 | match node with 226 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.LockStatementSyntax as node -> 227 | Some (node.AttributeLists |> Seq.toList, node.LockKeyword, node.OpenParenToken, node.Expression, node.CloseParenToken, node.Statement) 228 | | _ -> None 229 | 230 | let (|MethodDeclaration|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 231 | match node with 232 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.MethodDeclarationSyntax as node -> 233 | Some (node.Arity, node.AttributeLists |> Seq.toList, node.ReturnType, node.ExplicitInterfaceSpecifier, node.Identifier, node.TypeParameterList, node.ParameterList, node.ConstraintClauses |> Seq.toList, node.Body, node.ExpressionBody, node.SemicolonToken) 234 | | _ -> None 235 | 236 | let (|NameColon|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 237 | match node with 238 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.NameColonSyntax as node -> 239 | Some (node.Expression, node.Name, node.ColonToken) 240 | | _ -> None 241 | 242 | let (|NamespaceDeclaration|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 243 | match node with 244 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.NamespaceDeclarationSyntax as node -> 245 | Some (node.AttributeLists |> Seq.toList, node.NamespaceKeyword, node.Name, node.OpenBraceToken, node.Externs |> Seq.toList, node.Usings |> Seq.toList, node.Members |> Seq.toList, node.CloseBraceToken, node.SemicolonToken) 246 | | _ -> None 247 | 248 | let (|OperatorDeclaration|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 249 | match node with 250 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.OperatorDeclarationSyntax as node -> 251 | Some (node.AttributeLists |> Seq.toList, node.ReturnType, node.ExplicitInterfaceSpecifier, node.OperatorKeyword, node.CheckedKeyword, node.OperatorToken, node.ParameterList, node.Body, node.ExpressionBody, node.SemicolonToken) 252 | | _ -> None 253 | 254 | let (|OperatorMemberCref|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 255 | match node with 256 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.OperatorMemberCrefSyntax as node -> 257 | Some (node.OperatorKeyword, node.CheckedKeyword, node.OperatorToken, node.Parameters) 258 | | _ -> None 259 | 260 | let (|ParameterList|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 261 | match node with 262 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax as node -> 263 | Some (node.OpenParenToken, node.CloseParenToken) 264 | | _ -> None 265 | 266 | let (|Parameter|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 267 | match node with 268 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ParameterSyntax as node -> 269 | Some (node.AttributeLists |> Seq.toList, node.Type, node.Identifier, node.Default) 270 | | _ -> None 271 | 272 | let (|ParenthesizedLambdaExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 273 | match node with 274 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ParenthesizedLambdaExpressionSyntax as node -> 275 | Some (node.AsyncKeyword, node.AttributeLists |> Seq.toList, node.ReturnType, node.ParameterList, node.ArrowToken, node.Block, node.ExpressionBody) 276 | | _ -> None 277 | 278 | let (|PropertyDeclaration|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 279 | match node with 280 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax as node -> 281 | Some (node.AttributeLists |> Seq.toList, node.Type, node.ExplicitInterfaceSpecifier, node.Identifier, node.AccessorList, node.ExpressionBody, node.Initializer, node.SemicolonToken) 282 | | _ -> None 283 | 284 | let (|AccessorDeclaration|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 285 | match node with 286 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.AccessorDeclarationSyntax as node -> 287 | Some (node.AttributeLists |> Seq.toList, node.Keyword, node.Body, node.ExpressionBody, node.SemicolonToken) 288 | | _ -> None 289 | 290 | let (|QualifiedName|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 291 | match node with 292 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.QualifiedNameSyntax as node -> 293 | Some (node.Left, node.DotToken, node.Right) 294 | | _ -> None 295 | 296 | let (|RecordDeclaration|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 297 | match node with 298 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.RecordDeclarationSyntax as node -> 299 | Some (node.AttributeLists |> Seq.toList, node.Keyword, node.ClassOrStructKeyword, node.Identifier, node.TypeParameterList, node.ParameterList, node.BaseList, node.ConstraintClauses |> Seq.toList, node.OpenBraceToken, node.Members |> Seq.toList, node.CloseBraceToken, node.SemicolonToken) 300 | | _ -> None 301 | 302 | let (|RefType|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 303 | match node with 304 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.RefTypeSyntax as node -> 305 | Some (node.RefKeyword, node.ReadOnlyKeyword, node.Type) 306 | | _ -> None 307 | 308 | let (|ReturnStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 309 | match node with 310 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ReturnStatementSyntax as node -> 311 | Some (node.AttributeLists |> Seq.toList, node.ReturnKeyword, node.Expression, node.SemicolonToken) 312 | | _ -> None 313 | 314 | let (|SimpleLambdaExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 315 | match node with 316 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.SimpleLambdaExpressionSyntax as node -> 317 | Some (node.AsyncKeyword, node.AttributeLists |> Seq.toList, node.Parameter, node.ArrowToken, node.Block, node.ExpressionBody) 318 | | _ -> None 319 | 320 | let (|StackAllocArrayCreationExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 321 | match node with 322 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.StackAllocArrayCreationExpressionSyntax as node -> 323 | Some (node.StackAllocKeyword, node.Type, node.Initializer) 324 | | _ -> None 325 | 326 | let (|Subpattern|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 327 | match node with 328 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.SubpatternSyntax as node -> 329 | Some (node.NameColon, node.ExpressionColon, node.Pattern) 330 | | _ -> None 331 | 332 | let (|SwitchStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 333 | match node with 334 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.SwitchStatementSyntax as node -> 335 | Some (node.AttributeLists |> Seq.toList, node.SwitchKeyword, node.OpenParenToken, node.Expression, node.CloseParenToken, node.OpenBraceToken, node.Sections |> Seq.toList, node.CloseBraceToken) 336 | | _ -> None 337 | 338 | let (|ThrowStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 339 | match node with 340 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ThrowStatementSyntax as node -> 341 | Some (node.AttributeLists |> Seq.toList, node.ThrowKeyword, node.Expression, node.SemicolonToken) 342 | | _ -> None 343 | 344 | let (|TryStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 345 | match node with 346 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.TryStatementSyntax as node -> 347 | Some (node.AttributeLists |> Seq.toList, node.TryKeyword, node.Block, node.Catches |> Seq.toList, node.Finally) 348 | | _ -> None 349 | 350 | let (|UnsafeStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 351 | match node with 352 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.UnsafeStatementSyntax as node -> 353 | Some (node.AttributeLists |> Seq.toList, node.UnsafeKeyword, node.Block) 354 | | _ -> None 355 | 356 | let (|UsingDirective|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 357 | match node with 358 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.UsingDirectiveSyntax as node -> 359 | Some (node.GlobalKeyword, node.UsingKeyword, node.StaticKeyword, node.Alias, node.Name, node.SemicolonToken) 360 | | _ -> None 361 | 362 | let (|UsingStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 363 | match node with 364 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.UsingStatementSyntax as node -> 365 | Some (node.AttributeLists |> Seq.toList, node.AwaitKeyword, node.UsingKeyword, node.OpenParenToken, node.Declaration, node.Expression, node.CloseParenToken, node.Statement) 366 | | _ -> None 367 | 368 | let (|WhileStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 369 | match node with 370 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.WhileStatementSyntax as node -> 371 | Some (node.AttributeLists |> Seq.toList, node.WhileKeyword, node.OpenParenToken, node.Condition, node.CloseParenToken, node.Statement) 372 | | _ -> None 373 | 374 | let (|YieldStatement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 375 | match node with 376 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.YieldStatementSyntax as node -> 377 | Some (node.AttributeLists |> Seq.toList, node.YieldKeyword, node.ReturnOrBreakKeyword, node.Expression, node.SemicolonToken) 378 | | _ -> None 379 | 380 | let (|TypeArgumentList|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 381 | match node with 382 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.TypeArgumentListSyntax as node -> 383 | Some (node.LessThanToken, node.GreaterThanToken) 384 | | _ -> None 385 | 386 | let (|PredefinedType|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 387 | match node with 388 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.PredefinedTypeSyntax as node -> 389 | Some (node.Keyword) 390 | | _ -> None 391 | 392 | let (|ArrayType|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 393 | match node with 394 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ArrayTypeSyntax as node -> 395 | Some (node.ElementType, node.RankSpecifiers |> Seq.toList) 396 | | _ -> None 397 | 398 | let (|PointerType|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 399 | match node with 400 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.PointerTypeSyntax as node -> 401 | Some (node.ElementType, node.AsteriskToken) 402 | | _ -> None 403 | 404 | let (|FunctionPointerType|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 405 | match node with 406 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.FunctionPointerTypeSyntax as node -> 407 | Some (node.DelegateKeyword, node.AsteriskToken, node.CallingConvention, node.ParameterList) 408 | | _ -> None 409 | 410 | let (|FunctionPointerParameterList|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 411 | match node with 412 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.FunctionPointerParameterListSyntax as node -> 413 | Some (node.LessThanToken, node.GreaterThanToken) 414 | | _ -> None 415 | 416 | let (|FunctionPointerCallingConvention|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 417 | match node with 418 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.FunctionPointerCallingConventionSyntax as node -> 419 | Some (node.ManagedOrUnmanagedKeyword, node.UnmanagedCallingConventionList) 420 | | _ -> None 421 | 422 | let (|FunctionPointerUnmanagedCallingConventionList|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 423 | match node with 424 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.FunctionPointerUnmanagedCallingConventionListSyntax as node -> 425 | Some (node.OpenBracketToken, node.CloseBracketToken) 426 | | _ -> None 427 | 428 | let (|FunctionPointerUnmanagedCallingConvention|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 429 | match node with 430 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.FunctionPointerUnmanagedCallingConventionSyntax as node -> 431 | Some (node.Name) 432 | | _ -> None 433 | 434 | let (|NullableType|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 435 | match node with 436 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.NullableTypeSyntax as node -> 437 | Some (node.ElementType, node.QuestionToken) 438 | | _ -> None 439 | 440 | let (|TupleType|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 441 | match node with 442 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.TupleTypeSyntax as node -> 443 | Some (node.OpenParenToken, node.CloseParenToken) 444 | | _ -> None 445 | 446 | let (|TupleElement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 447 | match node with 448 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.TupleElementSyntax as node -> 449 | Some (node.Type, node.Identifier) 450 | | _ -> None 451 | 452 | let (|OmittedTypeArgument|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 453 | match node with 454 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.OmittedTypeArgumentSyntax as node -> 455 | Some (node.OmittedTypeArgumentToken) 456 | | _ -> None 457 | 458 | let (|ScopedType|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 459 | match node with 460 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ScopedTypeSyntax as node -> 461 | Some (node.ScopedKeyword, node.Type) 462 | | _ -> None 463 | 464 | let (|ParenthesizedExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 465 | match node with 466 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ParenthesizedExpressionSyntax as node -> 467 | Some (node.OpenParenToken, node.Expression, node.CloseParenToken) 468 | | _ -> None 469 | 470 | let (|TupleExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 471 | match node with 472 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.TupleExpressionSyntax as node -> 473 | Some (node.OpenParenToken, node.CloseParenToken) 474 | | _ -> None 475 | 476 | let (|PrefixUnaryExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 477 | match node with 478 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.PrefixUnaryExpressionSyntax as node -> 479 | Some (node.OperatorToken, node.Operand) 480 | | _ -> None 481 | 482 | let (|AwaitExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 483 | match node with 484 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.AwaitExpressionSyntax as node -> 485 | Some (node.AwaitKeyword, node.Expression) 486 | | _ -> None 487 | 488 | let (|PostfixUnaryExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 489 | match node with 490 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.PostfixUnaryExpressionSyntax as node -> 491 | Some (node.Operand, node.OperatorToken) 492 | | _ -> None 493 | 494 | let (|MemberAccessExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 495 | match node with 496 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.MemberAccessExpressionSyntax as node -> 497 | Some (node.Expression, node.OperatorToken, node.Name) 498 | | _ -> None 499 | 500 | let (|ConditionalAccessExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 501 | match node with 502 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ConditionalAccessExpressionSyntax as node -> 503 | Some (node.Expression, node.OperatorToken, node.WhenNotNull) 504 | | _ -> None 505 | 506 | let (|MemberBindingExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 507 | match node with 508 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.MemberBindingExpressionSyntax as node -> 509 | Some (node.OperatorToken, node.Name) 510 | | _ -> None 511 | 512 | let (|ElementBindingExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 513 | match node with 514 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ElementBindingExpressionSyntax as node -> 515 | Some (node.ArgumentList) 516 | | _ -> None 517 | 518 | let (|RangeExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 519 | match node with 520 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.RangeExpressionSyntax as node -> 521 | Some (node.LeftOperand, node.OperatorToken, node.RightOperand) 522 | | _ -> None 523 | 524 | let (|ImplicitElementAccess|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 525 | match node with 526 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ImplicitElementAccessSyntax as node -> 527 | Some (node.ArgumentList) 528 | | _ -> None 529 | 530 | let (|BinaryExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 531 | match node with 532 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.BinaryExpressionSyntax as node -> 533 | Some (node.Left, node.OperatorToken, node.Right) 534 | | _ -> None 535 | 536 | let (|AssignmentExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 537 | match node with 538 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.AssignmentExpressionSyntax as node -> 539 | Some (node.Left, node.OperatorToken, node.Right) 540 | | _ -> None 541 | 542 | let (|ConditionalExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 543 | match node with 544 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ConditionalExpressionSyntax as node -> 545 | Some (node.Condition, node.QuestionToken, node.WhenTrue, node.ColonToken, node.WhenFalse) 546 | | _ -> None 547 | 548 | let (|ThisExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 549 | match node with 550 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ThisExpressionSyntax as node -> 551 | Some (node.Token) 552 | | _ -> None 553 | 554 | let (|BaseExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 555 | match node with 556 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.BaseExpressionSyntax as node -> 557 | Some (node.Token) 558 | | _ -> None 559 | 560 | let (|LiteralExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 561 | match node with 562 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.LiteralExpressionSyntax as node -> 563 | Some (node.Token) 564 | | _ -> None 565 | 566 | let (|MakeRefExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 567 | match node with 568 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.MakeRefExpressionSyntax as node -> 569 | Some (node.Keyword, node.OpenParenToken, node.Expression, node.CloseParenToken) 570 | | _ -> None 571 | 572 | let (|RefTypeExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 573 | match node with 574 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.RefTypeExpressionSyntax as node -> 575 | Some (node.Keyword, node.OpenParenToken, node.Expression, node.CloseParenToken) 576 | | _ -> None 577 | 578 | let (|RefValueExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 579 | match node with 580 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.RefValueExpressionSyntax as node -> 581 | Some (node.Keyword, node.OpenParenToken, node.Expression, node.Comma, node.Type, node.CloseParenToken) 582 | | _ -> None 583 | 584 | let (|CheckedExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 585 | match node with 586 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.CheckedExpressionSyntax as node -> 587 | Some (node.Keyword, node.OpenParenToken, node.Expression, node.CloseParenToken) 588 | | _ -> None 589 | 590 | let (|DefaultExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 591 | match node with 592 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.DefaultExpressionSyntax as node -> 593 | Some (node.Keyword, node.OpenParenToken, node.Type, node.CloseParenToken) 594 | | _ -> None 595 | 596 | let (|TypeOfExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 597 | match node with 598 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.TypeOfExpressionSyntax as node -> 599 | Some (node.Keyword, node.OpenParenToken, node.Type, node.CloseParenToken) 600 | | _ -> None 601 | 602 | let (|SizeOfExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 603 | match node with 604 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.SizeOfExpressionSyntax as node -> 605 | Some (node.Keyword, node.OpenParenToken, node.Type, node.CloseParenToken) 606 | | _ -> None 607 | 608 | let (|InvocationExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 609 | match node with 610 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.InvocationExpressionSyntax as node -> 611 | Some (node.Expression, node.ArgumentList) 612 | | _ -> None 613 | 614 | let (|ElementAccessExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 615 | match node with 616 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ElementAccessExpressionSyntax as node -> 617 | Some (node.Expression, node.ArgumentList) 618 | | _ -> None 619 | 620 | let (|ArgumentList|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 621 | match node with 622 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ArgumentListSyntax as node -> 623 | Some (node.OpenParenToken, node.CloseParenToken) 624 | | _ -> None 625 | 626 | let (|BracketedArgumentList|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 627 | match node with 628 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.BracketedArgumentListSyntax as node -> 629 | Some (node.OpenBracketToken, node.CloseBracketToken) 630 | | _ -> None 631 | 632 | let (|ExpressionColon|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 633 | match node with 634 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionColonSyntax as node -> 635 | Some (node.Expression, node.ColonToken) 636 | | _ -> None 637 | 638 | let (|DeclarationExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 639 | match node with 640 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.DeclarationExpressionSyntax as node -> 641 | Some (node.Type, node.Designation) 642 | | _ -> None 643 | 644 | let (|CastExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 645 | match node with 646 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.CastExpressionSyntax as node -> 647 | Some (node.OpenParenToken, node.Type, node.CloseParenToken, node.Expression) 648 | | _ -> None 649 | 650 | let (|RefExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 651 | match node with 652 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.RefExpressionSyntax as node -> 653 | Some (node.RefKeyword, node.Expression) 654 | | _ -> None 655 | 656 | let (|InitializerExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 657 | match node with 658 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.InitializerExpressionSyntax as node -> 659 | Some (node.OpenBraceToken, node.CloseBraceToken) 660 | | _ -> None 661 | 662 | let (|ImplicitObjectCreationExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 663 | match node with 664 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ImplicitObjectCreationExpressionSyntax as node -> 665 | Some (node.NewKeyword, node.ArgumentList, node.Initializer) 666 | | _ -> None 667 | 668 | let (|ObjectCreationExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 669 | match node with 670 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ObjectCreationExpressionSyntax as node -> 671 | Some (node.NewKeyword, node.Type, node.ArgumentList, node.Initializer) 672 | | _ -> None 673 | 674 | let (|WithExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 675 | match node with 676 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.WithExpressionSyntax as node -> 677 | Some (node.Expression, node.WithKeyword, node.Initializer) 678 | | _ -> None 679 | 680 | let (|AnonymousObjectMemberDeclarator|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 681 | match node with 682 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.AnonymousObjectMemberDeclaratorSyntax as node -> 683 | Some (node.NameEquals, node.Expression) 684 | | _ -> None 685 | 686 | let (|AnonymousObjectCreationExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 687 | match node with 688 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.AnonymousObjectCreationExpressionSyntax as node -> 689 | Some (node.NewKeyword, node.OpenBraceToken, node.CloseBraceToken) 690 | | _ -> None 691 | 692 | let (|ArrayCreationExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 693 | match node with 694 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ArrayCreationExpressionSyntax as node -> 695 | Some (node.NewKeyword, node.Type, node.Initializer) 696 | | _ -> None 697 | 698 | let (|ImplicitArrayCreationExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 699 | match node with 700 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ImplicitArrayCreationExpressionSyntax as node -> 701 | Some (node.NewKeyword, node.OpenBracketToken, node.CloseBracketToken, node.Initializer) 702 | | _ -> None 703 | 704 | let (|ImplicitStackAllocArrayCreationExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 705 | match node with 706 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ImplicitStackAllocArrayCreationExpressionSyntax as node -> 707 | Some (node.StackAllocKeyword, node.OpenBracketToken, node.CloseBracketToken, node.Initializer) 708 | | _ -> None 709 | 710 | let (|QueryExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 711 | match node with 712 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.QueryExpressionSyntax as node -> 713 | Some (node.FromClause, node.Body) 714 | | _ -> None 715 | 716 | let (|QueryBody|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 717 | match node with 718 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.QueryBodySyntax as node -> 719 | Some (node.Clauses |> Seq.toList, node.SelectOrGroup, node.Continuation) 720 | | _ -> None 721 | 722 | let (|FromClause|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 723 | match node with 724 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.FromClauseSyntax as node -> 725 | Some (node.FromKeyword, node.Type, node.Identifier, node.InKeyword, node.Expression) 726 | | _ -> None 727 | 728 | let (|LetClause|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 729 | match node with 730 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.LetClauseSyntax as node -> 731 | Some (node.LetKeyword, node.Identifier, node.EqualsToken, node.Expression) 732 | | _ -> None 733 | 734 | let (|JoinClause|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 735 | match node with 736 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.JoinClauseSyntax as node -> 737 | Some (node.JoinKeyword, node.Type, node.Identifier, node.InKeyword, node.InExpression, node.OnKeyword, node.LeftExpression, node.EqualsKeyword, node.RightExpression, node.Into) 738 | | _ -> None 739 | 740 | let (|JoinIntoClause|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 741 | match node with 742 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.JoinIntoClauseSyntax as node -> 743 | Some (node.IntoKeyword, node.Identifier) 744 | | _ -> None 745 | 746 | let (|WhereClause|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 747 | match node with 748 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.WhereClauseSyntax as node -> 749 | Some (node.WhereKeyword, node.Condition) 750 | | _ -> None 751 | 752 | let (|OrderByClause|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 753 | match node with 754 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.OrderByClauseSyntax as node -> 755 | Some (node.OrderByKeyword) 756 | | _ -> None 757 | 758 | let (|Ordering|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 759 | match node with 760 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.OrderingSyntax as node -> 761 | Some (node.Expression, node.AscendingOrDescendingKeyword) 762 | | _ -> None 763 | 764 | let (|SelectClause|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 765 | match node with 766 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.SelectClauseSyntax as node -> 767 | Some (node.SelectKeyword, node.Expression) 768 | | _ -> None 769 | 770 | let (|GroupClause|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 771 | match node with 772 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.GroupClauseSyntax as node -> 773 | Some (node.GroupKeyword, node.GroupExpression, node.ByKeyword, node.ByExpression) 774 | | _ -> None 775 | 776 | let (|QueryContinuation|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 777 | match node with 778 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.QueryContinuationSyntax as node -> 779 | Some (node.IntoKeyword, node.Identifier, node.Body) 780 | | _ -> None 781 | 782 | let (|OmittedArraySizeExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 783 | match node with 784 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.OmittedArraySizeExpressionSyntax as node -> 785 | Some (node.OmittedArraySizeExpressionToken) 786 | | _ -> None 787 | 788 | let (|InterpolatedStringExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 789 | match node with 790 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.InterpolatedStringExpressionSyntax as node -> 791 | Some (node.StringStartToken, node.Contents |> Seq.toList, node.StringEndToken) 792 | | _ -> None 793 | 794 | let (|IsPatternExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 795 | match node with 796 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.IsPatternExpressionSyntax as node -> 797 | Some (node.Expression, node.IsKeyword, node.Pattern) 798 | | _ -> None 799 | 800 | let (|ThrowExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 801 | match node with 802 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ThrowExpressionSyntax as node -> 803 | Some (node.ThrowKeyword, node.Expression) 804 | | _ -> None 805 | 806 | let (|WhenClause|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 807 | match node with 808 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.WhenClauseSyntax as node -> 809 | Some (node.WhenKeyword, node.Condition) 810 | | _ -> None 811 | 812 | let (|DiscardPattern|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 813 | match node with 814 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.DiscardPatternSyntax as node -> 815 | Some (node.UnderscoreToken) 816 | | _ -> None 817 | 818 | let (|DeclarationPattern|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 819 | match node with 820 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.DeclarationPatternSyntax as node -> 821 | Some (node.Type, node.Designation) 822 | | _ -> None 823 | 824 | let (|VarPattern|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 825 | match node with 826 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.VarPatternSyntax as node -> 827 | Some (node.VarKeyword, node.Designation) 828 | | _ -> None 829 | 830 | let (|RecursivePattern|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 831 | match node with 832 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.RecursivePatternSyntax as node -> 833 | Some (node.Type, node.PositionalPatternClause, node.PropertyPatternClause, node.Designation) 834 | | _ -> None 835 | 836 | let (|PositionalPatternClause|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 837 | match node with 838 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.PositionalPatternClauseSyntax as node -> 839 | Some (node.OpenParenToken, node.CloseParenToken) 840 | | _ -> None 841 | 842 | let (|PropertyPatternClause|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 843 | match node with 844 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.PropertyPatternClauseSyntax as node -> 845 | Some (node.OpenBraceToken, node.CloseBraceToken) 846 | | _ -> None 847 | 848 | let (|ConstantPattern|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 849 | match node with 850 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ConstantPatternSyntax as node -> 851 | Some (node.Expression) 852 | | _ -> None 853 | 854 | let (|ParenthesizedPattern|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 855 | match node with 856 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ParenthesizedPatternSyntax as node -> 857 | Some (node.OpenParenToken, node.Pattern, node.CloseParenToken) 858 | | _ -> None 859 | 860 | let (|RelationalPattern|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 861 | match node with 862 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.RelationalPatternSyntax as node -> 863 | Some (node.OperatorToken, node.Expression) 864 | | _ -> None 865 | 866 | let (|TypePattern|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 867 | match node with 868 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.TypePatternSyntax as node -> 869 | Some (node.Type) 870 | | _ -> None 871 | 872 | let (|BinaryPattern|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 873 | match node with 874 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.BinaryPatternSyntax as node -> 875 | Some (node.Left, node.OperatorToken, node.Right) 876 | | _ -> None 877 | 878 | let (|UnaryPattern|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 879 | match node with 880 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.UnaryPatternSyntax as node -> 881 | Some (node.OperatorToken, node.Pattern) 882 | | _ -> None 883 | 884 | let (|ListPattern|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 885 | match node with 886 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ListPatternSyntax as node -> 887 | Some (node.OpenBracketToken, node.CloseBracketToken, node.Designation) 888 | | _ -> None 889 | 890 | let (|SlicePattern|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 891 | match node with 892 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.SlicePatternSyntax as node -> 893 | Some (node.DotDotToken, node.Pattern) 894 | | _ -> None 895 | 896 | let (|InterpolatedStringText|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 897 | match node with 898 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.InterpolatedStringTextSyntax as node -> 899 | Some (node.TextToken) 900 | | _ -> None 901 | 902 | let (|Interpolation|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 903 | match node with 904 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.InterpolationSyntax as node -> 905 | Some (node.OpenBraceToken, node.Expression, node.AlignmentClause, node.FormatClause, node.CloseBraceToken) 906 | | _ -> None 907 | 908 | let (|InterpolationAlignmentClause|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 909 | match node with 910 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.InterpolationAlignmentClauseSyntax as node -> 911 | Some (node.CommaToken, node.Value) 912 | | _ -> None 913 | 914 | let (|InterpolationFormatClause|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 915 | match node with 916 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.InterpolationFormatClauseSyntax as node -> 917 | Some (node.ColonToken, node.FormatStringToken) 918 | | _ -> None 919 | 920 | let (|VariableDeclaration|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 921 | match node with 922 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.VariableDeclarationSyntax as node -> 923 | Some (node.Type) 924 | | _ -> None 925 | 926 | let (|VariableDeclarator|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 927 | match node with 928 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.VariableDeclaratorSyntax as node -> 929 | Some (node.Identifier, node.ArgumentList, node.Initializer) 930 | | _ -> None 931 | 932 | let (|EqualsValueClause|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 933 | match node with 934 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.EqualsValueClauseSyntax as node -> 935 | Some (node.EqualsToken, node.Value) 936 | | _ -> None 937 | 938 | let (|SingleVariableDesignation|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 939 | match node with 940 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.SingleVariableDesignationSyntax as node -> 941 | Some (node.Identifier) 942 | | _ -> None 943 | 944 | let (|DiscardDesignation|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 945 | match node with 946 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.DiscardDesignationSyntax as node -> 947 | Some (node.UnderscoreToken) 948 | | _ -> None 949 | 950 | let (|ParenthesizedVariableDesignation|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 951 | match node with 952 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ParenthesizedVariableDesignationSyntax as node -> 953 | Some (node.OpenParenToken, node.CloseParenToken) 954 | | _ -> None 955 | 956 | let (|ElseClause|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 957 | match node with 958 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ElseClauseSyntax as node -> 959 | Some (node.ElseKeyword, node.Statement) 960 | | _ -> None 961 | 962 | let (|SwitchSection|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 963 | match node with 964 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.SwitchSectionSyntax as node -> 965 | Some (node.Labels |> Seq.toList, node.Statements |> Seq.toList) 966 | | _ -> None 967 | 968 | let (|CasePatternSwitchLabel|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 969 | match node with 970 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.CasePatternSwitchLabelSyntax as node -> 971 | Some (node.Keyword, node.Pattern, node.WhenClause, node.ColonToken) 972 | | _ -> None 973 | 974 | let (|CaseSwitchLabel|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 975 | match node with 976 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.CaseSwitchLabelSyntax as node -> 977 | Some (node.Keyword, node.Value, node.ColonToken) 978 | | _ -> None 979 | 980 | let (|DefaultSwitchLabel|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 981 | match node with 982 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.DefaultSwitchLabelSyntax as node -> 983 | Some (node.Keyword, node.ColonToken) 984 | | _ -> None 985 | 986 | let (|SwitchExpression|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 987 | match node with 988 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.SwitchExpressionSyntax as node -> 989 | Some (node.GoverningExpression, node.SwitchKeyword, node.OpenBraceToken, node.CloseBraceToken) 990 | | _ -> None 991 | 992 | let (|SwitchExpressionArm|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 993 | match node with 994 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.SwitchExpressionArmSyntax as node -> 995 | Some (node.Pattern, node.WhenClause, node.EqualsGreaterThanToken, node.Expression) 996 | | _ -> None 997 | 998 | let (|CatchClause|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 999 | match node with 1000 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.CatchClauseSyntax as node -> 1001 | Some (node.CatchKeyword, node.Declaration, node.Filter, node.Block) 1002 | | _ -> None 1003 | 1004 | let (|CatchDeclaration|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1005 | match node with 1006 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.CatchDeclarationSyntax as node -> 1007 | Some (node.OpenParenToken, node.Type, node.Identifier, node.CloseParenToken) 1008 | | _ -> None 1009 | 1010 | let (|CatchFilterClause|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1011 | match node with 1012 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.CatchFilterClauseSyntax as node -> 1013 | Some (node.WhenKeyword, node.OpenParenToken, node.FilterExpression, node.CloseParenToken) 1014 | | _ -> None 1015 | 1016 | let (|FinallyClause|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1017 | match node with 1018 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.FinallyClauseSyntax as node -> 1019 | Some (node.FinallyKeyword, node.Block) 1020 | | _ -> None 1021 | 1022 | let (|ExternAliasDirective|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1023 | match node with 1024 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ExternAliasDirectiveSyntax as node -> 1025 | Some (node.ExternKeyword, node.AliasKeyword, node.Identifier, node.SemicolonToken) 1026 | | _ -> None 1027 | 1028 | let (|FileScopedNamespaceDeclaration|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1029 | match node with 1030 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.FileScopedNamespaceDeclarationSyntax as node -> 1031 | Some (node.AttributeLists |> Seq.toList, node.NamespaceKeyword, node.Name, node.SemicolonToken, node.Externs |> Seq.toList, node.Usings |> Seq.toList, node.Members |> Seq.toList) 1032 | | _ -> None 1033 | 1034 | let (|AttributeList|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1035 | match node with 1036 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.AttributeListSyntax as node -> 1037 | Some (node.OpenBracketToken, node.Target, node.CloseBracketToken) 1038 | | _ -> None 1039 | 1040 | let (|AttributeArgumentList|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1041 | match node with 1042 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.AttributeArgumentListSyntax as node -> 1043 | Some (node.OpenParenToken, node.CloseParenToken) 1044 | | _ -> None 1045 | 1046 | let (|AttributeArgument|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1047 | match node with 1048 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.AttributeArgumentSyntax as node -> 1049 | Some (node.NameEquals, node.NameColon, node.Expression) 1050 | | _ -> None 1051 | 1052 | let (|NameEquals|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1053 | match node with 1054 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.NameEqualsSyntax as node -> 1055 | Some (node.Name, node.EqualsToken) 1056 | | _ -> None 1057 | 1058 | let (|TypeParameterList|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1059 | match node with 1060 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterListSyntax as node -> 1061 | Some (node.LessThanToken, node.GreaterThanToken) 1062 | | _ -> None 1063 | 1064 | let (|TypeParameter|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1065 | match node with 1066 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterSyntax as node -> 1067 | Some (node.AttributeLists |> Seq.toList, node.VarianceKeyword, node.Identifier) 1068 | | _ -> None 1069 | 1070 | let (|ClassDeclaration|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1071 | match node with 1072 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax as node -> 1073 | Some (node.AttributeLists |> Seq.toList, node.Keyword, node.Identifier, node.TypeParameterList, node.BaseList, node.ConstraintClauses |> Seq.toList, node.OpenBraceToken, node.Members |> Seq.toList, node.CloseBraceToken, node.SemicolonToken) 1074 | | _ -> None 1075 | 1076 | let (|StructDeclaration|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1077 | match node with 1078 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.StructDeclarationSyntax as node -> 1079 | Some (node.AttributeLists |> Seq.toList, node.Keyword, node.Identifier, node.TypeParameterList, node.BaseList, node.ConstraintClauses |> Seq.toList, node.OpenBraceToken, node.Members |> Seq.toList, node.CloseBraceToken, node.SemicolonToken) 1080 | | _ -> None 1081 | 1082 | let (|InterfaceDeclaration|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1083 | match node with 1084 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.InterfaceDeclarationSyntax as node -> 1085 | Some (node.AttributeLists |> Seq.toList, node.Keyword, node.Identifier, node.TypeParameterList, node.BaseList, node.ConstraintClauses |> Seq.toList, node.OpenBraceToken, node.Members |> Seq.toList, node.CloseBraceToken, node.SemicolonToken) 1086 | | _ -> None 1087 | 1088 | let (|EnumDeclaration|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1089 | match node with 1090 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.EnumDeclarationSyntax as node -> 1091 | Some (node.AttributeLists |> Seq.toList, node.EnumKeyword, node.Identifier, node.BaseList, node.OpenBraceToken, node.CloseBraceToken, node.SemicolonToken) 1092 | | _ -> None 1093 | 1094 | let (|BaseList|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1095 | match node with 1096 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.BaseListSyntax as node -> 1097 | Some (node.ColonToken) 1098 | | _ -> None 1099 | 1100 | let (|SimpleBaseType|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1101 | match node with 1102 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.SimpleBaseTypeSyntax as node -> 1103 | Some (node.Type) 1104 | | _ -> None 1105 | 1106 | let (|PrimaryConstructorBaseType|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1107 | match node with 1108 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.PrimaryConstructorBaseTypeSyntax as node -> 1109 | Some (node.Type, node.ArgumentList) 1110 | | _ -> None 1111 | 1112 | let (|TypeParameterConstraintClause|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1113 | match node with 1114 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.TypeParameterConstraintClauseSyntax as node -> 1115 | Some (node.WhereKeyword, node.Name, node.ColonToken) 1116 | | _ -> None 1117 | 1118 | let (|ConstructorConstraint|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1119 | match node with 1120 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ConstructorConstraintSyntax as node -> 1121 | Some (node.NewKeyword, node.OpenParenToken, node.CloseParenToken) 1122 | | _ -> None 1123 | 1124 | let (|TypeConstraint|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1125 | match node with 1126 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.TypeConstraintSyntax as node -> 1127 | Some (node.Type) 1128 | | _ -> None 1129 | 1130 | let (|DefaultConstraint|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1131 | match node with 1132 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.DefaultConstraintSyntax as node -> 1133 | Some (node.DefaultKeyword) 1134 | | _ -> None 1135 | 1136 | let (|FieldDeclaration|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1137 | match node with 1138 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.FieldDeclarationSyntax as node -> 1139 | Some (node.AttributeLists |> Seq.toList, node.Declaration, node.SemicolonToken) 1140 | | _ -> None 1141 | 1142 | let (|EventFieldDeclaration|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1143 | match node with 1144 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.EventFieldDeclarationSyntax as node -> 1145 | Some (node.AttributeLists |> Seq.toList, node.EventKeyword, node.Declaration, node.SemicolonToken) 1146 | | _ -> None 1147 | 1148 | let (|ExplicitInterfaceSpecifier|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1149 | match node with 1150 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ExplicitInterfaceSpecifierSyntax as node -> 1151 | Some (node.Name, node.DotToken) 1152 | | _ -> None 1153 | 1154 | let (|ConstructorInitializer|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1155 | match node with 1156 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ConstructorInitializerSyntax as node -> 1157 | Some (node.ColonToken, node.ThisOrBaseKeyword, node.ArgumentList) 1158 | | _ -> None 1159 | 1160 | let (|ArrowExpressionClause|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1161 | match node with 1162 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ArrowExpressionClauseSyntax as node -> 1163 | Some (node.ArrowToken, node.Expression) 1164 | | _ -> None 1165 | 1166 | let (|AccessorList|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1167 | match node with 1168 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.AccessorListSyntax as node -> 1169 | Some (node.OpenBraceToken, node.Accessors |> Seq.toList, node.CloseBraceToken) 1170 | | _ -> None 1171 | 1172 | let (|BracketedParameterList|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1173 | match node with 1174 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.BracketedParameterListSyntax as node -> 1175 | Some (node.OpenBracketToken, node.CloseBracketToken) 1176 | | _ -> None 1177 | 1178 | let (|FunctionPointerParameter|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1179 | match node with 1180 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.FunctionPointerParameterSyntax as node -> 1181 | Some (node.AttributeLists |> Seq.toList, node.Type) 1182 | | _ -> None 1183 | 1184 | let (|IncompleteMember|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1185 | match node with 1186 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.IncompleteMemberSyntax as node -> 1187 | Some (node.AttributeLists |> Seq.toList, node.Type) 1188 | | _ -> None 1189 | 1190 | let (|DocumentationCommentTrivia|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1191 | match node with 1192 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.DocumentationCommentTriviaSyntax as node -> 1193 | Some (node.Content |> Seq.toList, node.EndOfComment) 1194 | | _ -> None 1195 | 1196 | let (|TypeCref|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1197 | match node with 1198 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.TypeCrefSyntax as node -> 1199 | Some (node.Type) 1200 | | _ -> None 1201 | 1202 | let (|QualifiedCref|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1203 | match node with 1204 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.QualifiedCrefSyntax as node -> 1205 | Some (node.Container, node.DotToken, node.Member) 1206 | | _ -> None 1207 | 1208 | let (|NameMemberCref|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1209 | match node with 1210 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.NameMemberCrefSyntax as node -> 1211 | Some (node.Name, node.Parameters) 1212 | | _ -> None 1213 | 1214 | let (|IndexerMemberCref|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1215 | match node with 1216 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.IndexerMemberCrefSyntax as node -> 1217 | Some (node.ThisKeyword, node.Parameters) 1218 | | _ -> None 1219 | 1220 | let (|CrefParameterList|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1221 | match node with 1222 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterListSyntax as node -> 1223 | Some (node.OpenParenToken, node.CloseParenToken) 1224 | | _ -> None 1225 | 1226 | let (|CrefBracketedParameterList|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1227 | match node with 1228 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.CrefBracketedParameterListSyntax as node -> 1229 | Some (node.OpenBracketToken, node.CloseBracketToken) 1230 | | _ -> None 1231 | 1232 | let (|XmlElement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1233 | match node with 1234 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.XmlElementSyntax as node -> 1235 | Some (node.StartTag, node.Content |> Seq.toList, node.EndTag) 1236 | | _ -> None 1237 | 1238 | let (|XmlElementStartTag|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1239 | match node with 1240 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.XmlElementStartTagSyntax as node -> 1241 | Some (node.LessThanToken, node.Name, node.Attributes |> Seq.toList, node.GreaterThanToken) 1242 | | _ -> None 1243 | 1244 | let (|XmlElementEndTag|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1245 | match node with 1246 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.XmlElementEndTagSyntax as node -> 1247 | Some (node.LessThanSlashToken, node.Name, node.GreaterThanToken) 1248 | | _ -> None 1249 | 1250 | let (|XmlEmptyElement|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1251 | match node with 1252 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.XmlEmptyElementSyntax as node -> 1253 | Some (node.LessThanToken, node.Name, node.Attributes |> Seq.toList, node.SlashGreaterThanToken) 1254 | | _ -> None 1255 | 1256 | let (|XmlName|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1257 | match node with 1258 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.XmlNameSyntax as node -> 1259 | Some (node.Prefix, node.LocalName) 1260 | | _ -> None 1261 | 1262 | let (|XmlPrefix|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1263 | match node with 1264 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.XmlPrefixSyntax as node -> 1265 | Some (node.Prefix, node.ColonToken) 1266 | | _ -> None 1267 | 1268 | let (|XmlTextAttribute|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1269 | match node with 1270 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.XmlTextAttributeSyntax as node -> 1271 | Some (node.Name, node.EqualsToken, node.StartQuoteToken, node.EndQuoteToken) 1272 | | _ -> None 1273 | 1274 | let (|XmlCrefAttribute|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1275 | match node with 1276 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.XmlCrefAttributeSyntax as node -> 1277 | Some (node.Name, node.EqualsToken, node.StartQuoteToken, node.Cref, node.EndQuoteToken) 1278 | | _ -> None 1279 | 1280 | let (|XmlNameAttribute|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1281 | match node with 1282 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.XmlNameAttributeSyntax as node -> 1283 | Some (node.Name, node.EqualsToken, node.StartQuoteToken, node.Identifier, node.EndQuoteToken) 1284 | | _ -> None 1285 | 1286 | let (|XmlCDataSection|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1287 | match node with 1288 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.XmlCDataSectionSyntax as node -> 1289 | Some (node.StartCDataToken, node.EndCDataToken) 1290 | | _ -> None 1291 | 1292 | let (|XmlProcessingInstruction|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1293 | match node with 1294 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.XmlProcessingInstructionSyntax as node -> 1295 | Some (node.StartProcessingInstructionToken, node.Name, node.EndProcessingInstructionToken) 1296 | | _ -> None 1297 | 1298 | let (|XmlComment|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1299 | match node with 1300 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.XmlCommentSyntax as node -> 1301 | Some (node.LessThanExclamationMinusMinusToken, node.MinusMinusGreaterThanToken) 1302 | | _ -> None 1303 | 1304 | let (|IfDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1305 | match node with 1306 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.IfDirectiveTriviaSyntax as node -> 1307 | Some (node.HashToken, node.IfKeyword, node.Condition, node.EndOfDirectiveToken, node.IsActive, node.BranchTaken, node.ConditionValue) 1308 | | _ -> None 1309 | 1310 | let (|ElifDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1311 | match node with 1312 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ElifDirectiveTriviaSyntax as node -> 1313 | Some (node.HashToken, node.ElifKeyword, node.Condition, node.EndOfDirectiveToken, node.IsActive, node.BranchTaken, node.ConditionValue) 1314 | | _ -> None 1315 | 1316 | let (|ElseDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1317 | match node with 1318 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ElseDirectiveTriviaSyntax as node -> 1319 | Some (node.HashToken, node.ElseKeyword, node.EndOfDirectiveToken, node.IsActive, node.BranchTaken) 1320 | | _ -> None 1321 | 1322 | let (|EndIfDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1323 | match node with 1324 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.EndIfDirectiveTriviaSyntax as node -> 1325 | Some (node.HashToken, node.EndIfKeyword, node.EndOfDirectiveToken, node.IsActive) 1326 | | _ -> None 1327 | 1328 | let (|RegionDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1329 | match node with 1330 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.RegionDirectiveTriviaSyntax as node -> 1331 | Some (node.HashToken, node.RegionKeyword, node.EndOfDirectiveToken, node.IsActive) 1332 | | _ -> None 1333 | 1334 | let (|EndRegionDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1335 | match node with 1336 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.EndRegionDirectiveTriviaSyntax as node -> 1337 | Some (node.HashToken, node.EndRegionKeyword, node.EndOfDirectiveToken, node.IsActive) 1338 | | _ -> None 1339 | 1340 | let (|ErrorDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1341 | match node with 1342 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ErrorDirectiveTriviaSyntax as node -> 1343 | Some (node.HashToken, node.ErrorKeyword, node.EndOfDirectiveToken, node.IsActive) 1344 | | _ -> None 1345 | 1346 | let (|WarningDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1347 | match node with 1348 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.WarningDirectiveTriviaSyntax as node -> 1349 | Some (node.HashToken, node.WarningKeyword, node.EndOfDirectiveToken, node.IsActive) 1350 | | _ -> None 1351 | 1352 | let (|BadDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1353 | match node with 1354 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.BadDirectiveTriviaSyntax as node -> 1355 | Some (node.HashToken, node.Identifier, node.EndOfDirectiveToken, node.IsActive) 1356 | | _ -> None 1357 | 1358 | let (|DefineDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1359 | match node with 1360 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.DefineDirectiveTriviaSyntax as node -> 1361 | Some (node.HashToken, node.DefineKeyword, node.Name, node.EndOfDirectiveToken, node.IsActive) 1362 | | _ -> None 1363 | 1364 | let (|UndefDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1365 | match node with 1366 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.UndefDirectiveTriviaSyntax as node -> 1367 | Some (node.HashToken, node.UndefKeyword, node.Name, node.EndOfDirectiveToken, node.IsActive) 1368 | | _ -> None 1369 | 1370 | let (|LineDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1371 | match node with 1372 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.LineDirectiveTriviaSyntax as node -> 1373 | Some (node.HashToken, node.LineKeyword, node.Line, node.File, node.EndOfDirectiveToken, node.IsActive) 1374 | | _ -> None 1375 | 1376 | let (|LineDirectivePosition|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1377 | match node with 1378 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.LineDirectivePositionSyntax as node -> 1379 | Some (node.OpenParenToken, node.Line, node.CommaToken, node.Character, node.CloseParenToken) 1380 | | _ -> None 1381 | 1382 | let (|LineSpanDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1383 | match node with 1384 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.LineSpanDirectiveTriviaSyntax as node -> 1385 | Some (node.HashToken, node.LineKeyword, node.Start, node.MinusToken, node.End, node.CharacterOffset, node.File, node.EndOfDirectiveToken, node.IsActive) 1386 | | _ -> None 1387 | 1388 | let (|PragmaWarningDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1389 | match node with 1390 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.PragmaWarningDirectiveTriviaSyntax as node -> 1391 | Some (node.HashToken, node.PragmaKeyword, node.WarningKeyword, node.DisableOrRestoreKeyword, node.EndOfDirectiveToken, node.IsActive) 1392 | | _ -> None 1393 | 1394 | let (|PragmaChecksumDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1395 | match node with 1396 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.PragmaChecksumDirectiveTriviaSyntax as node -> 1397 | Some (node.HashToken, node.PragmaKeyword, node.ChecksumKeyword, node.File, node.Guid, node.Bytes, node.EndOfDirectiveToken, node.IsActive) 1398 | | _ -> None 1399 | 1400 | let (|ReferenceDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1401 | match node with 1402 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ReferenceDirectiveTriviaSyntax as node -> 1403 | Some (node.HashToken, node.ReferenceKeyword, node.File, node.EndOfDirectiveToken, node.IsActive) 1404 | | _ -> None 1405 | 1406 | let (|LoadDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1407 | match node with 1408 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.LoadDirectiveTriviaSyntax as node -> 1409 | Some (node.HashToken, node.LoadKeyword, node.File, node.EndOfDirectiveToken, node.IsActive) 1410 | | _ -> None 1411 | 1412 | let (|ShebangDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1413 | match node with 1414 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.ShebangDirectiveTriviaSyntax as node -> 1415 | Some (node.HashToken, node.ExclamationToken, node.EndOfDirectiveToken, node.IsActive) 1416 | | _ -> None 1417 | 1418 | let (|NullableDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode) = 1419 | match node with 1420 | | :? Microsoft.CodeAnalysis.CSharp.Syntax.NullableDirectiveTriviaSyntax as node -> 1421 | Some (node.HashToken, node.NullableKeyword, node.SettingToken, node.TargetToken, node.EndOfDirectiveToken, node.IsActive) 1422 | | _ -> None 1423 | 1424 | -------------------------------------------------------------------------------- /Microsoft.CodeAnalysis.ActivePatterns/Strict/CSharpAdditionals.fs: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Microsoft.CodeAnalysis.ActivePatterns - F# Active pattern matching library for Roslyn 4 | // Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | ///////////////////////////////////////////////////////////////////////////// 19 | 20 | namespace Microsoft.CodeAnalysis.CSharp.Strict 21 | 22 | open Microsoft.CodeAnalysis 23 | open Microsoft.CodeAnalysis.CSharp 24 | 25 | [] 26 | module Additionals = 27 | 28 | let (|Identifier|_|) node : string list option = 29 | let rec matcher (node:CSharpSyntaxNode) = 30 | match node with 31 | | IdentifierName(Token(text)) -> 32 | Some [ text ] 33 | | QualifiedName(left, _, right) -> 34 | matcher left |> Option.bind(fun left -> matcher right |> Option.bind(fun right -> Some (List.append left right))) 35 | | _ -> 36 | None 37 | matcher node 38 | -------------------------------------------------------------------------------- /Microsoft.CodeAnalysis.ActivePatterns/Strict/VisualBasicActivePatterns.fs: -------------------------------------------------------------------------------- 1 | // This is auto-generated source code by Microsoft.CodeAnalysis.ActivePatterns, DO NOT EDIT! 2 | 3 | namespace Microsoft.CodeAnalysis.VisualBasic.Strict 4 | 5 | [] 6 | module ActivePatterns = 7 | 8 | let (|EmptyStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 9 | match node with 10 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.EmptyStatementSyntax as node -> 11 | Some (node.Empty) 12 | | _ -> None 13 | 14 | let (|EndBlockStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 15 | match node with 16 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.EndBlockStatementSyntax as node -> 17 | Some (node.EndKeyword, node.BlockKeyword) 18 | | _ -> None 19 | 20 | let (|CompilationUnit|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 21 | match node with 22 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.CompilationUnitSyntax as node -> 23 | Some (node.Options |> Seq.toList, node.Imports |> Seq.toList, node.Attributes |> Seq.toList, node.Members |> Seq.toList, node.EndOfFileToken) 24 | | _ -> None 25 | 26 | let (|OptionStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 27 | match node with 28 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.OptionStatementSyntax as node -> 29 | Some (node.OptionKeyword, node.NameKeyword, node.ValueKeyword) 30 | | _ -> None 31 | 32 | let (|ImportsStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 33 | match node with 34 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ImportsStatementSyntax as node -> 35 | Some (node.ImportsKeyword) 36 | | _ -> None 37 | 38 | let (|SimpleImportsClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 39 | match node with 40 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.SimpleImportsClauseSyntax as node -> 41 | Some (node.Alias, node.Name) 42 | | _ -> None 43 | 44 | let (|ImportAliasClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 45 | match node with 46 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ImportAliasClauseSyntax as node -> 47 | Some (node.Identifier, node.EqualsToken) 48 | | _ -> None 49 | 50 | let (|XmlNamespaceImportsClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 51 | match node with 52 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.XmlNamespaceImportsClauseSyntax as node -> 53 | Some (node.LessThanToken, node.XmlNamespace, node.GreaterThanToken) 54 | | _ -> None 55 | 56 | let (|NamespaceBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 57 | match node with 58 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.NamespaceBlockSyntax as node -> 59 | Some (node.NamespaceStatement, node.Members |> Seq.toList, node.EndNamespaceStatement) 60 | | _ -> None 61 | 62 | let (|NamespaceStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 63 | match node with 64 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.NamespaceStatementSyntax as node -> 65 | Some (node.NamespaceKeyword, node.Name) 66 | | _ -> None 67 | 68 | let (|ModuleBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 69 | match node with 70 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ModuleBlockSyntax as node -> 71 | Some (node.ModuleStatement, node.Inherits |> Seq.toList, node.Implements |> Seq.toList, node.Members |> Seq.toList, node.EndModuleStatement, node.BlockStatement, node.EndBlockStatement) 72 | | _ -> None 73 | 74 | let (|StructureBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 75 | match node with 76 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.StructureBlockSyntax as node -> 77 | Some (node.StructureStatement, node.Inherits |> Seq.toList, node.Implements |> Seq.toList, node.Members |> Seq.toList, node.EndStructureStatement, node.BlockStatement, node.EndBlockStatement) 78 | | _ -> None 79 | 80 | let (|InterfaceBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 81 | match node with 82 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.InterfaceBlockSyntax as node -> 83 | Some (node.InterfaceStatement, node.Inherits |> Seq.toList, node.Implements |> Seq.toList, node.Members |> Seq.toList, node.EndInterfaceStatement, node.BlockStatement, node.EndBlockStatement) 84 | | _ -> None 85 | 86 | let (|ClassBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 87 | match node with 88 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ClassBlockSyntax as node -> 89 | Some (node.ClassStatement, node.Inherits |> Seq.toList, node.Implements |> Seq.toList, node.Members |> Seq.toList, node.EndClassStatement, node.BlockStatement, node.EndBlockStatement) 90 | | _ -> None 91 | 92 | let (|EnumBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 93 | match node with 94 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.EnumBlockSyntax as node -> 95 | Some (node.EnumStatement, node.Members |> Seq.toList, node.EndEnumStatement) 96 | | _ -> None 97 | 98 | let (|InheritsStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 99 | match node with 100 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.InheritsStatementSyntax as node -> 101 | Some (node.InheritsKeyword) 102 | | _ -> None 103 | 104 | let (|ImplementsStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 105 | match node with 106 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ImplementsStatementSyntax as node -> 107 | Some (node.ImplementsKeyword) 108 | | _ -> None 109 | 110 | let (|ModuleStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 111 | match node with 112 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ModuleStatementSyntax as node -> 113 | Some (node.AttributeLists |> Seq.toList, node.ModuleKeyword, node.Identifier, node.TypeParameterList, node.DeclarationKeyword) 114 | | _ -> None 115 | 116 | let (|StructureStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 117 | match node with 118 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.StructureStatementSyntax as node -> 119 | Some (node.AttributeLists |> Seq.toList, node.StructureKeyword, node.Identifier, node.TypeParameterList, node.DeclarationKeyword) 120 | | _ -> None 121 | 122 | let (|InterfaceStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 123 | match node with 124 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.InterfaceStatementSyntax as node -> 125 | Some (node.AttributeLists |> Seq.toList, node.InterfaceKeyword, node.Identifier, node.TypeParameterList, node.DeclarationKeyword) 126 | | _ -> None 127 | 128 | let (|ClassStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 129 | match node with 130 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ClassStatementSyntax as node -> 131 | Some (node.AttributeLists |> Seq.toList, node.ClassKeyword, node.Identifier, node.TypeParameterList, node.DeclarationKeyword) 132 | | _ -> None 133 | 134 | let (|EnumStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 135 | match node with 136 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.EnumStatementSyntax as node -> 137 | Some (node.AttributeLists |> Seq.toList, node.EnumKeyword, node.Identifier, node.UnderlyingType) 138 | | _ -> None 139 | 140 | let (|TypeParameterList|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 141 | match node with 142 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.TypeParameterListSyntax as node -> 143 | Some (node.OpenParenToken, node.OfKeyword, node.CloseParenToken) 144 | | _ -> None 145 | 146 | let (|TypeParameter|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 147 | match node with 148 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.TypeParameterSyntax as node -> 149 | Some (node.VarianceKeyword, node.Identifier, node.TypeParameterConstraintClause) 150 | | _ -> None 151 | 152 | let (|TypeParameterSingleConstraintClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 153 | match node with 154 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.TypeParameterSingleConstraintClauseSyntax as node -> 155 | Some (node.AsKeyword, node.Constraint) 156 | | _ -> None 157 | 158 | let (|TypeParameterMultipleConstraintClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 159 | match node with 160 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.TypeParameterMultipleConstraintClauseSyntax as node -> 161 | Some (node.AsKeyword, node.OpenBraceToken, node.CloseBraceToken) 162 | | _ -> None 163 | 164 | let (|SpecialConstraint|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 165 | match node with 166 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.SpecialConstraintSyntax as node -> 167 | Some (node.ConstraintKeyword) 168 | | _ -> None 169 | 170 | let (|TypeConstraint|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 171 | match node with 172 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.TypeConstraintSyntax as node -> 173 | Some (node.Type) 174 | | _ -> None 175 | 176 | let (|EnumMemberDeclaration|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 177 | match node with 178 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.EnumMemberDeclarationSyntax as node -> 179 | Some (node.AttributeLists |> Seq.toList, node.Identifier, node.Initializer) 180 | | _ -> None 181 | 182 | let (|MethodBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 183 | match node with 184 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.MethodBlockSyntax as node -> 185 | Some (node.SubOrFunctionStatement, node.Statements |> Seq.toList, node.EndSubOrFunctionStatement, node.BlockStatement, node.EndBlockStatement) 186 | | _ -> None 187 | 188 | let (|ConstructorBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 189 | match node with 190 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ConstructorBlockSyntax as node -> 191 | Some (node.SubNewStatement, node.Statements |> Seq.toList, node.EndSubStatement, node.BlockStatement, node.EndBlockStatement) 192 | | _ -> None 193 | 194 | let (|OperatorBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 195 | match node with 196 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.OperatorBlockSyntax as node -> 197 | Some (node.OperatorStatement, node.Statements |> Seq.toList, node.EndOperatorStatement, node.BlockStatement, node.EndBlockStatement) 198 | | _ -> None 199 | 200 | let (|AccessorBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 201 | match node with 202 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.AccessorBlockSyntax as node -> 203 | Some (node.AccessorStatement, node.Statements |> Seq.toList, node.EndAccessorStatement, node.BlockStatement, node.EndBlockStatement) 204 | | _ -> None 205 | 206 | let (|PropertyBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 207 | match node with 208 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.PropertyBlockSyntax as node -> 209 | Some (node.PropertyStatement, node.Accessors |> Seq.toList, node.EndPropertyStatement) 210 | | _ -> None 211 | 212 | let (|EventBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 213 | match node with 214 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.EventBlockSyntax as node -> 215 | Some (node.EventStatement, node.Accessors |> Seq.toList, node.EndEventStatement) 216 | | _ -> None 217 | 218 | let (|ParameterList|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 219 | match node with 220 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ParameterListSyntax as node -> 221 | Some (node.OpenParenToken, node.CloseParenToken) 222 | | _ -> None 223 | 224 | let (|MethodStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 225 | match node with 226 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.MethodStatementSyntax as node -> 227 | Some (node.AttributeLists |> Seq.toList, node.SubOrFunctionKeyword, node.Identifier, node.TypeParameterList, node.ParameterList, node.AsClause, node.HandlesClause, node.ImplementsClause, node.DeclarationKeyword) 228 | | _ -> None 229 | 230 | let (|SubNewStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 231 | match node with 232 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.SubNewStatementSyntax as node -> 233 | Some (node.AttributeLists |> Seq.toList, node.SubKeyword, node.NewKeyword, node.ParameterList, node.DeclarationKeyword) 234 | | _ -> None 235 | 236 | let (|DeclareStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 237 | match node with 238 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.DeclareStatementSyntax as node -> 239 | Some (node.AttributeLists |> Seq.toList, node.DeclareKeyword, node.CharsetKeyword, node.SubOrFunctionKeyword, node.Identifier, node.LibKeyword, node.LibraryName, node.AliasKeyword, node.AliasName, node.ParameterList, node.AsClause, node.DeclarationKeyword) 240 | | _ -> None 241 | 242 | let (|DelegateStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 243 | match node with 244 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.DelegateStatementSyntax as node -> 245 | Some (node.AttributeLists |> Seq.toList, node.DelegateKeyword, node.SubOrFunctionKeyword, node.Identifier, node.TypeParameterList, node.ParameterList, node.AsClause, node.DeclarationKeyword) 246 | | _ -> None 247 | 248 | let (|EventStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 249 | match node with 250 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.EventStatementSyntax as node -> 251 | Some (node.AttributeLists |> Seq.toList, node.CustomKeyword, node.EventKeyword, node.Identifier, node.ParameterList, node.AsClause, node.ImplementsClause, node.DeclarationKeyword) 252 | | _ -> None 253 | 254 | let (|OperatorStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 255 | match node with 256 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.OperatorStatementSyntax as node -> 257 | Some (node.AttributeLists |> Seq.toList, node.OperatorKeyword, node.OperatorToken, node.ParameterList, node.AsClause, node.DeclarationKeyword) 258 | | _ -> None 259 | 260 | let (|PropertyStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 261 | match node with 262 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.PropertyStatementSyntax as node -> 263 | Some (node.AttributeLists |> Seq.toList, node.PropertyKeyword, node.Identifier, node.ParameterList, node.AsClause, node.Initializer, node.ImplementsClause, node.DeclarationKeyword) 264 | | _ -> None 265 | 266 | let (|AccessorStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 267 | match node with 268 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.AccessorStatementSyntax as node -> 269 | Some (node.AttributeLists |> Seq.toList, node.AccessorKeyword, node.ParameterList, node.DeclarationKeyword) 270 | | _ -> None 271 | 272 | let (|ImplementsClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 273 | match node with 274 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ImplementsClauseSyntax as node -> 275 | Some (node.ImplementsKeyword) 276 | | _ -> None 277 | 278 | let (|HandlesClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 279 | match node with 280 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.HandlesClauseSyntax as node -> 281 | Some (node.HandlesKeyword) 282 | | _ -> None 283 | 284 | let (|KeywordEventContainer|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 285 | match node with 286 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.KeywordEventContainerSyntax as node -> 287 | Some (node.Keyword) 288 | | _ -> None 289 | 290 | let (|WithEventsEventContainer|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 291 | match node with 292 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.WithEventsEventContainerSyntax as node -> 293 | Some (node.Identifier) 294 | | _ -> None 295 | 296 | let (|WithEventsPropertyEventContainer|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 297 | match node with 298 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.WithEventsPropertyEventContainerSyntax as node -> 299 | Some (node.WithEventsContainer, node.DotToken, node.Property) 300 | | _ -> None 301 | 302 | let (|HandlesClauseItem|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 303 | match node with 304 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.HandlesClauseItemSyntax as node -> 305 | Some (node.EventContainer, node.DotToken, node.EventMember) 306 | | _ -> None 307 | 308 | let (|IncompleteMember|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 309 | match node with 310 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.IncompleteMemberSyntax as node -> 311 | Some (node.AttributeLists |> Seq.toList, node.MissingIdentifier) 312 | | _ -> None 313 | 314 | let (|FieldDeclaration|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 315 | match node with 316 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.FieldDeclarationSyntax as node -> 317 | Some (node.AttributeLists |> Seq.toList) 318 | | _ -> None 319 | 320 | let (|VariableDeclarator|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 321 | match node with 322 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.VariableDeclaratorSyntax as node -> 323 | Some (node.AsClause, node.Initializer) 324 | | _ -> None 325 | 326 | let (|SimpleAsClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 327 | match node with 328 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.SimpleAsClauseSyntax as node -> 329 | Some (node.AsKeyword, node.AttributeLists |> Seq.toList, node.Type) 330 | | _ -> None 331 | 332 | let (|AsNewClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 333 | match node with 334 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.AsNewClauseSyntax as node -> 335 | Some (node.AsKeyword, node.NewExpression) 336 | | _ -> None 337 | 338 | let (|ObjectMemberInitializer|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 339 | match node with 340 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ObjectMemberInitializerSyntax as node -> 341 | Some (node.WithKeyword, node.OpenBraceToken, node.CloseBraceToken) 342 | | _ -> None 343 | 344 | let (|ObjectCollectionInitializer|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 345 | match node with 346 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ObjectCollectionInitializerSyntax as node -> 347 | Some (node.FromKeyword, node.Initializer) 348 | | _ -> None 349 | 350 | let (|InferredFieldInitializer|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 351 | match node with 352 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.InferredFieldInitializerSyntax as node -> 353 | Some (node.KeyKeyword, node.Expression) 354 | | _ -> None 355 | 356 | let (|NamedFieldInitializer|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 357 | match node with 358 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.NamedFieldInitializerSyntax as node -> 359 | Some (node.KeyKeyword, node.DotToken, node.Name, node.EqualsToken, node.Expression) 360 | | _ -> None 361 | 362 | let (|EqualsValue|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 363 | match node with 364 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.EqualsValueSyntax as node -> 365 | Some (node.EqualsToken, node.Value) 366 | | _ -> None 367 | 368 | let (|Parameter|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 369 | match node with 370 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ParameterSyntax as node -> 371 | Some (node.AttributeLists |> Seq.toList, node.Identifier, node.AsClause, node.Default) 372 | | _ -> None 373 | 374 | let (|ModifiedIdentifier|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 375 | match node with 376 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ModifiedIdentifierSyntax as node -> 377 | Some (node.Identifier, node.Nullable, node.ArrayBounds, node.ArrayRankSpecifiers |> Seq.toList) 378 | | _ -> None 379 | 380 | let (|ArrayRankSpecifier|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 381 | match node with 382 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ArrayRankSpecifierSyntax as node -> 383 | Some (node.OpenParenToken, node.CloseParenToken, node.Rank) 384 | | _ -> None 385 | 386 | let (|AttributeList|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 387 | match node with 388 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.AttributeListSyntax as node -> 389 | Some (node.LessThanToken, node.GreaterThanToken) 390 | | _ -> None 391 | 392 | let (|Attribute|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 393 | match node with 394 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.AttributeSyntax as node -> 395 | Some (node.Target, node.Name, node.ArgumentList) 396 | | _ -> None 397 | 398 | let (|AttributeTarget|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 399 | match node with 400 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.AttributeTargetSyntax as node -> 401 | Some (node.AttributeModifier, node.ColonToken) 402 | | _ -> None 403 | 404 | let (|AttributesStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 405 | match node with 406 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.AttributesStatementSyntax as node -> 407 | Some (node.AttributeLists |> Seq.toList) 408 | | _ -> None 409 | 410 | let (|ExpressionStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 411 | match node with 412 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ExpressionStatementSyntax as node -> 413 | Some (node.Expression) 414 | | _ -> None 415 | 416 | let (|PrintStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 417 | match node with 418 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.PrintStatementSyntax as node -> 419 | Some (node.QuestionToken, node.Expression) 420 | | _ -> None 421 | 422 | let (|WhileBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 423 | match node with 424 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.WhileBlockSyntax as node -> 425 | Some (node.WhileStatement, node.Statements |> Seq.toList, node.EndWhileStatement) 426 | | _ -> None 427 | 428 | let (|UsingBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 429 | match node with 430 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.UsingBlockSyntax as node -> 431 | Some (node.UsingStatement, node.Statements |> Seq.toList, node.EndUsingStatement) 432 | | _ -> None 433 | 434 | let (|SyncLockBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 435 | match node with 436 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.SyncLockBlockSyntax as node -> 437 | Some (node.SyncLockStatement, node.Statements |> Seq.toList, node.EndSyncLockStatement) 438 | | _ -> None 439 | 440 | let (|WithBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 441 | match node with 442 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.WithBlockSyntax as node -> 443 | Some (node.WithStatement, node.Statements |> Seq.toList, node.EndWithStatement) 444 | | _ -> None 445 | 446 | let (|LabelStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 447 | match node with 448 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.LabelStatementSyntax as node -> 449 | Some (node.LabelToken, node.ColonToken) 450 | | _ -> None 451 | 452 | let (|GoToStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 453 | match node with 454 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.GoToStatementSyntax as node -> 455 | Some (node.GoToKeyword, node.Label) 456 | | _ -> None 457 | 458 | let (|Label|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 459 | match node with 460 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.LabelSyntax as node -> 461 | Some (node.LabelToken) 462 | | _ -> None 463 | 464 | let (|StopOrEndStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 465 | match node with 466 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.StopOrEndStatementSyntax as node -> 467 | Some (node.StopOrEndKeyword) 468 | | _ -> None 469 | 470 | let (|ExitStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 471 | match node with 472 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ExitStatementSyntax as node -> 473 | Some (node.ExitKeyword, node.BlockKeyword) 474 | | _ -> None 475 | 476 | let (|ContinueStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 477 | match node with 478 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ContinueStatementSyntax as node -> 479 | Some (node.ContinueKeyword, node.BlockKeyword) 480 | | _ -> None 481 | 482 | let (|ReturnStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 483 | match node with 484 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ReturnStatementSyntax as node -> 485 | Some (node.ReturnKeyword, node.Expression) 486 | | _ -> None 487 | 488 | let (|SingleLineIfStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 489 | match node with 490 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.SingleLineIfStatementSyntax as node -> 491 | Some (node.IfKeyword, node.Condition, node.ThenKeyword, node.Statements |> Seq.toList, node.ElseClause) 492 | | _ -> None 493 | 494 | let (|SingleLineElseClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 495 | match node with 496 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.SingleLineElseClauseSyntax as node -> 497 | Some (node.ElseKeyword, node.Statements |> Seq.toList) 498 | | _ -> None 499 | 500 | let (|MultiLineIfBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 501 | match node with 502 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.MultiLineIfBlockSyntax as node -> 503 | Some (node.IfStatement, node.Statements |> Seq.toList, node.ElseIfBlocks |> Seq.toList, node.ElseBlock, node.EndIfStatement) 504 | | _ -> None 505 | 506 | let (|IfStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 507 | match node with 508 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.IfStatementSyntax as node -> 509 | Some (node.IfKeyword, node.Condition, node.ThenKeyword) 510 | | _ -> None 511 | 512 | let (|ElseIfBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 513 | match node with 514 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ElseIfBlockSyntax as node -> 515 | Some (node.ElseIfStatement, node.Statements |> Seq.toList) 516 | | _ -> None 517 | 518 | let (|ElseIfStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 519 | match node with 520 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ElseIfStatementSyntax as node -> 521 | Some (node.ElseIfKeyword, node.Condition, node.ThenKeyword) 522 | | _ -> None 523 | 524 | let (|ElseBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 525 | match node with 526 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ElseBlockSyntax as node -> 527 | Some (node.ElseStatement, node.Statements |> Seq.toList) 528 | | _ -> None 529 | 530 | let (|ElseStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 531 | match node with 532 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ElseStatementSyntax as node -> 533 | Some (node.ElseKeyword) 534 | | _ -> None 535 | 536 | let (|TryBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 537 | match node with 538 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.TryBlockSyntax as node -> 539 | Some (node.TryStatement, node.Statements |> Seq.toList, node.CatchBlocks |> Seq.toList, node.FinallyBlock, node.EndTryStatement) 540 | | _ -> None 541 | 542 | let (|TryStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 543 | match node with 544 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.TryStatementSyntax as node -> 545 | Some (node.TryKeyword) 546 | | _ -> None 547 | 548 | let (|CatchBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 549 | match node with 550 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.CatchBlockSyntax as node -> 551 | Some (node.CatchStatement, node.Statements |> Seq.toList) 552 | | _ -> None 553 | 554 | let (|CatchStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 555 | match node with 556 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.CatchStatementSyntax as node -> 557 | Some (node.CatchKeyword, node.IdentifierName, node.AsClause, node.WhenClause) 558 | | _ -> None 559 | 560 | let (|CatchFilterClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 561 | match node with 562 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.CatchFilterClauseSyntax as node -> 563 | Some (node.WhenKeyword, node.Filter) 564 | | _ -> None 565 | 566 | let (|FinallyBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 567 | match node with 568 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.FinallyBlockSyntax as node -> 569 | Some (node.FinallyStatement, node.Statements |> Seq.toList) 570 | | _ -> None 571 | 572 | let (|FinallyStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 573 | match node with 574 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.FinallyStatementSyntax as node -> 575 | Some (node.FinallyKeyword) 576 | | _ -> None 577 | 578 | let (|ErrorStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 579 | match node with 580 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ErrorStatementSyntax as node -> 581 | Some (node.ErrorKeyword, node.ErrorNumber) 582 | | _ -> None 583 | 584 | let (|OnErrorGoToStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 585 | match node with 586 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.OnErrorGoToStatementSyntax as node -> 587 | Some (node.OnKeyword, node.ErrorKeyword, node.GoToKeyword, node.Minus, node.Label) 588 | | _ -> None 589 | 590 | let (|OnErrorResumeNextStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 591 | match node with 592 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.OnErrorResumeNextStatementSyntax as node -> 593 | Some (node.OnKeyword, node.ErrorKeyword, node.ResumeKeyword, node.NextKeyword) 594 | | _ -> None 595 | 596 | let (|ResumeStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 597 | match node with 598 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ResumeStatementSyntax as node -> 599 | Some (node.ResumeKeyword, node.Label) 600 | | _ -> None 601 | 602 | let (|SelectBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 603 | match node with 604 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.SelectBlockSyntax as node -> 605 | Some (node.SelectStatement, node.CaseBlocks |> Seq.toList, node.EndSelectStatement) 606 | | _ -> None 607 | 608 | let (|SelectStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 609 | match node with 610 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.SelectStatementSyntax as node -> 611 | Some (node.SelectKeyword, node.CaseKeyword, node.Expression) 612 | | _ -> None 613 | 614 | let (|CaseBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 615 | match node with 616 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.CaseBlockSyntax as node -> 617 | Some (node.CaseStatement, node.Statements |> Seq.toList) 618 | | _ -> None 619 | 620 | let (|CaseStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 621 | match node with 622 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.CaseStatementSyntax as node -> 623 | Some (node.CaseKeyword) 624 | | _ -> None 625 | 626 | let (|ElseCaseClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 627 | match node with 628 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ElseCaseClauseSyntax as node -> 629 | Some (node.ElseKeyword) 630 | | _ -> None 631 | 632 | let (|SimpleCaseClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 633 | match node with 634 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.SimpleCaseClauseSyntax as node -> 635 | Some (node.Value) 636 | | _ -> None 637 | 638 | let (|RangeCaseClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 639 | match node with 640 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.RangeCaseClauseSyntax as node -> 641 | Some (node.LowerBound, node.ToKeyword, node.UpperBound) 642 | | _ -> None 643 | 644 | let (|RelationalCaseClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 645 | match node with 646 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.RelationalCaseClauseSyntax as node -> 647 | Some (node.IsKeyword, node.OperatorToken, node.Value) 648 | | _ -> None 649 | 650 | let (|SyncLockStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 651 | match node with 652 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.SyncLockStatementSyntax as node -> 653 | Some (node.SyncLockKeyword, node.Expression) 654 | | _ -> None 655 | 656 | let (|DoLoopBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 657 | match node with 658 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.DoLoopBlockSyntax as node -> 659 | Some (node.DoStatement, node.Statements |> Seq.toList, node.LoopStatement) 660 | | _ -> None 661 | 662 | let (|DoStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 663 | match node with 664 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.DoStatementSyntax as node -> 665 | Some (node.DoKeyword, node.WhileOrUntilClause) 666 | | _ -> None 667 | 668 | let (|LoopStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 669 | match node with 670 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.LoopStatementSyntax as node -> 671 | Some (node.LoopKeyword, node.WhileOrUntilClause) 672 | | _ -> None 673 | 674 | let (|WhileOrUntilClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 675 | match node with 676 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.WhileOrUntilClauseSyntax as node -> 677 | Some (node.WhileOrUntilKeyword, node.Condition) 678 | | _ -> None 679 | 680 | let (|WhileStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 681 | match node with 682 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.WhileStatementSyntax as node -> 683 | Some (node.WhileKeyword, node.Condition) 684 | | _ -> None 685 | 686 | let (|ForBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 687 | match node with 688 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ForBlockSyntax as node -> 689 | Some (node.ForStatement, node.Statements |> Seq.toList, node.NextStatement, node.ForOrForEachStatement) 690 | | _ -> None 691 | 692 | let (|ForEachBlock|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 693 | match node with 694 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ForEachBlockSyntax as node -> 695 | Some (node.ForEachStatement, node.Statements |> Seq.toList, node.NextStatement, node.ForOrForEachStatement) 696 | | _ -> None 697 | 698 | let (|ForStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 699 | match node with 700 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ForStatementSyntax as node -> 701 | Some (node.ForKeyword, node.ControlVariable, node.EqualsToken, node.FromValue, node.ToKeyword, node.ToValue, node.StepClause) 702 | | _ -> None 703 | 704 | let (|ForStepClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 705 | match node with 706 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ForStepClauseSyntax as node -> 707 | Some (node.StepKeyword, node.StepValue) 708 | | _ -> None 709 | 710 | let (|ForEachStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 711 | match node with 712 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ForEachStatementSyntax as node -> 713 | Some (node.ForKeyword, node.EachKeyword, node.ControlVariable, node.InKeyword, node.Expression) 714 | | _ -> None 715 | 716 | let (|NextStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 717 | match node with 718 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.NextStatementSyntax as node -> 719 | Some (node.NextKeyword) 720 | | _ -> None 721 | 722 | let (|UsingStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 723 | match node with 724 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.UsingStatementSyntax as node -> 725 | Some (node.UsingKeyword, node.Expression) 726 | | _ -> None 727 | 728 | let (|ThrowStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 729 | match node with 730 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ThrowStatementSyntax as node -> 731 | Some (node.ThrowKeyword, node.Expression) 732 | | _ -> None 733 | 734 | let (|AssignmentStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 735 | match node with 736 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.AssignmentStatementSyntax as node -> 737 | Some (node.Left, node.OperatorToken, node.Right) 738 | | _ -> None 739 | 740 | let (|MidExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 741 | match node with 742 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.MidExpressionSyntax as node -> 743 | Some (node.Mid, node.ArgumentList) 744 | | _ -> None 745 | 746 | let (|CallStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 747 | match node with 748 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.CallStatementSyntax as node -> 749 | Some (node.CallKeyword, node.Invocation) 750 | | _ -> None 751 | 752 | let (|AddRemoveHandlerStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 753 | match node with 754 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.AddRemoveHandlerStatementSyntax as node -> 755 | Some (node.AddHandlerOrRemoveHandlerKeyword, node.EventExpression, node.CommaToken, node.DelegateExpression) 756 | | _ -> None 757 | 758 | let (|RaiseEventStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 759 | match node with 760 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.RaiseEventStatementSyntax as node -> 761 | Some (node.RaiseEventKeyword, node.Name, node.ArgumentList) 762 | | _ -> None 763 | 764 | let (|WithStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 765 | match node with 766 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.WithStatementSyntax as node -> 767 | Some (node.WithKeyword, node.Expression) 768 | | _ -> None 769 | 770 | let (|ReDimStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 771 | match node with 772 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ReDimStatementSyntax as node -> 773 | Some (node.ReDimKeyword, node.PreserveKeyword) 774 | | _ -> None 775 | 776 | let (|RedimClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 777 | match node with 778 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.RedimClauseSyntax as node -> 779 | Some (node.Expression, node.ArrayBounds) 780 | | _ -> None 781 | 782 | let (|EraseStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 783 | match node with 784 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.EraseStatementSyntax as node -> 785 | Some (node.EraseKeyword) 786 | | _ -> None 787 | 788 | let (|LiteralExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 789 | match node with 790 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.LiteralExpressionSyntax as node -> 791 | Some (node.Token) 792 | | _ -> None 793 | 794 | let (|ParenthesizedExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 795 | match node with 796 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ParenthesizedExpressionSyntax as node -> 797 | Some (node.OpenParenToken, node.Expression, node.CloseParenToken) 798 | | _ -> None 799 | 800 | let (|TupleExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 801 | match node with 802 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.TupleExpressionSyntax as node -> 803 | Some (node.OpenParenToken, node.CloseParenToken) 804 | | _ -> None 805 | 806 | let (|TupleType|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 807 | match node with 808 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.TupleTypeSyntax as node -> 809 | Some (node.OpenParenToken, node.CloseParenToken) 810 | | _ -> None 811 | 812 | let (|TypedTupleElement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 813 | match node with 814 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.TypedTupleElementSyntax as node -> 815 | Some (node.Type) 816 | | _ -> None 817 | 818 | let (|NamedTupleElement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 819 | match node with 820 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.NamedTupleElementSyntax as node -> 821 | Some (node.Identifier, node.AsClause) 822 | | _ -> None 823 | 824 | let (|MeExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 825 | match node with 826 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.MeExpressionSyntax as node -> 827 | Some (node.Keyword) 828 | | _ -> None 829 | 830 | let (|MyBaseExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 831 | match node with 832 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.MyBaseExpressionSyntax as node -> 833 | Some (node.Keyword) 834 | | _ -> None 835 | 836 | let (|MyClassExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 837 | match node with 838 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.MyClassExpressionSyntax as node -> 839 | Some (node.Keyword) 840 | | _ -> None 841 | 842 | let (|GetTypeExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 843 | match node with 844 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.GetTypeExpressionSyntax as node -> 845 | Some (node.GetTypeKeyword, node.OpenParenToken, node.Type, node.CloseParenToken) 846 | | _ -> None 847 | 848 | let (|TypeOfExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 849 | match node with 850 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.TypeOfExpressionSyntax as node -> 851 | Some (node.TypeOfKeyword, node.Expression, node.OperatorToken, node.Type) 852 | | _ -> None 853 | 854 | let (|GetXmlNamespaceExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 855 | match node with 856 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.GetXmlNamespaceExpressionSyntax as node -> 857 | Some (node.GetXmlNamespaceKeyword, node.OpenParenToken, node.Name, node.CloseParenToken) 858 | | _ -> None 859 | 860 | let (|MemberAccessExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 861 | match node with 862 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.MemberAccessExpressionSyntax as node -> 863 | Some (node.Expression, node.OperatorToken, node.Name) 864 | | _ -> None 865 | 866 | let (|XmlMemberAccessExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 867 | match node with 868 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.XmlMemberAccessExpressionSyntax as node -> 869 | Some (node.Base, node.Token1, node.Token2, node.Token3, node.Name) 870 | | _ -> None 871 | 872 | let (|InvocationExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 873 | match node with 874 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.InvocationExpressionSyntax as node -> 875 | Some (node.Expression, node.ArgumentList) 876 | | _ -> None 877 | 878 | let (|ObjectCreationExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 879 | match node with 880 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ObjectCreationExpressionSyntax as node -> 881 | Some (node.NewKeyword, node.AttributeLists |> Seq.toList, node.Type, node.ArgumentList, node.Initializer) 882 | | _ -> None 883 | 884 | let (|AnonymousObjectCreationExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 885 | match node with 886 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.AnonymousObjectCreationExpressionSyntax as node -> 887 | Some (node.NewKeyword, node.AttributeLists |> Seq.toList, node.Initializer) 888 | | _ -> None 889 | 890 | let (|ArrayCreationExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 891 | match node with 892 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ArrayCreationExpressionSyntax as node -> 893 | Some (node.NewKeyword, node.AttributeLists |> Seq.toList, node.Type, node.ArrayBounds, node.RankSpecifiers |> Seq.toList, node.Initializer) 894 | | _ -> None 895 | 896 | let (|CollectionInitializer|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 897 | match node with 898 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.CollectionInitializerSyntax as node -> 899 | Some (node.OpenBraceToken, node.CloseBraceToken) 900 | | _ -> None 901 | 902 | let (|CTypeExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 903 | match node with 904 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.CTypeExpressionSyntax as node -> 905 | Some (node.Keyword, node.OpenParenToken, node.Expression, node.CommaToken, node.Type, node.CloseParenToken) 906 | | _ -> None 907 | 908 | let (|DirectCastExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 909 | match node with 910 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.DirectCastExpressionSyntax as node -> 911 | Some (node.Keyword, node.OpenParenToken, node.Expression, node.CommaToken, node.Type, node.CloseParenToken) 912 | | _ -> None 913 | 914 | let (|TryCastExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 915 | match node with 916 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.TryCastExpressionSyntax as node -> 917 | Some (node.Keyword, node.OpenParenToken, node.Expression, node.CommaToken, node.Type, node.CloseParenToken) 918 | | _ -> None 919 | 920 | let (|PredefinedCastExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 921 | match node with 922 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.PredefinedCastExpressionSyntax as node -> 923 | Some (node.Keyword, node.OpenParenToken, node.Expression, node.CloseParenToken) 924 | | _ -> None 925 | 926 | let (|BinaryExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 927 | match node with 928 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.BinaryExpressionSyntax as node -> 929 | Some (node.Left, node.OperatorToken, node.Right) 930 | | _ -> None 931 | 932 | let (|UnaryExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 933 | match node with 934 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.UnaryExpressionSyntax as node -> 935 | Some (node.OperatorToken, node.Operand) 936 | | _ -> None 937 | 938 | let (|BinaryConditionalExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 939 | match node with 940 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.BinaryConditionalExpressionSyntax as node -> 941 | Some (node.IfKeyword, node.OpenParenToken, node.FirstExpression, node.CommaToken, node.SecondExpression, node.CloseParenToken) 942 | | _ -> None 943 | 944 | let (|TernaryConditionalExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 945 | match node with 946 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.TernaryConditionalExpressionSyntax as node -> 947 | Some (node.IfKeyword, node.OpenParenToken, node.Condition, node.FirstCommaToken, node.WhenTrue, node.SecondCommaToken, node.WhenFalse, node.CloseParenToken) 948 | | _ -> None 949 | 950 | let (|SingleLineLambdaExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 951 | match node with 952 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.SingleLineLambdaExpressionSyntax as node -> 953 | Some (node.SubOrFunctionHeader, node.Body) 954 | | _ -> None 955 | 956 | let (|MultiLineLambdaExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 957 | match node with 958 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.MultiLineLambdaExpressionSyntax as node -> 959 | Some (node.SubOrFunctionHeader, node.Statements |> Seq.toList, node.EndSubOrFunctionStatement) 960 | | _ -> None 961 | 962 | let (|LambdaHeader|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 963 | match node with 964 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.LambdaHeaderSyntax as node -> 965 | Some (node.AttributeLists |> Seq.toList, node.SubOrFunctionKeyword, node.ParameterList, node.AsClause, node.DeclarationKeyword) 966 | | _ -> None 967 | 968 | let (|ArgumentList|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 969 | match node with 970 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ArgumentListSyntax as node -> 971 | Some (node.OpenParenToken, node.CloseParenToken) 972 | | _ -> None 973 | 974 | let (|OmittedArgument|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 975 | match node with 976 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.OmittedArgumentSyntax as node -> 977 | Some (node.Empty, node.IsNamed) 978 | | _ -> None 979 | 980 | let (|SimpleArgument|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 981 | match node with 982 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.SimpleArgumentSyntax as node -> 983 | Some (node.NameColonEquals, node.Expression, node.IsNamed) 984 | | _ -> None 985 | 986 | let (|NameColonEquals|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 987 | match node with 988 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.NameColonEqualsSyntax as node -> 989 | Some (node.Name, node.ColonEqualsToken) 990 | | _ -> None 991 | 992 | let (|RangeArgument|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 993 | match node with 994 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.RangeArgumentSyntax as node -> 995 | Some (node.LowerBound, node.ToKeyword, node.UpperBound, node.IsNamed) 996 | | _ -> None 997 | 998 | let (|QueryExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 999 | match node with 1000 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.QueryExpressionSyntax as node -> 1001 | Some (node.Clauses |> Seq.toList) 1002 | | _ -> None 1003 | 1004 | let (|CollectionRangeVariable|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1005 | match node with 1006 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.CollectionRangeVariableSyntax as node -> 1007 | Some (node.Identifier, node.AsClause, node.InKeyword, node.Expression) 1008 | | _ -> None 1009 | 1010 | let (|ExpressionRangeVariable|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1011 | match node with 1012 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ExpressionRangeVariableSyntax as node -> 1013 | Some (node.NameEquals, node.Expression) 1014 | | _ -> None 1015 | 1016 | let (|AggregationRangeVariable|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1017 | match node with 1018 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.AggregationRangeVariableSyntax as node -> 1019 | Some (node.NameEquals, node.Aggregation) 1020 | | _ -> None 1021 | 1022 | let (|VariableNameEquals|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1023 | match node with 1024 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.VariableNameEqualsSyntax as node -> 1025 | Some (node.Identifier, node.AsClause, node.EqualsToken) 1026 | | _ -> None 1027 | 1028 | let (|FunctionAggregation|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1029 | match node with 1030 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.FunctionAggregationSyntax as node -> 1031 | Some (node.FunctionName, node.OpenParenToken, node.Argument, node.CloseParenToken) 1032 | | _ -> None 1033 | 1034 | let (|GroupAggregation|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1035 | match node with 1036 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.GroupAggregationSyntax as node -> 1037 | Some (node.GroupKeyword) 1038 | | _ -> None 1039 | 1040 | let (|FromClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1041 | match node with 1042 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.FromClauseSyntax as node -> 1043 | Some (node.FromKeyword) 1044 | | _ -> None 1045 | 1046 | let (|LetClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1047 | match node with 1048 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.LetClauseSyntax as node -> 1049 | Some (node.LetKeyword) 1050 | | _ -> None 1051 | 1052 | let (|AggregateClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1053 | match node with 1054 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.AggregateClauseSyntax as node -> 1055 | Some (node.AggregateKeyword, node.AdditionalQueryOperators |> Seq.toList, node.IntoKeyword) 1056 | | _ -> None 1057 | 1058 | let (|DistinctClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1059 | match node with 1060 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.DistinctClauseSyntax as node -> 1061 | Some (node.DistinctKeyword) 1062 | | _ -> None 1063 | 1064 | let (|WhereClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1065 | match node with 1066 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.WhereClauseSyntax as node -> 1067 | Some (node.WhereKeyword, node.Condition) 1068 | | _ -> None 1069 | 1070 | let (|PartitionWhileClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1071 | match node with 1072 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.PartitionWhileClauseSyntax as node -> 1073 | Some (node.SkipOrTakeKeyword, node.WhileKeyword, node.Condition) 1074 | | _ -> None 1075 | 1076 | let (|PartitionClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1077 | match node with 1078 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.PartitionClauseSyntax as node -> 1079 | Some (node.SkipOrTakeKeyword, node.Count) 1080 | | _ -> None 1081 | 1082 | let (|GroupByClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1083 | match node with 1084 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.GroupByClauseSyntax as node -> 1085 | Some (node.GroupKeyword, node.ByKeyword, node.IntoKeyword) 1086 | | _ -> None 1087 | 1088 | let (|JoinCondition|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1089 | match node with 1090 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.JoinConditionSyntax as node -> 1091 | Some (node.Left, node.EqualsKeyword, node.Right) 1092 | | _ -> None 1093 | 1094 | let (|SimpleJoinClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1095 | match node with 1096 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.SimpleJoinClauseSyntax as node -> 1097 | Some (node.JoinKeyword, node.AdditionalJoins |> Seq.toList, node.OnKeyword) 1098 | | _ -> None 1099 | 1100 | let (|GroupJoinClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1101 | match node with 1102 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.GroupJoinClauseSyntax as node -> 1103 | Some (node.GroupKeyword, node.JoinKeyword, node.AdditionalJoins |> Seq.toList, node.OnKeyword, node.IntoKeyword) 1104 | | _ -> None 1105 | 1106 | let (|OrderByClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1107 | match node with 1108 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.OrderByClauseSyntax as node -> 1109 | Some (node.OrderKeyword, node.ByKeyword) 1110 | | _ -> None 1111 | 1112 | let (|Ordering|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1113 | match node with 1114 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.OrderingSyntax as node -> 1115 | Some (node.Expression, node.AscendingOrDescendingKeyword) 1116 | | _ -> None 1117 | 1118 | let (|SelectClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1119 | match node with 1120 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.SelectClauseSyntax as node -> 1121 | Some (node.SelectKeyword) 1122 | | _ -> None 1123 | 1124 | let (|XmlDocument|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1125 | match node with 1126 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.XmlDocumentSyntax as node -> 1127 | Some (node.Declaration, node.PrecedingMisc |> Seq.toList, node.Root, node.FollowingMisc |> Seq.toList) 1128 | | _ -> None 1129 | 1130 | let (|XmlDeclaration|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1131 | match node with 1132 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.XmlDeclarationSyntax as node -> 1133 | Some (node.LessThanQuestionToken, node.XmlKeyword, node.Version, node.Encoding, node.Standalone, node.QuestionGreaterThanToken) 1134 | | _ -> None 1135 | 1136 | let (|XmlDeclarationOption|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1137 | match node with 1138 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.XmlDeclarationOptionSyntax as node -> 1139 | Some (node.Name, node.Equals, node.Value) 1140 | | _ -> None 1141 | 1142 | let (|XmlElement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1143 | match node with 1144 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.XmlElementSyntax as node -> 1145 | Some (node.StartTag, node.Content |> Seq.toList, node.EndTag) 1146 | | _ -> None 1147 | 1148 | let (|XmlElementStartTag|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1149 | match node with 1150 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.XmlElementStartTagSyntax as node -> 1151 | Some (node.LessThanToken, node.Name, node.Attributes |> Seq.toList, node.GreaterThanToken) 1152 | | _ -> None 1153 | 1154 | let (|XmlElementEndTag|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1155 | match node with 1156 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.XmlElementEndTagSyntax as node -> 1157 | Some (node.LessThanSlashToken, node.Name, node.GreaterThanToken) 1158 | | _ -> None 1159 | 1160 | let (|XmlEmptyElement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1161 | match node with 1162 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.XmlEmptyElementSyntax as node -> 1163 | Some (node.LessThanToken, node.Name, node.Attributes |> Seq.toList, node.SlashGreaterThanToken) 1164 | | _ -> None 1165 | 1166 | let (|XmlAttribute|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1167 | match node with 1168 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.XmlAttributeSyntax as node -> 1169 | Some (node.Name, node.EqualsToken, node.Value) 1170 | | _ -> None 1171 | 1172 | let (|XmlString|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1173 | match node with 1174 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.XmlStringSyntax as node -> 1175 | Some (node.StartQuoteToken, node.EndQuoteToken) 1176 | | _ -> None 1177 | 1178 | let (|XmlPrefixName|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1179 | match node with 1180 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.XmlPrefixNameSyntax as node -> 1181 | Some (node.Name) 1182 | | _ -> None 1183 | 1184 | let (|XmlName|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1185 | match node with 1186 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.XmlNameSyntax as node -> 1187 | Some (node.Prefix, node.LocalName) 1188 | | _ -> None 1189 | 1190 | let (|XmlBracketedName|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1191 | match node with 1192 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.XmlBracketedNameSyntax as node -> 1193 | Some (node.LessThanToken, node.Name, node.GreaterThanToken) 1194 | | _ -> None 1195 | 1196 | let (|XmlPrefix|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1197 | match node with 1198 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.XmlPrefixSyntax as node -> 1199 | Some (node.Name, node.ColonToken) 1200 | | _ -> None 1201 | 1202 | let (|XmlComment|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1203 | match node with 1204 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.XmlCommentSyntax as node -> 1205 | Some (node.LessThanExclamationMinusMinusToken, node.MinusMinusGreaterThanToken) 1206 | | _ -> None 1207 | 1208 | let (|XmlProcessingInstruction|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1209 | match node with 1210 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.XmlProcessingInstructionSyntax as node -> 1211 | Some (node.LessThanQuestionToken, node.Name, node.QuestionGreaterThanToken) 1212 | | _ -> None 1213 | 1214 | let (|XmlCDataSection|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1215 | match node with 1216 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.XmlCDataSectionSyntax as node -> 1217 | Some (node.BeginCDataToken, node.EndCDataToken) 1218 | | _ -> None 1219 | 1220 | let (|XmlEmbeddedExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1221 | match node with 1222 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.XmlEmbeddedExpressionSyntax as node -> 1223 | Some (node.LessThanPercentEqualsToken, node.Expression, node.PercentGreaterThanToken) 1224 | | _ -> None 1225 | 1226 | let (|ArrayType|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1227 | match node with 1228 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ArrayTypeSyntax as node -> 1229 | Some (node.ElementType, node.RankSpecifiers |> Seq.toList) 1230 | | _ -> None 1231 | 1232 | let (|NullableType|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1233 | match node with 1234 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.NullableTypeSyntax as node -> 1235 | Some (node.ElementType, node.QuestionMarkToken) 1236 | | _ -> None 1237 | 1238 | let (|PredefinedType|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1239 | match node with 1240 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.PredefinedTypeSyntax as node -> 1241 | Some (node.Keyword) 1242 | | _ -> None 1243 | 1244 | let (|IdentifierName|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1245 | match node with 1246 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.IdentifierNameSyntax as node -> 1247 | Some (node.Identifier) 1248 | | _ -> None 1249 | 1250 | let (|GenericName|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1251 | match node with 1252 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.GenericNameSyntax as node -> 1253 | Some (node.Identifier, node.TypeArgumentList) 1254 | | _ -> None 1255 | 1256 | let (|QualifiedName|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1257 | match node with 1258 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.QualifiedNameSyntax as node -> 1259 | Some (node.Left, node.DotToken, node.Right) 1260 | | _ -> None 1261 | 1262 | let (|GlobalName|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1263 | match node with 1264 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.GlobalNameSyntax as node -> 1265 | Some (node.GlobalKeyword) 1266 | | _ -> None 1267 | 1268 | let (|TypeArgumentList|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1269 | match node with 1270 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.TypeArgumentListSyntax as node -> 1271 | Some (node.OpenParenToken, node.OfKeyword, node.CloseParenToken) 1272 | | _ -> None 1273 | 1274 | let (|CrefReference|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1275 | match node with 1276 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.CrefReferenceSyntax as node -> 1277 | Some (node.Name, node.Signature, node.AsClause) 1278 | | _ -> None 1279 | 1280 | let (|CrefSignature|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1281 | match node with 1282 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.CrefSignatureSyntax as node -> 1283 | Some (node.OpenParenToken, node.CloseParenToken) 1284 | | _ -> None 1285 | 1286 | let (|CrefSignaturePart|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1287 | match node with 1288 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.CrefSignaturePartSyntax as node -> 1289 | Some (node.Modifier, node.Type) 1290 | | _ -> None 1291 | 1292 | let (|CrefOperatorReference|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1293 | match node with 1294 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.CrefOperatorReferenceSyntax as node -> 1295 | Some (node.OperatorKeyword, node.OperatorToken) 1296 | | _ -> None 1297 | 1298 | let (|QualifiedCrefOperatorReference|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1299 | match node with 1300 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.QualifiedCrefOperatorReferenceSyntax as node -> 1301 | Some (node.Left, node.DotToken, node.Right) 1302 | | _ -> None 1303 | 1304 | let (|YieldStatement|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1305 | match node with 1306 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.YieldStatementSyntax as node -> 1307 | Some (node.YieldKeyword, node.Expression) 1308 | | _ -> None 1309 | 1310 | let (|AwaitExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1311 | match node with 1312 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.AwaitExpressionSyntax as node -> 1313 | Some (node.AwaitKeyword, node.Expression) 1314 | | _ -> None 1315 | 1316 | let (|DocumentationCommentTrivia|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1317 | match node with 1318 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.DocumentationCommentTriviaSyntax as node -> 1319 | Some (node.Content |> Seq.toList) 1320 | | _ -> None 1321 | 1322 | let (|XmlCrefAttribute|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1323 | match node with 1324 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.XmlCrefAttributeSyntax as node -> 1325 | Some (node.Name, node.EqualsToken, node.StartQuoteToken, node.Reference, node.EndQuoteToken) 1326 | | _ -> None 1327 | 1328 | let (|XmlNameAttribute|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1329 | match node with 1330 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.XmlNameAttributeSyntax as node -> 1331 | Some (node.Name, node.EqualsToken, node.StartQuoteToken, node.Reference, node.EndQuoteToken) 1332 | | _ -> None 1333 | 1334 | let (|ConditionalAccessExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1335 | match node with 1336 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ConditionalAccessExpressionSyntax as node -> 1337 | Some (node.Expression, node.QuestionMarkToken, node.WhenNotNull) 1338 | | _ -> None 1339 | 1340 | let (|NameOfExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1341 | match node with 1342 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.NameOfExpressionSyntax as node -> 1343 | Some (node.NameOfKeyword, node.OpenParenToken, node.Argument, node.CloseParenToken) 1344 | | _ -> None 1345 | 1346 | let (|InterpolatedStringExpression|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1347 | match node with 1348 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.InterpolatedStringExpressionSyntax as node -> 1349 | Some (node.DollarSignDoubleQuoteToken, node.Contents |> Seq.toList, node.DoubleQuoteToken) 1350 | | _ -> None 1351 | 1352 | let (|InterpolatedStringText|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1353 | match node with 1354 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.InterpolatedStringTextSyntax as node -> 1355 | Some (node.TextToken) 1356 | | _ -> None 1357 | 1358 | let (|Interpolation|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1359 | match node with 1360 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.InterpolationSyntax as node -> 1361 | Some (node.OpenBraceToken, node.Expression, node.AlignmentClause, node.FormatClause, node.CloseBraceToken) 1362 | | _ -> None 1363 | 1364 | let (|InterpolationAlignmentClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1365 | match node with 1366 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.InterpolationAlignmentClauseSyntax as node -> 1367 | Some (node.CommaToken, node.Value) 1368 | | _ -> None 1369 | 1370 | let (|InterpolationFormatClause|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1371 | match node with 1372 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.InterpolationFormatClauseSyntax as node -> 1373 | Some (node.ColonToken, node.FormatStringToken) 1374 | | _ -> None 1375 | 1376 | let (|ConstDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1377 | match node with 1378 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ConstDirectiveTriviaSyntax as node -> 1379 | Some (node.HashToken, node.ConstKeyword, node.Name, node.EqualsToken, node.Value) 1380 | | _ -> None 1381 | 1382 | let (|IfDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1383 | match node with 1384 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.IfDirectiveTriviaSyntax as node -> 1385 | Some (node.HashToken, node.ElseKeyword, node.IfOrElseIfKeyword, node.Condition, node.ThenKeyword) 1386 | | _ -> None 1387 | 1388 | let (|ElseDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1389 | match node with 1390 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ElseDirectiveTriviaSyntax as node -> 1391 | Some (node.HashToken, node.ElseKeyword) 1392 | | _ -> None 1393 | 1394 | let (|EndIfDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1395 | match node with 1396 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.EndIfDirectiveTriviaSyntax as node -> 1397 | Some (node.HashToken, node.EndKeyword, node.IfKeyword) 1398 | | _ -> None 1399 | 1400 | let (|RegionDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1401 | match node with 1402 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.RegionDirectiveTriviaSyntax as node -> 1403 | Some (node.HashToken, node.RegionKeyword, node.Name) 1404 | | _ -> None 1405 | 1406 | let (|EndRegionDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1407 | match node with 1408 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.EndRegionDirectiveTriviaSyntax as node -> 1409 | Some (node.HashToken, node.EndKeyword, node.RegionKeyword) 1410 | | _ -> None 1411 | 1412 | let (|ExternalSourceDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1413 | match node with 1414 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ExternalSourceDirectiveTriviaSyntax as node -> 1415 | Some (node.HashToken, node.ExternalSourceKeyword, node.OpenParenToken, node.ExternalSource, node.CommaToken, node.LineStart, node.CloseParenToken) 1416 | | _ -> None 1417 | 1418 | let (|EndExternalSourceDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1419 | match node with 1420 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.EndExternalSourceDirectiveTriviaSyntax as node -> 1421 | Some (node.HashToken, node.EndKeyword, node.ExternalSourceKeyword) 1422 | | _ -> None 1423 | 1424 | let (|ExternalChecksumDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1425 | match node with 1426 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ExternalChecksumDirectiveTriviaSyntax as node -> 1427 | Some (node.HashToken, node.ExternalChecksumKeyword, node.OpenParenToken, node.ExternalSource, node.FirstCommaToken, node.Guid, node.SecondCommaToken, node.Checksum, node.CloseParenToken) 1428 | | _ -> None 1429 | 1430 | let (|EnableWarningDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1431 | match node with 1432 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.EnableWarningDirectiveTriviaSyntax as node -> 1433 | Some (node.HashToken, node.EnableKeyword, node.WarningKeyword) 1434 | | _ -> None 1435 | 1436 | let (|DisableWarningDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1437 | match node with 1438 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.DisableWarningDirectiveTriviaSyntax as node -> 1439 | Some (node.HashToken, node.DisableKeyword, node.WarningKeyword) 1440 | | _ -> None 1441 | 1442 | let (|ReferenceDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1443 | match node with 1444 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.ReferenceDirectiveTriviaSyntax as node -> 1445 | Some (node.HashToken, node.ReferenceKeyword, node.File) 1446 | | _ -> None 1447 | 1448 | let (|BadDirectiveTrivia|_|) (node:Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode) = 1449 | match node with 1450 | | :? Microsoft.CodeAnalysis.VisualBasic.Syntax.BadDirectiveTriviaSyntax as node -> 1451 | Some (node.HashToken) 1452 | | _ -> None 1453 | 1454 | -------------------------------------------------------------------------------- /Microsoft.CodeAnalysis.ActivePatterns/Strict/VisualBasicAdditionals.fs: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Microsoft.CodeAnalysis.ActivePatterns - F# Active pattern matching library for Roslyn 4 | // Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | ///////////////////////////////////////////////////////////////////////////// 19 | 20 | namespace Microsoft.CodeAnalysis.VisualBasic.Strict 21 | 22 | open Microsoft.CodeAnalysis 23 | open Microsoft.CodeAnalysis.VisualBasic 24 | 25 | [] 26 | module Additionals = 27 | 28 | let (|Identifier|_|) node : string list option = 29 | let rec matcher (node:VisualBasicSyntaxNode) = 30 | match node with 31 | | IdentifierName(Token(text)) -> 32 | Some [ text ] 33 | | QualifiedName(left, _, right) -> 34 | matcher left |> Option.bind(fun left -> matcher right |> Option.bind(fun right -> Some (List.append left right))) 35 | | _ -> 36 | None 37 | matcher node 38 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # F# Active pattern library for Roslyn Compiler Platform (C#, VB) 2 | 3 | "Microsoft.CodeAnalysis.ActivePatterns" is a F#'s active pattern functions library for [The .NET Compiler Platform ("Roslyn")](https://github.com/dotnet/roslyn) compiler platform. 4 | This library auguments for Roslyn AST (Abstract syntax tree nodes) types by F# active pattern functions. 5 | 6 | * This library still under construction... 7 | 8 | ## Status 9 | 10 | | Title | Status | 11 | |:----|:----| 12 | | NuGet | [![NuGet](https://img.shields.io/nuget/v/Microsoft.CodeAnalysis.ActivePatterns.svg?style=flat)](https://www.nuget.org/packages/Microsoft.CodeAnalysis.ActivePatterns) | 13 | 14 | ## Code example 15 | 16 | ### This code fragment for Roslyn analysis target: 17 | 18 | ```csharp 19 | using System.Collections.Generic; 20 | 21 | namespace SampleNamespace 22 | { 23 | public sealed class SampleClass 24 | { 25 | public SampleClass() 26 | { 27 | this.Value = System.DateTime.Now.Tick; 28 | } 29 | 30 | public long Value 31 | { 32 | get; 33 | set; 34 | } 35 | } 36 | } 37 | ``` 38 | 39 | ### This code fragment for Roslyn using C#: 40 | 41 | ```csharp 42 | using System.IO; 43 | using System.Linq; 44 | using System.Reflection; 45 | using System.Text; 46 | using Microsoft.CodeAnalysis.CSharp; 47 | using Microsoft.CodeAnalysis.CSharp.Syntax; 48 | 49 | /// Code fragments are how to analysis by Roslyn and C#. 50 | /// (These are not better and rough codes, but maybe longer analysis codes by using C#...) 51 | namespace csharp_sample 52 | { 53 | static class Program 54 | { 55 | private static string ReadSampleCode() 56 | { 57 | using (var fs = Assembly.GetEntryAssembly().GetManifestResourceStream("csharp_standard_usage_sample.Sample.cs")) 58 | { 59 | var tr = new StreamReader(fs, Encoding.UTF8); 60 | return tr.ReadToEnd(); 61 | } 62 | } 63 | 64 | private static string TraverseNameSyntax(NameSyntax name) 65 | { 66 | if (name is IdentifierNameSyntax idName) 67 | { 68 | return idName.Identifier.Text; 69 | } 70 | 71 | if (name is QualifiedNameSyntax qName) 72 | { 73 | return TraverseNameSyntax(qName.Left) + "." + TraverseNameSyntax(qName.Right); 74 | } 75 | 76 | return string.Empty; 77 | } 78 | 79 | static void Main(string[] args) 80 | { 81 | var sampleCode = ReadSampleCode(); 82 | 83 | var tree = (CSharpSyntaxTree) CSharpSyntaxTree.ParseText(sampleCode); 84 | var root = (CompilationUnitSyntax)tree.GetRoot(); 85 | 86 | // Too complex if we have to analyze roslyn AST using C#... 87 | 88 | if (root.Usings.Any(u => 89 | { 90 | var name = TraverseNameSyntax(u.Name); 91 | return name == "System.Collections.Generic"; 92 | })) 93 | { 94 | if (root.Members.Any(m => 95 | { 96 | if (m is NamespaceDeclarationSyntax nameDecl) 97 | { 98 | if (nameDecl.Name is IdentifierNameSyntax name) 99 | { 100 | if (name.Identifier.Text == "SampleNamespace") 101 | { 102 | if (nameDecl.Members.Any(m2 => 103 | { 104 | if (m2 is ClassDeclarationSyntax classDecl) 105 | { 106 | var name2 = classDecl.Identifier.Text; 107 | if (name2 == "SampleClass") 108 | { 109 | return true; 110 | } 111 | } 112 | return false; 113 | })) 114 | { 115 | // ... 116 | } 117 | } 118 | } 119 | } 120 | return false; 121 | })) 122 | { 123 | // ... 124 | } 125 | } 126 | } 127 | } 128 | } 129 | ``` 130 | 131 | ### If you are using for F# and this library: 132 | 133 | ```fsharp 134 | open System 135 | open System.IO 136 | open System.Reflection 137 | open System.Text 138 | 139 | open Microsoft.CodeAnalysis 140 | open Microsoft.CodeAnalysis.CSharp 141 | 142 | // This is a namespace for active pattern functions. 143 | open Microsoft.CodeAnalysis.CSharp.Strict 144 | 145 | [] 146 | let main argv = 147 | let sampleCode = 148 | use fs = Assembly.GetEntryAssembly().GetManifestResourceStream "Sample.cs" 149 | let tr = new StreamReader(fs, Encoding.UTF8) 150 | tr.ReadToEnd() 151 | 152 | let tree = CSharpSyntaxTree.ParseText sampleCode 153 | let root = tree.GetRoot() :?> CSharpSyntaxNode 154 | 155 | // Roslyn C# AST can handle by F#'s pattern matching. 156 | // AST types deconstructs by this library's active pattern functions. 157 | // And syntax node pattern naming is shorter. 158 | 159 | match root with 160 | | CompilationUnit 161 | (_, [ UsingDirective(_, _, _, Identifier(["System";"Collections";"Generic"]), _)], _, 162 | [ NamespaceDeclaration(_, 163 | Identifier(["SampleNamespace"]), _, _, _, 164 | [ ClassDeclaration(decl, 165 | _, Text("SampleClass"), _, _, _, _, 166 | memberDecls, 167 | _, _)], 168 | _, _) ], 169 | _) -> 170 | memberDecls 171 | |> Seq.choose (function 172 | | PropertyDeclaration(_, typeSyntax, _, Text(id), _, _, _, _) -> 173 | Some (typeSyntax, id) 174 | | _ -> None) 175 | |> Seq.iter (printf "%A") 176 | 177 | | _ -> () 178 | 0 179 | ``` 180 | 181 | ## Platform 182 | 183 | * .NET 7, 6, 5 184 | * .NET Standard 2.1, 2.0 185 | * .NET Core 3.1 186 | * .NET Framework 4.8, 4.6.1 187 | * Roslyn (based 4.4.0). 188 | 189 | ## Additional resources 190 | 191 | * ["You will be assimilated. Resistance is futile." - NGK2016B conference (12.17.2016) session slide.](http://www.slideshare.net/kekyo/documents-you-will-be-assimilated-resistance-is-futile) 192 | * This is a joke session ;) 193 | 194 | ## License 195 | 196 | * Copyright (c) Kouji Matsui 197 | * Under Apache v2 http://www.apache.org/licenses/LICENSE-2.0 198 | 199 | ## TODO: 200 | 201 | * Improvement auto generator for better output. 202 | * Add additional custom functions. 203 | 204 | ## History 205 | 206 | * 0.9.0: 207 | * Updated for using Roslyn 4.4.0 and .NET 7 SDK. 208 | * 0.8.20: 209 | * Fixed NamespaceDeclaration matcher. 210 | * 0.8.10: 211 | * Upgraded Roslyn to 3.6.0. 212 | * 0.8.1: 213 | * More shorter SyntaxNode related names (ex: CompilationUnitSyntax --> CompilationUnit). 214 | * Support strict and loose active patterns. 215 | * 0.7.1: 216 | * Support .NET Standard, .NET Core 2 and F# 4.5 (4.5.2), based Roslyn 2.8.2. 217 | * 0.5.1: 218 | * Initial packaged release. 219 | -------------------------------------------------------------------------------- /artifacts/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kekyo/Microsoft.CodeAnalysis.ActivePatterns/710b1ae41026d0aa54ab8273905488751e8868e4/artifacts/.gitkeep -------------------------------------------------------------------------------- /build-nupkg.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem F# Active pattern functions for Roslyn Compiler Platform 4 | rem Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud) 5 | rem 6 | rem Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0 7 | 8 | echo "" 9 | echo "===========================================================" 10 | echo "Build Microsoft.CodeAnalysis.ActivePatterns" 11 | echo "" 12 | 13 | rem git clean -xfd 14 | 15 | dotnet build -p:Configuration=Release 16 | dotnet pack -p:Configuration=Release -o artifacts 17 | -------------------------------------------------------------------------------- /build-nupkg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # F# Active pattern functions for Roslyn Compiler Platform 4 | # Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud) 5 | # 6 | # Licensed under Apache-v2: https://opensource.org/licenses/Apache-2.0 7 | 8 | echo 9 | echo "===========================================================" 10 | echo "Build Microsoft.CodeAnalysis.ActivePatterns" 11 | echo 12 | 13 | # git clean -xfd 14 | 15 | dotnet build -p:Configuration=Release 16 | dotnet pack -p:Configuration=Release -o artifacts 17 | -------------------------------------------------------------------------------- /csharp_standard_usage_sample/Program.cs: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Microsoft.CodeAnalysis.ActivePatterns - F# Active pattern matching library for Roslyn 4 | // Copyright (c) Kouji Matsui (@kozy_kekyo, @kekyo@mastodon.cloud) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | ///////////////////////////////////////////////////////////////////////////// 19 | 20 | // This code sample is standard usages for roslyn C# parser. 21 | // It's part of Microsoft.CodeAnalysis.ActivePatterns project 22 | // but truly not include these code fragments into library. 23 | 24 | // It goals to clarify why we want to active pattern library. 25 | // You can compare the "test" project (contains active pattern version). 26 | 27 | using System.IO; 28 | using System.Linq; 29 | using System.Reflection; 30 | using System.Text; 31 | 32 | using Microsoft.CodeAnalysis.CSharp; 33 | using Microsoft.CodeAnalysis.CSharp.Syntax; 34 | 35 | namespace csharp_standard_usage_sample; 36 | 37 | static class Program 38 | { 39 | private static string ReadSampleCode() 40 | { 41 | using (var fs = Assembly.GetEntryAssembly()!. 42 | GetManifestResourceStream("csharp_standard_usage_sample.Sample.cs")) 43 | { 44 | var tr = new StreamReader(fs!, Encoding.UTF8); 45 | return tr.ReadToEnd(); 46 | } 47 | } 48 | 49 | private static string TraverseNameSyntax(NameSyntax name) 50 | { 51 | if (name is IdentifierNameSyntax idName) 52 | { 53 | return idName.Identifier.Text; 54 | } 55 | 56 | if (name is QualifiedNameSyntax qName) 57 | { 58 | return TraverseNameSyntax(qName.Left) + "." + TraverseNameSyntax(qName.Right); 59 | } 60 | 61 | return string.Empty; 62 | } 63 | 64 | static void Main(string[] args) 65 | { 66 | var sampleCode = ReadSampleCode(); 67 | 68 | var tree = (CSharpSyntaxTree) CSharpSyntaxTree.ParseText(sampleCode); 69 | var root = (CompilationUnitSyntax)tree.GetRoot(); 70 | 71 | // Too complex if we have to analyze roslyn AST using C#... 72 | 73 | if (root.Usings.Any(u => 74 | { 75 | var name = TraverseNameSyntax(u.Name); 76 | return name == "System.Collections.Generic"; 77 | })) 78 | { 79 | if (root.Members.Any(m => 80 | { 81 | if (m is NamespaceDeclarationSyntax nameDecl) 82 | { 83 | if (nameDecl.Name is IdentifierNameSyntax name) 84 | { 85 | if (name.Identifier.Text == "SampleNamespace") 86 | { 87 | if (nameDecl.Members.Any(m2 => 88 | { 89 | if (m2 is ClassDeclarationSyntax classDecl) 90 | { 91 | var name2 = classDecl.Identifier.Text; 92 | if (name2 == "SampleClass") 93 | { 94 | return true; 95 | } 96 | } 97 | return false; 98 | })) 99 | { 100 | // Found "SampleClass" class declaration in this namespace. 101 | // ... 102 | 103 | return true; 104 | } 105 | } 106 | } 107 | } 108 | return false; 109 | })) 110 | { 111 | // Found "SampleClass" class declaration. 112 | // ... 113 | } 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /csharp_standard_usage_sample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: ComVisible(false)] 6 | [assembly: Guid("42b937e4-331f-4dbc-bc27-873b3281ff93")] 7 | -------------------------------------------------------------------------------- /csharp_standard_usage_sample/Sample.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SampleNamespace 4 | { 5 | public sealed class SampleClass 6 | { 7 | public SampleClass() 8 | { 9 | this.Value = System.DateTime.Now.Ticks; 10 | } 11 | 12 | public long Value 13 | { 14 | get; 15 | set; 16 | } 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /csharp_standard_usage_sample/csharp_standard_usage_sample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net6.0 5 | Exe 6 | csharp_standard_usage_sample 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /nuget.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/Program.fs: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Microsoft.CodeAnalysis.ActivePatterns - F# Active pattern matching library for Roslyn 4 | // Copyright (c) 2016-2018 Kouji Matsui (@kozy_kekyo) 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | // 18 | ///////////////////////////////////////////////////////////////////////////// 19 | 20 | // This code sample is using for this library. 21 | 22 | // It goals to clarify why we want to active pattern library. 23 | // You can compare the "csharp_standard_usage_sample" project (contains C# version). 24 | 25 | module test 26 | 27 | open System 28 | open System.IO 29 | open System.Reflection 30 | open System.Text 31 | 32 | open Microsoft.CodeAnalysis 33 | open Microsoft.CodeAnalysis.CSharp 34 | 35 | // This is a namespace for active pattern functions. 36 | // "Strict" means strongly typed args and return types. 37 | open Microsoft.CodeAnalysis.CSharp.Strict 38 | 39 | // You can use "Loose" namespace if you are requiring loose traverser by base AST node types. 40 | // (ex: Microsoft.CodeAnalysis.SyntaxNode) 41 | // Loose pattern functions NOT lesser than Strict. 42 | // Because it can make unified traverser for C# and VB AST nodes. 43 | 44 | [] 45 | let main argv = 46 | let sampleCode = 47 | use fs = Assembly.GetEntryAssembly().GetManifestResourceStream "test.Sample.cs" 48 | let tr = new StreamReader(fs, Encoding.UTF8) 49 | tr.ReadToEnd() 50 | 51 | let tree = CSharpSyntaxTree.ParseText sampleCode :?> CSharpSyntaxTree 52 | let root = tree.GetRoot() 53 | 54 | // Roslyn C# AST can handle by F#'s pattern matching. 55 | // AST types deconstructs by this library's active pattern functions. 56 | // And syntax node pattern naming is shorter. 57 | 58 | match root with 59 | | CompilationUnit 60 | (_, [ UsingDirective(_, _, _, _, Identifier(["System";"Collections";"Generic"]), _)], _, 61 | [ NamespaceDeclaration(_, Token("SampleNamespace"), _, _, _, 62 | [ ClassDeclaration(decl, 63 | _, Token("SampleClass"), _, _, _, _, 64 | memberDecls, 65 | _, _)], 66 | _, _, _) ], 67 | _) -> 68 | memberDecls 69 | |> Seq.choose (function 70 | | PropertyDeclaration(_, typeSyntax, _, Token(id), _, _, _, _) -> 71 | Some (typeSyntax, id) 72 | | _ -> None) 73 | |> Seq.iter (printf "%A") 74 | 75 | | _ -> () 76 | 0 77 | 78 | -------------------------------------------------------------------------------- /test/Sample.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace SampleNamespace 4 | { 5 | public sealed class SampleClass 6 | { 7 | public SampleClass() 8 | { 9 | this.Value = System.DateTime.Now.Ticks; 10 | } 11 | 12 | public long Value 13 | { 14 | get; 15 | set; 16 | } 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /test/test.fsproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net6.0 5 | Exe 6 | test 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | --------------------------------------------------------------------------------