本文整理汇总了C#中CodeElementsParser.PUBLIC方法的典型用法代码示例。如果您正苦于以下问题:C# CodeElementsParser.PUBLIC方法的具体用法?C# CodeElementsParser.PUBLIC怎么用?C# CodeElementsParser.PUBLIC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeElementsParser
的用法示例。
在下文中一共展示了CodeElementsParser.PUBLIC方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnterFunctionDeclarationHeader
public override void EnterFunctionDeclarationHeader(CodeElementsParser.FunctionDeclarationHeaderContext context)
{
var visibility = context.PUBLIC() != null ? AccessModifier.Public : AccessModifier.Private;
QualifiedName name = null;
if (context.UserDefinedWord() != null) {
var token = ParseTreeUtils.GetTokenFromTerminalNode(context.UserDefinedWord());
name = new URI(token.Text);
}
Context = context;
CodeElement = new FunctionDeclarationHeader(name, visibility);
}
示例2: EnterFunctionDeclarationHeader
public override void EnterFunctionDeclarationHeader(CodeElementsParser.FunctionDeclarationHeaderContext context)
{
var type = FunctionType.Undefined;
if (context.PROCEDURE() != null) type = FunctionType.Procedure;
if (context.FUNCTION() != null) type = FunctionType.Function;
// TCRFUN_NO_DEFAULT_ACCESS_MODIFIER
// As the grammar enforces that there must be one least one of the PUBLIC or PRIVATE keywords,
// there will be a syntax error if there is neither of these two keywords.
// So, the fact of considering a function PRIVATE by default does not break this rule.
var visibility = context.PUBLIC() != null ? AccessModifier.Public : AccessModifier.Private;
SymbolDefinition name = null;
if (context.functionNameDefinition() != null) {
name = CobolWordsBuilder.CreateFunctionNameDefinition(context.functionNameDefinition());
}
Context = context;
CodeElement = new FunctionDeclarationHeader(name, visibility, type);
}