コード例 #1
0
ファイル: Visitor.cs プロジェクト: super-string/public
        public override Result VisitDevice([NotNull] testParser.DeviceContext context)
        {
            var ident     = context.IDENT();
            var deviceStr = ident.GetText().ToUpper();

            Device device;

            if (!Device.TryParse(deviceStr, out device))
            {
                return(Result.CreateError("解析できなかったデバイス:" + deviceStr));
            }

            return(Result.CreateSuccess(device));
        }
コード例 #2
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="testParser.device"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitDevice([NotNull] testParser.DeviceContext context)
 {
 }
コード例 #3
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="testParser.device"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitDevice([NotNull] testParser.DeviceContext context)
 {
     return(VisitChildren(context));
 }