示例#1
0
        public static ExpressionSyntax HandleBaseTypeContext(VisualBasic6Parser.BaseTypeContext node)
        {
            if (node == null)
            {
                throw new ArgumentNullException(nameof(node));
            }


            if (node.STRING() != null)
            {
                //return SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, SyntaxFactory.Literal(asg.getCtx().STRINGLITERAL().getText());
                return(SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, SyntaxFactory.Literal(node.getText())));
            }
            else if (node.INTEGER() != null)
            {
                return(SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(int.Parse(node.getText(), NumberFormatInfo.InvariantInfo))));
            }
            else if (node.DOUBLE() != null)
            {
                return(SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(double.Parse(node.getText(), NumberFormatInfo.InvariantInfo))));
            }
            else
            {
                throw new NotImplementedException("node type");
                // TODO: A bit risky. Assumes that literals are same in VB6 and C#.
                //return SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, SyntaxFactory.Literal(node.getText()));
            }

            //return GetExpression(asg.getCtx().getChild(0), statements);
        }
示例#2
0
 public override object VisitBaseType([NotNull] VisualBasic6Parser.BaseTypeContext context)
 {
     CreateModel(context);
     return(null);
 }
示例#3
0
 public override void ExitBaseType([NotNull] VisualBasic6Parser.BaseTypeContext context)
 {
 }