Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
c5a85857
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c5a85857
编写于
9月 07, 2014
作者:
K
Kevin_H
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor (move) some internal helpers... (changeset 1330757)
上级
c8ae3dc4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
0 addition
and
37 deletion
+0
-37
Src/Compilers/CSharp/Portable/Syntax/SyntaxFactory.cs
Src/Compilers/CSharp/Portable/Syntax/SyntaxFactory.cs
+0
-13
Src/Compilers/VisualBasic/Portable/Syntax/SyntaxNodeFactories.vb
...pilers/VisualBasic/Portable/Syntax/SyntaxNodeFactories.vb
+0
-24
未找到文件。
Src/Compilers/CSharp/Portable/Syntax/SyntaxFactory.cs
浏览文件 @
c5a85857
...
...
@@ -1203,19 +1203,6 @@ public static ExpressionSyntax ParseExpression(string text, int offset = 0, Pars
}
}
internal
static
ExpressionSyntax
ParseDebuggerExpression
(
SourceText
text
,
bool
consumeFullText
=
true
)
{
using
(
var
lexer
=
new
InternalSyntax
.
Lexer
(
text
,
CSharpParseOptions
.
Default
))
using
(
var
parser
=
new
InternalSyntax
.
LanguageParser
(
lexer
,
oldTree
:
null
,
changes
:
null
,
lexerMode
:
InternalSyntax
.
LexerMode
.
DebuggerSyntax
))
{
var
node
=
parser
.
ParseExpression
();
if
(
consumeFullText
)
node
=
parser
.
ConsumeUnexpectedTokens
(
node
);
var
parent
=
InternalSyntax
.
SyntaxFactory
.
ExpressionStatement
(
node
,
InternalSyntax
.
SyntaxFactory
.
Token
(
SyntaxKind
.
SemicolonToken
));
var
syntaxTree
=
CSharpSyntaxTree
.
Create
((
ExpressionStatementSyntax
)
parent
.
CreateRed
(),
text
);
return
((
ExpressionStatementSyntax
)
syntaxTree
.
GetRoot
()).
Expression
;
}
}
/// <summary>
/// Parse a StatementSyntaxNode using grammar rule for statements.
/// </summary>
...
...
Src/Compilers/VisualBasic/Portable/Syntax/SyntaxNodeFactories.vb
浏览文件 @
c5a85857
...
...
@@ -8,7 +8,6 @@
Imports
System.Threading
Imports
System.Text
Imports
Microsoft.CodeAnalysis.Text
Imports
Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports
Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports
Microsoft.CodeAnalysis.VisualBasic.SyntaxFacts
Imports
InternalSyntax
=
Microsoft
.
CodeAnalysis
.
VisualBasic
.
Syntax
.
InternalSyntax
...
...
@@ -176,29 +175,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End
Using
End
Function
''' <summary>
''' Parse a debugger expression (e.g. possibly including pseudo-variables).
''' </summary>
''' <param name="text">The input string</param>
Friend
Shared
Function
ParseDebuggerExpression
(
text
As
SourceText
,
Optional
consumeFullText
As
Boolean
=
True
)
As
ExpressionSyntax
Using
scanner
As
New
InternalSyntax
.
Scanner
(
text
,
VisualBasicParseOptions
.
Default
,
isScanningForExpressionCompiler
:
=
True
)
' NOTE: Default options should be enough
Using
p
=
New
InternalSyntax
.
Parser
(
scanner
)
p
.
GetNextToken
()
Dim
node
=
p
.
ParseExpression
()
If
consumeFullText
Then
node
=
p
.
ConsumeUnexpectedTokens
(
node
)
Dim
statement
=
InternalSyntax
.
SyntaxFactory
.
PrintStatement
(
New
InternalSyntax
.
PunctuationSyntax
(
SyntaxKind
.
QuestionToken
,
"?"
,
Nothing
,
Nothing
),
node
)
Dim
compilationUnit
=
InternalSyntax
.
SyntaxFactory
.
CompilationUnit
(
options
:
=
Nothing
,
[
imports
]
:
=
Nothing
,
attributes
:
=
Nothing
,
members
:
=
InternalSyntax
.
SyntaxList
.
List
(
statement
),
endOfFileToken
:
=
InternalSyntax
.
SyntaxFactory
.
EndOfFileToken
)
Dim
syntaxTree
=
VisualBasicSyntaxTree
.
Create
(
DirectCast
(
compilationUnit
.
CreateRed
(
Nothing
,
0
),
CompilationUnitSyntax
))
Return
DirectCast
(
DirectCast
(
syntaxTree
.
GetRoot
(),
CompilationUnitSyntax
).
Members
.
Single
(),
PrintStatementSyntax
).
Expression
End
Using
End
Using
End
Function
''' <summary>
''' Parse an executable statement.
''' </summary>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录